Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm using OpenTK and working in C#, if that matters. I'm trying to get lighting effects on a textured object. I'm using obj and mtl files to define them. No matter what I try my object is either invisible, unlit (plain texture), or completely white.

I defined my mtl by having my texture mapped to diffusion (that is, map_Kd texture.png). I found that if I don't set both a Ka and Kd (in addition to the texture) the object is invisible. It also seems that the actual ambient values don't change anything - they could be 0 and transparent, as long as they're defined.

If I set my material to have white ambient, diffuse, and specular, then the object is 100% white, no matter what I do with my light source. And this is after I set it to gl_separate_specular_color, as before that I just got the plain texture. I tried making sure I had a normal defined for at least one face of the model, with no luck. I'm trying to have my texture be dominant, with a little bit of specular lighting on it.

What am I doing wrong? Is the lighting "working" but the all white means I haven't set my shininess properly? Is it being infinitely reflective or something?

share|improve this question

1 Answer

up vote 3 down vote accepted

I figured out that my problem was twofold. One, I didn't have enough normals defined. Two, I was using flat shading. With only one normal to go on, all the faces were using the same normal for shading, hence they all reflected light in exactly the same way. So my model was a uniform color. Adding more normals and using smooth shading made it look nice.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.