SHARE
TWEET

ScriptableRenderFeature

a guest Aug 27th, 2019 543 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using UnityEngine.Rendering;
  2. using UnityEngine.Rendering.Universal;
  3.  
  4. public class DepthNormalsFeature : ScriptableRendererFeature
  5. {
  6.     private DepthNormalsPass depthNormalsPass;
  7.  
  8.     RenderTargetHandle m_DepthNormalsTexture;
  9.  
  10.     public override void Create()
  11.     {
  12.         if (depthNormalsPass == null)
  13.             depthNormalsPass =
  14.                 new DepthNormalsPass(RenderPassEvent.BeforeRenderingPrepasses, RenderQueueRange.opaque, -1);
  15.  
  16.         m_DepthNormalsTexture.Init("_CameraDepthNormalsTexture");
  17.     }
  18.  
  19.     public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
  20.     {
  21.         depthNormalsPass.Setup(renderingData.cameraData.cameraTargetDescriptor, m_DepthNormalsTexture);
  22.         renderer.EnqueuePass(depthNormalsPass);
  23.     }
  24.  
  25.     void OnValidate()
  26.     {
  27.         depthNormalsPass?.SetLayerMask(-1);
  28.     }
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top