Fixed shadow matte not working with ambient occlusion when MSAA is en… #3157
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…abled
Purpose of this PR
This PR fix a wrong behavior when shadow matte is use with Ambient Occlusion and MSAA is enabled.
In this case the code was not outputting any data for the shadow matte material in the normal buffer and thus out put was wrong.
Root cause of the issue is the ColorMask [_ColorMaskNormal] directive in unlit.shader which seems to not work when set from a cmd.SetGlobalInt() call. The value never change.
However after code inspection it appear that all this masking for color buffer is useless as the shader pass code already output only what is used, and with unlit shader normal buffer are always the last one (as unlit don't have decal and depth msaa and motion vector are render first), so all work fine by simply removing the code (Which could be due to a recent clean of order of all this for decal layer).
Also even if it is a very unsusual use case, this PR also fix the same issue if the shadow matte have motion vector.
Testing status
Tested the Shadow matte ambient occlusion test with and without MSAA.
Added a MSAA test for shadow matte with ambient occlusion. It is enough coverage.
Get same result with or without MSAA on existing test
Comments to reviewers
Notes for the reviewers you have assigned.