Welcome to Fractal Forums

Fractal Software => Fragmentarium => Topic started by: Patryk Kizny on November 20, 2015, 10:39:46 PM




Title: Help with SunSky
Post by: Patryk Kizny on November 20, 2015, 10:39:46 PM
Hey,

There's SunSky in frag examples that I am using with my renderer now.
The problem I encountered is that the bottom hemisphere is grey and I wanted to make it black or adjustable.
And I can't seem to be able to find what to modify to tweak it.

Any help?

 


Title: Re: Help with SunSky
Post by: Syntopia on November 21, 2015, 01:09:37 AM
In 'vec3 sunsky(vec3 viewDir)' you can insert a line before the 'return' statement like:
 
Code:
sky = dot(up, viewDir)<0.0 ? 100.0*vec3(1,0,0) : sky;	

You still get a bit of grey near the horizon - here you can cheat a little and pull the sky down, by changing to:
Code:
float cosUpViewAngle = dot(up, viewDir);

If you want the to use the fake ground color to actually light your model, you'll have to update the 'sky' method as well.


Title: Re: Help with SunSky
Post by: Patryk Kizny on November 21, 2015, 01:28:44 AM
Thanks. That cuts a straight line which is not too cool.
I was rather curious what causes the effective grey in the lower hemisphere and how to create an organic falloff to black instead of grey.


Title: Re: Help with SunSky
Post by: Syntopia on November 21, 2015, 04:59:44 PM
You ¨could mix in something smoothly based on the "dot(up, viewDir)" which is 1 for up, 0 for the horizon, and -1 for down.

I think all atmospheric models will turn white/grey near the horizon. The models are not welldefined below the horizon.


Title: Re: Help with SunSky
Post by: Patryk Kizny on November 21, 2015, 05:56:18 PM
Thanks. That's what I did.
What was better as a tweak in fact was to rotate the sky view dir along the Right axis. That way I achieve camera-dependent horizon shift which lowers the horizon to compensate for missing content due to limited raytracer range.

Thanks a lot for your help!