Volumetric Light Scattering as a Custom Renderer Feature in URP | raywenderlich.com

Learn how to create your own custom rendering features with Unity’s Universal Render Pipeline by adding some volumetric light scattering to a small animated scene.

This is a companion discussion topic for the original entry at https://www.raywenderlich.com/22027819-volumetric-light-scattering-as-a-custom-renderer-feature-in-urp

Hey thanks for this awesome tutorial!

I’m having trouble atm with objects in my scene being detected and sent to the occluders map. The objects I have in the scene are using the “UniversalForward” lightmode. I have the ShaderTagId set up in the list as was suggested. I first followed along and set up everything, and then after I had this issue I did a sanity check by directly copying over the source. I get some random artifacts:


For extra clarity, if I walk from an open field into the forest while facing a still sun, the occlusion map does not change at all. The current one that exists seems to have random artifacts.

Thanks for reading!

After inspecting the issue more, it appears that the trees rendered by vegetation studio pro do not add to the occlusion map, but their normal object counterparts do. So it’s a matter of the way vegetation studio pro renders it’s objects.

1 Like

Great tutorial, but occluders map does not include terrain for me. Did anyone found a fix for this?

1 Like

Hey paulst!

I didn’t think about Terrains when writing this tutorial, thanks for bringing it up. Remember that to create the occluders map, we render all objects that are using shaders listed in the shaderTagIdList.
In this tutorial we are supporting all URP Shaders, so make sure that your Terrain is using the Universal Render Pipeline/Terrain/Lit shader.

You can check the Terrain material. If it is not using the URP Terrain Shader, then you will have to add that shader to the list. But it should be easier to just use the URP Shader.

Hope this helps!

hi, i have face the problem of the ray work fine on unity play mode but not function after build the game, (it will cause the build out game show nothing, just black screen show.)

I faced this problem too. The solution is to go the editor, and go to Edit>Project setting>Graphics and add both the “RadialBlur” and “UnlitColor” shaders to the “Always Included Shaders” list.

Hi, great tutorial. I’m not sure how your supposed to modify the intensity / blurWidth values.
Changing the values in VolumetricLightScatteringSettings will only have an effect if [System.Serializable] is removed.

Also I can’t figure out how to change the values in the inspector. I tried loading the “Radial Blur Test” material instead of creating a new Material like the tutorial does. Like this:

//radialBlurMaterial = new Material(Shader.Find("Hidden/RW/RadialBlur"));
radialBlurMaterial = Resources.Load<Material>("Materials/RadialBlurTest");

The volumetric light effect still worked but I was not able to change the intensity or blurWidth values for the “Radial Blur Test” Material in the inspector.
Does anyone know what I’m missing? Thanks

I figured it out. The values can be changed in the Forward Renderer

Hi Coingod,
Thank you for your tutorial :slight_smile: awesome work !
I have an issue where my custom lit shaders (created with Shader graph) are ot handled in the default ShaderTagId list you gave.
I’ve tried added all URP LightMode (URP ShaderLab Pass tags | Universal RP | 10.2.2) but it’s inefficient.
Do you have an idea of what kind of ShaderTag I can set ?

Nevermind, the issue was the shader was “Transparent” and not “Opaque”. Is there a way to consider “Transparent” shaders as occluder ?

It only works in 2d view. When I turn my camera, axis flips and effect flips either