PDA

View Full Version : Using materials and lighting ???



Punchey
03-22-2002, 06:32 AM
Okay, I've got a weird problem. I'm loading in Milkshape models. I've got the materials of the model set so that diffuse is all the way up (255), and everything else (specular, ambient, emissive, shininess) are all the way down (0). Now, the problem is that my models wind up being lit as though my light source was (1,1,1) regardless of the actual color of the light. If I set the light to nothiing but one or two channels, (1,0,0) or (1,1,0) for example, then the light comes through as that color. But if I increase the other channel's value much AT ALL (1, 0.1, 0.1), then the model is lit as though it was set to (1,1,1)!!! Is there something I'm doing wrong?

I mean, it's weird because it's acting almost like the color values are in the range 0 - 0.1 instead of 0 - 1 becaues the brightness also seems off. I can set the color to (0.01,0.01,0.01) and it's still as bright looking as (1,1,1). What am I missing? Thanks!

Korval
03-22-2002, 11:30 AM
Could you post the exact command you use to set the light color?

Punchey
03-22-2002, 11:54 AM
GLfloat Light2Diffuse[]={ 1.0f, 0.01f, 1.0f, 1.0f };

...

glLightfv(GL_LIGHT1, GL_DIFFUSE, Light2Diffuse);

Oliver LS
03-23-2002, 07:08 PM
Are you calculating your normals? I've been messing with lights a lot and I had a lot of weird problems like that when I wasn't!

harsman
03-24-2002, 10:41 AM
It sure sounds like your normals are too long, but it's hard to know for sure. Try:



glEnable(GL_NORMALIZE);

Punchey
03-25-2002, 05:41 AM
THANK YOU HARSMAN!!!!!! That did the trick! I wonder why Milkshape's output models don't already have normalized normals? That seems odd to me. Anyway, you guys are the best! Thanks again!