Minimap creation - Page 2

Minimap creation

Discuss maps & map creation - from concept to execution to the ever elusive release.

Moderator: Moderators

User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10454
Joined: 24 Jan 2006, 21:12

Re: Minimap creation

Post by PicassoCT »

this map always reminded me off two spaceships lying in a drydock..
User avatar
qray
Posts: 377
Joined: 02 Feb 2009, 18:49

Re: Minimap creation

Post by qray »

qray wrote:
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
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.
Update: 8611 is right. Also FPS camera takes fov setting.

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 :wink:. In its diffuse minimap water and height information are missing and colors are quite different.

Image

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
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Minimap creation

Post by smoth »

Minimap is inverted
User avatar
qray
Posts: 377
Joined: 02 Feb 2009, 18:49

Re: Minimap creation

Post by qray »

smoth wrote:Minimap is inverted
I am not sure what you mean :?

This is one minimap with one half from diffuse texture and one half from screenshot.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: Minimap creation

Post by FLOZi »

It is rotated 180d vs the screenshot
User avatar
qray
Posts: 377
Joined: 02 Feb 2009, 18:49

Re: Minimap creation

Post by qray »

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
Attachments
screenshot.png
screenshot.png (101.14 KiB) Viewed 2677 times
diffuse.jpg
diffuse.jpg (9.34 KiB) Viewed 2677 times
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: Minimap creation

Post by FLOZi »

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.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Minimap creation

Post by Jools »

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 :wink:, getting SSMF effects right the hard).
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.
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: Minimap creation

Post by Silentwings »

I think jKs solution is the easy/clean way to do this!
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Minimap creation

Post by smoth »

FLOZi 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.
Still is flipped 180 tho
User avatar
qray
Posts: 377
Joined: 02 Feb 2009, 18:49

Re: Minimap creation

Post by qray »

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.
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.
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.
Silentwings wrote:I think jKs solution is the easy/clean way to do this!
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 newb :wink:).
smoth wrote: Still is flipped 180 tho
Apart from the fact that I didn't flip anyting: If flipped 180 it's basically the same image.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: Minimap creation

Post by Jools »

qray wrote:
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.
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.
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.
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.
User avatar
qray
Posts: 377
Joined: 02 Feb 2009, 18:49

Re: Minimap creation

Post by qray »

Forboding Angel wrote:The skybox shouldn't be in the minimap anyway, it's distracting.
I forgot to comment on this before: ingame the skybox isn't displayed for voidground/water. These areas are just plain black.
If included in minimap it just helps in webpage or lobby preview to identify / represent the map.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Minimap creation

Post by smoth »

qray wrote:
smoth wrote: Still is flipped 180 tho
Apart from the fact that I didn't flip anyting: If flipped 180 it's basically the same image.
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..

*edit* you know what, I am too tired to post anything coherent. balete the rest
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Minimap creation

Post by Forboding Angel »

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.
User avatar
qray
Posts: 377
Joined: 02 Feb 2009, 18:49

Re: Minimap creation

Post by qray »

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?
Attachments
minimap_screenshot.lua
(4.57 KiB) Downloaded 26 times
aeonios
Posts: 202
Joined: 03 Feb 2015, 14:27

Re: Minimap creation

Post by aeonios »

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. :|
User avatar
qray
Posts: 377
Joined: 02 Feb 2009, 18:49

Re: Minimap creation

Post by qray »

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 :wink:).
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 :wink:

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.
aeonios
Posts: 202
Joined: 03 Feb 2015, 14:27

Re: Minimap creation

Post by aeonios »

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. :|
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Minimap creation

Post by gajop »

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 =)

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
Post Reply

Return to “Map Creation”