NVIDIAGameWorks / Falcor

Real-Time Rendering Framework
https://developer.nvidia.com/falcor
Other
2.71k stars 496 forks source link

Incorrect normal calculation in Skinning.slang cause incorrect shading result #379

Closed KnakamuraS closed 1 year ago

KnakamuraS commented 1 year ago

In version 6.0, Skinning.slang do not compute normal vectors correctly when skinned mesh is deformed. This will cause wrong shading results as below.

Incorrect shading result (the arm part obviously reveals incorrect shading results): image

This problem may be due to a change in normal calculations in Source/Falcor/Scene/Animation/Skinning.slang from the v5.2 update.

s.normal = mul((float3x3) transpose(invTransposeMat), s.normal);

https://github.com/NVIDIAGameWorks/Falcor/blame/9fdfdbb37516f4273e952a5e30b85af8ccfe171d/Source/Falcor/Scene/Animation/Skinning.slang#L159

Correct shading result can be obtained by modifying the relevant line like this:

s.normal = mul((float3x3) invTransposeMat, s.normal);

Correct shading result: image

skallweitNV commented 1 year ago

Thanks for reporting, this slipped our tests! We confirmed the fix and it will be released soon as part of the next update.