Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted
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.
"Who is John Galt?"
Posted

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

Posted
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.
"Who is John Galt?"
Posted

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.

Posted
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.
"Who is John Galt?"

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...