chor: URP版シェーダーに ApplicationSpaceWarp対応を追加

This commit is contained in:
AoiKamishiro 2025-08-13 16:59:05 +09:00
parent 39a5dfc91c
commit f0cd4039c0
4 changed files with 36 additions and 1 deletions

View File

@ -249,6 +249,7 @@ namespace VRM10.MToon10.Editor
EditorGUILayout.LabelField("DstBlend", ((BlendMode)props[MToon10Prop.UnityDstBlend].floatValue).ToString());
EditorGUILayout.LabelField("ZWrite", ((UnityZWriteMode)props[MToon10Prop.UnityZWrite].floatValue).ToString());
EditorGUILayout.LabelField("AlphaToMask", ((UnityAlphaToMaskMode)props[MToon10Prop.UnityAlphaToMask].floatValue).ToString());
EditorGUILayout.LabelField("XR Motion Vectors Pass (Space Warp)", (props[MToon10Prop.MotionVector].floatValue) > 0.5f ? "Enabled" : "Disabled");
EditorGUILayout.LabelField("Enabled Keywords", string.Join("\n", mat.shaderKeywords), EditorStyles.textArea);
}
}

View File

@ -56,6 +56,9 @@
UnityDstBlend,
UnityZWrite,
UnityAlphaToMask,
// Motion Vector
MotionVector,
// for Editor
EditorEditMode,

View File

@ -53,6 +53,8 @@ namespace VRM10.MToon10
[MToon10Prop.UnityZWrite] = "_M_ZWrite",
[MToon10Prop.UnityAlphaToMask] = "_M_AlphaToMask",
[MToon10Prop.MotionVector] = "_XRMotionVectorsPass",
[MToon10Prop.EditorEditMode] = "_M_EditMode",
};

View File

@ -57,11 +57,14 @@ Shader "VRM10/Universal Render Pipeline/MToon10"
_M_ZWrite ("_ZWrite", Float) = 1.0
_M_AlphaToMask ("_AlphaToMask", Float) = 0.0
// Motion Vector
_XRMotionVectorsPass("_XRMotionVectorsPass", Float) = 1.0
// etc
_M_DebugMode ("_DebugMode", Float) = 0.0
// for Editor
_M_EditMode ("_EditMode", Float) = 0.0
_M_EditMode ("_EditMode", Float) = 0.0
}
// Shader Model 3.0
@ -81,6 +84,32 @@ Shader "VRM10/Universal Render Pipeline/MToon10"
"IgnoreProjector" = "True"
}
Pass
{
Name "XRMotionVectors"
Tags { "LightMode" = "XRMotionVectors" }
ColorMask RGBA
// Stencil write for obj motion pixels
Stencil
{
WriteMask 1
Ref 1
Comp Always
Pass Replace
}
HLSLPROGRAM
#pragma shader_feature_local _ALPHATEST_ON
#pragma multi_compile _ LOD_FADE_CROSSFADE
#pragma shader_feature_local_vertex _ADD_PRECOMPUTED_VELOCITY
#define APPLICATION_SPACE_WARP_MOTION 1
#include "Packages/com.unity.render-pipelines.universal/Shaders/BakedLitInput.hlsl"
#include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ObjectMotionVectors.hlsl"
ENDHLSL
}
// Universal Forward Pass
Pass
{