I was wondering if there's a way to make the fog color blend to the world / sky background. Any fog color and brightness I choose stand out against the sky, which is especially a problem since I'm using fog to cut the draw distance which looks bad:
Use sky as fog color
You could attach a script to your worldenvironment and control the color values of the sky backround and the fog color from there. Using the same color should probably get you what you are after?
@Megalomaniak said: You could attach a script to your worldenvironment and control the color values of the sky backround and the fog color from there. Using the same color should probably get you what you are after?
It would definitely be better. If I'm going that route I may as well make the ground color of the sky the same as the sky itself, then just set the fog to that. I was hoping I could instead use the fog as an alpha blend so it fades what it covers to transparency... kinda sounds like a nice feature for Godot 4.0 to have.
If you want, you can make a proposal on the Godot Proposal repository, so it can (potentially) be included in Godot 4.0 :smile:
What you have proposed sounds like an awesome idea! I've always wondered why most game engines haven't tried to do that. They usually just use one solid color instead of mixing the color with the background.
This is technically possible, see an Unity shader which does it here: https://github.com/keijiro/KinoFog
Posted a request on the tracker for this, thanks for that suggestion!
I think this is possible. I wrote some code for grabbing the pixel color of the sky. I think you could use a variation of this, but pass the whole texture to a shader and then use the SCREEN_UV to grab the sky pixel color and add fog based on that. I haven't tried it, but it might be worth a look. https://godotforums.org/discussion/comment/38646#Comment_38646
Hello. Try this on your camera.
How will that achieve the effect they're looking for? They're asking for fog to blend with the sky colour, which won't always be a solid colour.
@mziskandar said:
That looks exactly like what I was looking for! So I simply set the sky on the camera instead of the world to get those extra controls?
@MirceaKitsune said:
@mziskandar said:
That looks exactly like what I was looking for! So I simply set the sky on the camera instead of the world to get those extra controls?
Sky horizon, ground bottom color, ground horizon color = fog color visibility range or camera clip end = fog end