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 / 9588
9587  |  9589
Subject: 
Re: surface normals and vertex normals for OpenGL
Newsgroups: 
lugnet.cad.dev
Date: 
Thu, 11 Mar 2004 09:25:28 GMT
Viewed: 
1680 times
  
In lugnet.cad.dev, Travis Cobbs wrote:
In lugnet.cad.dev, Brian Durney wrote:
Hello,
I have some LDraw animation projects in mind and am starting by making a simple
viewer using OpenGL. ...

[snip]

When calculating surface normals I've run into some parts that get some strange
shading.  I'm guessing that it's because some polygons are CW and others are
CCW....

[snip]

I suspect this has been talked about in this group before, but probably not all
in one thread.  I'll try to summarize the things to look out for.

First of all, you are correct in that any files that aren't BFC-certified have
polygons with indeterminate winding.  Because of this, it is pretty much
impossible to generate accurate normals for these files.

It is neither impossible nor particularly hard.  I will snip the rest of the
post here and explain.

There is an interesting property of closed surfaces that can allow you to
determine the normals for all polygons (or triangles) given one correct
normal.

A "well behaved" closed surface can be decomposed into a set of
triangles in 3D space.  Each edge of the closed surface will be a
member of exactly two triangles.  Furthermore, the winding rule for
each triangle will be such that one triangle will traverse the edge
in one direction and the winding rule for the adjacent triangle will
go in the opposite direction.  Thus, given one triangle whose normal
is known, it is possible to keep visiting adjacent triangles until the
normals of all triangles are known.  Yes, this is really true!

A "well behaved" closed surface is 1) non-self intersecting 2) is
completely closed (i.e. no gaps or holes) 3) does not have any
edges that are in more than two triangles.  Two cubes that
share an edge would violate criteria 3).  Two cubes that share
a single point would probably work, but should be avoided as well.
I would postulate that it is the goal of LDRAW part designers to
produce "well behaved" closed surfaces.

If somebody would like to write a program and/or library that takes
an LDRAW file as its input and outputs a sequence of points,
triangles, and normals, that would be a "good thing."  Writing such
a library is on my "to do" list, but is at least a year out at this point
in time.

Hopefully the description above will provide some insight for solving
the normal determination problem for LDRAW parts.

My $.02,

-Wayne



Message has 2 Replies:
  Re: surface normals and vertex normals for OpenGL
 
(...) I don't know about that goal. I think it's better to make it easy to assemble the various primitives into parts. That way we get more people volunteering to make the parts. I don't think the primitives *can* be closed. I also think it's much (...) (20 years ago, 11-Mar-04, to lugnet.cad.dev)
  Re: surface normals and vertex normals for OpenGL
 
I'm working on just such a utility right now. I hope to have some beta code in a few days : ) (...) (20 years ago, 11-Mar-04, to lugnet.cad.dev)

Message is in Reply To:
  Re: surface normals and vertex normals for OpenGL
 
(...) I suspect this has been talked about in this group before, but probably not all in one thread. I'll try to summarize the things to look out for. First of all, you are correct in that any files that aren't BFC-certified have polygons with (...) (20 years ago, 7-Mar-04, to lugnet.cad.dev)

9 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