UnityChanToonShaderVer2_Project icon indicating copy to clipboard operation
UnityChanToonShaderVer2_Project copied to clipboard

Inconsistent Behavior of Baked Normal for Outline

Open crna-ruka opened this issue 2 years ago • 0 comments

Hi, I love this amazing shader. I've noticed that the results of Baked Normal for Outline seem to vary according to rotations of objects.

To Reproduce

  1. Open the sample scene in Baked Normal directory.
  2. Set Y rotations of each objects to 180. Much of the outlines disappear.

Screenshot screenshot_

Possible Solution

How about calculating the tangentTransform, at both line 76 of UCTS_Outline.cginc and line 82 of UCTS_Outline_Tess.cginc, in local space?

from float3x3 tangentTransform = float3x3(o.tangentDir, o.bitangentDir, o.normalDir);

to float3 bitangent = cross(v.normal, v.tangent.xyz) * v.tangent.w; float3x3 tangentTransform = float3x3(v.tangent.xyz, bitangent, v.normal);

crna-ruka avatar Nov 10 '22 07:11 crna-ruka