-
Notifications
You must be signed in to change notification settings - Fork 839
Decal Layers (Rendering Layers) #6442
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
base: master
Are you sure you want to change the base?
Conversation
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. URP 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. |
72083d9
to
4190446
Compare
@@ -63,7 +63,9 @@ Pass | |||
#endif | |||
#if _RENDER_PASS_ENABLED | |||
#define GBUFFER3 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need better way to specify inputs
…endering Layers Utils for that
…ogic only in C# side
…nal with render layers
float EncodeMeshRenderingLayer(uint renderingLayer) | ||
{ | ||
// TODO: Expose as property for the size | ||
return PackInt(renderingLayer, 16); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am guessing adding propery that controls size is the best approach here
@@ -153,21 +153,27 @@ internal GraphicsFormat GetGBufferFormat(int index) | |||
else if (index == GBufferShadowMask) // Optional: shadow mask is outputed in mixed lighting subtractive mode for non-static meshes only | |||
return GraphicsFormat.R8G8B8A8_UNorm; | |||
else if (index == GBufferRenderingLayers) // Optional: rendering layers is outputed when light layers are enabled (subset of rendering layers) | |||
return GraphicsFormat.R8_UNorm; | |||
return GraphicsFormat.R16_UNorm; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be controllable
#pragma vertex FullscreenVert | ||
#pragma fragment Fragment | ||
#pragma multi_compile _ _USE_DRAW_PROCEDURAL | ||
#pragma enable_d3d11_debug_symbols |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't forget to comment this enable_d3d11_debug_symbols
…universal/decal-layers # Conflicts: # com.unity.render-pipelines.universal/Editor/GlobalSettings/UniversalRenderPipelineGlobalSettingsUI.Skin.cs # com.unity.render-pipelines.universal/Runtime/Decal/DBuffer/DBufferRenderPass.cs # com.unity.render-pipelines.universal/Runtime/Passes/ScriptableRenderPass.cs # com.unity.render-pipelines.universal/Runtime/RendererFeatures/DecalRendererFeature.cs # com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs
Does ShaderPreprocessor.cs needs to be updated to strip out |
Updated |
…universal/decal-layers # Conflicts: # TestProjects/UniversalGraphicsTest_Foundation/Assets/CommonAssets/UniversalRPAsset.asset # TestProjects/UniversalGraphicsTest_Foundation/ProjectSettings/EditorBuildSettings.asset # com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalUnlitSubTarget.cs # com.unity.render-pipelines.universal/Runtime/Passes/DrawObjectsPass.cs # com.unity.render-pipelines.universal/Runtime/Passes/GBufferPass.cs
Was this ever fully implemented into Unity? I can't find it in the 2021 version(s). |
Purpose of this PR
Changing light layers backend into more general rendering layers
ScriptableRendererFeature.RequireRenderingLayers(bool isDeferred, out RenderingLayerUtils.Event atEvent, out RenderingLayerUtils.MaskSize maskSize)
Removing light layers concept from shader backend
Now all logic for comparing layers is done with full rendering layer mask in shaders (C# converts them during the property set). The benefits of this simplifies logic as there is no longer a need to transform rendering layers to light layers when comparing and also avoiding this with decal layers. This should not effect performance as shader always contained them as 32 bit integer. Also this opens a door in the future if we would decide to have rendering layers only in UX side too.
Adding internal API for renderer features to request _CameraRenderingLayersTexture
ScriptableRendererFeature will contain new method
internal override bool RequireRenderingLayers(bool isDeferred, out RenderingLayerUtils.Event atEvent, out RenderingLayerUtils.MaskSize maskSize)
. This will allow URP to know if to produce _CameraRenderingLayersTexture and also at what event. Depending on the event it will be produced either with DepthNormalOnlyPass/DrawObjectPass/GBufferPass.Decal Layers
Decal Layers implemented with above features and optimized for tiled-renderers. In case of DBuffer DepthNormalOnlyPass used for rendering layers. For Screen Space Forward ForwardOpaquePass provides it and for deferred GBuffer provides it.
New Decal Layers option to control its support in renderer feature:

New property in Decal Projector to specify Decal Layer it belongs to:

Testing status
Tiny Presentation
https://docs.google.com/presentation/d/12FzT-Kec55c2IdIXXH24nkI7Ksmb7tzDGWLSDdAcflk/edit#slide=id.g11145254bef_0_43
Technical Design Document
https://docs.google.com/document/d/1Vw6VkHaJkgwwi2_Rv_a98241OaFHsKtm72KuJsIGnJc/edit#
Comments to reviewers
Currently there is idea for removing decal and light layers and keeping only rendering layers for UX too (There is more info in TDD).