Hi, is there a possibility to apply the gradient fog to a standard shader like the “Simple Lit” shader? As far as a saw/tried it, you need a custom shadergraph where the “CorgiFogGradient” node needs to process the texture color to apply the fog.
Cheers,
Quegg
Are you referring to the Unity Built In Render Pipeline’s Standard shader, or are you referring to URP’s ‘Standard’ (Lit) shader?
This plugin doesn’t support the old built in pipeline, but if you need it to, let me know and I’ll see if I can do something about that.
If you mean the URP Lit shader, you have a few options (which are outlined in the documentation):
You can simply put the plugin in ‘post process’ mode, and you will not need to modify any shaders and the plugin will “just work” everywhere. The downside to this is the plugin is slightly slower, as it now requires an actual post processing pass which will touch every pixel. (adds a blit for a custom grabpass, then adds a blit to apply to screen).
OR
You can put the plugin in ‘per material’ mode. This mode requires all shaders in the project to include the shader macros that come with the plugin. You can do this with normal HLSL editing tools. I’ve also provided ShaderGraph tools, but URP’s ShaderGraph does not have a ‘final color’ block so it’s not possible to do any sort of per-material post processing with ShaderGraph yet. It’s just included to future proof for when they do. The upside to this mode is there is no extra post processing required, so its as fast as you could possibley render.
Hi thanks for answering!
I mean the default URP shader. I added render feature and set to post process mode, but the fog does not show up. It appears only if i use a material with a custom shadergraph applying the fog. Here a screenshot of a minimal test project:
1 is the Forward Renderer with the Render Feature,
2 is the Post Process Volume
3 the material and shader the objects use.
The camera has post processing enabled and the build-in post processing effects work(forgot to include that in the screenshot).
When i change the shader to a shadergraph which includes applying the fog inside the shader it works. Then i see the following
I guess i have something misconfigured somewhere but i cannot get it working as post process effect.
Maybe you have an idea what could be wrong.
Regards,
Quegg
The post process mode requires depth to be on, but it should be requesting URP to enable that for you. Maybe you need to enable it manually? It’s in the URP Renderer settings, next to opaque texture, toggle on depth texture.
It does not work even after enabling. I also tried it in an empty project and cannot make it work as post process.
Can you provide a minimal project/example where the fog as post process is working so i can compare to mine to figure out the problem? In the asset itself there is only an example where the material handle the fog.
The fastest way to run the fog is thru the per-material render mode. This bypasses any need for post processing. However, the setup is a lot more complicated. I highly recommend it, if you have experience with or want to study shader programming. There’s a guide on how to do this in the ReadMe.pdf file included with the plugin, although it assumes you have some shader knowledge already.
Even in the slower post-process mode, this seems very slow, it definitely should not be affecting your framerate in this way. What device are you using, what’s the hardware? And can you get me a profiler sample? Is it slow in the editor on your pc or just in builds on some mobile device? I need all the info you can give me to help you figure out what’s going wrong.
This update has a big performance improvement for anyone using per-frame volume updates. Here’s a before and after of the cpu profiler for updating the fog gradient texture (used internally to blend gradient values between volumes).