Recommended Posts

Hi All,
I want to know how to create Day and Night Effects in DirectX.Right now I am using only device.RenderState.Ambient light to give the day and night effects by varying the RGB values.Is there any better way to create day and night effects.I really want the solution for this.plz can anyone help on this.
thanks and regards.

0

Share this post

Link to post

Share on other sites

Having a dynamic sky would help a lot, I think (at least it has in my apps). This way, you can be on any day-night cycle that you want. However, if you don't need to change between the two in the same scene, I suppose just a correctly-colored sky-box or -dome would be appropriate.

If you are doing any type of global illumination, you can vary the parameters to that, as well. This can be as simple as a single directional light representing the sun/moon, to environment mapping, to PRT.

Then before rendering the frame, i clear the background to the 'sky' colour and set the ambient light to the 'ambient' colour. I also create a directional light with the 'sun' colour, and set its rotation around the x-axis to the 'sun_angle'.

This way you can just create an array of environments, and it will fade between them for you.

Theres some things i skipped over, like creating the array, timing, changing the current and next enviornment, but hopefully you can figgure that stuff out ;)