Game Development Community

Can Dynamic Cube Maps Render Shapes?

by John Kanalakis · in Torque Game Engine Advanced · 11/06/2006 (2:14 am) · 3 replies

Is the dynamic cube map effect able to render nearby shapes, or only the nearby Interior? I started by taking the stock TGEA demo and went to the room with the hovering cube mapped sphere. I added a couple DTS shapes, like the Orc player and gun within the room, underneath the sphere and saved the mission file. The dynamic cube-mapped sphere shows the room properly but never shows the models. Is there something else I'm missing, or is the dynamic cube map unable to render DTS shapes?

About the author

John Kanalakis is the owner of EnvyGames, an independent game development studio in Silicon Valley that produces games and tools for Xbox 360, Windows, and the Web.


#1
11/06/2006 (3:06 am)
Don't quote me on this as I have no clue what that shape is using, but I was under the impression you can filter reflections much like the waterblocks do, ie. you chose the object types you want reflected.
#2
11/06/2006 (9:27 am)
In the dynamic cubemap's update function, the renderScene() funciton is fed a mask which specifies which type of objects will be rendered to the cubemaps. I think it defaults to InteriorObjectType. If you remove the parameter, all objects will be drawn.

But one reminder: the dynamic cubemaps only render once, when the scene is rendered for the first time, meaning their image will become static after that. So a moving object will not display on it.

There is a #define which you can commend to disable this hack, and allow dynamic cubemaps to update once per frame, but in my experience it has a massive impact on performance, even with very low resolution cubemaps. It seems TSE's scenegraph becomes the botteneck when you suddenly need to go through the drawing pipeline 7 times a frame.

Since we were working on a game which required real-time reflections (it was a car game), we had to code our own reflection routine, using a dual paraboloid approach and sharing the reflection texture across all cars. It was nasty to code, though, and I hope the dynamic cubemaps become usable for real-time reflections in future TSE updates (better scenegraph?).
#3
11/06/2006 (10:33 am)
Thank Stefan and Manoel!

For future reference... the file engine\gfx\D3D\gfxD3DCubemap.cpp file can be changed around line 291...

Change:
gClientSceneGraph->renderScene( InteriorObjectType );

To:
gClientSceneGraph->renderScene( InteriorObjectType | ShapeBaseObjectType);

As Menoel states, this will render the dynamic cubemap one at initialization. To enable realtime cubemap generation, comment out the following lines around line 202.

#ifdef INIT_HACK
   if( mInit ) return;
   mInit = true;
#endif

I can really see how this will hurt the framerate. In my case, the game's rate went from an average 80fps to an average of 44 fps. The framerate doesnt drop at all with the one-time cubemap generation (if you can get away with that for your game).

Thanks again guys!