Set sun colour


10-02-2010 11:16:42

Hi, I'm very new to Caelum so forgive me if the question is too simple..
How can I set the colour of a sun, and make the sunset view manually. Do I need to set an image?
I created a sun when initializing Caelum:

Caelum::SphereSun* sun= new Caelum::SphereSun(m_sceneMgr, m_caelumSystem->getCaelumCameraNode ());
sun->setBodyColour (Ogre::ColourValue(1, 0, 0, 1));
sun->setLightColour(Ogre::ColourValue(1, 0, 0, 1));
m_caelumSystem->setSun (sun);

First, it seems that setBodyColour doesn't seem to make any change.
Second, setLightColour only makes the colour of the terrain changes(seems like it just impacts the reflections on the terrain, but I expect some effect in the air and sky)
Third, after the updateSubcomponents (Real timeSinceLastFrame) is being called in frameEnded(), even reflections on the terrain changed back. Could not see any effect of the sun colour any more.
Could anyone help me?


10-02-2010 18:31:44

Hi. I found the same issue but i have a bigger problem to resolve before.
Do you use the script *.os* to load the sky ?
I ask because i did not and i would like to try to see if the issue was the same ...


10-02-2010 19:14:36

Hi Tup4c,
So this IS a problem... I thought it was because I used it wrongly...
No I didn't use the script. If you have any progress would you let me know? Thanks... :)


10-02-2010 22:46:42

The sun color is set with the file SunGradient.png. I haven't tried this but you should be able to provide a different color set with the CaelumSystem::setSunColoursImage() and pass in the name of the new file with your modified sun colors.

Looking at the code it appears that your call to Sun::setBodyColour() is being overwritten during the mSun->update() call in CaelumSystem::updateSubcomponents(). It looks like you may need to extend Caelum to provide the functionality that you desire.



11-02-2010 13:42:14

Ok so we were both wrong. Thank you Fish. :wink:


18-02-2010 14:49:22

Thanks a lot, Fish.
Great to know what to try now~!