LDraw.org Discussion Forums

Full Version: BFCing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
I generally do that sort of modification using a text editor! Mainly LDraw Design Pad that has LDraw syntax highlighting, inlining possibilities, etc...

You may also change BFC statement in MLCad (double click on statement line), or use DatHeader. I highly recommend the use of Datheader anyway before submitting to parts tracker, this tool does a lot validity checks on your file.
Wouldn't it be possible to implement more of DatHeader's functions in the Submit function of the tracker?
Not directly the same code (because I believe DATheader needs the .NET framework), but running the header checks would be possible. In fact, I do run a Perl header checker against all the certified files prior to releasing a Parts Update. That's why you'll often see a bunch of Admin Edits immediately prior to the update, as I find things that have been missed by manual review.

I was initially reluctant to implement that in the Submit process for fear that authors would just get frustrated with trying to meet the needs of the then "new" header format, and we would lose files or even authors.

Maybe the format has had sufficient time to gain acceptance that it would be OK to implement it now.
I think it would be great to have. If I was told my header was wrong when I tried to submit I'd fix it immediately. Thus saving work for all reviewers.

Tim
I tried to BFC this part. Did I do it right? I used a lot of "BFC INVERTNEXT" since "reverse winding" didn't work on the primitives. That was all I could do with my limited knowledge.
Nearly. Your solution is correct in the way that all faces are correctly oriented now.
One can check that by looking at the part in LDView, with BFC checking mode enabled.
To do that, you can put a "BFC" button into the toolbar (using LDView's toolbar customization).

However, your solution solves the problem in an inefficient way, it can be done better:
Relax: BFCing is nothing else than orienting every surface in the file "properly",
such that its "front" points "outside", and its "back" points "inside" the part.

Quads can be re-oriented by reordering their points reversly:
This will make inside outside and vice versa. LDDP has a button for this, it is the one with the red/green color flipping.
That button simply takes a quad and reverses its order of points.

Your misunderstanding is regarding primitives. There, you currently wrote:
0 BFC INVERTNEXT
1 16 2 4 -2 0 1 0 -1.75 0 0 0 0 -1.75 1-4ring7.dat
Let's look at this in more detail, i.e., look at the matrix.
Without the BFC instruction, your ring primitive lies in the Y/Z plane, as you for example can see
directly from the matrix with some experience, or in MLCad when looking at it.
When looking at the ring in LDView with BFC checking enabled, you'll notice that it is simply
pointing "in the wrong X direction": when looking at it in X direction, you see its backside (in red).
Instead of now inverting the whole primitive by an extra BFC INVERTNEXT statement, you can simply
mirror the primitive at the Y/Z-plane, making it pointing "the other direction on the X axis".
This is easily achieved by flipping the sign of the X scaling: change
1 16 2 4 -2 0 1 0 -1.75 0 0 0 0 -1.75 1-4ring7.dat
to
1 16 2 4 -2 0 -1 0 -1.75 0 0 0 0 -1.75 1-4ring7.dat
, and voila, the primitive now is mirrored, and this means that its front now correctly points to the viewer.

This technique can generally be applied for all flat primitives, where the mirroring at the axis in which they are "flat"
will not warp their geometry.
(Sadly, BTW, tool WINDZ does not do that. It inserts all these BFC INVERTNEXT statements always.)

For non-flat primitives, like e.g. cylinders, things are a little different, and this mirroring technique cannot be applied,
as the mirroring will yield a completely different appearance in the part file which uses the primitive.
For these, the
0 BFC INVERTNEXT
statement cannot be avoided and must be used.

I hope this helps you a little. Once you've gotten more used to BFCing, it will become very, very simple to you.
Just the start is confusing. Don't let this frustrate you.
Always think simple of this. In the mathematical sense, each surface has an orientation, i.e., a "front" and a "back",
and this can be used for performance optimization when rendering such a part, because a surface which points
to the viewer with its "back" side will always be on an invisible "rear" side of a part, and can be left out from rendering
completely. Only the surfaces which show their "front" to the viewer need to be rendered. For the high number
of polygons our parts have, this effect can significantly speed up painting.
BFCing means nothing else than properly orienting all the surfaces of a part this way.
Wait... there's a tool for that?!? I changed the quads and triangles all manually in LDDP.

I already knew BFC in LDView, but thank you anyway. I was just curious about the BFC INVERTNEXT.
I'll have another look at it tomorrow.
Excellent summary!
BTW, maybe this forum is missing a "tutorial" section where this kind of discussions could be placed for reference in the future?

Quote:This will make inside outside and vice versa. LDDP has a button for this, it is the one with the red/green color flipping.
...and there is a keyboard shortcut too, Ctrl+W.
Quote:Sadly, BTW, tool WINDZ does not do that. It inserts all these BFC INVERTNEXT statements always
Windz does have several shortcomings,eg. it doesn't behave very well on open parts that have no clear inside/outside (eg. subparts), but it's often a big time saver. Windz is included in LETGUI distribution.
Despite its shortcomings, I would like to see it included in the AIOI as well - dunno if it's in there already.
At some point in the future, we might have an improved version.
As it is a very specialized tool to be used only by a handful of people, I don't see the need to put it in AIOI...
Pages: 1 2 3