Skip to content

[2021.2] Decal#3926

Merged
phi-lira merged 115 commits into
masterfrom
universal/decal
May 4, 2021
Merged

[2021.2] Decal#3926
phi-lira merged 115 commits into
masterfrom
universal/decal

Conversation

@lukaschod

@lukaschod lukaschod commented Mar 19, 2021

Copy link
Copy Markdown
Contributor

Purpose of this PR

Adding decals to URP!!!

Architecture

image

Features

  • DecalMesh and DecalProjector.
    image
  • DBuffer and ForwardEmissive.
  • Screen Space Forward (Basically Forward with normal reconstruction).
  • Screen Space GBuffer (Applies decals directly into GBuffer pass).
  • Angle Fade (Re-uses normal reconstruction).
  • Projector draw order.
  • Mesh bias depth/view.
  • Jobified data caching from transforms and draw call construction.
  • Burst support.
  • Small sub-set of ECS directly designed for decals.
  • All code is contained within Decal Renderer Feature. It is completely autonomous from render pipeline and nothing will be included related to decals if it is not there.
    image
  • ShaderGraph only support (Enable/Disable any surface data, LOD CrossFade, AngleFade).
    image
  • Draw distance.
  • Editor layers.
  • GPU instancing on/off.
  • Intermediate and non intermeediate rendering support (Graphics.DrawMesh/CommandBuffer.DrawMesh).
  • Hierarchy and non hierarchy scaling mode.
  • Preview rendering as plane.
    image
  • Normal reconstruction support.
  • Error shader rendering.
    image
  • Rendering on terrain.

Minor features

  • Special handling when there is no decal feature assigned.
    image
  • Special handling when shader graph does not have angle fade enabled.
    image
  • Special handling when bad materials is selected:
    image

JIRA

https://jira.unity3d.com/browse/URP-854

Demo Project

https://github.cds.internal.unity3d.com/lukasc/urp-decals-demo

Technical Design Document

https://docs.google.com/document/d/1hAASKwXJiGoFDgBE7ci9lcO-qjSX9sL49oDExBmv3nQ/edit


Testing status

Documentation

Files that contains any documentation/API or docs:

  • com.unity.render-pipelines.universal/Documentation~/TableOfContents.md
  • com.unity.render-pipelines.universal/Documentation~/decal-projector.md
  • com.unity.render-pipelines.universal/Documentation~/decal-shader.md
  • com.unity.render-pipelines.universal/Documentation~/renderer-feature-decal.md
  • com.unity.render-pipelines.universal/Documentation~/shaders-in-universalrp.md
  • com.unity.render-pipelines.universal/Editor/Decal/DecalProjectorEditor.Skin.cs
  • com.unity.render-pipelines.universal/Editor/Decal/DecalProjectorEditor.cs
  • com.unity.render-pipelines.universal/Editor/Decal/DecalShaderGraphGUI.cs
  • com.unity.render-pipelines.universal/Editor/RendererFeatures/DecalRendererFeatureEditor.cs
  • com.unity.render-pipelines.universal/Runtime/RendererFeatures/DisallowMultipleRendererFeature.cs
  • com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs

Comments to reviewers

Main concerns of PR:

  • Screen Space and GBuffer does not support Decal Mesh. This is limitation of Graphics.DrawMesh as it includes all passes and there is no way to filter it without material changes).
  • Scriptable Renderer Feature has new virtual method OnCull (It is called by URP before culling).
    image
  • Negative scale does not work with Decal Projector. By default in unity mesh renderers with negative scale has their winding inverted to account for changes, this is not part of Graphics.DrawMesh. We could workaround it with culling, but that will not work with instancing.
    image
  • Currently each technique of decal requires depth as read output and shader resource. Which forces depth copy, this will be solved in future PR. (Check https://docs.google.com/document/d/1hAASKwXJiGoFDgBE7ci9lcO-qjSX9sL49oDExBmv3nQ/edit#heading=h.wo67r6cr8k6c for details)
  • GBuffer technique does not work on terrain detail, because details are renderer in forward only pass (Which is after whole decals).

…hanging DecalSurfaceData to reals. Fixing screen size to be passed in all techniques correctly. Adding GI calcutation into SS and GBuffer decals.
@phi-lira phi-lira requested review from Verasl, eh-unity and phi-lira April 7, 2021 12:58

@svens-unity svens-unity left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great work!

@ryanhy-unity

Copy link
Copy Markdown

Quest looking much better but I still see a couple issues:

Screen space project decals are not appearing at all when using deferred rendering

Vulkan screen space deferred has some errors, specifically:

  • the normals decals are corrupted or something.
  • The base decal or texture appears offset in the right eye in multiview
  • Finally the unlit decals are not showing up here either

@ernestasKupciunas ernestasKupciunas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The general quality on the mobiles looks good. Lukas has addressed all the issues that were discovered during the testing. No active ones left. Decals are rendered fine on all testing devices.
Testing Doc: https://docs.google.com/document/d/1il4mitd4BBDHDiYaYpES8oIFGDKPc56vvWX-goJXQJE/edit

Unity used for testing:
Version: 2021.2.0a15.2070
Revision: trunk af5e3dc5f881
Built: Sun, 18 Apr 2021 18:17:23 GMT

Devices under test:
VLNQA00217, Razer Phone 2, 9.0.0, Snapdragon 845 SDM845, Adreno 630
VLNQA00268, Samsung Galaxy S10+, 10.0.0, Exynos 9 9820, Mali-G76
OnePlus Nord, 10, Snapdragon 765G SM7250-AB, Adreno 620
VLNQA00126, Samsung Galaxy S5 Mini, 6.0.1, Exynos 3 Quad 3470, Mali-400 MP
Samsung Galaxy Z Fold2 5G, 10, Snapdragon 865 SM8250, Adreno 650
iPad Air4, SoC: A14, iOS: 14.0
iPhone 12Pro, SoC: A14, iOS: 14.1
AppleTV 4k 64GB, tvOS: 14.5

@ryanhy-unity ryanhy-unity left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think the deferred issues seen on the Quest with Vulkan can be postponed to fix later. Otherwise looked good using Quest and Rift.

@oleks-k oleks-k left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Edited some descriptions, the documentation is acceptable for an MVP, will make more changes in the following days.

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.