Advertisement

Multipasses

Started by January 31, 2003 11:02 PM
6 comments, last by MaxxJag 22 years ago
I know what it is, I just don''t know how to do it. redraw the entire scene...that would likely cause Z-Fighting (no, not DBZ type...) so how is it done? I have a few theories but all fail.
glDepthFunc(GL_EQUAL);

| - Project-X - my mega project.. big things comming soon - | - adDeath - an ad blocker I made - | - email me - |
Advertisement
You have to render your model twice, and (as RipTorn wrote) depth testing should be set to GL_EQUAL.

Note that your models must be EXACTLY the same. The common pitfall of multipass Z-figthing is to render a big wall in a first pass and then render a small part of the wall in a second pass. For instance if you want to render a poster on a door, you would render the whole door with a wood texture in a first pass, and then render the poster with a poster texture in a second pass. This will inflige Z-fighting because the coordinates of the door and the poster will not really overlap (I mean, the depth fragments will not equal) exactly because of floating point approximations.

The problem has been discussed thousands of times before. I''m sure you could pick up any of the older topics hanging out there. There will be much more information than we can ever repeat
Don''t forget to take advantage of the compiled vertex arrays extensions while you are at it (They love multiple passes)
i understand that the depth testing formula shud be changed... but is there any reason/alternative to that by using depth masking instead?
- To learn, we share... Give some to take some -
Ya, I''m also trying to get the hang of Vertex Arrays. Though I''m trying to find out what feature should be used on what.
Advertisement
CraZeE: what do you mean by "depth masking" ?

MaxxJag: vertex arrays are good, but if you''re not used with them yet, maybe you should start with what you master now. And later you''ll have all the time you want to find optimizations.
I''m working on a FPS game right now, my main problem is that I lag resources and some basic knowledge, I do believe I understand vertex arrays now, haven''t used them yet.

This topic is closed to new replies.

Advertisement