By default, fog is not rendered on the skybox: By adding a huge oriented-plane behind, I can achieve the desired effect: I'm now thinking of adding a large inverted cube around the camera to handle this in all environments. Is there a better way to make the fog apply to the skybox? I saw in another post someone suggested modifying the Hidden/GlobalFog shader but I'm not sure how you can change the built in default shaders.
For anyone thinking of doing the same, the cube around the camera is working really well. Simply flip which side is rendered on the material.
An inverted cube around the camera sounds like a great way to achieve what you want, as long as you're mindful of culling distances. Just brought up one of my old projects with the Hidden/GlobalFog shader in it, the way that you would edit it to make it also apply to the skybox is simple (and would actually increase performance, technically): Code (CSharp): // Do not fog skybox if (rawDepth == _DistanceParams.y) fogFac = 1.0; Just delete those lines
I came across this Unity example the other day. I have not tried it yet but is seems to affect the skybox in the pictures. Not sure if it will help you or not. Gradient fog
Hi Bosozuki, Thanks for your response! This might be a silly question but where do I find the Hidden/GlobalFog shader to edit? Do you just copy it in to your project and make the changes and then it's automatically used? Oh and great link to the Gradient Fog example Thanks, Ranom
I am not sure for that particular example. IF you have not I would clone the example repository into an empty project for the specific unity version the repository used last. I would then dig around in that particular example to see everything Unity modified for that example and try to replicate in a new project of the version of Unity you are using. I do not believe you need to edit Hidden/GlobalFog shader since it is using a custom hlsl file to create a node in shader graph to be used by a render feature. When I get a chance I will dig around the example myself
Hi, just for @Ranom to confirm - I have just tried the gradientFog example @Bosozuki mentioned - it really works -> obscures completely the whole skybox (used Uni2021.1.6 + URP11). What would be great is to limit shader's "influence" just to narrower horizontal stripe along horizon, so that for example clouds in zenith would be still visible...but I have no clue yet how to achieve it.
Thank you both for your input Good idea to replicate and play with the sample, I should have thought of that myself.
I am testing this: FREE Skybox Extended Shader | VFX Shaders | Unity Asset Store There is skybox fog with some settings, and this is Amplify Shader Editor sample.