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 / 6987
6986  |  6988
Subject: 
Re: DirectX and .dat
Newsgroups: 
lugnet.cad.dev
Date: 
Wed, 27 Feb 2002 20:13:10 GMT
Viewed: 
394 times
  
In lugnet.cad.dev, Don Heyse writes:
In lugnet.cad.dev, Roland Melkert writes:
You're probably running into trouble with the random polygon winding
direction in most of the LDRAW parts.  This causes problems with
lighting and culling since the normals often point into the part rather
than out of it.  In opengl you can solve the problem at the cost of
some speed by treating back facing polygons the same as front facing
polygons and disabling backface culling.  An alternate method would
be to take the dot product of each polygon normal with the view vector
and reverse the order of the points in the polygon whenever the dot
product is positive.  This would turn all the polygons to face the
viewer.  None will ever be culled, but at least they'll get lighted
correctly.

One other option (that I just added to LDView in OpenGL) is to use two
directional lights that face in opposite directions.  This probably won't
work for the specular component, as the specular calculation actually
requires the normal to be the proper direction, but it works for diffuse
lighting.

I can't guarantee it will work in DirectX, but it would surprise me if it
didn't (assuming the back faces are being drawn in the first place).  As an
added bonus, this is actually faster in OpenGL (at least on my video card)
than two-sided lighting, the only real alternative.

All this assumes, of course, that you are properly calculating the normal in
the first place.

--Travis Cobbs (tcobbs@REMOVE.halibut.com)



Message is in Reply To:
  Re: DirectX and .dat
 
(...) You're probably running into trouble with the random polygon winding direction in most of the LDRAW parts. This causes problems with lighting and culling since the normals often point into the part rather than out of it. In opengl you can (...) (23 years ago, 27-Feb-02, to lugnet.cad.dev)

6 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

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