To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.devOpen lugnet.cad.dev in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / 6885
6884  |  6886
Subject: 
Re: A comprehensive LDraw object model
Newsgroups: 
lugnet.cad.dev
Date: 
Sun, 10 Feb 2002 19:40:18 GMT
Viewed: 
489 times
  
In lugnet.cad.dev, Jeremy H. Sproat writes:
In lugnet.cad.dev, Kyle McDonald writes:
Actually this brings up a different issue. I haven't put alot of thought
into it yet, but I think it would be useful to add information in the
part files that would allow a program to differentiate between geometry
that represents 'outside' walls and features, and 'inside' walls and
features.

IIRC (and I wish I could find the reference) the LDraw spec does support this.

It depends on the order of the points in the polygon; e.g. clockwise points
out, counterclockwise points in.  Or something like that.

But last I heard of this, there were a lot of LDraw parts that had
improperly-coded lines, so I dunno what the state of the whole thing is.

Backface culling or BFC?  Is that what I was remembering?  Arg.  Something
the parts authors were talking about, anyway...

Backface culling (BFC) is what you are describing, but it isn't what Kyle
was asking for :-).  In traditional realtime 3D rendering, polygons only
have one side.  The back side is literally non-existent.  It doesn't get
drawn at all.  This is called backface culling.

It only works if the polygon is specified in such a way as to be able to
determine which side is the back.  This is usually done by specifying all
the points in all the polygons using a consistend winding order (either
clockwise or counter-clockwise).  So, when the renderer (say OpenGL) goes to
draw a triangle that when rendered on the screen has its points in clockwise
order, but you've told OpenGL that all polygons are specified in
counter-clockwise order, it doesn't draw the triangle.  Note that it still
has to transform all the points in the polygon to screen coordinates in
order to make the decision whether or not to draw it.  But it can skip the
lighting calculation, texture calcuations, etc, as well as the actual
polygon fill.

The other (less obvious) thing that BFC gets you is the ability to use
one-sided lighting.  If you don't know which side of a polyon is the front,
you don't know which way the surface normal has to point.  So you have to
use two-sided lighting, which automatically mirrors the surface normal if it
is more than 90 degrees from the viewer.  This slows down the lighting
calculation.

There is a BFC extension to the LDraw format (using comment commands).
L3Lab supports it, as well as presumably other programs. LDView (my program)
doesn't at the moment, but probably will eventually.  Unfortunately, it
doesn't appear that too many parts support it at the moment, so it may not
really gain you much to support it.  The main performance gains I expect to
get in LDView are from the fact that once I have BFC working, I should be
able to use BFC for all my substituted stud primitives.

--Travis Cobbs (tcobbs@REMOVE.halibut.com)



Message is in Reply To:
  Re: A comprehensive LDraw object model
 
(...) IIRC (and I wish I could find the reference) the LDraw spec does support this. It depends on the order of the points in the polygon; e.g. clockwise points out, counterclockwise points in. Or something like that. But last I heard of this, there (...) (22 years ago, 10-Feb-02, to lugnet.cad.dev)

30 Messages in This Thread:











Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR