port from perforce

This commit is contained in:
2026-04-18 22:31:51 +02:00
commit 8d0ab5b7cc
8409 changed files with 3972376 additions and 0 deletions

View File

@@ -0,0 +1,101 @@
K 25
svn:wc:ra_dav:version-url
V 36
/svn/64k/!svn/ver/228/trunk/ev10/cfg
END
pswall.txt
K 25
svn:wc:ra_dav:version-url
V 47
/svn/64k/!svn/ver/228/trunk/ev10/cfg/pswall.txt
END
psao.txt
K 25
svn:wc:ra_dav:version-url
V 45
/svn/64k/!svn/ver/228/trunk/ev10/cfg/psao.txt
END
psrainbow.txt
K 25
svn:wc:ra_dav:version-url
V 50
/svn/64k/!svn/ver/228/trunk/ev10/cfg/psrainbow.txt
END
psdepth.txt
K 25
svn:wc:ra_dav:version-url
V 48
/svn/64k/!svn/ver/228/trunk/ev10/cfg/psdepth.txt
END
psblur.txt
K 25
svn:wc:ra_dav:version-url
V 47
/svn/64k/!svn/ver/228/trunk/ev10/cfg/psblur.txt
END
pssky.txt
K 25
svn:wc:ra_dav:version-url
V 46
/svn/64k/!svn/ver/228/trunk/ev10/cfg/pssky.txt
END
pstarmac.txt
K 25
svn:wc:ra_dav:version-url
V 49
/svn/64k/!svn/ver/228/trunk/ev10/cfg/pstarmac.txt
END
psdof.txt
K 25
svn:wc:ra_dav:version-url
V 46
/svn/64k/!svn/ver/228/trunk/ev10/cfg/psdof.txt
END
psphong.txt
K 25
svn:wc:ra_dav:version-url
V 48
/svn/64k/!svn/ver/228/trunk/ev10/cfg/psphong.txt
END
vssky.txt
K 25
svn:wc:ra_dav:version-url
V 46
/svn/64k/!svn/ver/228/trunk/ev10/cfg/vssky.txt
END
psgrass.txt
K 25
svn:wc:ra_dav:version-url
V 48
/svn/64k/!svn/ver/228/trunk/ev10/cfg/psgrass.txt
END
pspssm.txt
K 25
svn:wc:ra_dav:version-url
V 47
/svn/64k/!svn/ver/228/trunk/ev10/cfg/pspssm.txt
END
vsgeneral.txt
K 25
svn:wc:ra_dav:version-url
V 50
/svn/64k/!svn/ver/228/trunk/ev10/cfg/vsgeneral.txt
END
pstext.txt
K 25
svn:wc:ra_dav:version-url
V 47
/svn/64k/!svn/ver/228/trunk/ev10/cfg/pstext.txt
END
vsfsquad.txt
K 25
svn:wc:ra_dav:version-url
V 49
/svn/64k/!svn/ver/228/trunk/ev10/cfg/vsfsquad.txt
END
psray.txt
K 25
svn:wc:ra_dav:version-url
V 46
/svn/64k/!svn/ver/228/trunk/ev10/cfg/psray.txt
END

View File

@@ -0,0 +1,579 @@
9
dir
230
http://svn.xp-dev.com/svn/64k/trunk/ev10/cfg
http://svn.xp-dev.com/svn/64k
2010-04-27T20:33:45.185231Z
228
TGGC
svn:special svn:externals svn:needs-lock
e3c53db8-d867-4aff-9ce2-c1b2cf7253df
0
psao.txt
file
2010-03-26T12:17:46.501700Z
a8b7e40883c33edad4ed01a6eaedf9e2
2010-04-27T20:33:45.185231Z
228
TGGC
5220
pswall.txt
file
2010-03-31T15:36:34.908846Z
08899156eed95b0bf5e47371baeeef64
2010-04-27T20:33:45.185231Z
228
TGGC
2970
psrainbow.txt
file
2010-03-26T16:54:29.558855Z
c27c40c388f12562b92f264172b36b70
2010-04-27T20:33:45.185231Z
228
TGGC
1215
psblur.txt
file
2010-03-28T10:43:11.888060Z
221dfd0d72437edef56f2622f6496043
2010-04-27T20:33:45.185231Z
228
TGGC
1763
psdepth.txt
file
2010-03-23T08:43:47.226617Z
714f28018d1af00cf1437d78bfeb4094
2010-04-27T20:33:45.185231Z
228
TGGC
62
pssky.txt
file
2010-04-01T09:57:57.206928Z
404aed7642e4a6f218d775156cb23317
2010-04-27T20:33:45.185231Z
228
TGGC
3026
pstarmac.txt
file
2010-03-23T09:24:52.037003Z
1569e7a92068ae3b8db82034d7ecc519
2010-04-27T20:33:45.185231Z
228
TGGC
3085
psdof.txt
file
2010-03-31T12:36:41.787053Z
d4efc1a62ee9481891ae87dd7f6efd48
2010-04-27T20:33:45.185231Z
228
TGGC
3385
psphong.txt
file
2010-03-26T12:17:46.501700Z
3cd3752906d51653c8f6a16cdb968f9e
2010-04-27T20:33:45.185231Z
228
TGGC
1114
vssky.txt
file
2010-03-31T17:36:07.577578Z
e88d358090811c9ec8d364dd5a48f7ee
2010-04-27T20:33:45.185231Z
228
TGGC
357
psgrass.txt
file
2010-03-26T16:54:29.558855Z
77ac7c3f7d2f5754b334fa5137e38262
2010-04-27T20:33:45.185231Z
228
TGGC
2373
pspssm.txt
file
2010-03-24T12:51:15.250282Z
9128223739d5ff46d278cde4e0efba52
2010-04-27T20:33:45.185231Z
228
TGGC
4034
vsgeneral.txt
file
2010-03-23T09:24:52.037003Z
fb170316c9d94c8d4294433ca8f60348
2010-04-27T20:33:45.185231Z
228
TGGC
1156
pstext.txt
file
2010-03-23T09:24:52.037003Z
b551c1670266314e5b1c1c4398a0b44f
2010-04-27T20:33:45.185231Z
228
TGGC
1147
vsfsquad.txt
file
2010-03-30T16:08:59.911029Z
7bc554de6a5c2682889d5ee85b86a48a
2010-04-27T20:33:45.185231Z
228
TGGC
866
psray.txt
file
2010-03-30T09:57:35.106943Z
b0bfa22a3603a7087cbb19eda2f44491
2010-04-27T20:33:45.185231Z
228
TGGC
1565

View File

@@ -0,0 +1 @@
9

View File

@@ -0,0 +1,147 @@
float4 res : register(c0);
sampler2D colorSampler : register(s0);
sampler2D depthSampler : register(s1);
sampler2D ditherSampler : register(s2);
static float g_fRadiusBase = 0.005f;
static float g_fRadiusScale = 0.25f;
static float g_fFallOff = 0.7f;
static float g_fIntensity = 1.25f;
static float g_fGrain = 0.01f;
static float g_fRange = 1024.0f;
static float g_fBlurSensitivity = 250.f;
static const float3 vSamplePoints[12] = {
float3(0.083333f, 0.000000f, 0.083333f),
float3(-0.144338f, -0.083333f, 0.166667f),
float3(0.125000f, 0.216506f, 0.250000f),
float3(0.000000f, -0.333333f, 0.333333f),
float3(-0.208333f, 0.360844f, 0.416667f),
float3(0.433013f, -0.250000f, 0.500000f),
float3(-0.583333f, -0.000000f, 0.583333f),
float3(0.577350f, 0.333333f, 0.666667f),
float3(-0.375000f, -0.649519f, 0.750000f),
float3(-0.000000f, 0.833333f, 0.833333f),
float3(0.458333f, -0.793857f, 0.916667f),
float3(-0.866025f, 0.500000f, 1.000000f)
};
float4 ps_main(float2 TexCoord : TEXCOORD0) : COLOR0
{
// Sample random 2D matrix
float4 vRotation = tex2D(ditherSampler, TexCoord * res.xy / 32.0f) * 2.0f - 1.0f;
float2x2 mRotation = float2x2(vRotation.xy, vRotation.zw);
// Sample pixel depth
float fDepth = tex2D(depthSampler, TexCoord).x;
// Transform radius to screen space
float3 fScaledRadius = g_fRadiusBase + g_fRadiusScale / ( 8.0f + fDepth );
// Limit radius to reasonable sampling kernels
fScaledRadius = clamp(fScaledRadius, 4.0f * res.z, 64.0f * res.w);
// Transform sampling vector length back to world space
fScaledRadius.z *= fDepth;
float fOcclusion = 0.0f;
float fSampleWeight = 1.f / 18.849556f; // atan version
// float fSampleWeight = 1.f / 12.f;
// Loop over samples
for(int i = 0; i < 12; )
{
float4 fSampleDepth, fSampleRadius;
// Vectorize occlusion code
[unroll] for(int j = 0; j < 4; j++, i++)
{
// Randomly rotate scaled sample points
float3 vSampleOffset = fScaledRadius * vSamplePoints[i];
vSampleOffset.xy = mul(vSampleOffset.xy, mRotation);
// Sample depth texture
fSampleDepth[j] = tex2D(depthSampler, TexCoord + vSampleOffset.xy).x;
fSampleRadius[j] = vSampleOffset.z;
}
// Compute occlusion
float4 fDeltaDepth = (fDepth - fSampleDepth) / fSampleRadius;
float4 fAttenuation = g_fFallOff * fDeltaDepth;
float4 fBlocking = atan(fDeltaDepth) / (1.0f + max(0.0f, fAttenuation)); // atan version
// float4 fBlocking = fDeltaDepth / ( (1.0f + abs(fDeltaDepth)) * (1.0f + max(0.0f, fAttenuation)) );
fOcclusion += dot(fBlocking, fSampleWeight);
}
// Avoid ugly smudge artifacts
float2 fPixelPos = TexCoord * 2.0f - 1.0f;
float fBorderAttenuation = 1.0f - 0.7071f * dot(fPixelPos, fPixelPos);
// Write to intermediate buffer
float fAO = saturate(g_fIntensity * fOcclusion + g_fGrain) * fBorderAttenuation * step(fDepth, g_fRange);
return float4((float3)fAO, 0.f);
}
float4 ps_blur(float2 TexCoord, uniform bool bVertical)
{
float2 fStepSize = float2(1.f, bVertical ? -1.f : 1.f) * res.zw;
float3 fCenterDepths;
// Fetch 3 center depths
fCenterDepths.x = tex2D(depthSampler, TexCoord - fStepSize).x;
fCenterDepths.y = tex2D(depthSampler, TexCoord).x;
fCenterDepths.z = tex2D(depthSampler, TexCoord + fStepSize).x;
float3 fDepthContinuities, fDepthDeltas;
// Compute 3 depth continuity values
fDepthContinuities.x = tex2D(depthSampler, TexCoord - 2.0f * fStepSize).x;
fDepthContinuities.y = fCenterDepths.x;
fDepthContinuities.z = tex2D(depthSampler, TexCoord + 2.0f * fStepSize).x;
fDepthDeltas = fDepthContinuities - fCenterDepths.yzy;
fDepthContinuities += fCenterDepths.yzy - 2.0f * fCenterDepths;
// Correct AA issues
fDepthContinuities = abs(fDepthContinuities);
fDepthDeltas = abs(fDepthDeltas);
fDepthDeltas -= min(min(fDepthDeltas.x, fDepthDeltas.y), fDepthDeltas.z);
// Compute 3 weights
float3 fWeights = 1.0f / (1.0f + g_fBlurSensitivity * (fDepthContinuities + 16.f * fDepthDeltas));
float fOutput = 0.0f;
float3 fSamples;
float3 fSampleWeights = float3(3.0f, 1.5f, 1.0f);
// Blend 5 color samples respecting to the 3 depth continuity weights
fSamples.x = tex2D(colorSampler, TexCoord - 2.0f * fStepSize).x;
fSamples.y = tex2D(colorSampler, TexCoord - fStepSize).x;
fSamples.z = tex2D(colorSampler, TexCoord).x;
fOutput += dot(fSamples, fWeights.x);
fSamples.x = tex2D(colorSampler, TexCoord + fStepSize).x;
fOutput += dot(fSamples, fWeights.y);
fSamples.y = tex2D(colorSampler, TexCoord + 2.0f * fStepSize).x;
fOutput += dot(fSamples, fWeights.z);
// Average output weight
float fOutputWeight = dot(fWeights, 1.0f);
// Average output
fOutput /= 3.0f * fOutputWeight;
// Correction weight
float fCorrectionWeight = saturate(1.0f - fOutputWeight);
// Write to color buffer
fOutput = (1.0f - fCorrectionWeight) * fOutput + fCorrectionWeight * fSamples.z;
return float4((float3)fOutput, 0.f);
}
float4 ps_blur_hor(float2 TexCoord : TEXCOORD0) : COLOR0 { return ps_blur(TexCoord, false); }
float4 ps_blur_ver(float2 TexCoord : TEXCOORD0) : COLOR0 { return ps_blur(TexCoord, true); }

