PDA

View Full Version : Polygon reduced model lit differently



Kwark
07-06-2009, 07:43 AM
I've got a fairly complex model loaded in my opengl viewer.
This model is lit using 2 simple lights:


gl.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, new float[] { 0.0f, 0.0f, 0.0f, 1.0f }, 0);
gl.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, new float[] { 0.4f, 0.4f, 0.4f, 1.0f }, 0);
gl.glLightfv(GL.GL_LIGHT0, GL.GL_SPECULAR, new float[] { 1.0f, 1.0f, 1.0f, 1.0f }, 0);
gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, new float[] { -1.0f, 1.0f, 0.0f, 0.0f }, 0);
gl.glEnable(GL.GL_LIGHT0);

gl.glLightfv(GL.GL_LIGHT1, GL.GL_AMBIENT, new float[] { 0.0f, 0.0f, 0.0f, 1.0f }, 0);
gl.glLightfv(GL.GL_LIGHT1, GL.GL_DIFFUSE, new float[] { 0.4f, 0.4f, 0.4f, 1.0f }, 0);
gl.glLightfv(GL.GL_LIGHT1, GL.GL_SPECULAR, new float[] { 1.0f, 1.0f, 1.0f, 1.0f }, 0);
gl.glLightfv(GL.GL_LIGHT1, GL.GL_POSITION, new float[] { 1.0f, 1.0f, 1.0f, 0.0f }, 0);
gl.glEnable(GL.GL_LIGHT1);
Simple, but enough for now. This shows all details of the model.

This model is too complex for usage in a webapplet, so I've decided to reduce the polygon count to about 10%.
I've done this with Polygon Cruncher.

This reduced model is much smaller, and still loads fine.
What's not alright though is the lighting. The model seems completely smooth, I can't see any details on the surface (but they are there alright in 3dsmax).

Any ideas what may be going wrong? I'll post 2 renders tomorrow, but maybe someone has an idea what's going wrong.

ZbuffeR
07-07-2009, 12:35 AM
Maybe all the normals were removed during the polycount reduction ?