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 / 3030
3029  |  3031
Special: 
[DAT] (requires LDraw-compatible viewer)
Subject: 
Re: CW/CCW, vertex sequence, co-planar, convex
Newsgroups: 
lugnet.cad.dev
Date: 
Mon, 4 Oct 1999 17:45:50 GMT
Viewed: 
770 times
  
It seems to me that there are two major "camps" in the CW/CCW debate.

A.  Face-by-Face Method
This method suggests that CW-ness be ultimately evaluated on a face-by-face
basis.  Each quad in a primitive or part would hold a value of CW,CCW, or
Double-Sided/Unknown.  This value would be propagated up to parts using a
primitive, models using a part, etc. and could be altered at any level by a
negative determinate or a 0 CW command.

Using this method, you would define the stud2 primitive using:

0 CCW
1 16 0 -4 0 4 0 0 0 4 0 0 0 4 4-4cyli.dat
0 CW
1 16 0 -4 0 6 0 0 0 4 0 0 0 6 4-4cyli.dat
--meaning that the faces of the first 4-4cyli.dat should be drawn if their
vertices are ordered CCW, while the faces of the second 4-4cyli.dat should be
drawn if their vertices are ordered CW.

If you used stud2 in a subpart, then mirrored the subpart in your part, the
rendering program would be smart enough to alter the CW-ness value to
compensate for the fact that the vertex ordering would be changed.
Alternately, you could include a 0 Invert command to let the program know you
are inverting the CW-ness of the subpart.  In either case, the faces of the
first 4-4cyli.dat would now be drawn if the vertices are CW, while the faces
of the second would be drawn if they are CCW.

A face may also have an "unknown" value, in which case it is always drawn.

In this model, the role of a "part-fixer" utility would be to determine which
lines in parts and primitives can be marked 0 CW, which can be marked 0 CCW,
and which can't be figured out and should be left "unknown".

As I see it, the advantages of this approach include:
1.  Backface culling can be applied to sections of a part even if the entire
part can't be verified CW or CCW.  Thus all parts should see reduced drawing
time.
2.  The actual coordinates of the part & primitive files would not need to be
altered.  The meta commands would just be added.

Disadvantages might be:
1.  It might become overly complicated (either for part authors or for the
rendering program) to follow the trail of CW-ness.
2.  Repeated 0 CW, 0 CCW, 0 Invert commands could make the part files messy.


B. Part-by-Part Method
With this method, a part is either [C]CW compliant or it is not.  If it is
marked compliant (perhaps with 0 [C]CW-Compliant at the beginning), then when
it is drawn only [C]CW faces are drawn.  Otherwise all faces are drawn.

For a part to be considered compliant, all subparts and primitives used in the
part must themselves be compliant.  Thus the stud2.dat primitive would have to
be altered to:

1 16 0 -4 0 -4 0 0 0 4 0 0 0 4 4-4cyli.dat
1 16 0 -4 0 6 0 0 0 4 0 0 0 6 4-4cyli.dat

so that the normals of the quads are facing outward for the first case, and
inward in the second case.

A part which used:
1 16 0 0 0 1 0 0 0 -1 0 0 0 1 stud2.dat would not be considered compliant,
since the negative determinant would alter the CW-ness.  To fix the part you
would have to make it:
1 16 0 0 0 1 0 0 0 -1 0 0 0 -1 stud2.dat
As noted by Gary Williams, this becomes more difficult for asymmetrical
primitives.  For example,
1 16 0 0 0 1 0 0 0 -1 0 0 0 1 1-4cyli.dat would have to be changed to:
1 16 0 0 0 0 0 1 0 -1 0 1 0 0 1-4cyli.dat.

In my view as a part author rather than programmer, this would be almost
impossible for authors to follow on their own.  But if a utility could be
designed which could fix parts after they are created (perhaps even with some
limited interaction by the part author), this method might be feasable.  The
"part-fixer" utility would actually alter the lines of a part to reorder quad
vertices and transform primitives to make them comply.  This fixing would have
to start with the primitives and move up to subparts, then parts.

Advantages of the part-by-part model would be:
1.  Easier for rendering programs to deal with, since the program would only
have to follow inversions down to the part level.  For example, it would have
to recognize that part x was inverted in submodel "a," which was inverted in
the main model file, and so CW-ness will be double-reversed.  But it could
then draw all the CCW faces in the part (and its primitives) and skip the CW
faces.
2.  Part files would be altered considerably, but would only increase slightly
in size or complexity.

Disadvantages:
1.  Subparts, because they are not closed, probably could not be evaluated
with the part-fixer.  Thus most parts using subparts would be ineligible for
CW certification.
2.  Pretty much dependent on creating a robust "part-fixer" program.  Parts
more complex than basic bricks & plates would be very difficult to fix
manually.


So that's my take on where we are at (and feel free to disagree or make
corrections/additions).  I've been in both camps myself, and I guess my
preference depends on the extent to which a utility could be written to
completely fix parts.  It's just important to understand which of these paths
we want to go down, since I think they are mutually exclusive.

-John Van



Message has 1 Reply:
  Re: CW/CCW, vertex sequence, co-planar, convex
 
John VanZwieten wrote in message ... (...) Actually, I count three ideas. (...) messy. (...) when (...) the (...) to (...) only (...) have (...) in (...) CW (...) slightly (...) for (...) The third option, which I believe would be best, is similar (...) (25 years ago, 4-Oct-99, to lugnet.cad.dev)

Message is in Reply To:
  CW/CCW, vertex sequence, co-planar, convex, (115kB)  [DAT]
 
Here are 50 messages regarding the above subjects. The first from January 1998 where Leonardo Zide suggested CW/CCW. I support the CW/CCW idea (isn't it annoying knowing almost 50% of all faces are drawn to waste), though it will cost a considerable (...) (25 years ago, 29-Sep-99, to lugnet.cad.dev)

53 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
    

Custom Search

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