A question involving Z-Buffer...

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Nextor
Posts: 35
Joined: Wed Feb 16, 2005 9:06 am
Location: Madrid, SPAIN

A question involving Z-Buffer...

Post by Nextor »

Hi all.

I'm having a problem which I think I've solved by patiently reading a big portion of this forum, but I'd like to re-question it and add some more questions as I'm new at handling some 3D concepts as Z-Buffer, projection matrix etc...

I have a 2 meshes set, consisting of an eyeball and the eyelids in a face. In the scene you can see part of the eyeball behind the eyelids, obviously. The problem arises when I move back the camera from the meshes, the eyeball surface goes "getting out" from the eyelids, as it was before them.

The fact is that the eyeball surfaces are very close to the eyelids and, as I read at these forums, that's a problem for the renderer when calculating the order on which those are rendered. What I can do to solve that? Is a good idea to use bigger sized meshes so there is more distance between them? Adjust the near and far planes of the frustrum?

Although I have read carefully the Irrlicht manual, there's no much explanation on these concepts. Please, enlighten me.

Thank you very much.
Get away from her, you B*TCH !!! - Ellen Ripley
Zeuss
Posts: 114
Joined: Mon Nov 08, 2004 9:02 pm
Location: Canberra - Australia
Contact:

Post by Zeuss »

adjusting the near and far planes so they are closer will help. Putting more distance between the 2 meshes will help, but making them bigger (i.e just scaling them both up) will not help. As you will have to make the near and far planes largers to fit the model in, and therefore you will lose Z-Buffer accuracy and be a the beginning again.

In DirectX, I believe (i do not know about Irrlicht). There is a way to specify something as a 'decal'. So if it is near something on the Z-Buffer, it will automatically be put ontop. This is to stop say bullet holes being applied on a wall to not have this Z-Buffer clash.

Maybe someone with more Irrlicht experience than me can enlighten you on that.
Help make Irrlicht even Better! Create and submit your own Irrlicht Extension
Want a Games Education? Try The Academy of Interactive Entertainment
Nextor
Posts: 35
Joined: Wed Feb 16, 2005 9:06 am
Location: Madrid, SPAIN

Post by Nextor »

Thanks Zeuss for your quick answer, I'll have a try.
Get away from her, you B*TCH !!! - Ellen Ripley
Nextor
Posts: 35
Joined: Wed Feb 16, 2005 9:06 am
Location: Madrid, SPAIN

Post by Nextor »

Yes, I've had a look at it and I had to play with setNearPlane and setFOV together in order to have good results. Then, I was able to move back the camera far enough without seeing the eyeballs "popping out", get a decent field of vision and not to have a too big near plane distance.

Thanks again.
Get away from her, you B*TCH !!! - Ellen Ripley
Post Reply