• Unity
  • 2D Light URP Light Mask Duffuse Ramp and Specular

Hello guys. Can anyone use this maps with URP? I dont know how create shader with this maps. But maybe someone can share it.

Related Discussions
...

When using a 2D Renderer with URP, you need to use the Universal Render Pipeline/2D/Sprite shader, which can also be selected by choosing Lighting Mode Lit Universal 2D at any one of the Spine Sprite shaders. The Universal Render Pipeline/2D/Sprite shader only provides the Light Maskproperty out of the mentioned ones from the thread topic. Diffuse Ramp and Specular textures are for 3D renderer shaders only.

You can see the Light Mask property in action in the URP 2D Shaders example scene that comes with the URP Shaders UPM package available on the download page.

3 years later

Hello Harald. I've been playing around with the URP 2D renderer example. But I can't seem to see what effect the light mask has? Do I need to turn on any post processing for it to affect anything?

@paatz04 The blue rim light is implemented as follows:
1) 2D Light Blend Style layers are setup in Example 2D URP Renderer Data.
Rim is assigned at the red (R) channel of masks.

2) There is a global Rim Light gameObject with a 2DLight component of blue color, with Blend Style set to Rim (like a layer just an integer set to 1).

3) The skeleton's material now has a Mask Texture assigned, where the mask's red channel determines how much any 2DLight with Blend Mode Rim is to be applied. In this case, stretchyman-rim-mask is set to white only near the outer edge, where the rim light should be applied. Actually it would work the same with only the R channel being set. The G and B channels of the mask texture have no effect since no 2DLight uses Blend Mode using the G or B channels (and the Example 2D URP Renderer Data does not define anything for G and B channels).

Thanks so much for the explanation! I was only playing around with one of the other spotlights and didn't realize there was a separate light setup for it. This makes a lot of sense.