Skip to content
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

Internal/2021.3/staging #8124

Merged
merged 10 commits into from
Jan 22, 2025
Merged

Internal/2021.3/staging #8124

merged 10 commits into from
Jan 22, 2025

Conversation

UnityAljosha
Copy link
Collaborator

Please read the Contributing guide before making a PR.

Checklist for PR maker

  • Have you added a backport label (if needed)? For example, the need-backport-* label. After you backport the PR, the label changes to backported-*.
  • Have you updated the changelog? Each package has a CHANGELOG.md file.
  • Have you updated or added the documentation for your PR? When you add a new feature, change a property name, or change the behavior of a feature, it's best practice to include related documentation changes in the same PR. If you do add documentation, make sure to add the relevant Graphics Docs team member as a reviewer of the PR. If you are not sure which person to add, see the Docs team contacts sheet.
  • Have you added a graphic test for your PR (if needed)? When you add a new feature, or discover a bug that tests don't cover, please add a graphic test.

Purpose of this PR

Why is this PR needed, what hard problem is it solving/fixing?


Testing status

Describe what manual/automated tests were performed for this PR


Comments to reviewers

Notes for the reviewers you have assigned.

seungwon-oh and others added 10 commits December 16, 2024 14:42
…sk not blending

UUM-78038

There were issues where blending would occur further than the maximum distance for cascade shadows and could be broken depending on the camera view.

The alpha value of EvalShadow_GetSplitIndex is intended for blending between cascades. This is also used where the last cascade and shadowmask are blended, which is why the blending is not working properly.

Modified to blend cascade shadows and shadowmask in the same way as URP.

The images below compare the modified HDRP and URP.

