Gajet
Member
|
problem with z buffer
I've been having a strange problem today. in the past few days I've managed to generate a mesh dynamically, now it seems engine fails to properly use z buffer for drawing and I'm wondering why. take a look at this screenshot:
it's basically a maze, in which walls are semitransparent and roofs are solid. but as you can see in the right of picture, walls are drawn above roof. I've noticed that it's basically based on the order I'm defining triangles, and depth buffer is not used to render that image at all. I guess I'm missing something but I don't know what it could be. the whole code is somehow long so I just put "initpre" function here:
void InitPre()
{
DataPath("Data");
Paks.add("Data/engine.pak");
D.sync(true);
D.mode(800,600,0);
Renderer.type(RENDER_TYPE::RT_DEFERRED);
}
Now I've found what exactly is causing the problem but I don't know how to fix it. the problem is caused by material technique. I'm using "MTECH_BLEND" (since I'm not really needing lighting features). but it disables depth-sorting. I've also tried "MTECH_TEST_BLEND_LIGHT" but this one will result in disappearing all the walls.
(This post was last modified: 03-26-2012 11:33 PM by Gajet.)
|
|
03-26-2012 10:48 PM |
|
Gajet
Member
|
RE: problem with z buffer
well, after lots of searchs I've found out this problem can be solved using triangle level depth-sorting. can anyone help me how to use such a technique? And if I can use it while using blending function?
|
|
03-29-2012 01:20 AM |
|