PDA

View Full Version : Lighting transformation (strange results)



Ace_Man
12-16-2000, 06:50 PM
I have sort of a strange question. I've written an ASE loader. Previously, I had been calculating my normals for each triangle. This worked fine. I've just modified my loader to read normal values which I export from MAX. When I use these values. My models
tend to appear strange.

For example:
If I load in a mountain range model (and I calculate the normals), then Rotate the scene with "glRotatef(rot,0,1,0);" the shading appears as if each part of the mountain range is "coming into the light" and "lights" up when it spins in front of me (I am looking at 0,0,0 where the model sits).

If I use MAX's normal values, the shadows don't change like this. It's as if the model is sitting still and "I" am rotating around it. In other words, if one side of the mountain is dark, it will always remain dark with MAX's normal values. With my normal values, the dark side will "light" up when it spins around to face me (and the previously lit side becomes dark)

So one way is like the model is rotating and the other appears as if I am rotating around the model. The only thing changed was the normal values.

I'm not sure if I actually have a problem (and if so, which one of the normal values I should use). Does anyone have a suggestion or even a comment on this. It's just a bit strange to me is all, and I don't know why it's doing this. I wonder if it has something to do with the way my lights were set up in MAX perhaps?

zed
12-16-2000, 08:14 PM
i have limited experience with ase files but i seem to remember they seem to cock up the normals somehow. IIRC nate http://nate.scuzzy.net/ has some ase loading code on his site maybe worth checking out

Deiussum
12-17-2000, 10:40 AM
When do you do your light positioning? Maybe when you changed the code to use the new normals you inadvertently changed where you position the light. If you do something like this..

glRotate()
//position light

It should appear that you are moving becuase the light will effectively move as well. If you position your light when you initialize the scene, and then keep doing the rotates, it will appear that the scene is moving and the shading will change as the scene moves.