Minimap creation
Moderator: Moderators
Re: Minimap creation
this map always reminded me off two spaceships lying in a drydock..
Re: Minimap creation
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
Below an example with a fov of 11.25. With the smaller fov, min/maxheight divided by roughly 2 seems about sufficient in this case to minimize perspective distortions (-> minheight=45, maxheight=110).
I chose this example, since I always have a hard time to find this map in springlobby overview list

Will post an updated script later (plan to include other proposed changes, too).
P.S.: going down further with the fov to ~5 leads to some graphic artifacts.
- Attachments
-
- aquarius_example.jpg
- (122.08 KiB) Not downloaded yet
Re: Minimap creation
I am not sure what you meansmoth wrote:Minimap is inverted

This is one minimap with one half from diffuse texture and one half from screenshot.
Re: Minimap creation
It is rotated 180d vs the screenshot
Re: Minimap creation
Since it's obviously too confusing to put both in one image for comparison, attached small versions of both minimaps.
The map is (mirrored-)mirror symmetric
The map is (mirrored-)mirror symmetric
- Attachments
-
- screenshot.png (101.14 KiB) Viewed 2678 times
-
- diffuse.jpg (9.34 KiB) Viewed 2678 times
Re: Minimap creation
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.
Re: Minimap creation
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).
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: Minimap creation
I think jKs solution is the easy/clean way to do this!
Re: Minimap creation
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.
Re: Minimap creation
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.
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
Re: Minimap creation
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.
Re: Minimap creation
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.
If included in minimap it just helps in webpage or lobby preview to identify / represent the map.
Re: Minimap creation
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
*edit* you know what, I am too tired to post anything coherent. balete the rest
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Minimap creation
I noticed it too, but after reading the replies didn't have the energy to point out the obvious to people who should know better.
Lets put it this way... Feel free to guess why -i exists.
Lets put it this way... Feel free to guess why -i exists.
Re: Minimap creation
As I supected, the gl part is not that straight-forward for an absolute beginner. Therefore, attached for potential users an intermediate version until I have time to work on it again (resp. reading a bit about gl).
In this version, the FOV can be set. It does the cropping and saves the file in the screenshot folder following the naming scheme "minimap_mapname_number.png". The resizing to 1024x1024 has still to be done manually afterwards.
P.S.: from all I can see the min- and maxheight of a map can't be set in a gadget, or can it?
In this version, the FOV can be set. It does the cropping and saves the file in the screenshot folder following the naming scheme "minimap_mapname_number.png". The resizing to 1024x1024 has still to be done manually afterwards.
P.S.: from all I can see the min- and maxheight of a map can't be set in a gadget, or can it?
- Attachments
-
- minimap_screenshot.lua
- (4.57 KiB) Downloaded 26 times
Re: Minimap creation
hmm, I'm having trouble getting this to work right. It doesn't seem to turn the rest of the ui off by default, and I don't know how to do that so that it doesn't get in the way. It also doesn't seem to be lining the camera up properly with an overhead view, and instead takes shots from an isometric view which definitely would not work well (and it also overrides anything I do with the camera). I'm not sure why, although it may have to do with ZK. 

Re: Minimap creation
Hmm, always tried with BA so far. There, I only every one in a while had the problem that zoom is set way off (if tried again, it works, so a not too easy to catch bug
).
Just tried with a quite old version of ZK I still had lying around here and could reproduce some of the problems you mentioned (gui still there, no overhead view). Out of my head, I can't think of anything obvious ZK is doing that stops this widget, but I am also no lua expert
I am looking into a different approach (see jK's suggestion). But still not reached some of the relevant chapters in the gl book I'm reading... (*)
Until then I suggest: try it with BA or I can offer to start it on my system and supply minimap image to you if you point me to a map file.
(*) if an expert reads this:
Is there a draw callin that works on the map? I saw gl.Ortho and gl.Viewport in Lua OpenGL Api but couldn't find a calling where this would work on the map (and skybox). Otherwise it would probably be a quick and easy solution to produce orthographic and scaled minimap images ingame.

Just tried with a quite old version of ZK I still had lying around here and could reproduce some of the problems you mentioned (gui still there, no overhead view). Out of my head, I can't think of anything obvious ZK is doing that stops this widget, but I am also no lua expert

I am looking into a different approach (see jK's suggestion). But still not reached some of the relevant chapters in the gl book I'm reading... (*)
Until then I suggest: try it with BA or I can offer to start it on my system and supply minimap image to you if you point me to a map file.
(*) if an expert reads this:
Is there a draw callin that works on the map? I saw gl.Ortho and gl.Viewport in Lua OpenGL Api but couldn't find a calling where this would work on the map (and skybox). Otherwise it would probably be a quick and easy solution to produce orthographic and scaled minimap images ingame.
Re: Minimap creation
Hm, BA produced slightly better results, but the camera was zoomed all the way in. It also ended up taking 10 screenshots, only one of them sort-of decent. How do you control the fov and such? I haven't been able to find any settings for it. 

Re: Minimap creation
Here's something to get you started. I extracted this from my code, from multiple files, so I'm not sure if it'll work without changes.
It's also inefficient, you don't need to keep all the diffuse textures before blitting them, but I'll leave optimization as an exercise.
And finally, I'm not deleting all the GL objects.
Have fun =)
It's also inefficient, you don't need to keep all the diffuse textures before blitting them, but I'll leave optimization as an exercise.
And finally, I'm not deleting all the GL objects.
Have fun =)
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