This is more informative than a question (but perhaps someone can give some pointers Re performance…)
I have finally gotten around to implementing dynamic cube maps in my current project (I’ve put a piccy here ).
I initially went for the Render to texture solution and found it very slow (geforce 3 ti200). So I then created a glCopyTexSubImage() path and found it even slower…? So I did some benchmarks to compare different techniques etc.
In these tests I used the scene shown in the image above (very simple “map” with a single reflecting object). Collision detection has very little effect on performance but to standardize the results I left the ball in the “Home” position sitting stationary.
The Cube maps are updated every frame and the stencil shadows are enabled in all the tests. The pbuffer is 64x64pixels.
The tests I did (& the results) were…
1. Plain vanilla render, Stencil Shadows, no cubemaps
- 272fps
2. 1. + just switching to pbuffer with no output to pbuffer
- 223fps (~50fps just to switch to the pbuffer?)
3. 2. + render a single side of the cube map (-Y) and don’t copy the data to the cube map (ie. impact of rendering the scene to pbuffer)
- 220 fps
4. 3. + render to texture on
- 180 fps
5. 3. + use glCopyTexSubImage2D()
- 109 fps (Yikes!)
6. 2. + render two sides of the cube map (-Y, -X) and don’t copy the second side to the cube map (ie. impact of rendering the scene to pbuffer, copying 1 side to cubemap and then switching to another side)
- 108 fps (Switching sides costs HEAPS - compare this to 3. above)
7. 6. + render to texture on
- 118 fps
8. 6. + use glCopyTexSubImage2D()
- 73 fps
9. Render and copy all six sides using Render to texture
- 79 fps
10. Render and copy all six sides using glCopyTexSubImage()
- 32 fps
11. Use the primary frame buffer (ie. don’t use pbuffers) and render a single side of the cube map - update with glCopyTexSubImage.
- 233 fps
12. Same as 11 but do two sides of the cubemap.
- 205 fps
13. Same as 11 but do all 6 sides
- 138 fps
My conclusion from all this is that I will not use pbuffers (what’s the point - in a game you make the window top most so you won’t lose any of the framebuffer - and the performance is woeful otherwise - on nVidia, I’ll leave it configurable just in case). I’ll also update a single side of the cubemap each frame, rather than all six at once.
[This message has been edited by rgpc (edited 03-15-2003).]