Color Fog terrain on sky.

Community Forums/Graphic Chat/Color Fog terrain on sky.

Yue(Posted 2016) [#1]

What is the correct color for the mist in relation to the sky?

Although the fog has the same color as the sky, it looks different.

2, 183, 242



Polarix(Posted 2017) [#2]
have you tried making the fog brighter?


Bobysait(Posted 2017) [#3]
the fog is faded to the scene so it's the same color on your screen. It looks darker because of your ground which is dark grey.

just imagine this :
Your blue component for the sky is 255
your blue component for the ground is 100
the fog equation is something like a+(b-a)*depth_coef
(this is the linear formula, but the fog equation is not always in the linear form and more recent equation use exponential form)
So, it goes from (nearer from camera) 100 to (max depth) 255
There is nothing you can do but understand how it works so you can use a different approach for the sky instead of trying to tweak the fog.

For ex : If you intend to use a brighter color, you'll notice a straight band between sky and ground.

what you can do is use a mesh for the sky (with a big entityorder so it's rendered after everything and EntityFx 2+1), then set the vertices color such as :
Use 3 Colors (Dark,Deep and Light blue) with interpolation between each height
- higher vertices : dark blue (vertices higher from 0.5 to 1.0 for ex)
- medium vertices : deep blue ( vertices from y = 0.1 to 0.75)
- bottom vertices : light blue (from 0 to 0.2)
And set the fog color to match the bottom color.
It's just a setup, you can of course tweak it as you like (and also use different colors)

You can use a sphere for that -> bottom vertices are all the vertices with Y <= 0
(and, don't parent the sky to the camera, it's a common mistake, you need to update it in realtime and only use PositionEntity to update the x,z position)


have a look on the sky here, I used this trick for the demo (it also uses a gradiant for the sun position, and some lens flare and hilight + a sprite to darken the border, but it doesn't really change the base stuff and it can be done in all engines that support alpha and vertex color)
https://www.youtube.com/watch?v=oNgtiCq4rZo


Rick Nasher(Posted 2017) [#4]
Nice.
@Bobysait: How's the BigBang Engine coming along?


Yue(Posted 2017) [#5]
@Bobysait

Thanks You. :)




Blitzplotter(Posted 2017) [#6]
Nice work ;)