52 lines
1.3 KiB
HLSL
52 lines
1.3 KiB
HLSL
|
|
// glow 효과
|
|
#define MAX_SAMPLES 15
|
|
float2 g_avSampleOffsets[MAX_SAMPLES];
|
|
float4 g_avSampleWeights[MAX_SAMPLES];
|
|
// Glow 효과에 사용하는 텍스처 리스트
|
|
sampler g_s0 : register(s0) = sampler_state
|
|
{
|
|
MinFilter = LINEAR;
|
|
MagFilter = LINEAR;
|
|
MipFilter = NONE;
|
|
AddressU = Clamp;
|
|
AddressV = Clamp;
|
|
};
|
|
sampler g_s1 : register(s1);
|
|
sampler g_s2 : register(s2);
|
|
sampler g_s3 : register(s3);
|
|
sampler g_s4 : register(s4);
|
|
sampler g_s5 : register(s5);
|
|
sampler g_s6 : register(s6);
|
|
sampler g_s7 : register(s7);
|
|
|
|
float4 color_average = { 0.3333, 0.3333, 0.3333, 0 };
|
|
//=============================================================================
|
|
//Glow 효과 pixel shader
|
|
float4 Glow_PS( in float2 vScreenPosition : TEXCOORD0 ) : COLOR
|
|
{
|
|
float4 vSample = 0.0f;
|
|
float4 vColor = 0.0f;
|
|
|
|
float2 vSamplePosition = vScreenPosition;
|
|
|
|
// Perform a one-directional gaussian blur
|
|
for(int iSample = 0; iSample < MAX_SAMPLES; iSample++)
|
|
{
|
|
vSamplePosition += g_avSampleOffsets[iSample];
|
|
vColor = tex2D(g_s0, vSamplePosition);
|
|
vColor = dot(vColor, color_average);
|
|
vSample += g_avSampleWeights[iSample]*vColor;
|
|
}
|
|
|
|
return vSample;
|
|
}
|
|
|
|
technique GlowScreenTech
|
|
{
|
|
pass P0
|
|
{
|
|
VertexShader = NULL;
|
|
PixelShader = compile ps_2_0 Glow_PS();
|
|
}
|
|
} |