Jump to content
  • Advertisement
Sign in to follow this  
Tokage

OpenGL Uneven Lighting on Model

This topic is 5148 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a little 12-vertex model of a star that I made in Blender. The center of the star sticks out a little to make it 3D-looking. It's completely symmetrical, so the front looks just like the back. I loaded it into a program (Win32, C++, OpenGL) to display it. It draws okay, but when I'm displaying the front of the star, all the faces look the same color. It's fine from the back, and when it's tilted slightly away from the front, the faces are slightly different. Any idea what might be causing this, or how to fix it?

Share this post


Link to post
Share on other sites
Advertisement
A screenshot would be handy here, and some more info, e.g:
-How did you setup your normals and shading?
-What type of lighting are you using - because if the light is behind the star then then only ambient (uniform) lighting will apply on the front faces.
-Are you using a 2-sided shade model, or are the faces all 1-sided?

Share this post


Link to post
Share on other sites
The normals are whatever Blender exported them as. I checked in Blender and they're all okay. I'm using flat shading. The light isn't moving at all, it's just the star rotating, so the position of the light shouldn't be a problem. I tried turning on two-sided shading, but that didn't fix it. I think Blender does the winding automatically anyway.

EDIT: Check http://tok.dotsomething.net/starprob.gif for a bunch of screenshots. I marked each one with the angle of rotation of the star. Note that it is the star, not the camera, that is being rotated.

[Edited by - Tokage on September 19, 2004 2:07:51 PM]

Share this post


Link to post
Share on other sites
Did you make the star by copying an pasting one leg? If you do this a certain way in 3d max, the normals are all messed up and you have to do stuff to sort it out. Maybe a similar effect with Blender - is there a 'reset transform' tool or something similar?

Share this post


Link to post
Share on other sites
No, I did a spin-duplicate on two vertices to form two concentric pentagons pointing in opposite directions and one smaller than the other, then I made the center point and drew each face separately. To get the other side I just flipped the front over and made it the back. There's a feature in Blender to "recalculate normals," and I did that.

Share this post


Link to post
Share on other sites
It looks like the normals are incorrect. It shouldn't be too hard to check all 20 tri normals manually. Just make sure the front tri normals are reflections of the corresponding back triangle normals on your XY plane (assuming X points right and Y points up). Also check they're all unit length.

FYI, you can display an image in a post using an HTML image tag, like this
<img src="http://tok.dotsomething.net/starprob.gif">

Share this post


Link to post
Share on other sites
Oh, that's handy. Most forums have HTML off.

Anyway, I think the normals are fine because I had Blender calculate them for me, but I'll check.

EDIT: No, it was the normals. I fixed them manually. Thanks.

[Edited by - Tokage on September 19, 2004 6:44:03 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!