> From: Frederic Bouvier
> Curtis L. Olson wrote:
> > Drew wrote:
> > >Thanks for the info.
> > >
> > >FWIW, it probably doesn't have to be that way. The shading 'math', as
> > >you put it, should already be a function of the observer's position,
> > >in which case some conditional logic might take care of that.
> > >
> > >I might try to find the code for this. In the meantime, I'll just
> > >draw two opposite single-sided surfaces.
> > >
> > >
> > In opengl, lighting/shading is entirely dependent on the normal you
> > define for each vertex. The orientation of the surface does not factor
> > in. The orientation is used for backface culling, but that's something
> > entirely different.
> > Think about a terrain surface for instance, where the "normal" at any
> > given point needs to be some average of the normals of the surrounding
> > faces ... perhaps weighted by face size. If opengl decided to be smart
> > and overrule what you've provided for a normal, you wouldn't have the
> > level of control you need to do a lot of things.
> There are no normal defined in the AC3D file format. Normals are computed by
> plib ac loader.
That is true. They are defined somehow, of course. What ac3d actually does is
define the surfaces. IIRC the vertex coordinates in an object are listed first
and then a "refs" tables lists the references to the vertices of each surface
in "order" (along with the texture offsets). The "order" determines how the
normals project from the surface which is the plane of the triangle (vertices
are counter-clockwise around the normal).
It is actually a tiny bit more complicated than that, since surfaces of > 3
vertices are first triangulated by the loader so that the plane can be
determined (the normals must be perpendicular to the triangulated plane). The
loader will also split certain vertices based on the crease factor. Splitting
makes one vertice into two or three so the normals don't get averaged and not
averaging makes the surface edges sharp as opposed to rounded or smoothed.
Flightgear-devel mailing list