Hi recently i am trying to implement z ordering system into my directx framework. So every object will have z order property(int), and this value will have higher priority than depth checking for rendering. the current idea is from these three my assumptions that
- depth check happens beforeafter vertex shader
- value of
SV_POSITIONis used for depth checking - modifying z component of the value of
SV_POSITIONdoesn't affect anything except in depth checking, because it is in projection space.
so after calculating projection position(local pos * WVP matlocal pos * WVP mat), i did projective dividision(it seems to make problem) and modified only z component corresponding orders that i want to draw with.
This is brief VertextVertex shader code
VS_OUTPUT output;
output.pos = mul(WVPMat, input.pos); // projection pos
output.pos /= output.pos.w;
output.pos.z -= renderPriority;
return output;
And !!! it kinds of works !!! but when i get my camera closer to any object,
it weird thing happens

it doesn't make any this weird thing unless projective division. i am just curious why it happens instead of knowing another alternative way for z ordering. but any further advices and informations would be really appreciated.