Page 3 of 3

Re: Minimap creation

Posted: 03 Apr 2015, 21:04
by qray
@ aeonios:
aeonios wrote: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. :|
FOV is set in line 23:

Code: Select all

    local fov = 11.25 -- fov angle in degree
Everything else is calculated from this (and map size, but this is read from the file automatically). Normal camera fov seems to be 45. Below around 10 shadows should be disabled (they tend to give artefacts).
In line 72-74 there is commented debug output code:

Code: Select all

        --for index,value in pairs(Spring.GetCameraState()) do
        --    Spring.Echo("Camera State camStateLocal[\"" ..index .."\"]=" .. value)
        --end
Might help to uncomment this (don't know why, but sometimes it ran than more stable for me with this output on).

@ gajop
Thanks a lot! :-) Will be a big help since I tend to learn better from examples.
gajop wrote:It's also inefficient
Efficiency won't be a big problem / major goal at the beginning, since it's only used once to create the image and doesn't run in a real game.
Currently in chapter 6 of the book while framebuffer comes in chapter 10. RL, working on half finished maps and actually playing every now and then does not help to speed up my progress :wink:

Re: Minimap creation

Posted: 03 Apr 2015, 21:20
by aeonios
Oi, well for the moment: https://www.dropbox.com/s/x2gaedku2dsn0 ... 1.sd7?dl=0

Seems like it'd be a pain to get it working atm, although I look forward to an improved version.

Re: Minimap creation

Posted: 03 Apr 2015, 22:17
by qray
aeonios wrote:Oi, well for the moment: https://www.dropbox.com/s/x2gaedku2dsn0 ... 1.sd7?dl=0
Seems like it'd be a pain to get it working atm, although I look forward to an improved version.
Strange that it doesn't work for you :(
Attached an image I took here (fov=3, no height scaling).

Re: Minimap creation

Posted: 03 Apr 2015, 22:24
by aeonios
Thanks! I'm sure you'll figure it out in time. :P

Re: Minimap creation

Posted: 08 Apr 2015, 01:01
by gajop
Also, why is it you can't use the $minimap texture provided by Spring?
If you did, all you have to do would be:

Code: Select all

        local minimapPath = "minimap.png"
        Spring.Echo("Saving the minimap to " .. minimapPath .. "...")

        if VFS.FileExists(minimapPath, VFS.RAW) then
            Spring.Echo("removing the existing minimap")
            os.remove(minimapPath)
        end

        local texInfo = gl.TextureInfo("$minimap")
        local minimapTexture = gl.CreateTexture(texInfo.xsize, texInfo.ysize, {
            border = false,
            min_filter = GL.LINEAR,
            mag_filter = GL.LINEAR,
            wrap_s = GL.CLAMP_TO_EDGE,
            wrap_t = GL.CLAMP_TO_EDGE,
            fbo = true,
        })

        gl.Texture("$minimap")
        gl.RenderToTexture(minimapTexture,
        function()
            gl.TexRect(-1,-1, 1, 1)
        end)
        gl.Texture(false)

        gl.RenderToTexture(minimapTexture, gl.SaveImage, 0, 0, texInfo.xsize, texInfo.ysize, minimapPath)
        gl.DeleteTexture(minimapTexture)

Re: Minimap creation

Posted: 25 Apr 2015, 16:43
by qray
Sorry for late reply. Didn't find too much time (and energy) for spring in the last weeks :-(
I am not sure, if taking minimap fully works for what I had in mind (=to get a shinier minimap image). Will have to try... :-)