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 / 4299
4298  |  4300
Special: 
[DAT] (requires LDraw-compatible viewer)
Subject: 
Re: What is BFC meta command ?
Newsgroups: 
lugnet.cad.dev
Date: 
Mon, 3 Apr 2000 15:51:05 GMT
Viewed: 
2397 times
  
In lugnet.cad.dev, John Jensen wrote:

On Wed, 29 Mar 2000 21:52:37 GMT, Leonardo Zide
<leonardo@centroin.com.br> wrote:

Damien Duquennoy wrote:

With the new version of MLCad, i hear about BFC, but, i'm sorry, i don't know what it is...

Could someone give me explanations ?

BFC means back face culling, it basically means that the rendering
program doesn't need to draw the faces that are not facing the viewer
(calculated by taking the dot product between a face normal and the
camera direction). It's there to make the rendering faster, you don't
need to worry about that if you're not creating a new part or writing a
CAD program. :)
What if I am creating a new part?

The best thing to do for now is to make sure that you are writing clean
code.  The big difference with BFC-able files is there's a sense of
'front' and 'back' for polygons.  So you need to make sure that your
part files are written to communicate the correct information for each
polygon.  No matter what the details of the BFC spec end up being, there
are some things you can do now that won't change later.

Wrap quads and triangles consistently.  BFC-rendering programs are going
to figure out the front side of each polygon by looking at the sequence
of the points in the polygon.  'Wrapping' means to write the vertices on
lines of type 3 and 4 so that the vertices go in order around the
object.  When any quad/tri object in the part is viewed from the
object's outer surface, the vertices should go either clockwise or
counter-clockwise.  It's best to always wrap one way or the other; don't
mix clockwise and counter-clockwise in the same file.  Definitely don't
allow bowtie quads in your code.

You can use L3Lab to check your wrapping -- when you turn on the mytest6
option, all the surfaces will be rendered in either red or green.  If
you've wrapped consistently, the entire part will show as either red or
green.  If you've got a mix of colors, you've got a mix of wrapping
types.  The only exceptions to the consistent red/green coloring will be
primitive-file structures, such as studs.

The second thing to do is to avoid singular matrices in your subfile
references.  It's very easy to pull in a disc primitive like this:

1 16 0 0 0 10 0 0  0 0 0  0 0 10 4-4disc.dat

This will render correctly in LDraw/LDLite/etc, but it can't be BFC'ed,
because it's not a clean transformation.  Basically, there's no
Y-component.  To fix this, include a non-operative y-component, like
this:

1 16 0 0 0 10 0 0  0 1 0  0 0 10 4-4disc.dat
                     ^
It's a small change, that makes a real difference in BFC'ing.

The final thing to do for now, is to keep track of inverted primitive
references.  A standard pair of lines, found in every brick and plate
file, are:

0 Inside
1 16 0 24 0 -36 0 0 0 -20 0 0 0 16 box5.dat
0 Outside
1 16 0 24 0 -40 0 0 0 -24 0 0 0 20 box5.dat

These two lines specify the inside and outside walls of the brick.  The
thing is, in BFC-mode, one of these primitives need to be turned
inside-out.  The polygons of the inner box need to face inward, so you
can see them.  There doesn't seem to be a way to specify this inversion
in LDraw, so it's likely that the BFC standard will have a specific way
to flag subfiles which should be inverted.  For now, you might want to
add a comment line to mark these subfile references.

HTH, HAND, WAIDH?
Steve



Message is in Reply To:
  Re: What is BFC meta command ?
 
(...) What if I am creating a new part? Regards John (25 years ago, 1-Apr-00, to lugnet.cad.dev)

6 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