Merge pull request #139 from SpicyGangjeong/Develope

Follow
This commit is contained in:
hyunbin14
2025-11-16 21:47:21 +09:00
committed by GitHub
56 changed files with 877 additions and 277 deletions
@@ -194,8 +194,8 @@ BlendState BS_WeightBlend
BlendEnable[7] = true;
SrcBlend[0] = Inv_Src_Alpha;
DestBlend[0] = Src_Alpha;
SrcBlend[0] = Src_Alpha;
DestBlend[0] = Inv_Src_Alpha;
BlendOp[0] = Add;
@@ -57,31 +57,9 @@ PS_OUT_BACKBUFFER PS_OUT_LASTCOLOR(PS_IN In)
discard;
}
int iOption = vColorTexture.a * 10;
Out.vBackBuffer = vColorTexture;
switch (iOption)
{
case 1:
Out.vBackBuffer.rgb /= vColorTexture.rgb;
break;
case 2:
Out.vBackBuffer.rgb += vColorTexture.rgb;
break;
case 3:
Out.vBackBuffer.rgb -= vColorTexture.rgb;
break;
case 4:
Out.vBackBuffer.rgb *= vColorTexture.rgb;
break;
case 5:
Out.vBackBuffer.rgb = vColorTexture.rgb;
break;
default:
break;
}
return Out;
}
@@ -21,10 +21,13 @@ struct ParticleValue
float2 vMaskingUVMoveTime;
float2 vDiffuseUVMoveTime;
float2 vDistortionUVMoveTime;
float2 vNoiseUVMoveTime;
float2 vAniTime;
float2 vAniIndex;
};
@@ -16,7 +16,16 @@ vector g_vCamPosition;
Texture2D g_DiffuseTexture;
Texture2D g_NormalTexture;
Texture2D g_MaskingTexture;
Texture2D g_DAOTexture;
Texture2D g_THVTexture;
float3 g_RootColor;
float3 g_TipColor;
float3 g_DyeColor;
float g_DyeOpacity;
float g_HairRoughness;
matrix g_BoneMatrices[512];
@@ -274,31 +283,38 @@ PS_OUT_BLUR PS_MAIN_BLUR(PS_IN_BLUR In)
return Out;
}
PS_OUT PS_MAIN_TEST(PS_IN In)
PS_OUT PS_HAIR(PS_IN In)
{
PS_OUT Out;
float4 vMtrlDiffuse = g_TestColor;
float4 vMtrlMask = g_MaskingTexture.Sample(DefaultSampler, In.vTexcoord);
float fAlpha = vMtrlMask.r;
if (fAlpha < 0.1f)
float4 DAO = g_DAOTexture.Sample(DefaultSampler, In.vTexcoord);
float alpha = DAO.a;
if (alpha < 0.1f)
discard;
float4 THV = g_THVTexture.Sample(DefaultSampler, In.vTexcoord);
float rootMask = THV.r;
float tipMask = THV.g;
float variation = THV.b;
float3 baseColor = lerp(g_RootColor, g_TipColor, tipMask);
baseColor *= lerp(0.8, 1.2, variation);
baseColor = lerp(baseColor, g_DyeColor, g_DyeOpacity);
float4 vNormalDesc = g_NormalTexture.Sample(MirrorSampler, In.vTexcoord);
float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal);
float3 vNormal = mul(vNormalDesc.xyz * 2.f - 1.f, WorldMatrix);
float3 normal = mul(vNormalDesc.xyz * 2.f - 1.f, WorldMatrix);
if (g_bRimLight)
{
float fRimLight = GetRimLight(g_vCamPosition.xyz, In.vWorldPos.xyz, vNormal, g_fRimPower, g_fRimStrength);
vMtrlDiffuse.rgb = lerp(vMtrlDiffuse.rgb, g_vRimColor.rgb, fRimLight);
float fRim = GetRimLight(g_vCamPosition.xyz, In.vWorldPos.xyz, normal, g_fRimPower, g_fRimStrength);
baseColor = lerp(baseColor, g_vRimColor.rgb, fRim);
}
Out.vDiffuse = float4(vMtrlDiffuse.rgb * vMtrlMask.r, g_TestColor.a);
Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f);
Out.vDiffuse = float4(baseColor, alpha);
Out.vNormal = float4(normal * 0.5f + 0.5f, 0.f);
Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, 0.0f, 1.f);
return Out;
@@ -376,14 +392,14 @@ technique11 DefaultTechnique
PixelShader = compile ps_5_0 PS_MAIN_BLUR();
}
pass TestPass
pass HairPass
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_Default, 0);
SetBlendState(BS_AlphaBlend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
VertexShader = compile vs_5_0 VS_MAIN();
GeometryShader = NULL;
PixelShader = compile ps_5_0 PS_MAIN_TEST();
PixelShader = compile ps_5_0 PS_HAIR();
}
pass EyeLashPass
@@ -29,10 +29,15 @@ Texture2D g_NormalTexture : register(t1);
Texture2D g_MaskingTexture : register(t2);
Texture2D g_DissolveTexture : register(t3);
Texture2D g_NoiseTexture : register(t4);
Texture2D g_EmissiveTexture : register(t6);
StructuredBuffer<ParticleValue> g_ParticleValue : register(t5);
Texture2D g_EmissiveTexture : register(t6);
Texture2D g_DepthStencilTexture : register(t7);
float4 g_vCamPosition;
vector g_vColor;
@@ -204,25 +209,24 @@ PS_OUT BlendedWeight(vector fDiffuse, float fLinearZ)
float fWeight =
max(
min(1.0, max(max(vColor.r, vColor.g), vColor.b) * fAlpha),
fAlpha
) *
clamp(
0.03 / (1e-4 + pow(fLinearZ / 200, 4.0)),
1e-2, 3e3
);
min(1.0, max(max(vColor.r, vColor.g), vColor.b) * fAlpha), fAlpha)
*
clamp( 0.01 / (1e-4 + pow(fLinearZ / 200, 4.0)), 0.01f, 1000 );
//float fWeight = clamp(0.03f / (1e-5 + pow(fLinearZ, 4.0f)), 0.01, 3e3);
//float fWeight = clamp(0.03f / (1e-5 + pow(fLinearZ, 2.0f)), 0.01, 3e3);
//fWeight = max(fWeight, 1.0);
//이게 오리지널 웨이트 함수
//float fWeight = pow(fLinearZ, -2.5);
//float fWeight = clamp(pow(fLinearZ, -2.5f), 1.0f, 1000.0f);
Out.vDiffuse = vector(vColor.rgb * fAlpha, fAlpha) * fWeight;
Out.vRevealage.r = fAlpha;
Out.vColorTarget = vector(0.f, 0.f, 0.f, 0.f);
Out.vRevealage.a = fAlpha;
return Out;
}
@@ -349,6 +353,9 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlMask.r);
if (vMtrlDiffuse.a <= 0.f)
discard;
if (g_isDissolve == true)
{
vMtrlDissolve = g_DissolveTexture.Sample(DefaultSampler, In.vTexcoord);
@@ -369,7 +376,18 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
}
Out = BlendedWeight(vMtrlDiffuse , In.vProjPos.w);
int2 iTexel = int2(In.vPosition.xy);
float fDepthStencilValue = g_DepthStencilTexture.Load(int3(iTexel, 0)).r;
float fbias = 0.00005f;
if (fDepthStencilValue <= In.vProjPos.z / In.vProjPos.w + fbias)
discard;
Out = BlendedWeight(vMtrlDiffuse, In.vProjPos.w);
//if (vMtrlDiffuse.a >= g_fEmissiveCutAlpha)
@@ -565,7 +583,7 @@ technique11 DefaultTechnique
pass NON_NOMALMAP
{
SetRasterizerState(RS_Nocull);
SetDepthStencilState(DSS_Default, 0);
SetDepthStencilState(DSS_None, 0);
SetBlendState(BS_WB_Acc, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
VertexShader = compile vs_5_0 VS_MAIN();
GeometryShader = NULL;
@@ -194,8 +194,8 @@ BlendState BS_WeightBlend
BlendEnable[7] = true;
SrcBlend[0] = Inv_Src_Alpha;
DestBlend[0] = Src_Alpha;
SrcBlend[0] = Src_Alpha;
DestBlend[0] = Inv_Src_Alpha;
BlendOp[0] = Add;
@@ -57,31 +57,9 @@ PS_OUT_BACKBUFFER PS_OUT_LASTCOLOR(PS_IN In)
discard;
}
int iOption = vColorTexture.a * 10;
Out.vBackBuffer = vColorTexture;
switch (iOption)
{
case 1:
Out.vBackBuffer.rgb /= vColorTexture.rgb;
break;
case 2:
Out.vBackBuffer.rgb += vColorTexture.rgb;
break;
case 3:
Out.vBackBuffer.rgb -= vColorTexture.rgb;
break;
case 4:
Out.vBackBuffer.rgb *= vColorTexture.rgb;
break;
case 5:
Out.vBackBuffer.rgb = vColorTexture.rgb;
break;
default:
break;
}
return Out;
}
@@ -21,10 +21,13 @@ struct ParticleValue
float2 vMaskingUVMoveTime;
float2 vDiffuseUVMoveTime;
float2 vDistortionUVMoveTime;
float2 vNoiseUVMoveTime;
float2 vAniTime;
float2 vAniIndex;
};
@@ -14,6 +14,7 @@ struct ParticleValue
float2 vMaskingUVMoveTime;
float2 vDiffuseUVMoveTime;
float2 vDistortionUVMoveTime;
float2 vNoiseUVMoveTime;
float2 vAniTime;
@@ -35,6 +36,7 @@ StructuredBuffer<ParticleValue> g_ParticleValue : register(t5);
Texture2D g_EmissiveTexture : register(t6);
Texture2D g_DepthStencilTexture : register(t7);
Texture2D g_DistortionTexture : register(t8);
@@ -44,27 +46,30 @@ vector g_vColor;
float2 g_vDiffuseUVGainAmount;
float2 g_vMaskingUVGainAmount;
float2 g_vNoiseUVGainAmount;
float2 g_vDiffuseNoiseUVGainAmount;
float2 g_vMaskNoiseUVGainAmount;
//
int g_iMaskMoveLerpOption;
int g_iDiffuseMoveLerpOption;
int g_iMaskNoiseMoveLerpOption;
int g_iDiffuseNoiseMoveLerpOption;
int g_iNoiseMoveLerpOption;
//
float2 g_vDiffuseDistortionUVGainAmount;
float2 g_vMaskDistortionUVGainAmount;
int g_iMaskDistortionMoveLerpOption;
int g_iDiffuseDistortionMoveLerpOption;
//
float2 g_vUVCutting;
float2 g_vUVMaskCutting;
float g_fDiffuseAlpha;
int g_iBlurWeight; // 블러 강도
float g_fBlurIntensity; //블러 세기
float g_fNoiseDistortionIntensity; // 노이즈 왜곡 세기
float g_fNoiseDistortionIntensity; // 디스토션 왜곡 세기
float4 g_vEmissive;
float g_fColorOption;
float g_fEmissiveCutAlpha;
bool g_isDiffuse;
@@ -72,9 +77,13 @@ bool g_isMasking;
bool g_isDissolve;
bool g_isNoise;
bool g_isEmissive;
bool g_isDistortion;
bool g_isDiffuseUVMove;
bool g_isMaskUVMove;
bool g_isNoiseUVMove;
bool g_isReverseDissolve;
float g_fFar;
@@ -197,40 +206,36 @@ struct PS_OUT
};
PS_OUT BlendedWeight(vector fDiffuse, float fLinearZ , PS_IN In , float fProjZ)
PS_OUT BlendedWeight(vector fDiffuse, float fLinearZ)
{
PS_OUT Out;
float3 vColor = fDiffuse.rgb;
float fAlpha = fDiffuse.a;
// float fWeight =
//max(
// min(1.0, max(max(vColor.r, vColor.g), vColor.b) * fAlpha),
// fAlpha
//) *
//clamp(
// 0.01 / (1e-4 + pow(fLinearZ / 200, 4.0)),
// 0.01f, 1000
//);
// min(1.0, max(max(vColor.r, vColor.g), vColor.b) * fAlpha), fAlpha)
// *
// clamp(0.01 / (1e-4 + pow(fLinearZ / 200, 4.0)), 0.01f, 1000);
float fWeight = clamp(0.03f / (1e-5 + pow(fLinearZ, 2.0f)), 0.01, 3e3);
fWeight = max(fWeight, 1.0);
//float fWeight = clamp(0.03f / (1e-5 + pow(fLinearZ, 4.0f)), 0.01, 3e3);
//fWeight = max(fWeight, 1.0);
//이게 오리지널 웨이트 함수
//float fWeight = pow(fLinearZ, -2.5);
//float fWeight = clamp(pow(fLinearZ, -2.5f), 1.0f, 1000.0f);
Out.vDiffuse = vector(vColor.rgb * fAlpha, fAlpha) * fWeight;
float fWeight = clamp(pow(fLinearZ, -2.5f), 1.0f, 1000.0f);
Out.vDiffuse = vector(vColor.rgb * fAlpha, fAlpha) * fWeight;
Out.vRevealage.r = fAlpha;
Out.vRevealage.a = fAlpha;
return Out;
}
@@ -271,11 +276,13 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
vector vMtrlMask;
vector vMtrlNoise;
vector vMtrlDissolve;
vector vMtrlDistortion;
float fAnimIndex = g_ParticleValue[In.iGPUIndex].vAniIndex.x;
float2 vDiffuseTime = g_ParticleValue[In.iGPUIndex].vDiffuseUVMoveTime;
float2 vMaskingTime = g_ParticleValue[In.iGPUIndex].vMaskingUVMoveTime;
float2 vNoiseUVMoveTime = g_ParticleValue[In.iGPUIndex].vNoiseUVMoveTime;
float2 vDistortionUVMoveTime = g_ParticleValue[In.iGPUIndex].vDistortionUVMoveTime;
if (g_isDiffuse == true)
{
@@ -288,57 +295,74 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
UV += SelectLerpUV((g_vDiffuseUVGainAmount / g_vUVCutting), (vDiffuseTime.x / vDiffuseTime.y), g_iDiffuseMoveLerpOption);
}
/* 노이즈 */
if (g_isNoise == true)
/* 디퓨즈 디스토션 */
if (g_isDistortion == true)
{
float2 vNoiseUV = In.vTexcoord + SelectLerpUV(g_vDiffuseNoiseUVGainAmount, (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y), g_iDiffuseNoiseMoveLerpOption);
float2 vDistortion = In.vTexcoord + SelectLerpUV(g_vDiffuseDistortionUVGainAmount, (vDistortionUVMoveTime.x / vDistortionUVMoveTime.y), g_iDiffuseDistortionMoveLerpOption);
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vNoiseUV);
vMtrlDistortion = g_DistortionTexture.Sample(DefaultSampler, vDistortion);
//0.5f를 빼는 이유는 중심을 0으로 옮겨서 양음수 방향으로 offset을 줄수 있다.
vMtrlNoise.rg -= 0.5f;
vMtrlDistortion.rg -= 0.5f;
//아마 분할되었다면 noise도 분할해야할듯
vMtrlNoise.rg /= g_vUVCutting;
vMtrlDistortion.rg /= g_vUVCutting;
//노이즈 텍스쳐로 uv를 왜곡함
//디스토션(노이즈) 텍스쳐로 uv를 왜곡함
UV = UV + (vMtrlNoise).rg * g_fNoiseDistortionIntensity;
UV = UV + (vMtrlDistortion).rg * g_fNoiseDistortionIntensity;
}
/* 최종 색깔 */
vMtrlDiffuse = g_DiffuseTexture.Sample(DefaultSampler, UV);
if (g_vColor.a > 0)
vMtrlDiffuse += g_vColor;
if (vMtrlDiffuse.a < 0.3f)
discard;
}
else
{
vMtrlDiffuse = g_vColor;
}
/* 노이즈 */
if(g_isNoise)
{
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, In.vTexcoord);
vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlNoise.r);
vMtrlDiffuse *= vMtrlNoise;
}
if (g_isMasking == true)
{
float2 vMaskTexcoord = In.vTexcoord;
vMaskTexcoord = UV_Cutting(In.vTexcoord, g_vUVMaskCutting, int(fAnimIndex.x));
if (g_isNoise == true)
// 마스크 디스토션
if (g_isDistortion == true)
{
float2 UV; // 이미지의 UV값
float2 vNoiseUV = In.vTexcoord + SelectLerpUV(g_vMaskNoiseUVGainAmount, (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y), g_iMaskNoiseMoveLerpOption);
float2 vDistortionUV = In.vTexcoord + SelectLerpUV(g_vMaskDistortionUVGainAmount, (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y), g_iMaskDistortionMoveLerpOption);
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vNoiseUV);
vMtrlDistortion = g_DistortionTexture.Sample(DefaultSampler, vDistortionUV);
//노이즈 텍스쳐로 uv를 왜곡함
vMaskTexcoord = vMaskTexcoord + (vMtrlNoise - 0.5f).rg * g_fNoiseDistortionIntensity;
//디스토션(노이즈) 텍스쳐로 uv를 왜곡함
vMaskTexcoord = vMaskTexcoord + (vMtrlDistortion - 0.5f).r / g_vUVCutting * g_fNoiseDistortionIntensity;
vMtrlDiffuse *= vMtrlDistortion.r;
}
if (g_isMaskUVMove)
@@ -348,6 +372,7 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
}
vMtrlMask = g_MaskingTexture.Sample(PointSampler, vMaskTexcoord);
}
else
{
@@ -358,6 +383,8 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlMask.r);
if (vMtrlDiffuse.a <= 0.f)
discard;
@@ -365,38 +392,52 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
{
vMtrlDissolve = g_DissolveTexture.Sample(DefaultSampler, In.vTexcoord);
if (vMtrlDissolve.r < (In.vLifeTime.x / In.vLifeTime.y))
discard;
if(g_isReverseDissolve == true)
{
if (vMtrlDissolve.r >= (In.vLifeTime.x / In.vLifeTime.y))
discard;
}
else
{
if (vMtrlDissolve.r < (In.vLifeTime.x / In.vLifeTime.y))
discard;
}
}
vMtrlDiffuse.a *= g_fDiffuseAlpha;
// 색깔 추가할 처리 (이미시브)
float4 vEmissiveMtrl;
float4 vEmissiveMtrl = vector(0.f ,0.f ,0.f ,0.f);
if (g_isEmissive == true)
{
vEmissiveMtrl = g_EmissiveTexture.Sample(DefaultSampler, In.vTexcoord);
}
int2 texel = int2(In.vPosition.xy);
float fDepthStencilValue = g_DepthStencilTexture.Load(int3(texel, 0));
int2 iTexel = int2(In.vPosition.xy);
float bias = 0.0005f;
float fDepthStencilValue = g_DepthStencilTexture.Load(int3(iTexel, 0)).r;
if (fDepthStencilValue + bias < In.vProjPos.z / In.vProjPos.w)
float fbias = 0.000005f;
if (fDepthStencilValue <= In.vProjPos.z / In.vProjPos.w + fbias)
discard;
Out = BlendedWeight(vMtrlDiffuse, In.vProjPos.w, In, In.vProjPos.z / In.vProjPos.w);
//if (vMtrlDiffuse.a >= g_fEmissiveCutAlpha)
// Out.vColorTarget = vector(g_vEmissive.rgb + vEmissiveMtrl.rgb, g_fColorOption / 10.f);
//else
// Out.vColorTarget = vector(0.f, 0.f, 0.f, 0.f);
Out = BlendedWeight(vMtrlDiffuse, In.vProjPos.w);
if (vMtrlDiffuse.a / g_fDiffuseAlpha > g_fEmissiveCutAlpha)
{
float3 vEmissiveColor= g_vEmissive.rgb * g_vEmissive.a + vEmissiveMtrl.rgb * (1 - g_vEmissive.a);
Out.vColorTarget = vector(vEmissiveColor, vMtrlDiffuse.a);
}
else
Out.vColorTarget = vector(0.f, 0.f, 0.f, 0.f);
return Out;
}
@@ -458,11 +499,13 @@ PS_BLUR_OUT PS_BLUR(PS_BLUR_IN In)
vector vMtrlMask;
vector vMtrlNoise;
vector vMtrlDissolve;
vector vMtrlDistortion;
float fAnimIndex = g_ParticleValue[In.iGPUIndex].vAniIndex.x;
float2 vDiffuseTime = g_ParticleValue[In.iGPUIndex].vDiffuseUVMoveTime;
float2 vMaskingTime = g_ParticleValue[In.iGPUIndex].vMaskingUVMoveTime;
float2 vNoiseUVMoveTime = g_ParticleValue[In.iGPUIndex].vNoiseUVMoveTime;
float2 vDistortionUVMoveTime = g_ParticleValue[In.iGPUIndex].vDistortionUVMoveTime;
if (g_isDiffuse == true)
{
@@ -475,57 +518,70 @@ PS_BLUR_OUT PS_BLUR(PS_BLUR_IN In)
UV += SelectLerpUV((g_vDiffuseUVGainAmount / g_vUVCutting), (vDiffuseTime.x / vDiffuseTime.y), g_iDiffuseMoveLerpOption);
}
/* 노이즈 */
if (g_isNoise == true)
/* 디퓨즈 디스토션 */
if (g_isDistortion == true)
{
float2 vNoiseUV = In.vTexcoord + SelectLerpUV(g_vDiffuseNoiseUVGainAmount, (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y), g_iDiffuseNoiseMoveLerpOption);
float2 vDistortion = In.vTexcoord + SelectLerpUV(g_vDiffuseDistortionUVGainAmount, (vDistortionUVMoveTime.x / vDistortionUVMoveTime.y), g_iDiffuseDistortionMoveLerpOption);
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vNoiseUV);
vMtrlDistortion = g_DistortionTexture.Sample(DefaultSampler, vDistortion);
//0.5f를 빼는 이유는 중심을 0으로 옮겨서 양음수 방향으로 offset을 줄수 있다.
vMtrlNoise.rg -= 0.5f;
vMtrlDistortion.rg -= 0.5f;
//아마 분할되었다면 noise도 분할해야할듯
vMtrlNoise.rg /= g_vUVCutting;
vMtrlDistortion.rg /= g_vUVCutting;
//노이즈 텍스쳐로 uv를 왜곡함
//디스토션(노이즈) 텍스쳐로 uv를 왜곡함
UV = UV + (vMtrlNoise).rg * g_fNoiseDistortionIntensity;
UV = UV + (vMtrlDistortion).rg * g_fNoiseDistortionIntensity;
}
/* 최종 색깔 */
vMtrlDiffuse = g_DiffuseTexture.Sample(DefaultSampler, UV);
if (g_vColor.a > 0)
vMtrlDiffuse += g_vColor;
if (vMtrlDiffuse.a < 0.3f)
discard;
}
else
{
vMtrlDiffuse = g_vColor;
}
/* 노이즈 */
if (g_isNoise)
{
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, In.vTexcoord);
vMtrlDiffuse *= vMtrlNoise;
}
if (g_isMasking == true)
{
float2 vMaskTexcoord = In.vTexcoord;
vMaskTexcoord = UV_Cutting(In.vTexcoord, g_vUVMaskCutting, int(fAnimIndex.x));
if (g_isNoise == true)
// 마스크 디스토션
if (g_isDistortion == true)
{
float2 UV; // 이미지의 UV값
float2 vNoiseUV = In.vTexcoord + SelectLerpUV(g_vMaskNoiseUVGainAmount, (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y), g_iMaskNoiseMoveLerpOption);
float2 vDistortionUV = In.vTexcoord + SelectLerpUV(g_vMaskDistortionUVGainAmount, (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y), g_iMaskDistortionMoveLerpOption);
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vNoiseUV);
vMtrlDistortion = g_DistortionTexture.Sample(DefaultSampler, vDistortionUV);
//노이즈 텍스쳐로 uv를 왜곡함
vMaskTexcoord = vMaskTexcoord + (vMtrlNoise - 0.5f).rg * g_fNoiseDistortionIntensity;
//디스토션(노이즈) 텍스쳐로 uv를 왜곡함
vMaskTexcoord = vMaskTexcoord + (vMtrlDistortion - 0.5f).r / g_vUVCutting * g_fNoiseDistortionIntensity;
vMtrlDiffuse *= vMtrlDistortion.r;
}
if (g_isMaskUVMove)
@@ -535,6 +591,7 @@ PS_BLUR_OUT PS_BLUR(PS_BLUR_IN In)
}
vMtrlMask = g_MaskingTexture.Sample(PointSampler, vMaskTexcoord);
}
else
{
@@ -545,25 +602,40 @@ PS_BLUR_OUT PS_BLUR(PS_BLUR_IN In)
vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlMask.r);
if (g_isDissolve == true)
{
vMtrlDissolve = g_DissolveTexture.Sample(DefaultSampler, In.vTexcoord);
if (vMtrlDissolve.r < (In.vLifeTime.x / In.vLifeTime.y))
discard;
}
vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlMask.r);
if (vMtrlDiffuse.a <= 0.f)
discard;
if (g_isDissolve == true)
{
vMtrlDissolve = g_DissolveTexture.Sample(DefaultSampler, In.vTexcoord);
if (vMtrlDissolve.r < (In.vLifeTime.x / In.vLifeTime.y))
discard;
if(g_isReverseDissolve == true)
{
if (vMtrlDissolve.r >= (In.vLifeTime.x / In.vLifeTime.y))
discard;
}
else
{
if (vMtrlDissolve.r < (In.vLifeTime.x / In.vLifeTime.y))
discard;
}
}
vMtrlDiffuse.a *= g_fDiffuseAlpha;
// 색깔 추가할 처리 (이미시브)
float4 vEmissiveMtrl = vector(0.f, 0.f, 0.f, 0.f);
if (g_isEmissive == true)
{
vEmissiveMtrl = g_EmissiveTexture.Sample(DefaultSampler, In.vTexcoord);
}
Out.vDiffuse = vMtrlDiffuse * g_fBlurIntensity;
Out.vBlurWeight.r = g_iBlurWeight / 32.f;
@@ -587,7 +659,7 @@ technique11 DefaultTechnique
{
SetRasterizerState(RS_Nocull);
SetDepthStencilState(DSS_None, 0);
SetBlendState(BS_WB_Acc, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
VertexShader = compile vs_5_0 VS_MAIN();
GeometryShader = NULL;
PixelShader = compile ps_5_0 PS_NON_NORMALMAP();
@@ -596,7 +668,7 @@ technique11 DefaultTechnique
pass Blur
{
SetRasterizerState(RS_Nocull);
SetDepthStencilState(DSS_Default, 0);
SetDepthStencilState(DSS_Effect, 0);
SetBlendState(BS_AlphaBlend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
VertexShader = compile vs_5_0 VS_BLUR();
GeometryShader = NULL;
@@ -48,14 +48,21 @@ PS_OUT PS_MAIN(PS_IN In)
{
PS_OUT Out;
vector vMixedDiffuse = g_MixedDiffuseTexture.Sample(PointSampler, In.vTexcoord);
vector vRevealage = g_RevealageTexture.Sample(PointSampler, In.vTexcoord);
float fRevealage = g_RevealageTexture.Sample(PointSampler, In.vTexcoord);
if(vRevealage.b >= 1.f)
discard;
Out.vBackBuffer = vector(vMixedDiffuse.rgb / fRevealage , fRevealage);
//float fClamp;
//fClamp = clamp(vMixedDiffuse.a, 1e-4, 5e4);
//Out.vBackBuffer = vector(vMixedDiffuse.rgb / fClamp, fRevealage);
Out.vBackBuffer = vector(vMixedDiffuse.rgb / max(vMixedDiffuse.a, 1e-5), 1 - vRevealage.r);
return Out;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 549 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

+122 -51
View File
@@ -59,20 +59,14 @@ void CEditEffect::Late_Update(_float fTimeDelta)
if (m_pInstance_ModelCom == nullptr)
return;
ASSERT_JINWOO(false && "이거 고쳐야됨, 아래꺼를 위에껄로")
//{
// if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
// m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this);
// }
//}
//{
// _float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
// if (m_EffectInfo.isBlur == true)
// m_pGameInstance->Add_RenderGroup(RENDER::BLUR, this, *vPos, m_pTransformCom->Get_Radius());
if (m_EffectInfo.isBlur == true)
{
m_pGameInstance->Add_RenderGroup(RENDER::BLUR, this);
}
m_pGameInstance->Add_RenderGroup(RENDER::EFFECT, this);
// m_pGameInstance->Add_RenderGroup(m_EffectInfo.eRenderOrder, this, *vPos, m_pTransformCom->Get_Radius());
//}
}
void CEditEffect::Reference_Mat_For_EditEffect()
@@ -80,9 +74,9 @@ void CEditEffect::Reference_Mat_For_EditEffect()
string strName = {};
const char* pCompute[] = { "DIFFUSE" , "MASK", "NOISE", "DISSOLVE" };
const char* pCompute[] = { "DIFFUSE" , "MASK", "NOISE", "DISSOLVE" , "DISTORTION" , "EMISSIVE"};
if (ImGui::Combo("OPTION", &m_iSelectTextureNum, pCompute, 4))
if (ImGui::Combo("OPTION", &m_iSelectTextureNum, pCompute, 6))
{
}
switch (m_iSelectTextureNum)
@@ -119,6 +113,24 @@ void CEditEffect::Reference_Mat_For_EditEffect()
m_strDissolveName = strName;
}
break;
case 4:
strName = dynamic_cast<CEffect_Editor*>(m_pOwner)->Reference_Mat_For_EditEffect((CComponent**)&m_pDistortion_TextureCom, this);
if (strName != "")
{
m_strDistortionName = strName;
}
break;
case 5:
strName = dynamic_cast<CEffect_Editor*>(m_pOwner)->Reference_Mat_For_EditEffect((CComponent**)&m_pEmissive_TextureCom, this);
if (strName != "")
{
m_strEmissiveName = strName;
}
break;
default:
break;
@@ -245,6 +257,24 @@ HRESULT CEditEffect::Save_Effect(const _char* pPath)
}
}
if (m_EffectInfo.isDistortion)
{
size_t iComponentLength = m_strDistortionName.length();
const _char* pFileComponentPath = m_strDistortionName.c_str();
if (!WriteFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) {
return E_FAIL;
}
if (iComponentLength != 0)
{
if (!WriteFile(hFile, pFileComponentPath, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) {
return E_FAIL;
}
}
}
size_t iComponentLength = m_strModelName.length();
const _char* pFileComponentPath = m_strModelName.c_str();
@@ -332,6 +362,7 @@ void CEditEffect::Describe_Entity()
GUI::Checkbox("Diffuse", &m_EffectInfo.isDiffuse);
GUI::Checkbox("Masking", &m_EffectInfo.isMasking);
GUI::Checkbox("Dissolve", &m_EffectInfo.isDissolve);
GUI::Checkbox("Distortion", &m_EffectInfo.isDistortion);
GUI::Checkbox("Noise", &m_EffectInfo.isNoise);
@@ -365,14 +396,6 @@ void CEditEffect::Describe_Entity()
if (GUI::TreeNode("EMISSIVE"))
{
const char* pCompute[] = {"NONE", "DIV" , "PLUS", "SUBSTRACT", "MULTY" , "EQUL" };
_int iColorOption = (_int)m_EffectInfo.fColorOption;
if (ImGui::Combo("OPTION", &iColorOption, pCompute , 6))
{
m_EffectInfo.fColorOption = (_float)iColorOption;
}
ImGui::PushItemWidth(80);
GUI::DragFloat("EmissiveCutAlpha", &m_EffectInfo.fEmissiveCutAlpha, 0.005f, 0.f, 1.f);
@@ -465,6 +488,7 @@ void CEditEffect::Describe_Entity()
if (GUI::TreeNode("DIFFUSE"))
{
GUI::DragFloat("Diffuse Alpha", &m_EffectInfo.fDiffuseAlpha , 0.01f, 0.f, 1.f);
ImGui::PushItemWidth(80);
GUI::Checkbox("DiffuseUVMove", &m_EffectInfo.isDiffuseUVMove);
@@ -554,6 +578,9 @@ void CEditEffect::Describe_Entity()
{
if (GUI::TreeNode("DISSOLV_TEX"))
{
GUI::Checkbox("Reverse Dissolve", &m_EffectInfo.isReverseDissolve);
_string strName = m_strDissolveName = m_pGameInstance->Asset_Description<CTexture>(ENUM_CLASS(LEVEL::EFFECT), "DISSOLVE_TEXTURE", (CComponent**)&m_pDissolve_TextureCom, nullptr, this);
if (strName != "") {
@@ -568,40 +595,82 @@ void CEditEffect::Describe_Entity()
}
}
if (m_EffectInfo.isDistortion == true)
{
if (GUI::TreeNode("DISTORTION"))
{
ImGui::PushItemWidth(80);
GUI::DragFloat("DistortionIntensity", &m_EffectInfo.fNoiseDistortionIntensity, 0.005f, 0.f, 1.f);
GUI::Spacing();
GUI::DragFloat2("DiffuseDistortionUVGainAmount", (_float*)&m_EffectInfo.vDiffuseDistortionUVGainAmount, 0.01f);
_int iDiffuseNoiseMoveLerpOption = (_int)m_EffectInfo.iDiffuseDistortionMoveLerpOption;
if (ImGui::Combo("LerpDiffuseDistortionMove Option", &iDiffuseNoiseMoveLerpOption, pLerp, 9))
{
m_EffectInfo.iDiffuseDistortionMoveLerpOption = iDiffuseNoiseMoveLerpOption;
}
GUI::Spacing();
GUI::DragFloat2("MaskDistortionUVGainAmount", (_float*)&m_EffectInfo.vMaskDistortionUVGainAmount, 0.01f);
_int iMaskNoiseMoveLerpOption = (_int)m_EffectInfo.iMaskDistortionMoveLerpOption;
if (ImGui::Combo("Lerp MaskDistortionMove Option", &iMaskNoiseMoveLerpOption, pLerp, 9))
{
m_EffectInfo.iMaskDistortionMoveLerpOption = iMaskNoiseMoveLerpOption;
}
GUI::Spacing();
ImGui::PopItemWidth();
if (GUI::TreeNode("DISTORTION_TEX"))
{
_string strName = m_pGameInstance->Asset_Description<CTexture>(ENUM_CLASS(LEVEL::EFFECT), "DISTORTION_TEXTURE", (CComponent**)&m_pDistortion_TextureCom, nullptr, this);
if (strName != "") {
m_strDistortionName = strName;
}
GUI::TreePop();
}
GUI::TreePop();
}
}
if (m_EffectInfo.isNoise == true)
{
if (GUI::TreeNode("NOISE"))
{
GUI::Checkbox("NoiseMove", &m_EffectInfo.isNoiseUVMove);
ImGui::PushItemWidth(80);
GUI::DragFloat("NoiseDistortionIntensity", &m_EffectInfo.fNoiseDistortionIntensity, 0.005f, 0.f, 1.f);
GUI::Spacing();
GUI::DragFloat2("DiffuseNoiseUVGainAmount", (_float*)&m_EffectInfo.vDiffuseNoiseUVGainAmount, 0.01f);
_int iDiffuseNoiseMoveLerpOption = (_int)m_EffectInfo.iDiffuseNoiseMoveLerpOption;
if (ImGui::Combo("Lerp DiffuseNoiseMove Option", &iDiffuseNoiseMoveLerpOption, pLerp, 9))
{
m_EffectInfo.iDiffuseNoiseMoveLerpOption = iDiffuseNoiseMoveLerpOption;
}
GUI::Spacing();
GUI::DragFloat2("MaskNoiseUVGainAmount", (_float*)&m_EffectInfo.vMaskNoiseUVGainAmount, 0.01f);
_int iMaskNoiseMoveLerpOption = (_int)m_EffectInfo.iMaskNoiseMoveLerpOption;
if (ImGui::Combo("Lerp MaskNoiseMove Option", &iMaskNoiseMoveLerpOption, pLerp, 9))
{
m_EffectInfo.iMaskNoiseMoveLerpOption = iMaskNoiseMoveLerpOption;
}
GUI::Spacing();
GUI::DragFloat2("NoiseUVGainAmount", (_float*)&m_EffectInfo.vNoiseUVGainAmount, 0.01f);
ImGui::PopItemWidth();
GUI::Spacing();
_int iMaskMoveLerpOption = (_int)m_EffectInfo.iNoiseMoveLerpOption;
if (ImGui::Combo("Lerp NoiseMove Option", &iMaskMoveLerpOption, pLerp, 9))
{
m_EffectInfo.iMaskMoveLerpOption = iMaskMoveLerpOption;
}
if (GUI::TreeNode("NOISE_TEX"))
{
_string strName = m_pGameInstance->Asset_Description<CTexture>(ENUM_CLASS(LEVEL::EFFECT), "NOISE_TEXTURE", (CComponent**)&m_pNoise_TextureCom, nullptr, this);
@@ -609,15 +678,17 @@ void CEditEffect::Describe_Entity()
if (strName != "") {
m_strNoiseName = strName;
}
GUI::TreePop();
}
GUI::Separator(); GUI::Spacing();
GUI::TreePop();
}
}
GUI::Separator(); GUI::Spacing();
}
+288 -14
View File
@@ -273,6 +273,30 @@ HRESULT CEffectObject::Load(const _char* pFilePath , LEVEL eLevel)
return E_FAIL;
}
if (m_EffectInfo.isDistortion)
{
size_t iComponentLength = {};
if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) {
return E_FAIL;
}
if (iComponentLength != 0)
{
_char szName[MAX_PATH] = {};
if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) {
return E_FAIL;
}
m_strDistortionName = szName;
}
if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strDistortionName),
reinterpret_cast<CComponent**>(&m_pDistortion_TextureCom))))
return E_FAIL;
}
size_t iComponentLength = {};
@@ -302,6 +326,232 @@ HRESULT CEffectObject::Load(const _char* pFilePath , LEVEL eLevel)
return S_OK;
}
#ifdef _DEBUG
HRESULT CEffectObject::LoadPre(const _char* pFilePath, LEVEL eLevel)
{
_string strPerfectFilePath = pFilePath;
HANDLE hFile = CreateFileW(
CMyTools::ToWstring(strPerfectFilePath).c_str(), // 파일 이름
GENERIC_READ, // 읽기 모드
FILE_SHARE_READ, // 다른 프로세스도 읽기 가능
NULL,
OPEN_EXISTING, // 기존 파일 열기
FILE_ATTRIBUTE_NORMAL,
NULL
);
if (hFile == INVALID_HANDLE_VALUE) {
MessageBox(NULL, L"오브젝트 읽기 실패", L"System Message", MB_OK);
return E_FAIL;
}
DWORD dwByte(0);
PRE_EFFECT_INFO PreEffectInfo = {};
if (!ReadFile(hFile, &PreEffectInfo, sizeof(PRE_EFFECT_INFO), &dwByte, nullptr)) {
return E_FAIL;
}
memcpy(&m_EffectInfo, &PreEffectInfo, sizeof(PRE_EFFECT_INFO));
m_EffectInfo.LightDesc.pPosition = m_pTransformCom->Get_StatePtr(STATE::POSITION);
m_EffectInfo.LightDesc.iLevel = ENUM_CLASS(eLevel);
if (m_EffectInfo.LightDesc.eType != LIGHT::DIRECTIONAL) // 0이 아닐때만 생성
{
if (FAILED(Add_Component<CLight>(g_iStaticLevel, &m_pLightCom, &m_EffectInfo.LightDesc)))
{
return E_FAIL;
}
}
if (m_EffectInfo.isDiffuse)
{
size_t iComponentLength = {};
if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) {
return E_FAIL;
}
if (iComponentLength != 0)
{
_char szName[MAX_PATH] = {};
if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) {
return E_FAIL;
}
m_strDiffuseName = szName;
}
if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strDiffuseName),
reinterpret_cast<CComponent**>(&m_pDiffuse_TextureCom))))
return E_FAIL;
}
if (m_EffectInfo.isNoise)
{
size_t iComponentLength = {};
if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) {
return E_FAIL;
}
if (iComponentLength != 0)
{
_char szName[MAX_PATH] = {};
if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) {
return E_FAIL;
}
m_strNoiseName = szName;
}
if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strNoiseName),
reinterpret_cast<CComponent**>(&m_pNoise_TextureCom))))
return E_FAIL;
}
if (m_EffectInfo.isMasking)
{
size_t iComponentLength = {};
if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) {
return E_FAIL;
}
if (iComponentLength != 0)
{
_char szName[MAX_PATH] = {};
if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) {
return E_FAIL;
}
m_strMaskingName = szName;
}
if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strMaskingName),
reinterpret_cast<CComponent**>(&m_pMasking_TextureCom))))
return E_FAIL;
}
if (m_EffectInfo.isDissolve)
{
size_t iComponentLength = {};
if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) {
return E_FAIL;
}
if (iComponentLength != 0)
{
_char szName[MAX_PATH] = {};
if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) {
return E_FAIL;
}
m_strDissolveName = szName;
}
if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strDissolveName),
reinterpret_cast<CComponent**>(&m_pDissolve_TextureCom))))
return E_FAIL;
}
if (m_EffectInfo.isEmissive)
{
size_t iComponentLength = {};
if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) {
return E_FAIL;
}
if (iComponentLength != 0)
{
_char szName[MAX_PATH] = {};
if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) {
return E_FAIL;
}
m_strEmissiveName = szName;
}
if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strEmissiveName),
reinterpret_cast<CComponent**>(&m_pEmissive_TextureCom))))
return E_FAIL;
}
if (m_EffectInfo.isDistortion)
{
size_t iComponentLength = {};
if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) {
return E_FAIL;
}
if (iComponentLength != 0)
{
_char szName[MAX_PATH] = {};
if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) {
return E_FAIL;
}
m_strDistortionName = szName;
}
if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strDistortionName),
reinterpret_cast<CComponent**>(&m_pDistortion_TextureCom))))
return E_FAIL;
}
size_t iComponentLength = {};
if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) {
return E_FAIL;
}
if (iComponentLength != 0)
{
_char szName[MAX_PATH] = {};
if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)(DWORD)iComponentLength + 1), &dwByte, nullptr)) {
return E_FAIL;
}
m_strModelName = szName;
}
if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strModelName),
reinterpret_cast<CComponent**>(&m_pInstance_ModelCom))))
return E_FAIL;;
m_pInstance_ModelCom->Load_InstanceModel(hFile);
CloseHandle(hFile);
return S_OK;
}
#endif // _DEBUG
HRESULT CEffectObject::Bind_ShaderResources()
{
@@ -337,6 +587,10 @@ HRESULT CEffectObject::Bind_ShaderResources()
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_isDistortion", &m_EffectInfo.isDistortion, sizeof(_bool)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_isDiffuseUVMove", &m_EffectInfo.isDiffuseUVMove, sizeof(_bool)))) {
return E_FAIL;
}
@@ -345,6 +599,16 @@ HRESULT CEffectObject::Bind_ShaderResources()
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_isNoiseUVMove", &m_EffectInfo.isNoiseUVMove, sizeof(_bool)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_isReverseDissolve", &m_EffectInfo.isReverseDissolve, sizeof(_bool)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_vColor", &m_EffectInfo.vColor, sizeof(_float4)))) {
return E_FAIL;
}
@@ -353,10 +617,6 @@ HRESULT CEffectObject::Bind_ShaderResources()
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_fColorOption", &m_EffectInfo.fColorOption, sizeof(_float)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_fEmissiveCutAlpha", &m_EffectInfo.fEmissiveCutAlpha, sizeof(_float)))) {
return E_FAIL;
}
@@ -373,16 +633,21 @@ HRESULT CEffectObject::Bind_ShaderResources()
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_vDiffuseNoiseUVGainAmount", &m_EffectInfo.vDiffuseNoiseUVGainAmount, sizeof(_float2)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_vMaskNoiseUVGainAmount", &m_EffectInfo.vMaskNoiseUVGainAmount, sizeof(_float2)))) {
if (FAILED(m_pShaderCom->Bind_RawValue("g_vNoiseUVGainAmount", &m_EffectInfo.vNoiseUVGainAmount, sizeof(_float2)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_vDiffuseDistortionUVGainAmount", &m_EffectInfo.vDiffuseDistortionUVGainAmount, sizeof(_float2)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_vMaskDistortionUVGainAmount", &m_EffectInfo.vMaskDistortionUVGainAmount, sizeof(_float2)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_vUVCutting", &m_EffectInfo.vUVCutting, sizeof(_float2)))) {
return E_FAIL;
}
@@ -400,12 +665,16 @@ HRESULT CEffectObject::Bind_ShaderResources()
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_iMaskNoiseMoveLerpOption", &m_EffectInfo.iMaskNoiseMoveLerpOption, sizeof(_int)))) {
if (FAILED(m_pShaderCom->Bind_RawValue("g_iMaskDistortionMoveLerpOption", &m_EffectInfo.iMaskDistortionMoveLerpOption, sizeof(_int)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_iDiffuseNoiseMoveLerpOption", &m_EffectInfo.iDiffuseNoiseMoveLerpOption, sizeof(_int)))) {
if (FAILED(m_pShaderCom->Bind_RawValue("g_iDiffuseDistortionMoveLerpOption", &m_EffectInfo.iDiffuseDistortionMoveLerpOption, sizeof(_int)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_fDiffuseAlpha", &m_EffectInfo.fDiffuseAlpha, sizeof(_float)))) {
return E_FAIL;
}
@@ -447,9 +716,13 @@ HRESULT CEffectObject::Bind_ShaderResources()
}
}
if (m_pDistortion_TextureCom != nullptr)
{
if (FAILED(m_pDistortion_TextureCom->Bind_ShaderResource(m_pShaderCom, "g_DistortionTexture", 0))) {
return E_FAIL;
}
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
return E_FAIL;
}
@@ -498,6 +771,7 @@ void CEffectObject::Free()
SAFE_RELEASE(m_pMasking_TextureCom);
SAFE_RELEASE(m_pDissolve_TextureCom);
SAFE_RELEASE(m_pEmissive_TextureCom);
SAFE_RELEASE(m_pDistortion_TextureCom);
SAFE_RELEASE(m_pShaderCom);
SAFE_RELEASE(m_pInstance_ModelCom);
@@ -23,7 +23,8 @@ HRESULT CEffect_Editor::Initialize_Prototype()
{
ReadMaterials("../Bin/Resources/VFX/Particles/Magic/Protego");
ReadMaterials("../Bin/Resources/VFX/Particles/Magic/Confringo");
for (auto iter : m_MatFiles)
@@ -33,7 +34,7 @@ HRESULT CEffect_Editor::Initialize_Prototype()
{
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::EFFECT), vec_iter.first,
CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, vec_iter.second.c_str(), 0, vec_iter.first)))) {
return E_FAIL;
continue;
}
}
@@ -104,6 +105,61 @@ HRESULT CEffect_Editor::Ready_Child()
return S_OK;
}
HRESULT CEffect_Editor::ReSaveFile(const _char* pDirectoryPath)
{
_uint iIndex = {};
for (const auto& file : filesystem::directory_iterator(pDirectoryPath))
{
if (file.is_directory())
continue;
string ext = file.path().extension().string();
if (strcmp(ext.c_str(),".bin"))
continue;
_char szFilePath[MAX_PATH] = {};
strcpy_s(szFilePath, MAX_PATH, file.path().string().c_str());
/////////////////////////////
CEditEffect* pEditEffect = nullptr;
CPartObject::PARTOBJECT_DESC PartsDesc{};
PartsDesc.pParentTransform = m_pTransformCom;
if (FAILED(Add_PartObject<CEditEffect>("ReSaveFile" + iIndex++ , ENUM_CLASS(LEVEL::EFFECT), &pEditEffect, &PartsDesc)))
return E_FAIL;
if (FAILED(pEditEffect->LoadPre(szFilePath, LEVEL::EFFECT)))
{
Safe_Release(pEditEffect);
continue;
}
_string strPath = szFilePath;
size_t iPos;
while ((iPos = strPath.find(ext)) != std::string::npos) {
strPath.erase(iPos, ext.length());
};
pEditEffect->Save_Effect(strPath.c_str());
Safe_Release(pEditEffect);
}
return S_OK;
}
void CEffect_Editor::ReadMaterials(const char* pDirectoryName)
{
for (const auto& file : filesystem::directory_iterator(pDirectoryName))
@@ -283,8 +339,12 @@ _string CEffect_Editor::Reference_Mat_For_EditEffect(CComponent** pTexture, CGam
, wstrTextureInfo.first // 이름
);
if(strName != "")
if (strName != "")
{
GUI::TreePop();
return strName;
}
};
@@ -374,6 +434,11 @@ void CEffect_Editor::Describe_Entity()
{
Load_Edit(m_strSavePath.c_str());
}
if (GUI::Button("RESAVE"))
{
ReSaveFile(m_strSavePath.c_str());
}
ImGui::End();
+10
View File
@@ -475,6 +475,16 @@ HRESULT CLoader::Loading_For_Effect()
});
Asset_FileLoad("../Bin/Resources/Models/Effect/Goo", L"Prototype_Instance_Model_", [&](_wstring wstrFileName, const _char* pFilePath) {
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::EFFECT), wstrFileName,
CInstance_Model::Create(m_pDevice, m_pContext, pFilePath, MODEL::NONANIM, XMMatrixScaling(0.1f, 0.1f, 0.1f) * XMMatrixIdentity(), 0))))
return E_FAIL;
return S_OK;
});
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Desc_Box"),
CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Box/Box.bin", XMMatrixIdentity()))))
return E_FAIL;
+69 -7
View File
@@ -21,17 +21,21 @@ class CEffectObject abstract : public CPartObject
_float2 vDiffuseUVGainAmount = {};
_float2 vMaskingUVGainAmount = {};
_float2 vNoiseUVGainAmount = {};
_float2 vDiffuseNoiseUVGainAmount = {};
_float2 vMaskNoiseUVGainAmount = {};
_float2 vDiffuseDistortionUVGainAmount = {};
_float2 vMaskDistortionUVGainAmount = {};
_float2 vUVCutting = { 1.f ,1.f };
_float2 vUVMaskCutting = { 1.f ,1.f };
_int iMaskMoveLerpOption = { 0 };
_int iDiffuseMoveLerpOption = { 0 };
_int iMaskNoiseMoveLerpOption = { 0 };
_int iDiffuseNoiseMoveLerpOption = { 0 };
_int iNoiseMoveLerpOption = { 0 };
_int iMaskDistortionMoveLerpOption = { 0 };
_int iDiffuseDistortionMoveLerpOption = { 0 };
_int iBlurWeight = { 0 };
@@ -40,14 +44,15 @@ class CEffectObject abstract : public CPartObject
_bool isDissolve = {};
_bool isNoise = {};
_bool isEmissive = {};
_bool isDistortion = {};
_bool isDiffuseUVMove = {};
_bool isNoiseUVMove = {};
_bool isMaskUVMove = {};
_bool isBlur = {};
_bool isBillboard = {};
_float4 vEmissive = { 0.f ,0.f ,0.f ,0.f };
_float fColorOption = {};
_float fDiffuseAlpha = { 1.f };
_float fBlurIntensity = {};
_float fNoiseDistortionIntensity = {};
_float fEmissiveCutAlpha = {};
@@ -55,8 +60,57 @@ class CEffectObject abstract : public CPartObject
LIGHT_DESC LightDesc = {};
RENDER eRenderOrder = { RENDER::EFFECT };
_bool isReverseDissolve = {};
}EFFECT_INFO;
typedef struct tagPreEffectInfo
{
_float4 vColor = { 0.f ,0.f ,0.f ,1.f };
_float2 vDiffuseUVGainAmount = {};
_float2 vMaskingUVGainAmount = {};
_float2 vNoiseUVGainAmount = {};
_float2 vDiffuseDistortionUVGainAmount = {};
_float2 vMaskDistortionUVGainAmount = {};
_float2 vUVCutting = { 1.f ,1.f };
_float2 vUVMaskCutting = { 1.f ,1.f };
_int iMaskMoveLerpOption = { 0 };
_int iDiffuseMoveLerpOption = { 0 };
_int iNoiseMoveLerpOption = { 0 };
_int iMaskDistortionMoveLerpOption = { 0 };
_int iDiffuseDistortionMoveLerpOption = { 0 };
_int iBlurWeight = { 0 };
_bool isDiffuse = {};
_bool isMasking = {};
_bool isDissolve = {};
_bool isNoise = {};
_bool isEmissive = {};
_bool isDistortion = {};
_bool isDiffuseUVMove = {};
_bool isNoiseUVMove = {};
_bool isMaskUVMove = {};
_bool isBlur = {};
_bool isBillboard = {};
_float4 vEmissive = { 0.f ,0.f ,0.f ,0.f };
_float fDiffuseAlpha = { 1.f };
_float fBlurIntensity = {};
_float fNoiseDistortionIntensity = {};
_float fEmissiveCutAlpha = {};
LIGHT_DESC LightDesc = {};
RENDER eRenderOrder = { RENDER::EFFECT };
}PRE_EFFECT_INFO;
protected:
CEffectObject(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
CEffectObject(const CEffectObject& rhs);
@@ -70,6 +124,13 @@ class CEffectObject abstract : public CPartObject
virtual HRESULT Render_Blur() override;
public:
HRESULT Load(const _char* pFilePath, LEVEL eLevel);
public:
#ifdef _DEBUG
HRESULT LoadPre(const _char* pFilePath, LEVEL eLevel);
#endif // DEBUG
protected:
virtual HRESULT Bind_ShaderResources() override;
virtual HRESULT Ready_Components(void* pArg) override;
@@ -82,6 +143,7 @@ class CEffectObject abstract : public CPartObject
CTexture* m_pMasking_TextureCom = { nullptr };
CTexture* m_pDissolve_TextureCom = { nullptr };
CTexture* m_pEmissive_TextureCom = { nullptr };
CTexture* m_pDistortion_TextureCom = { nullptr };
CShader* m_pShaderCom = { nullptr };
CLight* m_pLightCom = { nullptr };
@@ -96,7 +158,7 @@ class CEffectObject abstract : public CPartObject
_string m_strDissolveName = {};
_string m_strModelName = {};
_string m_strEmissiveName = {};
_string m_strDistortionName = {};
public:
virtual void Free() override;
@@ -33,6 +33,7 @@ class CEffect_Editor final : public CContainerObject
HRESULT Ready_Child();
HRESULT Bind_ShaderResources() override;
private:
HRESULT ReSaveFile(const _char* pDirectoryPath);
void ReadMaterials(const char* pDirectoryName);
void ReadMaterial(_wstring wstrFileName, const char* pFilePath);
@@ -194,8 +194,8 @@ BlendState BS_WeightBlend
BlendEnable[7] = true;
SrcBlend[0] = Inv_Src_Alpha;
DestBlend[0] = Src_Alpha;
SrcBlend[0] = Src_Alpha;
DestBlend[0] = Inv_Src_Alpha;
BlendOp[0] = Add;
@@ -57,31 +57,9 @@ PS_OUT_BACKBUFFER PS_OUT_LASTCOLOR(PS_IN In)
discard;
}
int iOption = vColorTexture.a * 10;
Out.vBackBuffer = vColorTexture;
switch (iOption)
{
case 1:
Out.vBackBuffer.rgb /= vColorTexture.rgb;
break;
case 2:
Out.vBackBuffer.rgb += vColorTexture.rgb;
break;
case 3:
Out.vBackBuffer.rgb -= vColorTexture.rgb;
break;
case 4:
Out.vBackBuffer.rgb *= vColorTexture.rgb;
break;
case 5:
Out.vBackBuffer.rgb = vColorTexture.rgb;
break;
default:
break;
}
return Out;
}
@@ -21,10 +21,13 @@ struct ParticleValue
float2 vMaskingUVMoveTime;
float2 vDiffuseUVMoveTime;
float2 vDistortionUVMoveTime;
float2 vNoiseUVMoveTime;
float2 vAniTime;
float2 vAniIndex;
};
@@ -48,14 +48,21 @@ PS_OUT PS_MAIN(PS_IN In)
{
PS_OUT Out;
vector vMixedDiffuse = g_MixedDiffuseTexture.Sample(PointSampler, In.vTexcoord);
vector vRevealage = g_RevealageTexture.Sample(PointSampler, In.vTexcoord);
float fRevealage = g_RevealageTexture.Sample(PointSampler, In.vTexcoord);
if(vRevealage.b >= 1.f)
discard;
Out.vBackBuffer = vector(vMixedDiffuse.rgb / fRevealage , fRevealage);
//float fClamp;
//fClamp = clamp(vMixedDiffuse.a, 1e-4, 5e4);
//Out.vBackBuffer = vector(vMixedDiffuse.rgb / fClamp, fRevealage);
Out.vBackBuffer = vector(vMixedDiffuse.rgb / max(vMixedDiffuse.a, 1e-5), 1 - vRevealage.r);
return Out;
}
@@ -540,6 +540,12 @@ void CInstance_Model::Describe_Entity()
Instane_Buffer_ReStruct();
}
if (ImGui::DragFloat2("DistortionUVMoveTime", reinterpret_cast<_float*>(&m_InstanceDesc.vDistortionUVMoveTime)))
{
Instane_Buffer_ReStruct();
}
if (ImGui::DragFloat2("NoiseUVMoveTime", reinterpret_cast<_float*>(&m_InstanceDesc.vNoiseUVMoveTime)))
{
Instane_Buffer_ReStruct();
+4 -3
View File
@@ -26,6 +26,7 @@ HRESULT CRenderer::Add_RenderGroup(RENDER eRenderGroup, CGameObject* pRenderObje
if (RENDER::UI == eRenderGroup || RENDER::PRIORITY == eRenderGroup /* || RENDER::SHADOW == eRenderGroup*/ || RENDER::BLUR == eRenderGroup) {
bPossible = true;
}
bPossible = true;
if (true == bPossible) {
m_RenderObjects[ENUM_CLASS(eRenderGroup)].push_back(pRenderObject);
@@ -72,7 +73,7 @@ void CRenderer::Render()
#ifdef _DEBUG
m_pGameInstance->RenderTarget_Debuger();
if(m_pGameInstance->Key_Pressing(DIK_F10))
Render_Debug();
#endif
@@ -587,14 +588,14 @@ HRESULT CRenderer::Initialize()
/*WB_COLOR*/
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_WB_Color"), (_uint)Viewport.Width, (_uint)Viewport.Height,
DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 1.0f)))) {
DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 0.0f)))) {
return E_FAIL;
}
/* WB_A*/
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_WB_Revealage"), (_uint)Viewport.Width, (_uint)Viewport.Height,
DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(1.0f, 1.0f, 1.0f, 1.0f)))) {
DXGI_FORMAT_R16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 0.0f)))) {
return E_FAIL;
}
@@ -26,6 +26,7 @@ class ENGINE_DLL CInstance_Model final : public CComponent
_float2 vMaskingUVMoveTime = { 1.f, 1.f };
_float2 vDiffuseUVMoveTime = { 1.f, 1.f };
_float2 vDistortionUVMoveTime = { 1.f , 1.f };
_float2 vNoiseUVMoveTime = { 1.f ,1.f };
_float2 vAniTime = { 1.f , 1.f };
_float2 vAniIndex = {};
@@ -60,6 +61,7 @@ class ENGINE_DLL CInstance_Model final : public CComponent
_float2 vMaskingUVMoveTime = {};
_float2 vDiffuseUVMoveTime = {};
_float2 vDistortionUVMoveTime = {};
_float2 vNoiseUVMoveTime = {};
_float2 vAniTime = {};