unity3d-jp / UnityChanToonShaderVer2_Project

UnityChanToonShaderVer2 Project / v.2.0.9 Release
3.82k stars 811 forks source link

Point lights flicker when you move the camera. #105

Closed Fabrazz closed 2 years ago

Fabrazz commented 2 years ago

Great shader, however point & spotlights flicker on the surface for me. This is with the built-in render pipeline using Toon (Built-in) and only occurs in play mode. Any help would be greatly appreciated Flickers

Fabrazz commented 2 years ago

Update, this happens when meshes are combined during play from being set to static. Any solution to this? image

Nobuyuki-Kobayashi commented 2 years ago

As far as I can judge from the screenshot, I assume you are using UTS2 for background objects in your scene. UTS2 is a character-specific toon shader, so there must be one real-time directional light in the scene for look design. If you are using UTS2 for background objects and there is no available directional light in the scene, I strongly recommend using a PBR shader such as Standard Shader.

H3idi-X commented 2 years ago

Hi, it looks like the light falls on flat objects. If this assumption is right, I believe this should be hard to solve, as UTS clip a light at a certain level. For flat objects, every single normal on the meshes are completely the same. It brings about sudden change of shading when we move lights, objects or cameras.

Nobuyuki-Kobayashi commented 2 years ago

For toon shaders, including UTS2, that use lights to generate paint divisions, the following methods are generally used if you want to moderate the change in the way the lights hit the planes.

  1. Instead of dividing the plane into a minimal number of divisions, add several divisions to increase the number of vertices on the plane.
  2. Transfer the vertex normals of the sphere or other part of the surface to those vertex normals using the DCC tool.

By doing 1 and 2, you can smooth the light hitting each vertex and thus avoid sudden changes in the painting. The UTS2 normal map lighting sample does the same thing, so I recommend checking the geometry there.

https://github.com/unity3d-jp/UnityChanToonShaderVer2_Project/blob/release/legacy/2.0/Manual/UTS2_Manual_en.md#normalmap-settings-submenu

Check a ※Hint section above.

Any further usage is beyond the scope of our support, so please investigate on your own.

H3idi-X commented 2 years ago

Hi, If we do not receive additional information, we will close this issue in a few days. We have set up a template for bug reports, so please fill it the next time you wish to submit a bug report.