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/master #8031

Merged
merged 115 commits into from
Feb 8, 2024
Merged

Internal/master #8031

merged 115 commits into from
Feb 8, 2024

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.

adrien-de-tocqueville and others added 30 commits January 11, 2024 18:37
When the sun is low, sampling the ambient probe may give negative lighting value due to spherical harmonics approximation
This is incorrect so we clamp to 0 in that case
Subtle change but with negative value, the bottom of the clouds get a weird dark blue tint

reported here https://forum.unity.com/threads/volumetric-clouds.1078811/page-14#post-8958450

Before
![image](https://media.github.cds.internal.unity3d.com/user/2154/files/18333e78-fcfc-4ba5-8ff3-3c2fb1c73d5f)

After
![image](https://media.github.cds.internal.unity3d.com/user/2154/files/a0bfe433-145a-4852-8b7b-a771bd3294c3)
… Volume Profile

This PR fixes https://jira.unity3d.com/browse/UUM-55807.

The code in `VolumeUtils.TryAddDiffusionProfiles` was already removing null entries from the Default Volume Profile in an asset post-processing callback. This PR removes the early-exits that prevented this function from being called if nothing is being added. So now we always call it and cleanup null entries immediately as they appear, which fixes the bug.
DOCG-5019 - Fix URP docs broken links: 1st batch, easy-to-fix links.
Jira: UUM-55369
How to reproduce:
1. Open any project with Visual Effect Graph installed
2. Create a VFX Graph and open it
3. In a System Label enter loads of characters

Actual result: The following console errror
>Layout update is struggling to process current layout (consider simplifying to avoid recursive layout): EditorPanelRootElement unity-panel-container3 (x:0.00, y:0.00, width:1084.00, height:590.00) world rect: (x:0.00, y:0.00, width:1084.00, height:590.00)" is logged in the Console and the Editor might freeze and the user will have to close it without saving

Expected result: The System Label should have a character limit or other form of validation

Reproduced on: Windows 11

![screenshot](https://jira.unity3d.com/secure/attachment/1311055/Unity_f3YwlUrMU6.png)
- Adding VFX graph splash to pool scene
(Also possible to throw balls with space key)

![vlcsnap-2023-12-22-15h23m37s0654](https://media.github.cds.internal.unity3d.com/user/1764/files/34311bd7-1427-498f-846f-7332734ef1e8)

- Adding VFX graph at the waterfall bottom to glacier scene.

![vlcsnap-2023-12-22-15h23m37s017](https://media.github.cds.internal.unity3d.com/user/1764/files/50d42df9-c4d3-496c-b87f-6f4afcef3472)


This adds a few mb to the water samples. (from 12-ish to 17-ish mb)

![image](https://media.github.cds.internal.unity3d.com/user/1764/files/baad2ac2-7e00-489c-a8f3-80a9096745c9)
Fix corner case of Gradient Sampling based on expression entry in case of instancing. These kind of gradient were considered as constant while there actually are dynamic.

There are be several ways of fixing this, this approach is the minimal less risky solution.
Fix problems with re-enabling or re-disabling GPU Resident Drawer by settings outside the Render Pipeline Asset.
We discovered that the following keywords were not used in URP, and removing them will reduce the shader variant count and code complexity.
I am also putting the expected number of variant reduction in URP3DSampleScenes with High quality settings.


- _WINDQUALITY_FASTEST, 0
- DISABLE_TEXTURE2D_X_ARRAY (in some locations), 60
- BLIT_SINGLE_SLICE, 0

Some variants using these keywords have actually been prefiltered, so we won't see any direct reduction when removing some of the keywords


Please refer to [URP 16.0.4 Shader Analysis](https://docs.google.com/spreadsheets/d/1ro2fgD4VR8bZ9uNcuNVPF35bYgnwQ6J6t11Mr5nLLcY/edit#gid=564636499) for more details.
Task: https://jira.unity3d.com/browse/XPIPELINE-861
Figma: https://www.figma.com/file/IXFbhlcmNB51IIl28giuhq/Render-Graph-Debug-Tooling?type=design&node-id=1062-10309&mode=design&t=d4lRUk4OJDU5iyyI-0

This PR improves Render Graph Viewer UI by adding functionality to open the selected RG Pass in C# IDE, plus makes some small UI logic changes.

Workflow enabled by these changes is this:

![jump-to-source](https://media.github.cds.internal.unity3d.com/user/3380/files/b6588f44-64b8-40f2-a4bc-423e5f46377c)


List of changes:
- Add functionality in RenderGraph to record caller file & line information during pass recording. The code is only active in the editor, and does nothing unless RG Viewer is open and debug data recording has been requested.
- Implement UI to display a "#" icon in the UI when hovering the rectangle below pass name. Clicking on it opens the pass definition in your C# IDE:
![image](https://media.github.cds.internal.unity3d.com/user/3380/files/b1965b13-1ec5-4f00-8cf0-26a6b895f6d1)
![image](https://media.github.cds.internal.unity3d.com/user/3380/files/f017c8db-fc19-4e8d-8557-218bca63590a)
- Implement hover & selection for pass names (rotated 45 degrees)
  - Passes are now selected by clicking on the name rather than the rectangle below pass name
Minor issue introduced at https://github.cds.internal.unity3d.com/unity/unity/pull/41013 I missed it during initial review but noticed during this backport https://github.cds.internal.unity3d.com/unity/unity/pull/42204/

The wrong consideration of taskType was leading to unexpected `#pragma multi_compile_instancing` within compute shader
![image](https://media.github.cds.internal.unity3d.com/user/42/files/c9152646-a018-4bf0-a7b7-9f8359a0d83e)

It doesn't have a significative impact but it's more correct.
JIRA: [UUM-59082](https://jira.unity3d.com/browse/UUM-59082)

Update "last used frame" of last shared resource in the list
The Shader Graph Feature Examples Sample is a set of sample content for Shader Graph that shows users how to achieve specific effects and techniques using Shader Graph. It's similar (in type and complexity) to the Node Reference Samples that we added in October

Here is a draft of the blog post we plan to release with the content:
https://docs.google.com/document/d/1n24_2yn6UvKCVooQ250_TuEiWOZMdVUpggDT6Whg8rc

Here is a demo video we plan to release with the content:
https://drive.google.com/file/d/1YfvwcFiZkKDdBL6AfXC48fDUF3O7RCqn
Fix [UUM-60204](https://jira.unity3d.com/browse/UUM-60204) where deleting the user script added the Custom Post Process in Project Settings > Graphics break both the inspectors and the rendering.

It was because the deserialization of the list was not checking if type still exists.
…playmode

1. Persistent Values of the Graphics settings were only stored and loaded on developer mode
2. The values must be set to the main scroll view on the geometry changed event, that is when all the child elements heights are known.
Regular docs sync to main
…lied alpha

Adds an option to multiply specular by opacity by disabling preserve specular
This is not technically correct but offers similar control to transparents that are not in premultiply mode and helps for VFX.

Disabling affect specular in material settings provides the same result as before, but now you have an option to get a different result, so maybe not really needed to mention in upgrade guide as now it's working more as expected (previously the option had no effect)
JIRA: https://jira.unity3d.com/browse/XPIPELINE-860

This PR removes the use of Overlay framework that was used to display pass/resource information, and replaces them with a fixed side panel that contains the same information.

Old: 
![image](https://media.github.cds.internal.unity3d.com/user/3380/files/a08034ff-0c1c-406f-b829-292959745b01)


New (URP):
![image](https://media.github.cds.internal.unity3d.com/user/3380/files/11825a63-f101-4deb-a060-224c7ffc99be)
New (HDRP):
![image](https://media.github.cds.internal.unity3d.com/user/3380/files/d9e9c572-7334-4c2e-928d-6b46092a8490)

List of changes:
- Refactored content from overlays to side panel
  - Removed obsolete overlay code & resources
- Added logic so that full vertical space is claimed by side panel resource list & pass list if only one of them is visible. If both are visible, vertical space is shared 50/50.
- Added search filter field for passes & resources
- Added capability for HeaderFoldout uxml element to display an icon
The bloom pass was recently portd to be an UnsafePass, and it causes unnecessary clears because of a wrong clear flag setup
gathering of PRs

try to fix warnings (#41363)
Fix custom post process doc example (#41684)
Remove some warning messages from release build (#41734)
Fixed NullReferenceException when exiting Play Mode with HDRP + DLSS+ XR (#41683)
Fix Some Visual Corruption on Switch (#41710)
[Jjira # UUM-54446] Fixing haloing artifacts on motion blur. (#41695)
HDRP Switch Lightmap Fixes (#42288)
Fixes to ensure that GPU Resident Drawer (new in 2023.3) resources are included when building the player:
- Check for *any* render pipeline supporting the GPU Resident Drawer, not just the first one
- When checking the asset, check the RendererData instead of the Renderer (that may not have been created)
…cks (UUM-59882)

Fixes UUM-59882.
- Destroys a cached volume stack if it has been invalidated.
- Fixes a loop in `VolumeManager::Deinitialize()` as it wasn't disposing stacks in an array.
…latform (UUM-60997)

Disabling test `205_SSAO_BackBuffer_AfterOpaque` on one platform due to UUM-60997
This change adds new functions for baking probes that take data for multiple probes rather a single probe. This allows us to bake all probes using a single instance of the native baking system rather than creating a new one for every individual probe bake. Using these new functions, HDRP can now bake all probes in a single batch which significantly reduces total baking time.

This change also fixes a few potential memory leaks (missing calls to Dispose()) on some of the light baking objects.
alex-vazquez-unity3d and others added 26 commits February 2, 2024 19:36
The event name was too long for BIG Query.
Added a new 'Generate Lighting' button on adjustment volumes
This is available in all modes and rebake the probes falling inside the adjustment volume with the regular bake pipeline
This means they take into account other overlapping adjustment volumes, virtual offset and all

![image](https://media.github.cds.internal.unity3d.com/user/2154/files/cc61d23d-56d5-4611-8275-84d5cfc65009)

Additionally added an editor tool to only show the probes that fall under the influcence of the selected adjustment volume

https://media.github.cds.internal.unity3d.com/user/2154/files/eeaa1f24-f04e-4e4e-b3c1-cad8467488dd

Finally, did a bit of refactor that @remi  asked for regarding shader loading. Only relevant commit should be 7e85e49fe8fe98db9d432509463c4a4bc5496a2e. Changes are literally what was in the patch you sent me 🙂
… Markers

This PR cleans the profiling markers in Render Graph pipeline. High level markers from RenderGraphProfileId will be used by both NRP and standard compilers while low level markers in NRP compiler are adjusted. 

This PR also adjusts confusing name and usage of forceManualClearOfResourceDisabled variable in RenderGraphResourceRegistry.
This change fixes some incorrect logic in the shadow rendering code that
was using the camera's state on the render graph execution timeline to
restore the gpu-side copy of the global constant buffer. The camera's
state changes during the render graph build process, so the state needs
to be captured at build time for correctness.

In this particular case, the camera state doesn't actually change during
shadow rendering so we can also skip the cpu-side global constant buffer
update logic and just push the current cpu-side copy to the gpu.
Restructure and rename the Customizing URP documentation section to get it ready for Render Graph documentation.

Most of the PR renames or moves pages, but there is some new content where I had to create a new landing page or introduction.

Jira ticket: [DOCG-4894](https://jira.unity3d.com/browse/DOCG-4894)
ShaderGraph has its own set of shader include files. In HLSLSupportShim.hlsl, it checks if the current shader platform is GLSL based, becaus GLSL does not support textureLod(samplerCubeShadow) calls. The shader platform check didn't include SHADER_API_WEBGPU, which is GLSL dependent (like Vulkan). This causes ShaderGraph Lit shaders to error when built for WebGPU.

Fixes https://jira.unity3d.com/browse/PLATGRAPH-2799.

POI Ticket : https://jira.unity3d.com/browse/POI-744
Jira Epic : https://jira.unity3d.com/browse/PLATGRAPH-2548
Updates 2 reference images and increases test threshold for one test scene.
It was causing instabilities in our CI.
Fixing performance regression issue introduced by #39403.

The 2DRenderer was missing the fallback error shader. Added into the URP runtime resources as UniversalRenderer also needs it.

https://jira.unity3d.com/browse/UUM-61092
Hitting the active sampler limit (max 16 in d3d11) is a hard error. URP Lit shader has many material layers/textures that put pressure on the sampler limit.

Reduce active sampler count by turning non-user configurable samplers into hardcoded reusable inline samplers.
Such as depth, normal, SSAO, reflection probe atlas etc.

Reusing is not possible on OpenGL platforms as the sampler and texture are coupled into a "texture unit".
However, all the other APIs should benefit from the sharing.
Adds a guide for users upgrading custom shaders that were originally created to work with the Built-in Render Pipeline so that they work with the Universal Render Pipeline.
JIRA: https://jira.unity3d.com/browse/LIGHT-1883
Added additional method in ShaderPrintManager to allow a synchronous print (useful for debugging outside of a frame, for instance in unit tests)
Correctly handle missing motion vectors for TAA. Fixes black screen on the 2D renderer when TAA is enabled.
Does not implement TAA for 2D.
Fix a performance regression introduced in https://github.cds.internal.unity3d.com/unity/unity/pull/39296.

The fix introduces scalarization of area lighting code in forward lighting shaders. Both the issue and the fix are console-only.
…ature.Create()

This PR addresses https://jira.unity3d.com/browse/UUM-44048

Slack discussion: https://unity.slack.com/archives/C89KFUUCT/p1706102897599419

**The issue:**
Currently, `ScriptableRendererFeature.Create()` is called from `OnEnable()` and `OnValidate()` event functions, both of which regularly occur when `UniversalRenderPipeline` has not yet been constructed, for example any time a script change triggers domain reload, or user enters playmode. This is a problem because ScriptableRendererFeature is logically a subsystem of the render pipeline, so it is expected that you are able initialize rendering resources in `ScriptableRendererFeature.Create()`. Since `RTHandleSystem` is only initialized by URP constructor, calling `RTHandle.Alloc()` here will result in errors.

**The fix:**
Turns out `ScriptableRendererFeature.Create()` is called from 3 places:
1. `ScriptableRendererFeature.OnEnable()` (event function)
2. `ScriptableRendererFeature.OnValidate()` (event function)
3. `ScriptableRenderer.ctor()`

The callsite 3) is the one that actually takes the feature from `ScriptableRendererData`, calls `Create()` and adds it to another list inside the runtime `ScriptableRenderer` instance, where it can be accessed during rendering.

All of this means that `ScriptableRendererFeature.Create()` gets called **at least 3 times** for example whenever you enter play mode. This seems kind of wasteful but maybe there's a reason for it that I'm not seeing.

The fix I'm making is just adding a check to callsites 1) and 2) so that they don't call `Create()` if URP has not yet been constructed. `ScriptableRenderer` constructor still guarantees that the feature gets created before rendering.
Rendering was broken and exceptions were shown when Reset was being triggered for GraphicsSettings.asset.
Fixed a warning in Lens flare shader for URP
Users have complained about performance issues on some platforms due to a change in SH Evaluation mode causing them to use PerPixel instead of PerVertex. This PR makes sure those platform use PerVertex when set to Auto.

This PR does the following: 
- Adds a few platforms to ShAutoDetect to use PerVertex when Auto is selected.
- Renames `XRPlatformBuildTimeDetect` to `PlatformBuildTimeDetect` as it's now used for more than XR.
- Fixes a few typos and indentation.
This PR prevents shaders used in the SDF Baker to compile on OpenGLES3. They were not supported nor tested on this platform. This avoid getting warnings like `Shader warning in 'GenSdfRayMap': HLSLcc: The resource 'rayMap' uses an unsupported type/format for read/write access at kernel RayMapScanX (on gles3)`.

Warnings on **other platforms**, mentionned in this bug (https://jira.unity3d.com/browse/UUM-53994) are already fixed.
Warnings on GLES3 about buffer count are not fixed, and will not be fixed.
…+ Adding a Game Camera helper + Adding a SetKeyword overload

* Optimize RenderGraph CPU cost by converting Screen Space Ambient Occlusion (SSAO) from many RasterPasses into a single UnsafePass.
* Adds a `isGameCamera` to UniversalCameraData (Already had one for scene and preview cameras)
* Adds an overload for SetKeyword in CoreUtils that accepts LocalKeyword.

[POI-817](https://jira.unity3d.com/browse/POI-817)
[GFXRPF-172](https://jira.unity3d.com/browse/GFXRPF-172)
This PR makes it a bit more obvious in UI and tooltips that the light culling mask doesn't work in Forward+.

If all active renderers are Forward+, then the culling mask setting in the light inspector is greyed out with the following tooltip:

![image](https://media.github.cds.internal.unity3d.com/user/2726/files/5ae12d18-0cc9-494f-abe1-12c419b61909)

If even one of the active renderers is something other than Forward+, then the setting is enabled again. But the tooltip also mentions that Forward+ doesn't support the setting:

![image](https://media.github.cds.internal.unity3d.com/user/2726/files/c799444c-c9d4-4814-be48-f987bafe466e)
@UnityAljosha UnityAljosha requested review from a team as code owners February 8, 2024 18:10
@UnityAljosha UnityAljosha merged commit f1d5ddb into master Feb 8, 2024
2 of 3 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.