* Blending of cascade shadows and shadowmask.
![image](https://media.github.cds.internal.unity3d.com/user/1641/files/fb63bbbc-c8fc-410d-ae0f-8dfffa22bcbd)

* To visualize the blending, cascade shadows are represented as 0 (black area) and shadowmask as 0.5 (gray area). Blending occurs at the maximum distance of cascade shadows.
![image](https://media.github.cds.internal.unity3d.com/user/1641/files/657f732a-934d-4362-b051-5f8f8ce8785b)

Comparison of original HDRP and modified HDRP as the camera distance increases. You can see that the blending works properly regardless of the distance.

* Original
![image](https://media.github.cds.internal.unity3d.com/user/1641/files/11e28622-fcc4-468e-be0d-b74f4014cd99)

* Modified
![image](https://media.github.cds.internal.unity3d.com/user/1641/files/98b11973-7485-452c-975f-e39034f7721e)
…U'S if …

Issue : https://jira.unity3d.com/browse/UUM-82949
Camera view is not rendered on PowerVR Rogue GE8320 GPU'S if Shadows are enabled in URP Asset and Camera stack contains Overlay Camera's. This is caused by changes done to fix https://jira.unity3d.com/browse/UUM-59572

These changes are now being reverted. There is a PR in trunk which fixes original bug ([UUM-59572](https://jira.unity3d.com/browse/UUM-59572)) without needing the fix that is now being reverted.
…ith a clear coat value of 0

Jira : [UUM-84980](https://jira.unity3d.com/browse/UUM-84980)

**Short Description:** 

When 'Clear Coat'(Surface Option) is activated in the Shader Graph, _MATERIAL_FEATURE_CLEAR_COAT is enabled regardless of the actual Clear Coat value. In this case, if the coatMask value is 0 in the EvaluateBSDF_ScreenSpaceReflection() of Lit.hlsl, there is an issue with specular calculation (no problems arise with small values such as 0.001 or 0.00001).

Therefore, I resolve this issue by handling the Clear Coat calculation even when the value is 0.

**Long Description:**

- When 'Clear Coat'(Surface Option) is activated and the clearCoat value is 0 in the shader graph, the ssrLighting value in EvaluateBSDF_ScreenSpaceReflection() is not zero.

- For HDRP/Lit with a 'clear coat' value of 0, the ssrLighting value is 0, 0, 0, 0. (Therefore, no issue occurs)

- In the 'Render SSR' pass, during the 'ScreenSpaceReflectionsTracing' call, the rays are killed at the killRay step for HDRP/Lit, but they pass through in the shader graph.

- This issue arises due to different normalData.perceptualRoughness values, which are computed in the ForwardDepthPrepass.

- During the ForwardDepthPrepass when calculating normalData for each Object, the value changes depending on whether the _MATERIAL_FEATURE_CLEAR_COAT keyword is enabled.

- For HDRP/Lit, in LitGUI.cs, the _MATERIAL_FEATURE_CLEAR_COAT is disabled when the clear coat value is 0, but in the shader graph, the keyword is enabled based on the 'Clear Coat'(Surface Option) regardless of the actual Clear Coat value.

- Due to the nature of the shader graph, accessing the 'Clear Coat' value of the Fragment Node directly is difficult, and the variable name connected to the Clear Coat value can be set differently for each user, making it challenging to check if the Clear Coat value is 0 in ShaderGraphAPI.cs. (See the code below for reference)
```
float _Property_622a98e8ad5742088e5c548ea3797750_Out_0_Float = _Coat;
surface.CoatMask = _Property_622a98e8ad5742088e5c548ea3797750_Out_0_Float;
```

- Therefore, I modified EvaluateBSDF_ScreenSpaceReflection() in Lit.hlsl.
**This is a partial backport based on https://github.cds.internal.unity3d.com/unity/unity/pull/58698 for branch 6000.0/staging**

Minor fixes from graphics docs feedback tickets.

Jira tickets:

- https://jira.unity3d.com/browse/DOCG-6327 - fix link to DOTS instancing docs
- https://jira.unity3d.com/browse/DOCG-6328 - remove link to missing sample
- https://jira.unity3d.com/browse/DOCG-6294 - remove note from min and max
- https://jira.unity3d.com/browse/DOCG-6289 - remove incorrect use of 'naming conventions'
- https://jira.unity3d.com/browse/DOCG-5082 - add link to RenderingLayerMask API
- https://jira.unity3d.com/browse/DOCG-5803 - add link to depth texture information
…ead-only materials in HDRP

**This is a backport of https://github.cds.internal.unity3d.com/unity/unity/pull/59117**

Add note about converting read-only materials in HDRP

Jira ticket: https://jira.unity3d.com/browse/DOCG-5432
… when the original resolution is odd

Fixed black border artifact when using DLSS at certain resolution. The issue is that DRS causes the camera to have odd resolutions which the downsampled SSAO algorithm didn't handled well.
… is disabled

This PR fixes HDRP sky rendering when Camera Relative Rendering is disabled.

`ComputePixelCoordToWorldSpaceViewDirectionMatrix()` in `HDCamera.cs` contains:

```
...
if (useGenericMatrix)
{
    var viewSpaceRasterTransform = new Matrix4x4(
        new Vector4(2.0f * resolution.z, 0.0f, 0.0f, -1.0f),
        new Vector4(0.0f, -2.0f * resolution.w, 0.0f, 1.0f),
        new Vector4(0.0f, 0.0f, 1.0f, 0.0f),
        new Vector4(0.0f, 0.0f, 0.0f, 1.0f));

    var transformT = viewConstants.invViewProjMatrix.transpose * Matrix4x4.Scale(new Vector3(-1.0f, -1.0f, -1.0f));
    return viewSpaceRasterTransform * transformT;
}
...
```

Here the view matrix that was used to build `viewConstants.invViewProjMatrix` has translation component if Camera Relative Rendering is disabled when it shouldn't.

![scene_view](https://github.cds.internal.unity3d.com/unity/unity/assets/7006/95047d07-52f3-4d19-8698-0120ad86987f)
Scene View

![game_view_wrong](https://github.cds.internal.unity3d.com/unity/unity/assets/7006/2cb0b898-ddb2-4819-ae58-7900ce0c4221)
Game View, bugged

![game_view_fixed](https://github.cds.internal.unity3d.com/unity/unity/assets/7006/0a9b4699-9737-426f-a605-fd51a5ae72eb)
Game View, fixed
Minor docs fixes for January 2025, from user feedback. Part 2.

Jira tickets:

- https://jira.unity3d.com/browse/DOCG-6479 - move experimental warnings to below h1s
- https://jira.unity3d.com/browse/DOCG-6481 - add a link to RenderDoc from shader debugging landing page
… docs

**This is a backport of https://github.cds.internal.unity3d.com/unity/unity/pull/59127**

Add steps to the 2D sprite lit shader graph URP docs, to clarify connecting up transparency/alpha, and setting the normal map input. Response to user feedback.

Jira tickets:

- https://jira.unity3d.com/browse/DOCG-6464
- https://jira.unity3d.com/browse/DOCG-6465
@UnityAljosha UnityAljosha requested review from a team as code owners January 22, 2025 14:43
Copy link

It appears that you made a non-draft PR!
Please convert your PR to draft (button on the right side of the page).
See the PR template for more information.
Thank you!

@UnityAljosha UnityAljosha merged commit f55be63 into 2021.3/staging Jan 22, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants