Re: Minimap creation
Posted: 11 Mar 2015, 19:30
this map always reminded me off two spaceships lying in a drydock..
Open Source Realtime Strategy Game Engine
https://springrts.com/phpbb/
Update: 8611 is right. Also FPS camera takes fov setting.qray wrote:Sure it's all camera modes? I didn't see the fov value when listing the values of camState of the fps camera. Would have to try when back home.8611 wrote: Maybe relevant, since Spring 92.0 all camera modes can change their FOV at playtime. https://springrts.com/mantis/view.php?id=3291
I am not sure what you meansmoth wrote:Minimap is inverted
I don't understand one point: why put diffuse texture in minimap? Minimap is supposed to be like a radar image to help you easily see where you and enemy is. Putting too much stuff into it makes it harder to see simple things. This is actually why I would like to make the minimap black & white, so that it shows the relevant stuff better.qray wrote: To create a minimap:
Easy way one: take the automatically created one (mapconv on windows) or just re-scale your diffuse texture. Mostly gives a not-too-good looking minimap and misses water as well a lot of the shinyness - especially when specular, splat and lightning effects or LUA drawing are being used.
Could be worked over in image editor of your choice, but to bring it close to the real map might include a lot of work (drawing blue over water areas is the easy part, getting SSMF effects right the hard).
Still is flipped 180 thoFLOZi wrote:Ah, myself and smoth, being perhaps unfamiliar with the map, assumed that both images were of the full map, side by side, rather than half and half.
As said above: matter of taste. Would maybe be good to have two minimap images: one for webpages and lobby overview and one for actual ingame minimap. But also for ingame minimap: people have different opinions on how simplified or not it should be.Jools wrote:I don't understand one point: why put diffuse texture in minimap? Minimap is supposed to be like a radar image to help you easily see where you and enemy is. Putting too much stuff into it makes it harder to see simple things. This is actually why I would like to make the minimap black & white, so that it shows the relevant stuff better.
Yes, and I plan to look into this. But for a total newb in gl it's not that straight forward (or maybe it turns out it is, don't know yet being a newbSilentwings wrote:I think jKs solution is the easy/clean way to do this!
Apart from the fact that I didn't flip anyting: If flipped 180 it's basically the same image.smoth wrote: Still is flipped 180 tho
Fair enough, that makes sense. I just gave my input, people have different opinions so the more you can customise it the better, so it meet everyone's tastes.qray wrote:As said above: matter of taste. Would maybe be good to have two minimap images: one for webpages and lobby overview and one for actual ingame minimap. But also for ingame minimap: people have different opinions on how simplified or not it should be.Jools wrote:I don't understand one point: why put diffuse texture in minimap? Minimap is supposed to be like a radar image to help you easily see where you and enemy is. Putting too much stuff into it makes it harder to see simple things. This is actually why I would like to make the minimap black & white, so that it shows the relevant stuff better.
In the end it's up to the map maker, at least how it's handled currently. I am just proposing one method that I prefer myself.
If people want it handled commonly for all maps, it should be IMHO implemented in the engine or game and the minimap should be produced on the fly while loading the map.
I forgot to comment on this before: ingame the skybox isn't displayed for voidground/water. These areas are just plain black.Forboding Angel wrote:The skybox shouldn't be in the minimap anyway, it's distracting.
Your attachments didn't show on my phone. Doesn't really matter I can tell that is the mini map to this map.. Your example used the left side of a mirrored map. that means it is flipped 180. As flozi said earlier but when I replied there was no attachment on my phone for some reason..qray wrote:Apart from the fact that I didn't flip anyting: If flipped 180 it's basically the same image.smoth wrote: Still is flipped 180 tho
Code: Select all
TEXTURE_SIZE = 1024
function createMapTexture(notFBO)
return gl.CreateTexture(TEXTURE_SIZE, TEXTURE_SIZE, {
border = false,
min_filter = GL.LINEAR,
mag_filter = GL.LINEAR,
wrap_s = GL.CLAMP_TO_EDGE,
wrap_t = GL.CLAMP_TO_EDGE,
fbo = not notFBO,
})
end
function Blit(tex1, tex2)
gl.Texture(tex1)
gl.RenderToTexture(tex2, function()
gl.TexRect(-1,-1, 1, 1, 0, 0, 1, 1)
end)
gl.Texture(false)
end
function generateMapTextures()
-- Spring textures have fbo=false
local oldMapTexture = createMapTexture(false)
-- Spring diffuse map
local mapFBOTextures = {}
for i = 0, math.floor(Game.mapSizeX / TEXTURE_SIZE) do
mapFBOTextures[i] = {}
for j = 0, math.floor(Game.mapSizeZ / TEXTURE_SIZE) do
local mapTexture = createMapTexture()
-- get the the Spring texture and copy it to an fbo enabled one
Spring.GetMapSquareTexture(i, j, 0, oldMapTexture)
Blit(oldMapTexture, mapTexture)
mapFBOTextures[i][j] = mapTexture
-- you probably don't need this (it would modify the existing Spring texture)
-- Spring.SetMapSquareTexture(i, j, mapTexture)
end
end
gl.DeleteTexture(oldMapTexture)
return mapFBOTextures
end
function DrawMinimap()
local mapFBOTextures = generateMapTextures()
local texturePath = "minimap.png"
local totalMapTexture = gl.CreateTexture(Game.mapSizeX, Game.mapSizeZ, {
border = false,
min_filter = GL.NEAREST,
mag_filter = GL.NEAREST,
wrap_s = GL.CLAMP_TO_EDGE,
wrap_t = GL.CLAMP_TO_EDGE,
fbo = true,
})
local totalMapFBO = gl.CreateFBO({
color0 = totalMapTexture
})
local texSize = TEXTURE_SIZE
local sizeX = math.floor(Game.mapSizeX / texSize)
local sizeZ = math.floor(Game.mapSizeZ / texSize)
local mapFBO
for i = 0, sizeX do
for j = 0, sizeZ do
local mapTexture = mapFBOTextures[i][j]
mapFBO = gl.CreateFBO({
color0 = mapTexture
})
gl.BlitFBO(
mapFBO, 0, 0, texSize, texSize,
totalMapFBO, i * texSize, (sizeZ - j) * texSize, (i + 1) * texSize, (sizeZ - j - 1) * texSize)
end
end
gl.RenderToTexture(totalMapTexture, gl.SaveImage, 0, 0, Game.mapSizeX, Game.mapSizeZ, texturePath)
end