Netskate
18-10-2008 14:13:41
So, to make it shorts...
I want to change water colour... if is night, water had to be more dark, else it had to be more bright.
Which method to do this?
I have implemented one, but I'm not sure if it's the best (probably not) and if it is too heavy (seems not to be). So I would know your thought.
Premise I use caelum, then I have a sun with a position, but this can be applied to another light source in movement like a sun.
The idea is to have a watercolour that is costant, as xavi told, water is always of the same colour.
So what we had to change is the brightness of that colour...
Then I implemented two methods:
first I convert the rgb water color to hsl model, then I increment and decrease the lum value in base of the sun position, (for this I make an interpolation from max and min value of brightest and darkest colour) then reconvert the hsl colour (with lum value updated) to rgb and set it to hydrax->setwatercolour();
this operation is done at every frame, or each 0.5 seconds (it's not important, depending to be realistic, from the sun's speed)
So I would know if this is a good not-too-heavy method in your opinion, and if there's something better than this.
I want to change water colour... if is night, water had to be more dark, else it had to be more bright.
Which method to do this?
I have implemented one, but I'm not sure if it's the best (probably not) and if it is too heavy (seems not to be). So I would know your thought.
Premise I use caelum, then I have a sun with a position, but this can be applied to another light source in movement like a sun.
The idea is to have a watercolour that is costant, as xavi told, water is always of the same colour.
So what we had to change is the brightness of that colour...
Then I implemented two methods:
static Ogre::ColourValue rgbToHsl(Ogre::ColourValue rgb); // Transform a rgb colour into hsl coordinates (r = hue, g = saturation, b = lum)
static Ogre::ColourValue hslToRgb(Ogre::ColourValue hsl); // Transform a hsl colour into rgb coordinates
first I convert the rgb water color to hsl model, then I increment and decrease the lum value in base of the sun position, (for this I make an interpolation from max and min value of brightest and darkest colour) then reconvert the hsl colour (with lum value updated) to rgb and set it to hydrax->setwatercolour();
this operation is done at every frame, or each 0.5 seconds (it's not important, depending to be realistic, from the sun's speed)
So I would know if this is a good not-too-heavy method in your opinion, and if there's something better than this.