Question

A very general question.....

If I define a model (say a cube) around 0,0,0 and then translate that model to another position (say 100,100,100) and also translate the light to near it everything works well and the model is correctly light.

However, if I define the model around 100,100,100 in the first place the lighting is all wrong.

My question is - do models have to be defined around 0,0,0?

Many thanks.

No correct solution

OTHER TIPS

No, not at all. There might be problem with normals or light position. When debugging lights I suggest you draw them (as a small cube or something) to easier see if there is an issue.

Sorry - this text is too long to put in the comments section

This is very strange!

I have defined 2 triangles ( I have set opengl to work clockwise)

Triangle 1 vertices: -1,0,1 -1,0,-1, 1,0,-1 Normals:-1,2,1 -1,2,-1, 1,2,-1

Triangle 2 vertices: -99,0,-101, -99,0,-99, -101,0,-99 Normals:-99,2,-101, -99,2,-99, -101,2,-99

I set the light position to 100,10,-100.

One at a time I draw triangle 1 translated to 100,0,-100 and triangle 2 translated to 0,0,0.

Triangle 1 works perfectly but triangle 2 only has ambient lighting on it.

If I change the normals on triangle 2 to -1,2,1 -1,2,-1, 1,2,-1 (which seems crazy) it works! So now triangle 2 looks like this.... Triangle 2 vertices: -99,0,-101, -99,0,-99, -101,0,-99 Normals:-1,2,1 -1,2,-1, 1,2,-1

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top