whoimi

A geek blog

View on GitHub

HDRP ShaderPass说明

所有PassName

public static class HDShaderPassNames
{
  // ShaderPass string - use to have consistent name through the code
  public static readonly string s_EmptyStr = "";
  public static readonly string s_ForwardStr = "Forward";
  public static readonly string s_DepthOnlyStr = "DepthOnly";
  public static readonly string s_DepthForwardOnlyStr = "DepthForwardOnly";
  public static readonly string s_ForwardOnlyStr = "ForwardOnly";
  public static readonly string s_GBufferStr = "GBuffer";
  public static readonly string s_GBufferWithPrepassStr = "GBufferWithPrepass";
  public static readonly string s_SRPDefaultUnlitStr = "SRPDefaultUnlit";
  public static readonly string s_MotionVectorsStr = "MotionVectors";
  public static readonly string s_DistortionVectorsStr = "DistortionVectors";
  public static readonly string s_TransparentDepthPrepassStr = "TransparentDepthPrepass";
  public static readonly string s_TransparentBackfaceStr = "TransparentBackface";
  public static readonly string s_TransparentDepthPostpassStr = "TransparentDepthPostpass";
  public static readonly string s_MetaStr = "Meta";
  public static readonly string s_ShadowCasterStr = "ShadowCaster";
  public static readonly string s_MeshDecalsStr = "DBufferMesh";

  // ShaderPass name
  public static readonly ShaderPassName s_EmptyName = new ShaderPassName(s_EmptyStr);
  public static readonly ShaderPassName s_ForwardName = new ShaderPassName(s_ForwardStr);
  public static readonly ShaderPassName s_DepthOnlyName = new ShaderPassName(s_DepthOnlyStr);
  public static readonly ShaderPassName s_DepthForwardOnlyName = new ShaderPassName(s_DepthForwardOnlyStr);
  public static readonly ShaderPassName s_ForwardOnlyName = new ShaderPassName(s_ForwardOnlyStr);
  public static readonly ShaderPassName s_GBufferName = new ShaderPassName(s_GBufferStr);
  public static readonly ShaderPassName s_GBufferWithPrepassName = new ShaderPassName(s_GBufferWithPrepassStr);
  public static readonly ShaderPassName s_SRPDefaultUnlitName = new ShaderPassName(s_SRPDefaultUnlitStr);
  public static readonly ShaderPassName s_MotionVectorsName = new ShaderPassName(s_MotionVectorsStr);
  public static readonly ShaderPassName s_DistortionVectorsName = new ShaderPassName(s_DistortionVectorsStr);
  public static readonly ShaderPassName s_TransparentDepthPrepassName = new ShaderPassName(s_TransparentDepthPrepassStr);
  public static readonly ShaderPassName s_TransparentBackfaceName = new ShaderPassName(s_TransparentBackfaceStr);
  public static readonly ShaderPassName s_TransparentDepthPostpassName = new ShaderPassName(s_TransparentDepthPostpassStr);
  public static readonly ShaderPassName s_MeshDecalsName = new ShaderPassName(s_MeshDecalsStr);

  // Legacy name 这部分的Pass都会作为ErrorPass渲染
  public static readonly ShaderPassName s_AlwaysName = new ShaderPassName("Always");
  public static readonly ShaderPassName s_ForwardBaseName = new ShaderPassName("ForwardBase");
  public static readonly ShaderPassName s_DeferredName = new ShaderPassName("Deferred");
  public static readonly ShaderPassName s_PrepassBaseName = new ShaderPassName("PrepassBase");
  public static readonly ShaderPassName s_VertexName = new ShaderPassName("Vertex");
  public static readonly ShaderPassName s_VertexLMRGBMName = new ShaderPassName("VertexLMRGBM");
  public static readonly ShaderPassName s_VertexLMName = new ShaderPassName("VertexLM");
}

Forward

所有在前向渲染物体使用这个Pass,正常情况下使用Deferred时,所有不透明物体都需要在DeferredPass 完成渲染,这里只渲染透明物体。

ForwardOnly

通过ForwardOnly可以强制在Forward 阶段渲染不透明物体

无光照物体使用这个Pass,并且不输出法线

DepthForwardOnly

和ForwardOnly对应使用

DepthOnly

渲染深度,Forward和Deferred必须有一个深度

TransparentDepthPrepass

透明物体Prepass深度