Making sure it's rendered behind everything

Started by
5 comments, last by Joe Forhens 21 years, 3 months ago
Hey How can i make sure something will never be infront of anything else . I don''t want any hacks here , i guess it''s a zbuffer state thx
Thank you all :)
Advertisement
Render it first, then render everything else on top.
-Richard
Z-buffer IS enabled , if i do this and another object is further then it will be drawn behind what i want to be rendered last . The solution should be fairly easy to implement if i''m not mistaken it has to do with ZENABLE and ZBIAS render states . I just want to be sure .
Thank you all :)
1) Disable z-testing/z-writing.
2) Render background object(s).
3) Enable z-testing/z-writing.
4) Render foreground object(s).

Z-bias is something different. It''s used to prevent ''z-buffer fighting'' when rendering (nearly) co-planar polygons.
You could also implement your own sorting routine and then have complete control over your render order. the advantage is that once you code it you can use it in several other portions of your engine. This will also allow for a bunch of cool effects with alpha''d billboards and point sprites later down the road.

Dreddnafious Maelstrom

"If I have seen further, it was by standing on the shoulders of Giants"

Sir Isaac Newton
"Let Us Now Try Liberty"-- Frederick Bastiat
Thx , sorting is probably what i''ll do .
Thank you all :)
Does not sound efficient.

Regards

Thomas Tomiczek
THONA Consulting Ltd.
(Microsoft MVP C#/.NET)
RegardsThomas TomiczekTHONA Consulting Ltd.(Microsoft MVP C#/.NET)

This topic is closed to new replies.

Advertisement