浏览代码

Fix for depth prepass not having correct world position

This was causing issue with alpha tested geometry using planar mapping,
depth prepass was wrong
/main
sebastienlagarde 7 年前
当前提交
dd2eb685
共有 3 个文件被更改,包括 38 次插入48 次删除
  1. 23
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/ShaderPass/LitDepthPass.hlsl
  2. 40
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/ShaderPass/LitDistortionPass.hlsl
  3. 23
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/ShaderPass/LitVelocityPass.hlsl

23
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/ShaderPass/LitDepthPass.hlsl


// Varying - Use for pixel shader
// This second set of define allow to say which varyings will be output in the vertex (no more tesselation)
#if REQUIRE_TANGENT_TO_WORLD
#define VARYINGS_NEED_POSITION_WS // Required to get view vector
#define VARYINGS_NEED_TEXCOORD0
#ifdef LAYERED_LIT_SHADER
#define VARYINGS_NEED_POSITION_WS // Required to get view vector and to get planar/triplanar mapping working
#define VARYINGS_NEED_TEXCOORD0
#if defined(_REQUIRE_UV2) || defined(_REQUIRE_UV3)
#define VARYINGS_NEED_TEXCOORD2
#endif
#if defined(_REQUIRE_UV3)
#define VARYINGS_NEED_TEXCOORD3
#endif
#ifdef ATTRIBUTES_NEED_TEXCOORD2
#define VARYINGS_NEED_TEXCOORD2
#endif
#ifdef ATTRIBUTES_NEED_TEXCOORD3
#define VARYINGS_NEED_TEXCOORD3
#endif
#if ATTRIBUTES_NEED_COLOR
#define VARYINGS_NEED_COLOR
#endif
#if REQUIRE_VERTEX_COLOR
#define VARYINGS_NEED_COLOR
#endif
// This include will define the various Attributes/Varyings structure

40
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/ShaderPass/LitDistortionPass.hlsl


#endif
// Attributes
#define REQUIRE_UV_FOR_TESSELATION (defined(TESSELLATION_ON) && defined(_TESSELLATION_DISPLACEMENT))
#define REQUIRE_VERTEX_COLOR_FOR_TESSELATION REQUIRE_UV_FOR_TESSELATION
#define REQUIRE_TANGENT_TO_WORLD (defined(_HEIGHTMAP) && defined(_PIXEL_DISPLACEMENT))
#define REQUIRE_TANGENT_TO_WORLD defined(_PIXEL_DISPLACEMENT)
#define REQUIRE_NORMAL defined(TESSELLATION_ON) || REQUIRE_TANGENT_TO_WORLD || defined(_VERTEX_WIND) || defined(_VERTEX_DISPLACEMENT)
#define REQUIRE_VERTEX_COLOR (defined(_VERTEX_DISPLACEMENT) || defined(_TESSELLATION_DISPLACEMENT) || (defined(LAYERED_LIT_SHADER) && (defined(_LAYER_MASK_VERTEX_COLOR_MUL) || defined(_LAYER_MASK_VERTEX_COLOR_ADD))) || defined(_VERTEX_WIND))
#if defined(TESSELLATION_ON) || REQUIRE_TANGENT_TO_WORLD || defined(_VERTEX_WIND)
#if REQUIRE_NORMAL
#ifdef _VERTEX_WIND
#if REQUIRE_VERTEX_COLOR
#define ATTRIBUTES_NEED_COLOR
#endif

#define ATTRIBUTES_NEED_TEXCOORD0
#define ATTRIBUTES_NEED_TEXCOORD0 // Always present, distortion use TexCoord0
#if REQUIRE_UV_FOR_TESSELATION || REQUIRE_TANGENT_TO_WORLD || defined(_ALPHATEST_ON)
#if defined(_VERTEX_DISPLACEMENT) || REQUIRE_TANGENT_TO_WORLD || defined(_ALPHATEST_ON) || defined(_TESSELLATION_DISPLACEMENT)
#define ATTRIBUTES_NEED_TEXCOORD1
#if defined(_REQUIRE_UV2) || defined(_REQUIRE_UV3)
#define ATTRIBUTES_NEED_TEXCOORD2

#endif
#endif
#if REQUIRE_VERTEX_COLOR_FOR_TESSELATION
#define ATTRIBUTES_NEED_COLOR
#endif
#define VARYINGS_NEED_POSITION_WS // Can be require if we have planar or triplanar distortion
#define VARYINGS_NEED_POSITION_WS // Required to get view vector
#define VARYINGS_NEED_TEXCOORD0
#ifdef LAYERED_LIT_SHADER
#define VARYINGS_NEED_TEXCOORD0
#if defined(_REQUIRE_UV2) || defined(_REQUIRE_UV3)
#define VARYINGS_NEED_TEXCOORD2
#endif
#if defined(_REQUIRE_UV3)
#define VARYINGS_NEED_TEXCOORD3
#endif
#ifdef ATTRIBUTES_NEED_TEXCOORD2
#define VARYINGS_NEED_TEXCOORD2
#endif
#ifdef ATTRIBUTES_NEED_TEXCOORD3
#define VARYINGS_NEED_TEXCOORD3
#endif
#if ATTRIBUTES_NEED_COLOR
#define VARYINGS_NEED_COLOR
#endif
#endif

23
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/ShaderPass/LitVelocityPass.hlsl


// Varying - Use for pixel shader
// This second set of define allow to say which varyings will be output in the vertex (no more tesselation)
#define VARYINGS_NEED_POSITION_WS
#define VARYINGS_NEED_POSITION_WS // Can be require if we have planar or triplanar distortion
#if REQUIRE_TANGENT_TO_WORLD
#define VARYINGS_NEED_TANGENT_TO_WORLD

#define VARYINGS_NEED_TEXCOORD0
#ifdef LAYERED_LIT_SHADER
#define VARYINGS_NEED_TEXCOORD0
#if defined(_REQUIRE_UV2) || defined(_REQUIRE_UV3)
#define VARYINGS_NEED_TEXCOORD2
#endif
#if defined(_REQUIRE_UV3)
#define VARYINGS_NEED_TEXCOORD3
#endif
#ifdef ATTRIBUTES_NEED_TEXCOORD2
#define VARYINGS_NEED_TEXCOORD2
#endif
#ifdef ATTRIBUTES_NEED_TEXCOORD3
#define VARYINGS_NEED_TEXCOORD3
#endif
#if ATTRIBUTES_NEED_COLOR
#define VARYINGS_NEED_COLOR
#endif
#if REQUIRE_VERTEX_COLOR
#define VARYINGS_NEED_COLOR
#endif
// This include will define the various Attributes/Varyings structure
正在加载...
取消
保存