Juan Lastra Posted January 13, 2005 Posted January 13, 2005 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.ShowingHiddenLines.bmp Quote
IngisKahn Posted January 13, 2005 Posted January 13, 2005 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. Quote "Who is John Galt?"
Juan Lastra Posted January 13, 2005 Author Posted January 13, 2005 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 Quote
IngisKahn Posted January 13, 2005 Posted January 13, 2005 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. Quote "Who is John Galt?"
Kavan Posted January 13, 2005 Posted January 13, 2005 Instead of using Compare.Always just use Compare.Equal. Quote
Juan Lastra Posted January 14, 2005 Author Posted January 14, 2005 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. Quote
IngisKahn Posted January 14, 2005 Posted January 14, 2005 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. Quote "Who is John Galt?"
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.