Jump to content
  • Advertisement

Archived

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

jamessharpe

Sky Colours - A Practical Analytic Model for Daylight

This topic is 5520 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''m trying to implement "A Practical Analytic Model for Daylight" to get vertex colours for a skydome, however I am getting very large values for the luminance. This is causing my vertex colour calculations to overflow(stored as unsigned chars), and gives colours that are undesirable. Can anyone tell me how I should scale the luminance value so it is in the correct range?

Share this post


Link to post
Share on other sites
Advertisement
First do all your math in floating point (floats or doubbles) then convert to unsigned chars at the end. If values go out of range (usualy around of sun) just clamp them. Also there are other ways to convert Xyz color to RGB than described in that paper (709 RGB with D65 white point matrix). [some screenshots from my implementation : http://www2.arnes.si/~ssdmtera/download0.htm]

You should never let your fears become the boundaries of your dreams.

Share this post


Link to post
Share on other sites
That''s exactly what I was doing - all the maths in floating point and then converting at the end, using the 709RGB with D65 whitepoint matrix.

What is the range that i should be clamping to, and in which colour space?

Share this post


Link to post
Share on other sites
Just tried clamping RGB floating point values to [0.0, 1.0] range - this gives a yellow! sky for most of the time and an orange band moves across it, and then returns to yellow.

EDIT: I think the problem may lie in the calculation of the Zenith Yxy values. I'm using the equations at the end of the paper, these are giving me values of ~3.4 for Y, x and y, which I know is obviously wrong since x and y must lie in [0,1].

EDIT: Duhh.. I was calculating theta for the sun wrong! I was mulitply Pi by 2 instead of dividing by 2, however I have now got a pure whiet sky, do I need an exposure function of some kind to bring the colours back in range?

[edited by - jamessharpe on June 2, 2003 1:51:06 PM]

[edited by - jamessharpe on June 2, 2003 1:59:24 PM]

Share this post


Link to post
Share on other sites
I am using an exposure ramp for luminance. The XYZ->RGB conversion is also D65 Whitepoint.


new_Luminance = 1.0 - exp(-(1.0/expsure) * Luminance);


I have source on my website, it uses the OpenSceneGraph as scene graph.

_DarkWIng_:
how did you get such a nice reddish sunset? Mine is to yellow.



eisscholle.de



[edited by - stephanh on June 2, 2003 2:47:32 PM]

Share this post


Link to post
Share on other sites
There are alot of parametrs to play around. I just found some that make sun red

But my exposure is a bit different. I gor from Xyz to HVS, use exposure function (exponential like yours or linear) in HVS space then convert back to RGB.

[edit]: I also do some kind of gamma correction after exposure so this gives a bit different colors also.

One question for you: how do you handle points that are under horizon? I was geting some wierd colors so I just used color from horizon (or a bit bellow it).


You should never let your fears become the boundaries of your dreams.

[edited by - _DarkWIng_ on June 2, 2003 4:04:44 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by _DarkWIng_
There are alot of parametrs to play around. I just found some that make sun red



Hehe, i just played around with the parameters explained in the paper but haven''t got far. So there''s hope...thanks

quote:

But my exposure is a bit different. I gor from Xyz to HVS, use exposure function (exponential like yours or linear) in HVS space then convert back to RGB.



I also tried this some time ago, though i haven''t found a direkt conversion from Xyz/XYZ to HSV (i think we already had this in another thread)

quote:

One question for you: how do you handle points that are under horizon? I was geting some wierd colors so I just used color from horizon (or a bit bellow it).



The angles (from zenith) are limited to -PI/2 to PI/2. I simply don''t use angles (for the samples) out of that range and move the skydome as low as neccessary so i don''t see the edge. It''s a limitation of the model.




eisscholle.de

Share this post


Link to post
Share on other sites
Thanks for the help I''ve got it working now.
quote:

Original post by _DarkWIng_
There are alot of parametrs to play around. I just found some that make sun red



Are the parameters you need to adjust the perez coefficients for the chromaticity values, the XYZ to RGB matrix or both?

DarkWing : for your clouds are you using a separate plane or are you texturing the dome? I''ve got a perlin noise generator for my clouds and that''s produced good results, I was just wondering how to go about applying it onto my sky.

Also the night sky with this model isn''t very good - has anyone considered implementing a different model for the nightsky?

Share this post


Link to post
Share on other sites
I did play with perez coefficients but not for pictures on my site. They can give you some WIERD results (alien world skys). The most important values are turbidity, sun height and gamma correction.

Clouds are mapped to the dome. I projected points of skydome to virtual plane then mapped texture coordinats back to dome.

stephanh : I haven''t found direct XYZ to HSV conversion so I go from XYZ ro RGB then to HVS

You should never let your fears become the boundaries of your dreams.

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!