Line Rendering big problem

Juan Lastra

Newcomer
Joined
Jan 13, 2005
Messages
5
Location
Madrid (Spain)
Hello:
I am drawing trimming lines on a surface. To show the lines I put them on the top using the following call:

device.RenderState.ZBufferFunction = Compare.Always;

The lines are rendered on the top of the surface in the right way.
The problem is that the back lines (on the back of the surface) are also
drawn like black shadows. I don´t understand why it is happenning,
if these lines has an normal that isn´t visible from the camera.

Do you have some idea about it ?

I enclosed one image describing the problem:

In the image you can appreciate the front red lines, and the shadows on the back of the surface.
 

Attachments

They are being draw because you're using Compare.Always. The Normal is just the direction that they reflect light, not the direction they are visable from. Lines are not culled.
 
How to solve it ?

Thank you fro your help.
If the lines aren´t culled, it means that I need to implement my own hidden removel algorithm. Is this the only solution ?

Regards,
Juan Lastra
 
I would try to get the ZBuffer to work for you. If you can't get that to work then I'd suggest a vertex shader to either shift the lines by a small transformed z or to alpha out the obverse lines.
 
Similar results win Compare.Equal

I got similar results when I used the Compare.Equal option.
With this option the lines blinks according to the point of view,
but the genral effect is the same, the back lines appear
as shadows.
 
The default value of LessEqual would be best I think. If you still have broken lines I'd try slightly decreasing the z component of the line vertices in view space in a simple vertex shader.
 
Back
Top