浏览代码

Added motion vector support to Unlit

/main
Thomas 7 年前
当前提交
6e7134b5
共有 3 个文件被更改,包括 38 次插入1 次删除
  1. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Unlit/ShaderPass/UnlitSharePass.hlsl
  2. 36
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Unlit/Unlit.shader
  3. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Unlit/UnlitData.hlsl

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Unlit/ShaderPass/UnlitSharePass.hlsl


#define ATTRIBUTES_NEED_TEXCOORD2
#endif
#if defined(_ENABLE_FOG_ON_TRANSPARENT)
#if defined(_ENABLE_FOG_ON_TRANSPARENT) || (SHADERPASS == SHADERPASS_VELOCITY)
#define VARYINGS_NEED_POSITION_WS
#endif

36
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Unlit/Unlit.shader


[ToggleOff] _EnableFogOnTransparent("Enable Fog", Float) = 0.0
[ToggleOff] _DoubleSidedEnable("Double sided enable", Float) = 0.0
// Stencil state
[HideInInspector] _StencilRef("_StencilRef", Int) = 2 // StencilLightingUsage.RegularLighting (fixed at compile time)
[HideInInspector] _StencilWriteMask("_StencilWriteMask", Int) = 7 // StencilMask.Lighting (fixed at compile time)
[HideInInspector] _StencilRefMV("_StencilRefMV", Int) = 128 // StencilLightingUsage.RegularLighting (fixed at compile time)
[HideInInspector] _StencilWriteMaskMV("_StencilWriteMaskMV", Int) = 128 // StencilMask.ObjectsVelocity (fixed at compile time)
// Caution: C# code in BaseLitUI.cs call LightmapEmissionFlagsProperty() which assume that there is an existing "_EmissionColor"
// value that exist to identify if the GI emission need to be enabled.
// In our case we don't use such a mechanism but need to keep the code quiet. We declare the value and always enable it.

#include "ShaderPass/UnlitSharePass.hlsl"
#include "UnlitData.hlsl"
#include "../../ShaderPass/ShaderPassLightTransport.hlsl"
ENDHLSL
}
Pass
{
Name "Motion Vectors"
Tags{ "LightMode" = "MotionVectors" } // Caution, this need to be call like this to setup the correct parameters by C++ (legacy Unity)
// If velocity pass (motion vectors) is enabled we tag the stencil so it don't perform CameraMotionVelocity
Stencil
{
WriteMask [_StencilWriteMaskMV]
Ref [_StencilRefMV]
Comp Always
Pass Replace
}
Cull[_CullMode]
ZWrite On
HLSLPROGRAM
#define SHADERPASS SHADERPASS_VELOCITY
#include "../../ShaderVariables.hlsl"
#include "../../Material/Material.hlsl"
#include "ShaderPass/UnlitSharePass.hlsl"
#include "UnlitData.hlsl"
#include "../../ShaderPass/ShaderPassVelocity.hlsl"
ENDHLSL
}

1
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Unlit/UnlitData.hlsl


//-------------------------------------------------------------------------------------
// Fill SurfaceData/Builtin data function
//-------------------------------------------------------------------------------------
#include "../MaterialUtilities.hlsl"
void GetSurfaceAndBuiltinData(FragInputs input, float3 V, inout PositionInputs posInput, out SurfaceData surfaceData, out BuiltinData builtinData)
{

正在加载...
取消
保存