Skip to main content
gamedev.net
🔒 Locked

Camera-Lighting problems

Started by emotion_sickness May 30, 2003 at 6:38 PM 3 replies 850+ views
Original Post
emotion_sickness
emotion_sickness
Hi, I have my stage with lighting enabled, one point light turned on in the position of my camera (meaning that its using the same xPos yPos & zPos that I use in the viewport coordinates). The object in the view is iluminated and when it rotates it gets the appropiate shading, so everything ''till here is ok. But when I move the camera I can only see the front face of my object (it dissapears when I turn the camera around) and in the same movement function I update the values of the light and call setlight again, so in theory the light should be following the camera right? The camera rotates around the object, allways looking to the origin. Another weird thing is that no matter where I put the light the object is allways equally iluminated, even if the light is 1000 units far or near, but maybe that''s a rare property of point lights, or what? I hope I made myself clear. Cheers James
DerMeister
DerMeister
Really wierd. Now this may really sound silly but, does the object have its normals defined in the right way? Or maybe something about the ambient light (just an idea, cause I''m not really experienced in lightning).
I recommend you to use the "sample" light defined in the sdk tutorials and experiment with them... maybe some parameter is wrong. It is possible that the normals are not defined right if it is a mesh exported from a 3d modeler...

good luck

No matter where you go... &this
No matter where you go... &this
tok_junior
tok_junior
Hm, that's very odd... That the light intensity doesn't change is because you haven't set the attenuation-values up, but for the other problem, i haven't got a clue...
It sounds to me that you're using a directional light, you sure you're not doing that by mistake?

[edited by - tok_junior on May 31, 2003 4:10:47 PM]
emotion_sickness
emotion_sickness
Thanks for your posts.
The normals are properly set, since when you rotate the object around the origin it gets the corresponding ilumination. The problem is when the camera moves, the light doesn''t move. And Yes, I call SetLight everytime I update the position values.
I know its weir, since I used the same movement of the camera in the sdk sample and the light moves with it, but still can''t figure out what''s wrong with mine =/
Dreddnafious Maelstrom
Dreddnafious Maelstrom
it actually sounds to me that you are using too much ambient light, are you sure the shading is working correctly? does the light only light the sides that face it?

remember that if you do alpha blending with a color key that you have set your renderstate to blend the vertices diffuse property with the texture, this will light everything equally and emulate ambient light, be sure at the end of any alpha blend to set the render state back to modulate.
"Let Us Now Try Liberty"-- Frederick Bastiat

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.