Skip to content

Shading artifacts on normal-mapped surface due to normal flip #2852

@pablode

Description

@pablode

Today I've investigated a set of test failures in guc's test suite. In this specific example, we have a normal-mapped plane where the MaterialX renderer exhibits artifacts that do not exist in the glTF and UsdPreviewSurface reference images:

MaterialX UsdPreviewSurface glTF Reference
Image Image

(Consider the circular artifact on the circle in the top left corner.)

Initially this reminded me a bit of the bump terminator problem so I visualized the angle between shading normal and geometric normal (green = angle is zero or negative):

main debug
Image Image

And after some more debugging I stumbled upon this line in the oren_nayar implementation, which flips the shading normal depending on the view direction:

Image

What seems to happen is that the normal-mapped shading normal gets flipped because the view direction lies outside its hemisphere. With the line commented out, the result looks correct:

Image

Could it be that we actually want to flip the shading normal depending on dot(N_geom, V)? But then the problem is that we already calculated the effect of the normal map. We would need to do it before calculating the new normal with in, scale, and the TBN-frame.. but then again there needs to be a guarantee that the flip happens before BRDF evaluation.

I have not investigated further, but wanted to log this issue so that it can be discussed, as there are people in the community who are much more familiar with the GLSL BRDF implementations.

Example material in question (needs the MaterialX plane mesh): Material_07.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions