> Date: Thu, 12 Sep 2002 19:12:12 +0200 > From: Desiree Hilbring <[EMAIL PROTECTED]> > > I have one AmbientLight and one DirectionalLight in my scene. > I try to lit a surface, with about 5 to 50 vertices. Lighting is > okay for the normal height of the surface, but as soon as I do > superelevation on the scene to the influence of the light onto the objects > decreases for the degree of scaling the height axis. > Can anyone please explain that? I thought a DirectionalLight is coming > from infinity.
Are you using a non-uniform scale factor to increase the elevation? If so, there is a Java 3D bug that is probably responsible for the lighting problems: bugid 4722648 p3/s3 Non-uniform scale causes lighting errors. The description contains the following: A simple height-field application submitted by a user ([EMAIL PROTECTED]) varies the height field by setting a non-uniform transform in the TransformGroup above the geometry. The lower-right unlabeled slider controls the Z-scale, initially 1.0. If the slider is moved up and down then incorrect lighting results are shown. This is only a problem with OpenGL on Solaris and Windows. D3D always normalizes normals so the problem doesn't exist under D3D. With OpenGL, the executeGeometryArray() and executeGeometryArrayVA() native methods check the isNonUniformScale parameter to see if GL_NORMALIZE should be enabled. However, this parameter is always false when moving the slider even though the Z scale is clearly being applied. It appears that dynamic changes to the non-uniform status of a transform don't get propagated to the native methods until something explicitly provokes a call to the RenderMolecule reset() method. Possible workarounds: Scaling the geometry data explicitly and recomputing the normals without using a non-uniform Transform3D will always work, but is expensive. It's not sufficient to use a non-uniform Transform3D and just rescale the normals explicitly, since GL_RESCALE_NORMAL can't be turned off. On Solaris, the environment variable J3D_FORCE_NORMALIZE can be set in the environment to force the use of GL_NORMALIZE initially. This is only done the first time when the context is created however, so if GL_NORMALIZE is ever disabled it won't be possible to enable it again. The bug only presents itself when the scale is changed dynamically. If the Transform3D is initially created with a non-uniform scale, then the lighting is correct until Java 3D notices that the scale has become uniform again. In the test application this won't happen unless the Z scale is set to 1.0 in the slider and the "BR" button is clicked. -- Mark Hood =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
