Subject:
|
Re: BFCFixer
|
Newsgroups:
|
lugnet.cad.dev
|
Date:
|
Thu, 3 Feb 2005 08:42:46 GMT
|
Viewed:
|
2386 times
|
| |
| |
In lugnet.cad.dev, Mark Tarrabain wrote:
> Don Heyse wrote:
> > But wait, If you can make a program to fix winding on the fly then make
> > a tool for ldraw.org so it can be added to the part submission process.
> > Then we can run it on all the parts so nobody ever has to fix them on
> > the fly again. That'll make *all* the renderers faster.
>
> Well, I had some spare time today... so I wrote one.
>
> It goes through a single LDraw part file and reorients all the polygons
> in it to have the same winding. It comprehends the notion of subfiles
> and already BFC compliant parts, and puts the following lines:
> 0 Processed by BFCFixer
> 0 BFC CERTIFY <winding>
> immediately after any leading type 0 lines which may already be in the
> part file being processed. <winding> is, of course, replaced by either
> CW or CCW, depending on the orientation.
>
> I wrote it in Java, so it'll work anywhere that Java works. I
> developed it inside netbeans, which generated a nice ant buildfile
> automagically for me.
>
> It's an admittedly crude hack but it seems to work for every case I've
> thrown at it so far For any part which is effectively self-intersecting
> part, however, it could theoretically generate a bogus result, depending
> on the order that the polygons are described. As I'm not an LDraw part
> designer, I don't know how serious a problem this could be.
>
> Anyone want it? I could put it up on my website and post a link to it
> tomorrow if people are interested.
>
> > > Mark
I may be being dense here, but I dont understand how this can be done
programatically.
The point of BFC is to allow renderers to understand if a particular polygon is
facing the camera or facing away from it. If all polygons are wound consistently
from the "outside" of the part, then when tranformed to 2 dimensions, those
facing the camera will have one winding direction and those facing away will
have the opposite winding. The way renderers can chose to ignore the rear-facing
polygons. If your program can determine "outside" then why the need for BFC,
because renderers could use the same algorithm. If it cannot determine "outside"
then I'm having trouble understanding how it can set the winding correctly.
Take for example the quad on the outside of a 2x4 brick and the parallel quad on
rear of that "wall" on the indside of the well. Can your program detect that
these should be wound in opposite directions?
Chris
|
|
Message has 2 Replies: | | Re: BFCFixer
|
| (...) I think it can be done for simple objects, by choosing a random winding for 1 polygon, then processing all touching polygons so they're wound the same way (when looking from the same side - out ot in). This would produce a result that is (...) (20 years ago, 3-Feb-05, to lugnet.cad.dev)
| | | Re: BFCFixer
|
| (...) The way it's been done before is to draw rays from the origin outward. The first polygon a ray crosses is facing inward, and the last polygon a ray crosses would be facing outward. The ones in between *should* alternate facing in and out. Do (...) (20 years ago, 3-Feb-05, to lugnet.cad.dev)
|
Message is in Reply To:
| | BFCFixer
|
| (...) Well, I had some spare time today... so I wrote one. It goes through a single LDraw part file and reorients all the polygons in it to have the same winding. It comprehends the notion of subfiles and already BFC compliant parts, and puts the (...) (20 years ago, 3-Feb-05, to lugnet.cad.dev)
|
22 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|