PDA

View Full Version : ligjt



07-26-2006, 12:17 PM
Hi I have a cube without a face (this permit me to see inside it). the hole in the cube in in front of mine: I put face normals like
faceup (0,1,0), face left (-1,0,0)......now I have the light on the left of cube; beside faceLeft; it happen that inside cube all face appear dark/black (I think it's ok). but the leftFace (inside) appear white (the color of cube faces). WHy? there isn't a normal in inside cube and there isn't a light...thanks

RigidBody
07-26-2006, 02:11 PM
a light source is never occluded by the geometry, even though it may be occluded in reality. only the dot product of a face normal and the vector to the light source is taken into account.

to get the effect you want, you'll need some kind of shadow algorithm.

glAren
07-26-2006, 02:17 PM
Piece of code could be usefull .. but seems you lights your cube from the righ side, not from the left and have two sided lighting enabled - the left side from outside is dark, isn't it?

07-26-2006, 02:44 PM
ok, so my face (a quads) must appear white in both sides..:!?? My light is positional, but i think this doens't matter....

glAren
07-28-2006, 01:58 AM
No, only from side where the light is. If you have e.g. quad on XZ plane (Y=0)and vertex normals are set up (0.0, 1.0, 0.0):
(front side (FS) is the side from where the normal comes out, back side (BS) is the other)
1) you have one side lighting
a)light is e.g. on position 0,10,0
->the FS will be lit
b)light is e.g. on position 0,-10,0
->nothing will be lit
2) you have two-sided lighting
a)light is e.g. on position 0,10,0
->the FS will be lit
b)light is e.g. on position 0,-10,0
->the BS will be lit