BSP Faces depth sorting
Hi,
I have a little problem. I''m trying to render a q3 bsp maps. That works pretty good by now, but I want to have the blended polygons drawn correct. I know that sorting is needed when drawing transparent triangles. I first draw all of my opaque objects. Then I need to draw the transparent objects in a back to front order. That works pretty good in some cases but the problem is, that some of the bsp faces represent whole objects. So those objects themself look very strange What I need to do, is check every single triangle''s distance after checking every single face''s distance to the camera and then draw those triangles in a back to front order. This gets pretty complicated especially with the GL_TRIANGLE_FAN vertex order. Is there a way to avoid this or do I really have to check every triangle? How to do that with GL_TRIANGLE_FAN? Does anyone know how this is done in Quake?
TIA,
ZMaster
That''s what I thought. I suppose Q1 doesn''t even have alpha blending implemented. Or at least by far not the way Q3 has it.
Do you support shaders already, or just assume objects whose texture is RGBA must be blended ?
IMHO you won''t obtain good results without supporting shaders.
You can take a look at q3view (in NeHe''s downloads) or Cake (try google search) to get more info...
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)
IMHO you won''t obtain good results without supporting shaders.
You can take a look at q3view (in NeHe''s downloads) or Cake (try google search) to get more info...
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)
I blend all objects, which have an alpha-channel textures applied to them. I do not support Q3 shaders, yet. I don''t even know if I''ll ever support them, because I''m not trying to write some kind of a Quake 3 clone... But thanks for the hints. I''ll read the source of q3view and cake.
Q3A shaders describe how objects must be sorted (sort of). It''s not really necessary to depth-sort them, you just have to render them in the right order (opaque, sky, banner, transparent, nearest).
You might want to look at the Q3A shader manual to get the idea...
http://www.heppler.com/shader/
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)
You might want to look at the Q3A shader manual to get the idea...
http://www.heppler.com/shader/
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)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement