Perrytje's picture

Lighting and VBO

Hi,

I've loaded a couple of cubes into a VBO, and now I'm trying to light them, the problem is however that they act like every cube has it's own light source, instead of having one look.

It almost appears as if the distance to the light is not taken into account at all.

Here's what it looks like at the moment, I don't want these weird changes in colour on the surface:

Can anybody help me?


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
daniklad's picture

It looks like that because you have normals pointing outward from the corners of the cube. You need to split the faces up so each have it's own set of normals all pointing in the same direction.

Normals illustration

Normals are interpolated across the face so with normals like the left side you will get a curved surface and with normals like the right side you get a flat surface.