Skip to content

[2022.1] Fix for specular materials in URP (Case 1326941) #6064

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 47 commits into from
Jan 10, 2022

Conversation

ellioman
Copy link
Contributor

Purpose of this PR

Second attempt at landing this PR. First attempt was #4798
This PR fixes case 1326941, where brdfDiffuse was incorrectly calculated for Specular materials.

New test scenes (Forward + Deferred) were created to prevent this from happening again.

Before

image

After

image

Yamato

https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/universal%252Fspecular-bugfix-1326941

ellioman and others added 30 commits April 8, 2021 00:14
# Conflicts:
#	com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl
# Conflicts:
#	com.unity.render-pipelines.universal/CHANGELOG.md
# Conflicts:
#	com.unity.render-pipelines.universal/CHANGELOG.md
# Conflicts:
#	com.unity.render-pipelines.universal/CHANGELOG.md
* [XR][URP] Fix issue with vignette location in XR

Vignette center needs to respect the real view center since in XR, with asymmetric FOV, the center of the render taget is not always the center of the view. We deduce the real center via the projection matrix data and use that to offset the vignette's center.

* Updated changelog

* Extracted comon XRView code into ComputeEyeCenterUV & Allow more than 2 XR views

* Fix vignette movement direction for XR when whe change the vignette "center" parameter

* Returning to 2 views only for XR vignette.

This will keep the shader as simple as possible, if we need to support more views in the future, we can restore this code

* Use "Vector4.zero" instead of "new Vector4(0.0f, 0.0f, 0.0f, 0.0f)"

* Only set v3 if we are using single pass

That variable is only needed if single-pass instancing/multiview is active, so we can simplify the code to only do the asymetric FOV correction when we are in multi-pass mode.

* More improvements

- Renamed _Vignette_Params3 to _Vignette_ParamsXR
- Moved all single-pass XR values in _Vignette_ParamsXR
- Extracted code to correct eye center to XRPass class

* Adding a comment to describe what ApplyXRViewCenterOffset does

* Quick fix a comment that is not right anymore after moving the code
@ellioman ellioman requested review from a team as code owners October 19, 2021 11:42
@github-actions
Copy link

github-actions bot commented Oct 19, 2021

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)

URP
/jobDefinition/.yamato%252Fall-urp.yml%2523PR_URP_trunk
With changes to URP packages, you should also run
/jobDefinition/.yamato%2Fall-lightmapping.yml%23PR_Lightmapping_trunk

Shader Graph
/jobDefinition/.yamato%252Fall-shadergraph.yml%2523PR_ShaderGraph_trunk
Depending on your PR, you may also want
/jobDefinition/.yamato%252Fall-shadergraph_builtin_foundation.yml%2523PR_ShaderGraph_BuiltIn_Foundation_trunk
/jobDefinition/.yamato%252Fall-shadergraph_builtin_lighting.yml%2523PR_ShaderGraph_BuiltIn_Lighting_trunk

VFX
/jobDefinition/.yamato%252Fall-vfx.yml%2523PR_VFX_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.

@phi-lira
Copy link
Contributor

PR Still has failures on DX11.

@ellioman
Copy link
Contributor Author

The three CI failures are known and not caused by this PR.

@ellioman ellioman merged commit 2badd96 into master Jan 10, 2022
@ellioman ellioman deleted the universal/specular-bugfix-1326941 branch January 10, 2022 16:01
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.

8 participants