View File

@@ -0,0 +1,59 @@
float4 res : register(c0);
float4 glow : register(c31);
sampler2D colorSampler : register(s0);
sampler2D guideSampler : register(s4);
static float2 fGaussianWeights[] = {
float2(-3.0f, 0.015625f),
float2(-2.0f, 0.09375f),
float2(-1.0f, 0.234375f),
float2(0.0f, 0.3125f),
float2(1.0f, 0.234375f),
float2(2.0f, 0.09375f),
float2(3.0f, 0.015625f)
};
float4 ps_blur(float2 t : TEXCOORD0, uniform float2 vDir) : COLOR0
{
float2 vDelta = vDir * res.zw;
float4 fColor = 0.f;
for(int i = 0; i < 7; i++)
fColor += fGaussianWeights[i].y
* tex2D(colorSampler, t + fGaussianWeights[i].x * vDelta);
return fColor;
}
float4 ps_blur_hor(float2 t : TEXCOORD0) : COLOR0 { return ps_blur(t, float2(1.f, 0.f)); }
float4 ps_blur_ver(float2 t : TEXCOORD0) : COLOR0 { return ps_blur(t, float2(0.f, 1.f)); }
float4 ps_blur_bil(float2 t : TEXCOORD0, uniform float2 vDir) : COLOR0
{
float2 vDelta = vDir * res.zw;
float4 fGuide = tex2D(guideSampler, t);
float4 fColor = 0.f;
float fWeight = 0.f;
for(int i = 0; i < 7; i++)
{
float2 to = t + vDelta * fGaussianWeights[i].x;
float4 fSample = tex2D(colorSampler, to);
float fSampleWeight = (1.f - saturate(4.f * (fGuide.w - fSample.w))) * fGaussianWeights[i].y;
fColor += fSample * fSampleWeight;
fWeight += fSampleWeight;
}
return lerp(fGuide, fColor / fWeight, fWeight);
}
float4 ps_blur_bil_hor(float2 t : TEXCOORD0) : COLOR0 { return ps_blur_bil(t, float2(1.f, 0.f)); }
float4 ps_blur_bil_ver(float2 t : TEXCOORD0) : COLOR0 { return ps_blur_bil(t, float2(0.f, 1.f)); }
float4 ps_extract_inv_alpha(float2 t : TEXCOORD0) : COLOR0
{
float4 c = tex2D(colorSampler, t);
c.a = 1.f - c.a;
c.xyz *= c.a;
return c * glow;
}

View File

@@ -0,0 +1,4 @@
float4 ps_main(float4 s : TEXCOORD3):color
{
return s.z;
}

View File

@@ -0,0 +1,105 @@
float4 res : register(c0);
float2 Dist : register(c3);
sampler2D colorSampler : register(s0);
sampler2D depthSampler : register(s1);
sampler2D blurSampler : register(s4);
// Tweakables
static float g_fRadius = 0.005f;
static float g_fLowRadiusScaling = 0.4f;
static float g_fNearPlane = 1.0f;
static float g_fFocalPlane = Dist.y;
static float g_fDistScale = 1.0f / pow( g_fFocalPlane , 2.5f );
static float g_fFarPlane= 128.0f;
static const float2 vPoissonDisc[] = {
float2(-0.326212f, -0.40581f),
float2(-0.840144f, -0.07358f),
float2(-0.695914f, 0.457137f),
float2(-0.203345f, 0.620716f),
float2(0.96234f, -0.194983f),
float2(0.473434f, -0.480026f),
float2(0.519456f, 0.767022f),
float2(0.185461f, -0.893124f),
float2(0.507431f, 0.064425f),
float2(0.89642f, 0.412458f),
float2(-0.32194f, -0.932615f),
float2(-0.791559f, -0.59771f)
};
float4 ps_blur_intensity(float2 TexCoord : TEXCOORD0) : COLOR0
{
// Sample pixel depth
float fDepth = tex2D(depthSampler, TexCoord).x;
// Anti-aliasing
float4 fDDTexCoords1 = TexCoord.xyxy, fDDTexCoords2 = TexCoord.xyxy;
fDDTexCoords1.zw -= res.zw; fDDTexCoords2.zw += res.zw;
float4 fDDDepth4 = fDepth - float4(
tex2D(depthSampler, fDDTexCoords1.zy).x, tex2D(depthSampler, fDDTexCoords1.xw).x,
tex2D(depthSampler, fDDTexCoords2.zy).x, tex2D(depthSampler, fDDTexCoords2.xw).x );
// fDDDepth4 = lerp(fDDDepth4, abs(fDDDepth4), (fDDDepth4 * fDDDepth4.zwxy) > 0.f);
float2 fDeltaDepth2 = max(fDDDepth4.xy, fDDDepth4.zw);
float fDeltaDepth = max(fDeltaDepth2.x, fDeltaDepth2.y);
float fIntensity;
if(fDepth < g_fFocalPlane)
{
// Close-up blur
fIntensity = (fDepth - g_fFocalPlane) / (g_fFocalPlane - g_fNearPlane);
}
else
{
// Distance blur
float2 fDistances = (fDepth - g_fFocalPlane);
fDistances.y -= max(fDeltaDepth, 0.f);
float2 fIntensities = saturate(fDistances * g_fDistScale );
fIntensity = lerp(fIntensities.y, fIntensities.x, fIntensities.y);
}
// Bias to valid range
return float4(
tex2D(colorSampler, TexCoord).xyz,
saturate(0.5f + 0.5f * fIntensity) );
}
float4 ps_main(float2 TexCoord : TEXCOORD0) : COLOR0
{
// Center pixel depth
float fDepth = tex2D(colorSampler, TexCoord).w;
// Scale sampling radius
float fRadius = abs(2.0f * g_fRadius * fDepth - g_fRadius);
float fLowRadius = fRadius * g_fLowRadiusScaling;
float4 fColor = 0.0f;
float fAmount = 0.0f;
// Loop over samples
for(int i = 0; i < 12; i++)
{
// Sample on poisson disc
float2 fHighSampleTexCoord = TexCoord + fRadius * vPoissonDisc[i];
float2 fLowSampleTexCoord = TexCoord + fLowRadius * vPoissonDisc[i];
// Sample blurred and unblurred texture
float4 fHighSample = tex2D(colorSampler, fHighSampleTexCoord);
float4 fLowSample = tex2D(blurSampler, fLowSampleTexCoord);
// Blend between blurred and unblurred texture
float fSampleBlurIntensity = abs(2.f * fHighSample.w - 1.f);
// * saturate(1.f - 3.f * (fHighSample.w - fLowSample.w));
float4 fSample = lerp(fHighSample, fLowSample, fSampleBlurIntensity);
// Compute smart weight to avoid cross-edge leaking
float fWeight = fSample.w < fDepth ? abs(2.f * fSample.w - 1.f) : 1.f;
// Sum up
fColor += fSample * fWeight;
fAmount += fWeight;
}
return fColor / fAmount;
}

View File

@@ -0,0 +1,80 @@
float4 g_fResolution : register(c0);
float3 g_vLightDir : register(c1);
sampler2D randomSampler : register(s0);
sampler1D diffSampler : register(s2);
sampler2D shadowSampler : register(s4);
sampler2D depthSampler : register(s5);
static float3 g_fColor = float3(0.45f, 0.5f, 0.18f); // float3(.2f, .5f, .1f);
static float g_fTexScale = .25f;
static float g_fDensity = 3.f;
static float2 g_fInnerOuterRadiusSq = float2(240.f * 240.f, 380.f * 380.f);
static float4 g_fHaze = float4(0.765f, 0.808f, 0.871f, -0.3f);
static float2 g_fHazeDensityIntensity = float2(0.25f, 0.6f);
struct psIn
{
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
float noise(float2 t)
{
float4 r = tex2D(randomSampler, .03125f * t);
float lr = dot(r, float4(1.f, 10.f, 100.f, 1000.f));
return lr * 2.f / 1111.f - 1.f;
}
float abs_noise(float2 t) { return abs( noise(t) ); }
float4 ps_main(psIn i):color
{
float2 t = i.w.xz * g_fTexScale;
float fCenterDist = dot(i.w.xz, i.w.xz) - g_fInnerOuterRadiusSq.x;
fCenterDist /= g_fInnerOuterRadiusSq.y - g_fInnerOuterRadiusSq.x;
// Texturing
float4 fColor = abs_noise(t) / 2.f;
fColor.xyz = 0.5f + 0.1f * fColor.xyz;
fColor.zw += noise(2.f * t) / float2(32.f, 4.f);
fColor.xw += noise(4.f * t) / float2(64.f, 8.f);
fColor.yw += noise(8.f * t) / float2(16.f, 16.f);
fColor.xyz += noise(16.f * t) / 16.f;
fColor.xyz += noise(32.f * t) / 32.f;
fColor.xyz += noise(128.f * t) / 32.f;
fColor.xyz += noise(1024.f * t) / 32.f;
// Color
fColor.xyz *= 2.f * fColor.xyz;
fColor.xyz *= g_fColor;
// Density
fColor.w = saturate(g_fDensity * fColor.w + fCenterDist);
// Shadow (AA)
float2 sc = i.s.xy / i.s.w;
float aa = abs( tex2D(depthSampler, sc).x - i.s.z );
float2 ddaa = float2(ddx(aa), ddy(aa));
float2 aaetc = sign(-ddaa) * g_fResolution.zw;
sc += aaetc * saturate(4.f * aa);
float fShadow = 0.2f + 0.8f * (float)tex2D(shadowSampler, sc);
// Diffuse light
fColor.xyz *= tex1D( diffSampler, fShadow * (0.5f + 0.5f * dot(normalize(i.n), -g_vLightDir)) ).xyz;
// Haze
fColor.xyz = lerp( fColor.xyz, g_fHaze,
saturate(g_fHazeDensityIntensity.x * fCenterDist) * g_fHazeDensityIntensity.y );
// Premultiplied alpha
fColor.xyz *= fColor.a;
return fColor;
}

View File

@@ -0,0 +1,43 @@
float4 g_fResolution : register(c0);
float3 g_vLightDir : register(c1);
sampler1D dif : register(s2);
sampler1D spec : register(s3);
sampler2D shadowSampler : register(s4);
sampler2D depthSampler : register(s5);
static float4 g_fSpecularPower = {0.85f, 0.85f, 0.85f, 0.85f};
struct psIn
{
float4 c : COLOR0;
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
float4 ps_main(psIn i):color
{
// Shadow AA
float2 sc = i.s.xy / i.s.w;
float aa = abs( tex2D(depthSampler, sc).x - i.s.z );
float2 ddaa = float2(ddx(aa), ddy(aa));
float2 aaetc = sign(-ddaa) * g_fResolution.zw;
sc += aaetc * saturate(4.f * aa);
float4 fColor = i.c;
float fS= 0.2f + 0.8f * tex2D(shadowSampler, sc);
float3 n = normalize(i.n);
// Lighting
fColor.xyz *= tex1D( dif, fS * ( 0.5f + 0.5f * dot( n, -g_vLightDir) ) );
// Specular highlights
float3 h = normalize( normalize(i.v) + -g_vLightDir );
float s = dot(n, h);
fColor.xyz += g_fSpecularPower * tex1D(spec, fS * ( 0.5f + 0.5f * s ) );
return fColor;
}

View File

@@ -0,0 +1,108 @@
float2 g_fResolution : register(c0);
float3 g_vViewPos : register(c2);
float g_fSplit : register(c23);
float4x4 g_mShadowVP : register(c24);
float3 g_vShadowViewPos : register(c28);
float3 g_vShadowViewDir : register(c29);
float4 g_fShadowMapScalingRes : register(c30);
sampler2D shadowMapSampler : register(s0);
sampler2D depthSampler : register(s1);
sampler2D ditherSampler : register(s2);
static float g_fRadius = 6.0f / 64.0f;
static float g_fBias = 4.0f / 64.0f;
static float g_fDepthBias = 16.0f / 64.0f;
static float g_fBiasFalloff = 1.5f / 64.0f;
static float g_fSharpness = 640.0f / 64.0f;
static float g_fBlurSharpness = 640.0f / 64.0f;
static float g_fDepthBlurSharpness = 16.0f / 64.0f;
static const float2 s_vShadowDisc[] = {
float2(-0.326212f, -0.40581f),
float2(-0.840144f, -0.07358f),
float2(-0.695914f, 0.457137f),
float2(-0.203345f, 0.620716f),
float2(0.96234f, -0.194983f),
float2(0.473434f, -0.480026f),
float2(0.519456f, 0.767022f),
float2(0.185461f, -0.893124f),
float2(0.507431f, 0.064425f),
float2(0.89642f, 0.412458f),
float2(-0.32194f, -0.932615f),
float2(-0.791559f, -0.59771f)
};
float4 ps_main(float2 TexCoord : TEXCOORD0, float3 EyeDir : TEXCOORD1) : COLOR0
{
// Compute eye space position
float fEyeDepth = tex2D(depthSampler, TexCoord).x;
float4 vEyePoint = float4(g_vViewPos + fEyeDepth * EyeDir, 1.0f);
// Transform eye point to shadow space
float4 vShadowCoord = mul(vEyePoint, g_mShadowVP);
vShadowCoord.z = dot(vEyePoint.xyz - g_vShadowViewPos, g_vShadowViewDir);
vShadowCoord.xy = vShadowCoord.xy * float2(.5f, -.5f)
+ vShadowCoord.w * (.5f + .5f / g_fShadowMapScalingRes.zw);
// Scale radius
float2 fScaledRadius = g_fRadius * g_fShadowMapScalingRes.xy;
// Transform to shadow map
float2 vShadowCoordProj = vShadowCoord.xy / vShadowCoord.w;
// Clip pixels outside shadow map
clip( float4(vShadowCoordProj, 1.0f - vShadowCoordProj) - fScaledRadius.xyxy );
// Compute sampling plane
float4 vShadowCoordDDX = ddx(vShadowCoord), vShadowCoordDDY = ddy(vShadowCoord);
float2 vShadowCoordDeltaDepth = float2(
vShadowCoordDDX.y * vShadowCoordDDY.z - vShadowCoordDDY.y * vShadowCoordDDX.z,
vShadowCoordDDY.x * vShadowCoordDDX.z - vShadowCoordDDX.x * vShadowCoordDDY.z )
/ (vShadowCoordDDY.x * vShadowCoordDDX.y - vShadowCoordDDX.x * vShadowCoordDDY.y);
vShadowCoordDeltaDepth = vShadowCoord.w * clamp(vShadowCoordDeltaDepth, -16.f, 16.f);
// Compute bias
float fAdaption = 1.f / (1.0f + g_fBiasFalloff * fEyeDepth);
float fAdaptedBias = g_fBias; // lerp(g_fDepthBias, g_fBias, fAdaption);
float fAdaptedBlurSharpness = lerp(g_fDepthBlurSharpness, g_fBlurSharpness, fAdaption);
// Apply bias
float fReferenceDepth = vShadowCoord.z - fAdaptedBias;
// Sample random 2D matrix
float4 vRotation = tex2D(ditherSampler, TexCoord * g_fResolution / 32.0f) * 2.0f - 1.0f;
float2x2 mRotation = float2x2(vRotation.xy, vRotation.zw);
float fShadow = -1.f;
float fSampleWeight = 1.f / 6;
// Sample
for(int i = 0; i < 12; )
{
float4 fSampleDepth;
// Vectorize occlusion code
[unroll] for(int j = 0; j < 4; j++, i++)
{
// Compute some point around this pixel
float2 vSampleOffset = fScaledRadius * mul(s_vShadowDisc[i], mRotation);
// Compute depth delta
float fSampleDeltaDepth = dot(vSampleOffset * vShadowCoordDeltaDepth, 1.f);
// Sample shadow map
fSampleDepth[j] = tex2D(shadowMapSampler, vShadowCoordProj + vSampleOffset).x - fSampleDeltaDepth;
}
// Compare shadow map depth with pixel depth
// (fSampleDepth < fReferenceDepth)
float4 fOcclusion = saturate(fAdaptedBlurSharpness * (fReferenceDepth - fSampleDepth));
// Sum up samples
fShadow += dot(fOcclusion, fSampleWeight);
}
// Write to intermediate buffer
return (1.0f - fShadow); // * float4(g_fSplit == float3(0, 1, 2) || g_fSplit == float3(3, 4, 5), 1.0f);
}

View File

@@ -0,0 +1,46 @@
float4 g_fResolution : register(c0);
float3 g_vLightDir : register(c1);
sampler2D tex : register(s0);
sampler1D dif : register(s2);
sampler1D spec : register(s3);
sampler2D shadowSampler : register(s4);
sampler2D depthSampler : register(s5);
static float4 g_fSpecularPower = {0.85f, 0.85f, 0.85f, 0.85f};
struct psIn
{
float4 c : COLOR0;
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
float4 ps_main(psIn i):color
{
// Shadow AA
float2 sc = i.s.xy / i.s.w;
float aa = abs( tex2D(depthSampler, sc).x - i.s.z );
float2 ddaa = float2(ddx(aa), ddy(aa));
float2 aaetc = sign(-ddaa) * g_fResolution.zw;
sc += aaetc * saturate(4.f * aa);
float4 fColor = i.c * tex2D( tex, i.t );
float fS= 0.125f + 0.875f * tex2D(shadowSampler, sc);
// Lighting
fColor.xyz *= tex1D(dif, fS * ( 0.5f + 0.5f * dot( i.n, -g_vLightDir) ));
// Specular highlights
float3 h = normalize( normalize(i.v) + -g_vLightDir );
float s = dot(i.n, h);
fColor.xyz += g_fSpecularPower * tex1D(spec, fS * ( 0.5f + 0.5f * s ) );
// Red-only glow
// fColor.a = saturate(fColor.a + 1.f - fColor.r);
return fColor;
}

View File

@@ -0,0 +1,56 @@
float3 lightDir : register(c1);
float3 viewDir : register(c4);
float3 passID2expIsLast : register(c23);
sampler2D colorSampler : register(s0);
sampler2D depthSampler : register(s1);
// Tweakables
static float4 g_fRayColor = float4(0.9f, 0.8f, 0.7f, 1.0f);
static float g_fRayNearPlane = 10.0f;
static float g_fRayFarPlane = 500.0f;
static float g_fRayDensity = 0.25f;
static float g_fRayDecay = 0.9125f;
static float g_fRayAnglePersistence = 4.f;
float4 ps_ray_mask(float2 TexCoord : TEXCOORD0, float2 LightPos : TEXCOORD2) : COLOR0
{
float2 d = LightPos - TexCoord;
float r = saturate( 1.f - dot(d, d) );
r *= saturate( g_fRayAnglePersistence * dot(-lightDir, viewDir) );
float m = tex2D(depthSampler, TexCoord).x;
m = saturate( (m - g_fRayNearPlane) / (g_fRayFarPlane - g_fRayNearPlane) );
// m = saturate(1.f - m);
// float2 p = TexCoord * 2.0f - 1.0f;
// float b = saturate( 1.0f - 0.7071f * dot(p, p) );
return /* b */ m * r * g_fRayColor;
}
// Pixel shader
float4 ps_ray_extrude(float2 TexCoord : TEXCOORD0, float2 LightPos : TEXCOORD2) : COLOR0
{
float2 s = g_fRayDensity / (passID2expIsLast.y) * (LightPos - TexCoord) / 8.f;
float4 r = 0.f, ro = 0.f, rm = 0.f, rd = .125f;
float2 c = TexCoord;
for(int i = 0; i < 8; i++)
{
float4 rs = tex2D(colorSampler, c);
ro = (i == 0) ? rs : ro;
rm = max(rs, rm);
rs.xyz = rm.xyz;
r += rs * rd;
rd.xyz *= (float3)g_fRayDecay;
c += s;
}
r.a = min(ro.a, r.a);
return r * saturate(1.f - passID2expIsLast.z * r.a);
}

View File

@@ -0,0 +1,80 @@
float3 g_vLightDir : register(c1); // = normalize( float3(1.f,-3.f,-2.f) );
float3 g_fTime : register(c3);
sampler3D randomSampler : register(s0);
static float4 g_fSky = float4(0.392f, 0.502f, 0.702f, 0.7f);
static float4 g_fHaze = float4(0.765f, 0.808f, 0.871f, -0.3f);
//static float4 g_fAbyss = float4(0.01f, 0.01f, 0.04f, -1.0f);
static float g_fSunSize = .0025f;
static float g_fCoronaSize = .005f;
static float4 g_fSunColor = float4(0.925f, 1.0f, 0.75f, 1.f);
float4 clouds(float3 d, float4 color)
{
float3 t = float3(g_fTime.x*0.001, 0, 0);
float3 bumpOffset = float3(0.f, .07f, 0.f);
float3 d1 = normalize(d + bumpOffset), d2 = normalize(d + cross(bumpOffset, d));
float4 cloud = tex3D(randomSampler, float3(0.2,0.6,0.2) * d);
float4 cloud1 = tex3D(randomSampler, float3(0.2,0.6,0.2) * d1);
float4 cloud2 = tex3D(randomSampler, float3(0.2,0.6,0.2) * d2);
float cover = g_fTime.z;
float3 smoothAlpha = float3(cloud.a, cloud1.a, cloud2.a);
smoothAlpha = saturate( smoothAlpha - max(cover - smoothAlpha, 0.f) * .25f );
float bumpDepth = .5f;
float3 cloudel = d + d * (bumpDepth - bumpDepth * smoothAlpha.x);
float3 cloudel1 = d1 + d1 * (bumpDepth - bumpDepth * smoothAlpha.y);
float3 cloudel2 = d2 + d2 * (bumpDepth - bumpDepth * smoothAlpha.z);
float3 normal = normalize( cross(cloudel1 - cloudel, cloudel2 - cloudel) );
cloud *= 0.5;
cloud += tex3D(randomSampler, float3(0.4,1.2,0.4) * (d + t)) * 0.25;
cloud += tex3D(randomSampler, float3(0.8,2.4,0.8) * d) * 0.125;
cloud += tex3D(randomSampler, float3(1.6,4.8,1.6) * (d + t)) * 0.0625;
cloud.a = saturate( saturate( cloud.a * 2.5f ) - max(cover - cloud.a, 0.f) * 25.f );
float3 sdd = d + g_vLightDir;
float sd = dot(sdd, sdd);
float s = g_fCoronaSize / ( g_fCoronaSize + saturate(sd - g_fSunSize) );
float light = 0.5f + 0.7f * dot(normal, -g_vLightDir);
float3 stormNormal = normalize(cloud.xyz * 2 - 1);
float stormLight = 0.5f + 0.5f * dot(stormNormal, g_vLightDir);
cloud.xyz = lerp(cloud.xyz, stormLight, 0.3f * saturate(1.f - cover));
cloud.xyz = dot(cloud.xyz, .3f) + 0.1f * cloud.xyz;
cloud.xyz = 1.f - .65f * cloud.xyz * (1.f - 0.2f * cover);
cloud.xyz += 0.4f * light * saturate(cover);
cloud.xyz = cloud.a * cloud.xyz + (1 - cloud.a) * color.xyz;
cloud.xyz += (1 - 0.5f * cloud.a) * g_fSunColor.xyz * s;
float3 riseColor = float3(0.9,0.8,0) * (1 - g_fTime.z * 0.5);
float a = pow( max(0, dot(g_vLightDir, -d)), 2 ) * 0.7 * (1.f - .9f * abs(g_vLightDir.y));
float risefac = -1.f - g_vLightDir.y;
if (sign(dot(g_vLightDir, d)) > 0)
risefac = -1.0;
cloud.xyz += max( 0, a * lerp( riseColor, 1, min(1.0, risefac*1.5) + risefac ) );
cloud.a = 1.f;
return cloud;
}
float4 ps_main(float3 w : TEXCOORD4):color
{
float4 fColor = g_fSky;
float3 d = normalize(w);
float g1 = saturate( (d.y - g_fSky.w) / (g_fHaze.w - g_fSky.w) );
fColor.xyz = lerp(g_fSky.xyz, g_fHaze.xyz, g1);
return clouds(d, fColor);
}

View File

@@ -0,0 +1,115 @@
float4 g_fResolution : register(c0);
float3 g_vLightDir : register(c1);
sampler3D randomSampler : register(s0);
sampler1D diffSampler : register(s2);
sampler1D specSampler : register(s3);
sampler2D shadowSampler : register(s4);
sampler2D depthSampler : register(s5);
static float g_fTileHardness = .6f;
static float g_fTileDepth = 8.f;
static float g_fBumpDepth = .75f;
static float g_fTexScale = 1.f;
static float g_fSpecularPower = 0.5f;
static float g_fSpecularHardness = 32.f;
struct psIn
{
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
float rand_val(float4 r)
{
float lr = dot(r, float4(10.f, 100.f, 1000.f, 1.f));
return lr / 1111.f;
}
float noise(float3 t)
{
float4 r = tex3D(randomSampler, .03125f * t);
return rand_val(r)* 2.f - 1.f;
}
float noise_grad(float3 t, float3 dtX, float3 dtY)
{
float4 r = tex3Dgrad(randomSampler, .03125f * t, .0625f * dtX, .0625f * dtY);
return rand_val(r)* 2.f - 1.f;
}
float abs_noise(float3 t)
{
return abs( noise(t) );
}
float abs_noise_grad(float3 t, float3 dtX, float3 dtY)
{
return abs( noise_grad(t, dtX, dtY) );
}
float4 ps_main(psIn i) : COLOR0
{
float3 t = i.w * g_fTexScale;
float3 pw = i.w.xxz; pw.y = 0.0f; // i.w - i.n * dot(i.w, i.n);
float3 pt = pw * g_fTexScale + .5f;
float3 tt = floor(pt);
float3 dttX = ddx(pt);
float3 dttY = ddy(pt);
// Texturing
float3 fColor = 0.15f * saturate( dot(1.f, abs(dttX) + abs(dttY)) );
fColor += abs_noise_grad(tt, dttX, dttY);
fColor += abs_noise(2.f * t) / 8.f;
fColor += noise(4.f * t) / 8.f;
float fDetail = noise(8.f * t) / 16.f;
fDetail += noise(16.f * t) / 16.f;
fDetail += noise(32.f * t) / 32.f;
fDetail += noise(128.f * t) / 32.f;
fDetail += noise(1024.f * t) / 32.f;
fColor += fDetail;
// Contrast
fColor = 1.0f - saturate(fColor);
fColor *= fColor;
fColor = 1.0f - fColor;
// Super tile
float3 tb = 2.f * frac(pt) - 1.f;
float3 te = tb * tb; // ^2
te *= te; // ^4
te *= te; // ^8
float tdd = saturate(1.f - 2.f * fwidth(pt));
float td = saturate( dot(tdd, te) );
float3 tc = 1.f - td;
float3 ti = saturate(td - g_fTileHardness);
// Bump mapping
float3 n = normalize(i.n + g_fBumpDepth * g_fTileDepth * ti * tb);
// Shadow (AA)
float2 sc = i.s.xy / i.s.w;
float aa = abs( tex2D(depthSampler, sc).x - i.s.z );
float2 ddaa = float2(ddx(aa), ddy(aa));
float2 aaetc = sign(-ddaa) * g_fResolution.zw;
sc += aaetc * saturate(4.f * aa);
float fShadow = 0.2f + 0.8f * (float)tex2D(shadowSampler, sc);
// Diffuse light
fColor *= tex1D( diffSampler, fShadow * (0.5f + 0.5f * dot(n, -g_vLightDir)) ).xyz;
// Specular highlights
float3 h = normalize( normalize(i.v) + -g_vLightDir );
float s = 0.5f + 0.5f * dot(n, h);
s *= saturate(1.f + g_fBumpDepth * fDetail);
fColor += g_fSpecularPower * tex1D(specSampler, fShadow * s).xyz; // pow(s, g_fSpecularHardness)
// Tile borders
fColor *= tc;
return float4(fColor, 1.0f);
}

View File

@@ -0,0 +1,43 @@
float4 g_fResolution : register(c0);
float3 g_vLightDir : register(c1);
sampler1D dif : register(s2);
sampler1D spec : register(s3);
sampler2D shadowSampler : register(s4);
sampler2D depthSampler : register(s5);
static float4 g_fSpecularPower = {1.15f, 1.05f, 1.0f, 1.25f};
struct psIn
{
float4 c : COLOR0;
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
float4 ps_main(psIn i):color
{
// Shadow AA
float2 sc = i.s.xy / i.s.w;
float aa = abs( tex2D(depthSampler, sc).x - i.s.z );
float2 ddaa = float2(ddx(aa), ddy(aa));
float2 aaetc = sign(-ddaa) * g_fResolution.zw;
sc += aaetc * saturate(4.f * aa);
float3 fColor = float3( 0.25f, 0.3f, 0.4f );
float fS= 0.2f + 0.8f * tex2D(shadowSampler, sc);
float3 n = normalize(i.n);
// Lighting
fColor.xyz *= tex1D( dif, fS * ( 0.5f + 0.5f * dot( n, -g_vLightDir) ) );
// Specular highlights
float3 h = normalize( normalize(i.v) + -g_vLightDir );
float s = dot( n, h);
fColor += g_fSpecularPower * tex1D(spec, fS * ( 0.5f + 0.5f * s ) );
return float4(fColor, 1.0f);
}

View File

@@ -0,0 +1,99 @@
float4 g_fResolution : register(c0);
float3 g_vLightDir : register(c1);
float4 g_fTime : register(c3);
sampler3D randomSampler : register(s0);
sampler2D tex : register(s1);
sampler1D diffSampler : register(s2);
sampler1D specSampler : register(s3);
sampler2D shadowSampler : register(s4);
sampler2D depthSampler : register(s5);
static float g_fVariation = .1f;
static float g_fBumpDepth = .02f;
static float g_fBumpFalloff = 256.f;
static float g_fTexScale = 1.f;
static float g_fSpecularPower = 0.2f;
static float g_fSpecularHardness = 32.f;
struct psIn
{
float4 c : COLOR0;
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
float noise(float3 t)
{
float4 r = tex3D(randomSampler, .03125f * t);
float lr = dot(r, float4(1.f, 10.f, 100.f, 1000.f));
return lr * 2.f / 1111.f - 1.f;
}
float abs_noise(float3 t) { return abs( noise(t) ); }
float4 ps_main(psIn i) : COLOR0
{
float3 t = i.w * g_fTexScale;
float4 fColor = i.c;
float fStruct = noise(t) / 2.f;
fStruct += noise(4.f * t) / 4.f;
fStruct += noise(8.f * t) / 8.f;
fStruct += noise(16.f * t) / 16.f;
fStruct += noise(32.f * t) / 32.f;
fColor.xyz *= (1.f - g_fVariation) + g_fVariation * fStruct;
float fDetail = noise(81.f * t) / 2.f;
fDetail += noise(243.f * t) / 4.f;
fDetail += noise(729.f * t) / 8.f;
// Bump mapping
// float ddf = g_fBumpFalloff * dot(fwidth(i.w), 1.f);
float3 pp = i.w + i.n * g_fBumpDepth * (fStruct + fDetail / 16.f); // (1.f + ddf)
float3 ddppx = ddx(pp);
float3 ddppy = ddy(pp);
float3 n = normalize( cross(ddppx, ddppy) );
// calculate coloration (hypno toad commands you!)
float3 wrd= float3(
round( i.w.x / g_fTime.w ) * g_fTime.w,
round( i.w.y / g_fTime.w ) * g_fTime.w,
round( i.w.z / g_fTime.w ) * g_fTime.w );
float fOffset= 33.0f - wrd.z / 8.0f - g_fTime / 56.0f;
if( fOffset < 0.0f )
{
fOffset= 0.0f;
}
float plasmaVal =
sin( sin ( 0.021f * g_fTime + wrd.y * 0.23f ) * 0.7f + wrd.x * 0.09f )
+ sin( 0.009f * g_fTime + sin ( wrd.z * 0.35f ) * 0.9f + wrd.y * 0.47f )
+ sin( sin ( 0.013f * g_fTime + wrd.x * 0.17f ) * 1.3f + wrd.z * 0.13f )
+ fOffset;
if( plasmaVal > 0.0f && plasmaVal < 1.0f )
{
fColor.xyz= tex2D( tex, plasmaVal ).xyz;
}
// Shadow (AA)
float2 sc = i.s.xy / i.s.w;
float aa = abs( tex2D(depthSampler, sc).x - i.s.z );
float2 ddaa = float2(ddx(aa), ddy(aa));
float2 aaetc = sign(-ddaa) * g_fResolution.zw;
sc += aaetc * saturate(4.f * aa);
float fShadow = 0.2f + 0.8f * (float)tex2D(shadowSampler, sc);
// Diffuse light
fColor.xyz *= tex1D( diffSampler, fShadow * (0.5f + 0.5f * dot(n, -g_vLightDir)) ).xyz;
// Specular highlights
float3 h = normalize( normalize(i.v) + -g_vLightDir );
float s = saturate( dot(n, h) );
fColor.xyz += g_fSpecularPower * tex1D(specSampler, fShadow * s).xyz;
return fColor;
}

View File

@@ -0,0 +1,29 @@
float4x4 matWVP : register(c0);
float4 res : register(c5);
float3 viewPos : register(c4);
float3 lightDir : register(c6);
float3x3 viewMatrixRotInv : register(c7);
float4 projScaleOffsetInv : register(c11);
struct vsOut
{
float4 p : POSITION;
float2 t : TEXCOORD0;
float3 e : TEXCOORD1;
float2 l : TEXCOORD2;
};
vsOut vs_main(float4 p : POSITION)
{
vsOut o = { p, p.xy, p.xyw, (float2)0.f };
o.p.xy += float2(-1.f, 1.f) * res.zw;
o.t = o.t * float2(.5f, -.5f) + .5f;
o.e.xy = o.e.xy * projScaleOffsetInv.xy + projScaleOffsetInv.zw;
o.e = mul(o.e, viewMatrixRotInv);
o.e.xy += float2(-1.f, 1.f) * res.zw;
// Compute light position
float4 lightPos = mul( float4(viewPos - lightDir, 1.0f), matWVP );
o.l = clamp( lightPos.xy / abs(lightPos.w), -1.f, 1.f );
o.l = o.l * float2(.5f, -.5f) + .5f;
return o;
};

View File

@@ -0,0 +1,51 @@
float4x4 matWVP : register(c0);
float4x4 matWorld : register(c12);
float4x4 matWorldI : register(c16);
float3 viewPos : register(c4);
float3 viewDir : register(c10);
float4 res : register(c5);
struct vsIn
{
float4 p : POSITION;
float3 n : NORMAL;
float4 c : COLOR;
float2 t : TEXCOORD;
};
struct vsOut
{
float4 p : POSITION;
float4 c : COLOR0;
float2 t : TEXCOORD0;
float3 n : TEXCOORD1;
float3 v : TEXCOORD2;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
vsOut vs_main(vsIn i)
{
vsOut o;
// Basic transformation of untransformed vertex into clip-space
o.p= mul(i.p, matWVP);
// No scaling or translation is done, simply assign them and let the GPU interpolate
o.c = i.c;
o.t = i.t;
// Trasform to world space
o.w= mul(i.p, matWorld).xyz;
o.n= mul(i.n, transpose((float3x3)matWorldI));
//OUT.normal = mul(matWorldIT, IN.normal);
// Calculate the view vector
o.v= viewPos - o.w;
// (Pre-proj biased screen texcoords, unscaled z, w)
o.s = o.p;
o.s.xy = o.s.xy * float2(.5f, -.5f) + o.s.w * (.5f + .5f * res.zw);
o.s.z = dot(o.w - viewPos, viewDir);
return o;
};

View File

@@ -0,0 +1,25 @@
float4x4 matWVP : register(c0);
float3 viewPos : register(c4);
struct vsOut
{
float4 p : POSITION;
float4 s : TEXCOORD3;
float3 w : TEXCOORD4;
};
vsOut vs_main(float4 p : POSITION)
{
vsOut o;
o.p = p;
o.p.xyz += viewPos;
o.p= mul(o.p, matWVP);
o.p.z= (1.f - 4.8e-6f) * o.p.w;
o.w= p.xyz;
o.s= 4.e3f;
return o;
};