Minimap/render-to-texture approach

I've added an overhead mini-map to my game, using the information I gathered from the TestLookAtSpatial source. I've basically set up an overhead camera node pointing straight down at the player, and am then rendering that scene to a texture which I'm using as my map.

I noticed that the second renderer (the texturerenderer) chops my framerate about in half on a non FBO enabled video card. I knocked the amount of frames down during the texture render pass and seemed to find a decent balance between the smoothness of the map render and framerate. I guess that's to be expeced on a low end video card, but seems easy enough to work around.

The only real glitch I ran into was that my UI objects (implemented as Nodes attached to my rootNode) appear in the minimap in strange ways (they seem to get mirrored or exhibit other strange behavior). I was able to address this by detaching them from the rootNode, performing the texture render, and then reattaching them on each pass.

So I guess my question is really more about whether there is a better way to implement an overhead map like the one I'm attempting to create. It definitely works, but I'm a bit concerned about some of the "nonstandard" work-arounds I did  to make it function the way that I wanted to. Any advice would be greatly appreciated.

Oh, and is there any way to render to a texture that's round instead of square?



Hmm, I don't think you could have a round texture; but you could probably multitexture a black circle 'cut out' or possibly an image with all zeros for the alpha would work (would have to set the combine alpha settings correctly)…

I am wondering why you can't render the landscape once (or once in a while) then 'draw' on a copy of it w/ the character icons and such; you could take a large area overhead shot then just 'zoom' in on the regions in your 'drawing' routine.

(heck just incorporate the round cut out thing mentioned above in drawing also, then you wouldn't have to multi-texture it.)

i did something similar. Take a look at ImposterNode and TestImposterNode. First off, you can have the map redrawn dynamically, say 20 or 25, or whatever times per second, should give you a good performance boost, also, make sure you have mipmapping disabled for the Textures you render to with TextureRenderer (big performance boost).

Also, the previously method would work, just render a square texture and use a Texture with the transparency you want on the edges. Combine with MultiTexturing and you should be good to go.

Great ideas, just what I was looking for - thanks!

I'll admit I'm not having much luck in getting the cut-out circle effect to work with multitexturing. I started with and while I can get textures to layer over each other, I get really funky effects whenever I try to do any sort of transparency.

I've got two textures I've been experimenting with; the first is the background (a still shot of my map) and the second is the "cutout" (a black square with a magenta circle - the magenta is the transparency color). The following code layers the "cutout"' image on top of the background image, but the black is visible and while the magenta portion is somewhat transparent (I can see the map through it), it gives the visible portion of the map a magenta "haze".

I've tried applying different alpha and material states to the quad but haven't been able to do much other than turn the entire quad black. Any tips on what I should be looking for?

    t = newQuad;
    t.setModelBound(new BoundingSphere());
    t.setLocalTranslation(new Vector3f(0, 0, 0));

    TextureState ts = display.getRenderer().createTextureState();
    Texture t1 = TextureManager.loadTexture(
    ts.setTexture(t1, 0);

    Texture t2 = TextureManager.loadTexture(TestMultitexture.class.getClassLoader().
    ts.setTexture(t2, 1);

    t.copyTextureCoords(0, 0, 1);