Jump to content


Wireframe removing invisible lines


  • You cannot reply to this topic
8 replies to this topic

#1 kaizer

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 29 October 2006 - 04:56 PM

Hello,

I am creating a 3D application that displays a figure in its wireframe model. I need to create an option that will remove invisible lines.

What algorithms can be used to do this?

Dont want to use a "face painting" with the background color to overwrite the invisible lines.

Don't know if a brute force:
For all lines, For all faces, if any face is in front of line, ignore the line
would work ok or if it would slow down.

Any comments on the subject and related subjects (visibility determination) are welcome.

Thanks.

#2 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 29 October 2006 - 05:00 PM

The subject you're asking about is part of NPR (non-photorealistic rendering). Try googling for something like "NPR blueprint rendering" or "NPR sketchy rendering" to find techniques for this. Beware though, it won't be fast even for relatively simple models.
reedbeta.com - developer blog, OpenGL demos, and other projects

#3 pater

    Valued Member

  • Members
  • PipPipPip
  • 117 posts

Posted 30 October 2006 - 07:39 AM

kaizer said:

Don't know if a brute force:
For all lines, For all faces, if any face is in front of line, ignore the line
would work ok or if it would slow down.

Thanks.
That'll certainly not help, because the problem is that it's not just a "draw the line" or "don't draw the line" decision. A line in the background may also be partially visible (even in segments, depending on the complexity of the model).

#4 gaia

    New Member

  • Members
  • Pip
  • 4 posts

Posted 30 October 2006 - 09:55 AM

Write a shader to update the depth buffer only in a first pass, change the depth bias slightly and render the same model as wireframe in a second pass? That should take appropriate care of the situations mentioned by pater too.

#5 kaizer

    New Member

  • Members
  • PipPip
  • 11 posts

Posted 30 October 2006 - 01:25 PM

Hello,

thanks for your comments.

Reedbeta said:

The subject you're asking about is part of NPR (non-photorealistic rendering). Try googling for something like "NPR blueprint rendering" or "NPR sketchy rendering" to find techniques for this. Beware though, it won't be fast even for relatively simple models.

That's an interesting technique however I don't think stuff that advanced...

pater said:

That'll certainly not help, because the problem is that it's not just a "draw the line" or "don't draw the line" decision. A line in the background may also be partially visible (even in segments, depending on the complexity of the model).

So control must get down to a pixel/pixel analysis?

Thanks.

#6 dave_

    Senior Member

  • Members
  • PipPipPipPip
  • 584 posts

Posted 30 October 2006 - 03:20 PM

gaia said:

Write a shader to update the depth buffer only in a first pass, change the depth bias slightly and render the same model as wireframe in a second pass? That should take appropriate care of the situations mentioned by pater too.
Thats what I was going to suggest. You dont have to write a shader, you could do this with the fixed function stuff in OpenGL.

#7 Goz

    Senior Member

  • Members
  • PipPipPipPip
  • 574 posts

Posted 30 October 2006 - 05:31 PM

gaia said:

Write a shader to update the depth buffer only in a first pass, change the depth bias slightly and render the same model as wireframe in a second pass? That should take appropriate care of the situations mentioned by pater too.

Do you actually have to bias? Or is the Z evaluation slightly different for wireframe than the original triangles? ie can you nto just set the compare to "equal"?

#8 Reedbeta

    DevMaster Staff

  • Administrators
  • 4979 posts
  • LocationBellevue, WA

Posted 30 October 2006 - 09:28 PM

For wireframe you'll be generating fragments based on lines rather than triangles, so yes, they'll be slightly different due to roundoff errors.
reedbeta.com - developer blog, OpenGL demos, and other projects

#9 gaia

    New Member

  • Members
  • Pip
  • 4 posts

Posted 31 October 2006 - 11:17 AM

Ah, so one can disable colour-write without having to write a shader. I stand corrected - my PC rendering knowledge is a little rusty (been concentrating on PSP for a while). Thanks for correcting my disinformation guys.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users