Skip to content

[HDRP] Improves robustness of detail normal mapping when scale = 0 (and not using surface gradients) #6980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 20, 2022

Conversation

eturquin
Copy link
Contributor

@eturquin eturquin commented Feb 3, 2022

This PR addresses: https://fogbugz.unity3d.com/f/cases/1399548/

Before:
Using some detail maps with null scale resulted in null normals.

Now:
Null scale will produce a "neutral" normal, as expected.

Note:
We could consider normalizing the detailNormal in a more general way, rather than in this specific use-case, but I went for the minimal amount of changes and risks of unwanted side-effects.

@github-actions
Copy link

github-actions bot commented Feb 3, 2022

Hi! This comment will help you figure out which jobs to run before merging your PR. The suggestions are dynamic based on what files you have changed.
Link to Yamato: https://unity-ci.cds.internal.unity3d.com/project/902/
Search for your PR branch using the search bar at the top, then add the following segment(s) to the end of the URL (you may need multiple tabs depending on how many packages you change)

HDRP
/jobDefinition/.yamato%2Fall-hdrp.yml%23PR_HDRP_trunk
With changes to HDRP packages, you should also run
/jobDefinition/.yamato%2Fall-lightmapping.yml%23PR_Lightmapping_trunk

Depending on the scope of your PR, you may need to run more jobs than what has been suggested. Please speak to your lead or a Graphics SDET (#devs-graphics-automation) if you are unsure.

@eturquin eturquin changed the title [SRP] Changed the way normals are unpacked from AG channels [HDRP] Improves robustness of detail normal mapping when scale = 0 (and not using surface gradients) Feb 3, 2022
@remi-chapelain remi-chapelain requested a review from a team February 3, 2022 16:16
Copy link
Contributor

@RemyUnity RemyUnity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@remi-chapelain
Copy link
Contributor

While this is still a slight improvement for the case where the detail map scale is zero , I don't really think this fixes the issue overall because on some cases when having both normal and detail map, it's still enough for some reasons to flip the normal onto the other hemisphere :|

83cf4d2f75325902a8c6dcf9bd9e1c80.mp4

I don't know if we can do anything about it while keeping the function (UnpackNormalAG) that infer the Z coordinate of the normal from the XY but wanted to highlight that !

@sebastienlagarde
Copy link
Contributor

any update?

@sebastienlagarde sebastienlagarde marked this pull request as ready for review February 9, 2022 13:16
@sebastienlagarde
Copy link
Contributor

discussed with Remi, we will merge the PR, waiting for Yamato

Copy link
Contributor

@remi-chapelain remi-chapelain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix is still an improvement so we will merge.

While this does not really fully fix the problem, it has been decided to discuss and maybe find a way to use surface gradient in the future rather than trying to fix the way normal map are blended right now.

@RemyUnity RemyUnity removed their request for review February 16, 2022 16:54
sebastienlagarde pushed a commit that referenced this pull request Feb 21, 2022
sebastienlagarde added a commit that referenced this pull request Feb 22, 2022
* Improve Path tracing docs #6494

* [HDRP] Improves robustness of detail normal mapping when scale = 0 (and not using surface gradients) #6980

* Add pragma renderer only for planar reflection preview shader (#7058)

* Add pragma renderer only for planar reflection preview shader

* various missing part

* Fix wrong class name in the CustomPassUtils doc (#7063)

* Fix null check reference in CollectLightsForRayTracing (Fix 1398381) #7065

* Fixed camera motion vector pass reading last frame depth texture #7111

* Update Custom-Pass-Injection-Points.md (#7116)

* Update Custom-Pass-Injection-Points.md (#7116)

* Fix lunix compil issues (#7143)

* note bolding (#7161)

* note bolding

* Apply formatting changes

* Update blit-overview.md

* Update blit-overview.md

* Update blit-overview.md

* Update blit-overview.md

* Update blit-overview.md

* Update blit-overview.md

Co-authored-by: noreply@unity3d.com <noreply@unity3d.com>
Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* updated screenshots (#7164)

* updated screenshots

* Apply formatting changes

Co-authored-by: noreply@unity3d.com <noreply@unity3d.com>

Co-authored-by: Vic Cooper <63712500+Vic-Cooper@users.noreply.github.com>
Co-authored-by: Emmanuel Turquin <emmanuel@turquin.org>
Co-authored-by: Antoine Lelievre <antoinel@unity3d.com>
Co-authored-by: JulienIgnace-Unity <julien@unity3d.com>
Co-authored-by: emilybrown1 <88374601+emilybrown1@users.noreply.github.com>
Co-authored-by: noreply@unity3d.com <noreply@unity3d.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants