Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Trying to fix the equation I use for a directional path of my sunlight?

This topic is 5298 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 sun in a skydome that I have following a circular path with a directional light as well. The light tends to follow the path I want and stuff but the problem is when its night time in the skydome the ground is light up like its day time and when its daytime the ground is nighttime yet the sky is daytime, and that makes no sense. Currently the path im using to calculate this is defined by an equation. The equation is as follows, and updates every frame. This equation gives me a very accurate circular path around the skydome and works rather well.
light.Direction.x = sin(float(m_fTime * 44.0f)) * 300;;
light.Direction.y = cos(float(m_fTime * 44.0f)) * 300;;
device->SetLight(0, &light);
	m_fTime = 1.0f;

As for the setup or default settings of the light they are defined as follows:
// Setup the light source.

light.Direction = D3DXVECTOR3(1.0f, 0.0f,1.0f);
light.Position.x = 0.0f;
light.Position.z = 0.0f;
light.Position.y = -50.0f;
light.Diffuse.r = light.Diffuse.g = light.Diffuse.b = light.Diffuse.a = 1.0f;
light.Specular.r = light.Specular.g = light.Specular.b = light.Specular.a = 1.0f;
device->LightEnable(0, TRUE);
device->SetLight(0, &light);
I tried changing the path of the light by using position as well but it tends not to move the light at all then.. and thats not what I want. I am wondering if there is something I can do to caculate the directional and positional locations of the light correctly so that it doesn't look like its daytime at night time, and night time at day time, w hich is how it currently is by that I mean when its daytime it lights up the sky but not the ground and when its night it lights up the ground and not the sky. It works fine if I just use say a positional or point light rather then a directional type, but the lighting casted onto the skydome looks rather tacky. If anyone can help it would be greatly appreicated For those of you who like visuals: [edited by - DevLiquidKnight on March 25, 2004 6:00:45 PM]

Share this post

Link to post
Share on other sites

  • 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!