UnityURPToonLitShaderExample icon indicating copy to clipboard operation
UnityURPToonLitShaderExample copied to clipboard

Imported tutorial shader not working correctly on lighting.

Open gpfl0712 opened this issue 9 months ago • 0 comments

First of all, your tutorial shader is greatly appreciated. Thanks for your hard work.

It's my first time to write a custom URP shader, so I'm trying to import your tutorial shader to my project. But there's something wrong with the lighting.

image On a directional light, the character receives light from every direction(no dark sides).

image On a point/spot light, the character does not receive any light. The most frustrating thing is, the character receives light from point/spot light when it's closer than 1.5-unit distance.(no matter how far the light range is)

Although, outlines are working properly, and the character produces shadows, other objects (using URP lit shader) normally receive shadows from it. So I'm curious if there's a problem with my project or configurations.

I tested on my project, unity 2021.3.7 LTS and URP 12.1.7, with this version of tutorial shader https://github.com/ColinLeung-NiloCat/UnityURPToonLitShaderExample/tree/4802381d313d19c04fff97eca59f9a0b34a7e15a And tested on a basic URP template project, unity 2022.3.20 LTS and URP 14.0.10, with current version of tutorial shader. Same results in both versions.

I made sure to apply material -> shader to tutorial shader, unity gameobject's mesh renderer component->cast shadows=On, unity light object component -> shadow type=hard/soft shadows, URP asset -> Lighting -> Main/Additional Light -> Per pixel, Cast Shadows = True.

This is my URP asset and Universal Render Data. And all the other settings are default. image image image

Thank you for your help!

gpfl0712 avatar Apr 27 '24 13:04 gpfl0712