I’m trying to create a vertical fog effect with 2-color gradient skybox. The current implementation is based on calculating the world position of a fragment and lerping its color to a fog color. It isn’t good enough since I need this effect to work with the gradient skybox. So basically I need to render a skybox in world shader. Is there any efficient way to calculate the color of the skybox for the specific fragment to achieve the smooth color blending?
Sure, especially if your skybox is as simple as a two color gradient. You just need to write a custom shader that does the same calculations as your skybox shader (which is likely a lerp based on the normalized world space view direction vector’s Y) and use that for the fog color.
Are you using a custom shader already, or a built in shader with the shadows turned off?