From c63eb6992dd9a1b91db1bdc0034b9c6727643a68 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Thu, 1 Jan 2026 15:10:25 +0900 Subject: [PATCH] [fix] Merge --- .../ShaderFiles/Shader_NPC_PBR_Anim.hlsl | 274 +++++++++--------- 1 file changed, 144 insertions(+), 130 deletions(-) diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl index 35ef22c86..067eb1772 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl @@ -37,35 +37,35 @@ float g_TempWeight; -Texture2D g_DiffuseTexture : register(t00); -Texture2D g_SpecularTexture : register(t01); -Texture2D g_AmbientTexture : register(t02); -Texture2D g_EmissiveTexture : register(t03); -Texture2D g_HeightTexture : register(t04); -Texture2D g_NormalTexture : register(t05); -Texture2D g_ShininessTexture : register(t06); -Texture2D g_NormalBlendTexture : register(t07); // OPACITY -Texture2D g_SROBlendTexture : register(t08); -Texture2D g_LightMapTexture : register(t09); -Texture2D g_ReflectionTexture : register(t10); -Texture2D g_DiffuseBlend : register(t11); // BASE_COLOR -Texture2D g_NormalCameraTexture : register(t12); -Texture2D g_EmissionColorTexture : register(t13); -Texture2D g_MetalnessTexture : register(t14); -Texture2D g_Diffuse_RoughnessTexture : register(t15); -Texture2D g_AmbientOcclusionTexture : register(t16); -Texture2D g_UnknownTexture : register(t17); -Texture2D g_SheenTexture : register(t18); -Texture2D g_ClearcoatTexture : register(t19); -Texture2D g_TransmissionTexture : register(t20); -Texture2D g_Maya_BaseTexture : register(t21); -Texture2D g_Maya_SpecularTexture : register(t22); -Texture2D g_Maya_Specular_ColorTexture : register(t23); -Texture2D g_Maya_Specular_RoughnessTexture : register(t24); -Texture2D g_AnisotropyTexture : register(t25); +Texture2D g_DiffuseTexture : register(t00); +Texture2D g_SpecularTexture : register(t01); +Texture2D g_AmbientTexture : register(t02); +Texture2D g_EmissiveTexture : register(t03); +Texture2D g_HeightTexture : register(t04); +Texture2D g_NormalTexture : register(t05); +Texture2D g_ShininessTexture : register(t06); +Texture2D g_NormalBlendTexture : register(t07); // OPACITY +Texture2D g_SROBlendTexture : register(t08); +Texture2D g_LightMapTexture : register(t09); +Texture2D g_ReflectionTexture : register(t10); +Texture2D g_DiffuseBlend : register(t11); // BASE_COLOR +Texture2D g_NormalCameraTexture : register(t12); +Texture2D g_EmissionColorTexture : register(t13); +Texture2D g_MetalnessTexture : register(t14); +Texture2D g_Diffuse_RoughnessTexture : register(t15); +Texture2D g_AmbientOcclusionTexture : register(t16); +Texture2D g_UnknownTexture : register(t17); +Texture2D g_SheenTexture : register(t18); +Texture2D g_ClearcoatTexture : register(t19); +Texture2D g_TransmissionTexture : register(t20); +Texture2D g_Maya_BaseTexture : register(t21); +Texture2D g_Maya_SpecularTexture : register(t22); +Texture2D g_Maya_Specular_ColorTexture : register(t23); +Texture2D g_Maya_Specular_RoughnessTexture : register(t24); +Texture2D g_AnisotropyTexture : register(t25); -StructuredBuffer g_BoneBuffer : register(t26); -StructuredBuffer g_PrevBoneBuffer : register(t27); +StructuredBuffer g_BoneBuffer : register(t26); +StructuredBuffer g_PrevBoneBuffer : register(t27); @@ -112,7 +112,7 @@ struct VS_OUT }; VS_OUT VS_MAIN_MESH(VS_IN_MESH In) { - VS_OUT Out = (VS_OUT)0; + VS_OUT Out = (VS_OUT) 0; matrix matWV, matWVP; matWV = mul(g_WorldMatrix, g_ViewMatrix); @@ -135,7 +135,7 @@ VS_OUT VS_MAIN_MESH(VS_IN_MESH In) VS_OUT VS_MAIN(VS_IN In) { - VS_OUT Out = (VS_OUT)0; + VS_OUT Out = (VS_OUT) 0; float4 w = In.vBlendWeight; float sumW = max(dot(w, 1.0f), 1e-6f); @@ -246,78 +246,91 @@ VS_OUT VS_MAIN_LEGACY(VS_IN In) { TempBoneMatrix += mul(g_OffsetMatrix[In.vBlendIndex.w], mul(g_BoneBuffer[In.vBlendIndex.w].LocalCombined, w.w)); - TempBoneMatrix += mul(g_OffsetMatrix[In.vBlendIndex.x], - mul(g_BoneMatrices[In.vBlendIndex.x], w.x)); } - else - { - TempBoneMatrix += mul(g_OffsetMatrix[In.vBlendIndex.x], - mul(g_BoneBuffer[In.vBlendIndex.x].LocalCombined, w.x)); - } - if (idx.y >= MinIdx && idx.y <= MaxIdx) - //if (g_RobeBoneMask[idx.y] == 1) - { - TempBoneMatrix += mul(g_OffsetMatrix[In.vBlendIndex.y], - mul(g_BoneMatrices[In.vBlendIndex.y], w.y)); - } - else - { - TempBoneMatrix += mul(g_OffsetMatrix[In.vBlendIndex.y], - mul(g_BoneBuffer[In.vBlendIndex.y].LocalCombined, w.y)); - } - if (idx.z >= MinIdx && idx.z <= MaxIdx) - //if (g_RobeBoneMask[idx.z] == 1) - { - TempBoneMatrix += mul(g_OffsetMatrix[In.vBlendIndex.z], - mul(g_BoneMatrices[In.vBlendIndex.z], w.z)); - } - else - { - TempBoneMatrix += mul(g_OffsetMatrix[In.vBlendIndex.z], - mul(g_BoneBuffer[In.vBlendIndex.z].LocalCombined, w.z)); - } - if (idx.w >= MinIdx && idx.w <= MaxIdx) - //if (g_RobeBoneMask[idx.w] == 1) - { - TempBoneMatrix += mul(g_OffsetMatrix[In.vBlendIndex.w], - mul(g_BoneMatrices[In.vBlendIndex.w], w.w)); - } - else - { - TempBoneMatrix += mul(g_OffsetMatrix[In.vBlendIndex.w], - mul(g_BoneBuffer[In.vBlendIndex.w].LocalCombined, w.w)); - { - uint iIndex = idx.z; - float fWeight = w.z; - if (isRobe) - { - if (29 == iIndex) - { - BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneBuffer[iIndex].LocalCombined)); - - } - else - { - BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneMatrices[iIndex])); - } - } - else - { - BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneBuffer[iIndex].LocalCombined)); - } - } - { - uint iIndex = idx.w; - float fWeight = w.w; - if (isRobe) - { - if (29 == iIndex) - { - BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneBuffer[iIndex].LocalCombined)); BoneMatrix = TempBoneMatrix; - + //matrix BoneMatrix = (matrix) 0; + //{ + // uint iIndex = idx.x; + // float fWeight = w.x; + // if (isRobe) + // { + // if (29 == iIndex) + // { + // BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneBuffer[iIndex].LocalCombined)); + + // } + // else + // { + // BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneMatrices[iIndex])); + // } + // } + // else + // { + // BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneBuffer[iIndex].LocalCombined)); + // } + //} + //{ + // uint iIndex = idx.y; + // float fWeight = w.y; + // if (isRobe) + // { + // if (29 == iIndex) + // { + // BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneBuffer[iIndex].LocalCombined)); + + // } + // else + // { + // BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneMatrices[iIndex])); + // } + // } + // else + // { + // BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneBuffer[iIndex].LocalCombined)); + // } + //} + //{ + // uint iIndex = idx.z; + // float fWeight = w.z; + // if (isRobe) + // { + // if (29 == iIndex) + // { + // BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneBuffer[iIndex].LocalCombined)); + + // } + // else + // { + // BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneMatrices[iIndex])); + // } + // } + // else + // { + // BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneBuffer[iIndex].LocalCombined)); + // } + //} + //{ + // uint iIndex = idx.w; + // float fWeight = w.w; + // if (isRobe) + // { + // if (29 == iIndex) + // { + // BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneBuffer[iIndex].LocalCombined)); + + // } + // else + // { + // BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneMatrices[iIndex])); + // } + // } + // else + // { + // BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneBuffer[iIndex].LocalCombined)); + // } + //} //float robeWeight = // g_RobeBoneMask[idx.x] * w.x @@ -345,7 +358,7 @@ VS_OUT VS_MAIN_LEGACY(VS_IN In) //} - matrix PrevBoneMatrix = + matrix PrevBoneMatrix = mul(g_OffsetMatrix[In.vBlendIndex.x], mul(g_PrevBoneMatrices[In.vBlendIndex.x], w.x)) + mul(g_OffsetMatrix[In.vBlendIndex.y], @@ -383,7 +396,7 @@ VS_OUT VS_MAIN_LEGACY(VS_IN In) VS_OUT VS_MAIN_OUTLINE_READ(VS_IN In) { - VS_OUT Out = (VS_OUT)0; + VS_OUT Out = (VS_OUT) 0; float4 w = In.vBlendWeight; float sumW = max(dot(w, 1.0f), 1e-6f); @@ -543,7 +556,7 @@ PS_OUT_OUTLINE PS_MAIN_OUTLINE_READ(PS_IN In) PS_OUT PS_EYELASH_DAOTHV_ToSRO(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float4 vDAO_Mask = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); if (true == g_bDisolve) @@ -586,7 +599,7 @@ PS_OUT PS_EYELASH_DAOTHV_ToSRO(PS_IN In) PS_OUT PS_TEETH_SRXO_ToSRO(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); if (true == g_bDisolve) @@ -619,7 +632,7 @@ PS_OUT PS_TEETH_SRXO_ToSRO(PS_IN In) PS_OUT PS_EYE_DN_SRO(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); if (true == g_bDisolve) @@ -649,7 +662,7 @@ PS_OUT PS_EYE_DN_SRO(PS_IN In) PS_OUT PS_EYE_OCC(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; discard; return Out; } @@ -657,7 +670,7 @@ PS_OUT PS_EYE_OCC(PS_IN In) PS_OUT PS_FACIAL_HAIR_DAOTHV_ToSRO(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float4 vDAO_Mask = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); if (true == g_bDisolve) @@ -701,7 +714,7 @@ PS_OUT PS_FACIAL_HAIR_DAOTHV_ToSRO(PS_IN In) PS_OUT PS_HEAD_HAIR_DAOTHV_ToSRO(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float4 vDAO_Mask = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); if (true == g_bDisolve) @@ -744,7 +757,7 @@ PS_OUT PS_HEAD_HAIR_DAOTHV_ToSRO(PS_IN In) PS_OUT PS_HEADwtHAND_DSRXON_ToSRO(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); if (true == g_bDisolve) @@ -776,7 +789,7 @@ PS_OUT PS_HEADwtHAND_DSRXON_ToSRO(PS_IN In) PS_OUT PS_LOWER_DSRON_ToSRO(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); if (true == g_bDisolve) @@ -808,7 +821,7 @@ PS_OUT PS_LOWER_DSRON_ToSRO(PS_IN In) PS_OUT PS_UPPER_DMRON_ToMRO(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); if (true == g_bDisolve) @@ -840,7 +853,7 @@ PS_OUT PS_UPPER_DMRON_ToMRO(PS_IN In) PS_OUT PS_GLASSES_DMRON_ToMRO(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); if (true == g_bDisolve) @@ -872,7 +885,7 @@ PS_OUT PS_GLASSES_DMRON_ToMRO(PS_IN In) PS_OUT PS_EmissiveMetalness_DENMRO_ToMRO(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); float4 vEmissive = g_EmissiveTexture.Sample(DefaultSampler, In.vTexcoord); @@ -906,7 +919,7 @@ PS_OUT PS_EmissiveMetalness_DENMRO_ToMRO(PS_IN In) PS_OUT PS_DNMRO_ToMRO(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); float4 vEmissive = g_EmissiveTexture.Sample(DefaultSampler, In.vTexcoord); @@ -940,7 +953,7 @@ PS_OUT PS_DNMRO_ToMRO(PS_IN In) PS_OUT PS_MI_ClothSim_DSEN_ToSRO(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); if (true == g_bDisolve) @@ -974,7 +987,7 @@ PS_OUT PS_MI_ClothSim_DSEN_ToSRO(PS_IN In) PS_OUT PS_MI_DANSROMRO_ToSRO(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); if (true == g_bDisolve) @@ -1013,7 +1026,7 @@ PS_OUT PS_MI_DANSROMRO_ToSRO(PS_IN In) PS_OUT PS_Troll_Club_DAENMROSRXO_ToMROX(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); if (true == g_bDisolve) @@ -1053,7 +1066,7 @@ PS_OUT PS_Troll_Club_DAENMROSRXO_ToMROX(PS_IN In) } PS_OUT PS_Player_EyeLash_DAOTHV_ToSRO(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float2 uv = In.vTexcoord; float2 center = float2(0.5f, 0.5f); float2 p = uv - center; @@ -1098,7 +1111,7 @@ PS_OUT PS_Player_EyeLash_DAOTHV_ToSRO(PS_IN In) } PS_OUT PS_Player_Eye_ToMRO(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float2 uv = In.vTexcoord; float4 vDiffuseColor = g_DiffuseTexture.Sample(DefaultSampler, uv); if (true == g_bDisolve) @@ -1128,7 +1141,7 @@ PS_OUT PS_Player_Eye_ToMRO(PS_IN In) } PS_OUT PS_Player_Robe_ToMRO(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float2 uv = In.vTexcoord; float4 vDiffuseColor = g_DiffuseTexture.Sample(DefaultSampler, uv); if (true == g_bDisolve) @@ -1160,7 +1173,7 @@ PS_OUT PS_Player_Robe_ToMRO(PS_IN In) } PS_OUT PS_Player_Suit_DSRON_ToSRO(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float2 uv = In.vTexcoord; float4 vDiffuseColor = g_DiffuseTexture.Sample(DefaultSampler, uv); if (true == g_bDisolve) @@ -1190,7 +1203,7 @@ PS_OUT PS_Player_Suit_DSRON_ToSRO(PS_IN In) } PS_OUT PS_Player_HairDAOTHV_ToSRO(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float2 uv = In.vTexcoord; float4 vDAOColor = g_DiffuseTexture.Sample(DefaultSampler, uv); if (true == g_bDisolve) @@ -1200,17 +1213,17 @@ PS_OUT PS_Player_HairDAOTHV_ToSRO(PS_IN In) } float3 vHairBaseColor = g_NormalBlendTexture.Sample(DefaultSampler, uv).rrr; float4 vNormalColor = g_NormalTexture.Sample(DefaultSampler, uv); - float4 vTHVColor = g_DiffuseBlend.Sample(DefaultSampler, uv); + float4 vTHVColor = g_DiffuseBlend.Sample(DefaultSampler, uv); float3 vNormalDecoded = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, In.vTexcoord); float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal); float3 vNormal = normalize(mul(vNormalDecoded, WorldMatrix)); - float AlphaMask = vDAOColor.g; - float AoMask_Dao = vDAOColor.b; - float RootTip = vTHVColor.r; - float SpecMask = vTHVColor.g; - float AoMask_Thv = vTHVColor.b; // Volume + float AlphaMask = vDAOColor.g; + float AoMask_Dao = vDAOColor.b; + float RootTip = vTHVColor.r; + float SpecMask = vTHVColor.g; + float AoMask_Thv = vTHVColor.b; // Volume float3 vColorHair = clamp(ColorMixer(vHairBaseColor, UnpackRGB8(g_iPackedBlendColor), g_fMixerFactor, g_iColorMixerMethod), 0.f, 1.f); float3 vColorRoot = vColorHair * 0.6f; @@ -1266,19 +1279,20 @@ PS_OUT_BLEND PS_Dragon_EtherealWings(PS_IN In) { PS_OUT_BLEND Out; float2 uv = In.vTexcoord; - float2 uvDiffuse = uv; uvDiffuse.y -= g_fEtherealRatio; + float2 uvDiffuse = uv; + uvDiffuse.y -= g_fEtherealRatio; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, uvDiffuse); float4 vEmissive = g_EmissiveTexture.Sample(DefaultSampler, uv); vDiffuse += vEmissive; float fOppacity = g_NormalBlendTexture.Sample(DefaultSampler, uvDiffuse).a; - vDiffuse.a = (1- fOppacity); + vDiffuse.a = (1 - fOppacity); Out.vAlbedo = vDiffuse; return Out; } PS_OUT PS_Dragon_Body(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float2 uv = In.vTexcoord; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, uv); if (true == g_bDisolve) @@ -1314,7 +1328,7 @@ PS_OUT PS_Dragon_Body(PS_IN In) PS_OUT PS_Dragon_Wings(PS_IN In) { - PS_OUT Out = (PS_OUT)0; + PS_OUT Out = (PS_OUT) 0; float2 uv = In.vTexcoord; float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, uv); if (true == g_bDisolve)