Skybox...
Hi all !
When rendering a scene, I'm currently drawing the skybox first.
Is there a way of drawing the skybox *last* to take advantage of the zbuffer (and fill only useful parts of the screen). Would it increase performance significantly ?
Thanx a lot in advance.
[edited by - rodzilla on September 27, 2002 12:00:45 PM]
SaM3d!, a cross-platform API for 3d based on SDL and OpenGL.The trouble is that things never get better, they just stay the same, only more so. -- (Terry Pratchett, Eric)
quote:
Is there a way of drawing the skybox *last* to take advantage of the zbuffer (and fill only useful parts of the screen).
Yes, sure you can do that. You''ll just have to be make sure that the z-depth of your skybox fragements is always larger than the largest depth value of your 3D scene. You could use glDepthRange(max, max) for that.
Another possibility is to use the stencil buffer: clear it at the beginning of the frame, then flag every pixel you draw in your 3D scene in the stencil buffer. When it comes to the sky, draw it only where the stencilbuffer is 0. Of course, you''ll still need to compute approximately correct z values for the sky, as you won''t get the z performance boost without them.
But in both cases, you''ll save a little bandwidth.
quote:
Would it increase performance significantly ?
Depends. It will reduce the fillrate burnt by your app on GF3+ style cards. If your engine was fillrate limited, then it will increase performance. If it wasn''t, then there won''t be any difference.
/ Yann
I haven''t tested this, but there''s a totally different approach called VBS or Virtual Background Sphere. Run a search on it - look for a literally green site that offers a dll, source for it and a nifty explanation on how to implement it yourself in a doc file. AFAIK - it''s fast, efficient and looks better than a regular skybox. Comments are welcome as I''m planning on implementing the thing sometime later and it''d be swell to know if i''ll be worth the time.
Crispy
Crispy
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement