UnityRef is currently in early development. Some features may be incomplete and/or not functioning.

UNITYREF

Your Pit Stop For Solving ANYTHING in Unity

graphics

Decal Shader Graph Normal Sampling

Under Audit

advanced renderingar developmentgraphics

Unity 2021.3.x - Unity 2023.x

Published 10 days ago

Users encounter difficulties obtaining accurate normal sample data within URP decal shader graphs, resulting in blocky or aliased effects when attempting to simulate lighting.

Issue

 When utilizing a decal shader graph, obtaining an accurate normal sample at a given position within the URP forward rendering path presents a challenge. While it is possible to sample the local position offset for various effects, attempts to retrieve precise normal sample data often result in a blocky 2x2 non-anti-aliased effect on edges, rendering the sampled data largely ineffective. This limitation impacts the ability to implement advanced effects such as fake lighting, particularly given the absence of certain light types like area lights in URP.

Experimental Fixes
  • Ensure the URP Renderer asset has the Depth Normals texture enabled for Render Features that might rely on it.
  • Explore using the Sample Scene Color node with appropriate blend modes if the issue is with post-processing decals affecting rendered normals.
  • Implement a custom Shader Graph solution that reconstructs the normal from depth information or uses an alternative normal input from a G-buffer.

Editor's Note:

The above fixes have not been verified by our audit team yet. They are provided exclusively for your own technical research. We recommend creating a backup of your project before proceeding with any attempts. Utilize at your own discretion!

Related Posts Haven't quite found a solution to your problem? We think these posts might help you.

Content inspired by a Unity discussion post.