port from perforce
This commit is contained in:
101
evoke-64k/trunk/ev10/cfg/cryspos.txt
Normal file
101
evoke-64k/trunk/ev10/cfg/cryspos.txt
Normal file
@@ -0,0 +1,101 @@
|
||||
Crystal
|
||||
Pos= 24.5 -10 -10.5
|
||||
Scale= 1
|
||||
Rot= -60 25 0
|
||||
Crystal
|
||||
Pos= 25 -10.5 -9
|
||||
Scale= 0.75
|
||||
Rot= -45 35 0
|
||||
Crystal
|
||||
Pos= 25 -10.5 -12
|
||||
Scale= 0.5
|
||||
Rot= -100 35 0
|
||||
Crystal
|
||||
Pos= 22.5 -12 -12.5
|
||||
Scale= 0.45
|
||||
Rot= -100 65 0
|
||||
Crystal
|
||||
Pos= 23 -11.5 -11
|
||||
Scale= 0.35
|
||||
Rot= -95 55 0
|
||||
Crystal
|
||||
Pos= 25 -11.25 -7.5
|
||||
Scale= 0.4
|
||||
Rot= -20 45 0
|
||||
|
||||
Crystal
|
||||
Pos= 20 12 2
|
||||
Scale= 0.7
|
||||
Rot= 90 10 180
|
||||
Crystal
|
||||
Pos= 20.25 12.0 2.5
|
||||
Scale= 0.55
|
||||
Rot= 150 16 180
|
||||
Crystal
|
||||
Pos= 20.1 11.85 2.95
|
||||
Scale= 0.1525
|
||||
Rot= 160 34 180
|
||||
Crystal
|
||||
Pos= 19.7 12.0 1.6
|
||||
Scale= 0.325
|
||||
Rot= 60 6 201
|
||||
|
||||
Crystal
|
||||
Pos= 10.4 13.5 -14
|
||||
Scale= 0.5
|
||||
Rot= 60 16 180
|
||||
Crystal
|
||||
Pos= 10.4 14 -14
|
||||
Scale= 0.425
|
||||
Rot= 39 -18 170
|
||||
|
||||
Crystal
|
||||
Pos= -6.1 10.7 -29.8
|
||||
Scale= 0.5
|
||||
Rot= -60 16 180
|
||||
Crystal
|
||||
Pos= -5.5 10.5 -29.5
|
||||
Scale= 0.325
|
||||
Rot= -180 18 180
|
||||
Crystal
|
||||
Pos= -6.3 10.2 -30
|
||||
Scale= 0.225
|
||||
Rot= 60 16 180
|
||||
|
||||
Crystal
|
||||
Pos= -16 8.5 -24
|
||||
Scale= 0.3525
|
||||
Rot= -110 12 180
|
||||
Crystal
|
||||
Pos= -15.9 8.1 -23.7
|
||||
Scale= 0.2
|
||||
Rot= 150 16 180
|
||||
|
||||
Crystal
|
||||
Pos= 45.625 -2 34
|
||||
Scale= 2.0
|
||||
Rot= 120 8 -30
|
||||
Crystal
|
||||
Pos= 42 -3.7 27
|
||||
Scale= 1.1
|
||||
Rot= -120 25 0
|
||||
Crystal
|
||||
Pos= 43.5 -3.7 26.7
|
||||
Scale= 0.6
|
||||
Rot= 110 4 -20
|
||||
Crystal
|
||||
Pos= 42 -6 28.1
|
||||
Scale= 1.2
|
||||
Rot= -75 20 0
|
||||
Crystal
|
||||
Pos= 38 -4.7 28.1
|
||||
Scale= 0.7
|
||||
Rot= -85 15 0
|
||||
Crystal
|
||||
Pos= 37 -3.5 28
|
||||
Scale= 0.4
|
||||
Rot= -125 30 0
|
||||
|
||||
|
||||
|
||||
|
||||
84
evoke-64k/trunk/ev10/cfg/entity.txt
Normal file
84
evoke-64k/trunk/ev10/cfg/entity.txt
Normal file
@@ -0,0 +1,84 @@
|
||||
//Magier/ Yetis
|
||||
|
||||
Entity
|
||||
Pos= 12 -12.2 23.5
|
||||
Scale= 0.75 0.75 0.75
|
||||
Rot= -70 0 0
|
||||
Move= 0 0 0
|
||||
Time= 0 200000
|
||||
|
||||
Entity
|
||||
Pos= 8 -19 36
|
||||
Rot= -140 0 0
|
||||
Scale= 0.75 0.75 0.75
|
||||
Move= 0 0 0
|
||||
Time= 0 200000
|
||||
|
||||
Entity
|
||||
Pos= -12 -13.75 -16
|
||||
Rot= 10 0 0
|
||||
Scale= 0.75 0.75 0.75
|
||||
Move= 0 0 0
|
||||
Time= 0 200000
|
||||
|
||||
// Greets Magier
|
||||
Entity
|
||||
Pos= 25 -12.2 10.5
|
||||
Scale= 1 1 1
|
||||
Rot= -70 0 0
|
||||
Move= 0 0 0
|
||||
Time= 0 200000
|
||||
|
||||
//Enten
|
||||
Entity
|
||||
Pos= 96 -8 -188
|
||||
Scale= 1 1 1
|
||||
Rot= 150 -15 20
|
||||
Move= 0 0 0
|
||||
Time= -100000 150000
|
||||
|
||||
Entity
|
||||
Pos= 73 -7.75 -168
|
||||
Scale= 1 1 1
|
||||
Rot= 0 70 40
|
||||
Move= 0 0 0
|
||||
Time= -100000 150000
|
||||
|
||||
//Logos
|
||||
Entity
|
||||
Pos= 56 -2 -160
|
||||
Scale= 1 1 1
|
||||
Rot= -30 75 0
|
||||
Move= 0 0 0
|
||||
Time= -100000 150000
|
||||
|
||||
Entity
|
||||
Pos= 35 -2 -170
|
||||
Scale= 1 1 1
|
||||
Rot= -90 75 20
|
||||
Move= 0 0 0
|
||||
Time= -100000 150000
|
||||
|
||||
|
||||
//Logos auftauchen
|
||||
Entity
|
||||
Pos= 140 -50 160
|
||||
Scale= 5 5 5
|
||||
Rot= 30 0 0
|
||||
Move= 0 200 0
|
||||
Time= 51000 3500
|
||||
|
||||
Entity
|
||||
Pos= 250 -50 140
|
||||
Scale= 5 5 5
|
||||
Rot= 180 0 0
|
||||
Move= 0 150 0
|
||||
Time= 50500 3500
|
||||
|
||||
Entity
|
||||
Pos= 189 3.5 394
|
||||
Scale= 2.75 2.75 2.75
|
||||
Rot= -140 0 0
|
||||
Move= 60 0 -105
|
||||
Time= 50500 3500
|
||||
|
||||
56
evoke-64k/trunk/ev10/cfg/param.txt
Normal file
56
evoke-64k/trunk/ev10/cfg/param.txt
Normal file
@@ -0,0 +1,56 @@
|
||||
#rundes Pieksding
|
||||
#----------------------------------
|
||||
SIZE000= 38 48
|
||||
|
||||
BASE000= 1 0
|
||||
|
||||
BANK000= 5.0 5.0 -32.0 0.0
|
||||
|
||||
|
||||
OFFSET000= 5 1
|
||||
BANK001= 12.0 2.5 1.0 0.2
|
||||
BANK002= 6.0 3.0 2.0 1.0
|
||||
|
||||
HEIGHT000= 4 3
|
||||
|
||||
BANK003= 5.0 2.0 8.0 1.0
|
||||
BANK004= 3.0 1.0 0.27 1.0
|
||||
BANK005= 2.0 2.0 0.7 1.0
|
||||
|
||||
MIX000= 0 6
|
||||
|
||||
BANK006= 1.0 0.2 0.0 0.0
|
||||
|
||||
COLOR000= 255 224 32 32
|
||||
|
||||
#blob
|
||||
#----------------------------------
|
||||
SIZE001= 48 32
|
||||
|
||||
BASE001= 2 7
|
||||
|
||||
BANK007= 8.0 3.0 3.0 0.0
|
||||
|
||||
BANK007= 24.0 16.0 24.0 0.0
|
||||
|
||||
OFFSET001= 5 8
|
||||
BANK008= 13.0 1.0 1.0 0.2
|
||||
BANK009= 2.0 1.0 5.0 1.0
|
||||
BANK010= 160.0 0.0 0.0 0.0
|
||||
BANK011= 0.0 0.0 0.0 0.0
|
||||
|
||||
HEIGHT001= 4 12
|
||||
|
||||
BANK012= 6.0 5.0 12.0 1.0
|
||||
BANK013= 3.0 1.0 0.27 1.0
|
||||
BANK014= 2.0 2.0 0.7 1.0
|
||||
|
||||
MIX001= 4 15
|
||||
BANK015= 0.15 0.15 0.325 2.0
|
||||
BANK016= 3.0 7.0 0.65 1.6
|
||||
BANK017= 5.0 2.0 0.85 1.4
|
||||
|
||||
COLOR001= 64 192 96 32
|
||||
|
||||
|
||||
|
||||
147
evoke-64k/trunk/ev10/cfg/psao.txt
Normal file
147
evoke-64k/trunk/ev10/cfg/psao.txt
Normal 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.05f;
|
||||
static float g_fRadiusScale = 0.25f;
|
||||
static float g_fFallOff = 0.05f;
|
||||
static float g_fIntensity = 1.25f;
|
||||
static float g_fGrain = 0.01f;
|
||||
static float g_fRange = 256.0f;
|
||||
static float g_fBlurSensitivity = 12.5f;
|
||||
|
||||
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); }
|
||||
59
evoke-64k/trunk/ev10/cfg/psblur.txt
Normal file
59
evoke-64k/trunk/ev10/cfg/psblur.txt
Normal file
@@ -0,0 +1,59 @@
|
||||
float4 res : register(c0);
|
||||
float4 glow : register(c61);
|
||||
|
||||
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 = 2.f - 2.0f * c.a;
|
||||
c.xyz *= c.a;
|
||||
return c;
|
||||
}
|
||||
72
evoke-64k/trunk/ev10/cfg/pscrystal.txt
Normal file
72
evoke-64k/trunk/ev10/cfg/pscrystal.txt
Normal file
@@ -0,0 +1,72 @@
|
||||
float4 g_fResolution : register(c0);
|
||||
float3 g_vLightDir : register(c1);
|
||||
float3 g_vViewDir : register(c4);
|
||||
|
||||
float4 g_fGlow : register(c61);
|
||||
|
||||
sampler1D dif : register(s2);
|
||||
sampler1D spec : register(s3);
|
||||
sampler2D shadowSampler : register(s4);
|
||||
sampler2D depthSampler : register(s5);
|
||||
samplerCUBE envSampler : register(s6);
|
||||
samplerCUBE envIntSampler : register(s7);
|
||||
|
||||
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;
|
||||
float3 o : TEXCOORD5;
|
||||
};
|
||||
|
||||
float4 ps_main(psIn i):color
|
||||
{
|
||||
// Environment lighting
|
||||
// return texCUBE(envIntSampler, i.n);
|
||||
// Environment reflection
|
||||
// return texCUBE(envSampler, reflect(-i.v, i.n));
|
||||
|
||||
// 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 n = normalize(i.n);
|
||||
float3 v = normalize(i.v);
|
||||
float3 no = normalize(i.o);
|
||||
|
||||
float3 fColor = i.c.xyz;
|
||||
float fShadow = 0.6f + 0.4f * tex2D(shadowSampler, sc);
|
||||
|
||||
// return texCUBE(envSampler, reflect(g_vViewDir, i.n));
|
||||
// g_vViewDir
|
||||
|
||||
// fColor *= texCUBE(envSampler, i.n).xyz; // * fShadow // envIntSampler
|
||||
// fColor += 0.1f * texCUBE(envSampler, reflect(-i.v, i.n)).xyz;
|
||||
|
||||
// Lighting
|
||||
float fLight = saturate( dot( n, -g_vLightDir) );
|
||||
fLight = min(fShadow * fLight, fLight);
|
||||
fColor.xyz *= lerp(
|
||||
float3(0.7f, 0.6f, 1.0f) * tex1D( dif, fLight ),
|
||||
float3(0.8f, 0.6f, 0.9f) * tex1D( dif, abs( sin(5 * fLight) ) ),
|
||||
saturate( 5 * dot(no, n) ) );
|
||||
|
||||
// return abs( 3 * dot(no, n) );
|
||||
|
||||
// Specular highlights
|
||||
float3 h = normalize( v + -g_vLightDir );
|
||||
float hdn = saturate( dot(n, h) );
|
||||
float fSpecularity = smoothstep( 0.5f, 0.9f,
|
||||
abs( sin(16 * hdn) ) * ( dot( n, -g_vLightDir) > 0 ) + abs( sin(8 * dot(n, v)) ) * 0.85f );
|
||||
fColor += 0.3f * fShadow * tex1D( spec, fSpecularity );
|
||||
|
||||
return float4( (1.0f + 1.5f * g_fGlow.w) * fColor, 0.3f );
|
||||
}
|
||||
4
evoke-64k/trunk/ev10/cfg/psdepth.txt
Normal file
4
evoke-64k/trunk/ev10/cfg/psdepth.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
float4 ps_main(float4 s : TEXCOORD3):color
|
||||
{
|
||||
return s.z;
|
||||
}
|
||||
105
evoke-64k/trunk/ev10/cfg/psdof.txt
Normal file
105
evoke-64k/trunk/ev10/cfg/psdof.txt
Normal 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;
|
||||
}
|
||||
60
evoke-64k/trunk/ev10/cfg/psenvlit.txt
Normal file
60
evoke-64k/trunk/ev10/cfg/psenvlit.txt
Normal file
@@ -0,0 +1,60 @@
|
||||
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);
|
||||
samplerCUBE envSampler : register(s6);
|
||||
samplerCUBE envIntSampler : register(s7);
|
||||
|
||||
static float g_fMinLight= 0.15f;
|
||||
static float3 g_fDif = float3(1.0f, 1.0f, 1.0f);
|
||||
static float3 g_fSpec = float3(3.0f, 3.0f, 3.0f);
|
||||
static float3 g_fShadowBack = float3(0.05f, 0.09f, 0.15f);
|
||||
|
||||
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
|
||||
{
|
||||
// Environment lighting
|
||||
// return texCUBE(envIntSampler, i.n);
|
||||
// Environment reflection
|
||||
// return texCUBE(envSampler, reflect(-i.v, i.n));
|
||||
|
||||
// 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 normal= normalize( i.n );
|
||||
|
||||
float fShadow = lerp( g_fMinLight, 1.0f, tex2D(shadowSampler, sc) );
|
||||
|
||||
float3 fColor = i.c.xyz;
|
||||
|
||||
float3 fDifLight= lerp( g_fShadowBack, texCUBE(envIntSampler, i.n ), fShadow );
|
||||
fColor*= fDifLight * g_fDif;
|
||||
|
||||
// Smoothstep sets threshold for specularity
|
||||
// fColor += 2.0f * smoothstep( 0.3f, 1.0f, texCUBE(envSampler, reflect(-i.v, normal)).xyz ); <- warum?! Spec kommt aus der ueberhellen Sonne
|
||||
fColor+= g_fSpec * i.c.aaa * texCUBE(envSampler, reflect(-i.v, normal)).xyz * lerp( 0.65f, 1.0f, fShadow );
|
||||
|
||||
// Interpret brightness > 1 as glow, ATTENTION: smaller glow value means MORE glow [0,1]
|
||||
float fGlow = saturate( 2.0f - dot(fColor, 0.333f) );
|
||||
|
||||
// Linear fake "tone mapping", remap color back into range [0,1] (glow will overbright area anyways)
|
||||
fColor.xyz /= max( 1.0f, dot(fColor, 0.333f) );
|
||||
|
||||
return float4( fColor, fGlow );
|
||||
}
|
||||
190
evoke-64k/trunk/ev10/cfg/psfluid.txt
Normal file
190
evoke-64k/trunk/ev10/cfg/psfluid.txt
Normal file
@@ -0,0 +1,190 @@
|
||||
float4x4 viewProj : register(c31);
|
||||
float3 eye : register(c2);
|
||||
float3 g_vLightDir : register(c1);
|
||||
float4x4 view : register(c35);
|
||||
|
||||
float softness : register(c20);
|
||||
float lightTransferAmmount : register(c21);
|
||||
float specularFactor : register(c22);
|
||||
float specularPower : register(c23);
|
||||
float translucencyAmmount : register(c24);
|
||||
float textureScale : register(c25);
|
||||
float surfaceTension : register(c26);
|
||||
float refractAmmount : register(c27);
|
||||
float depthDifferenceBlur : register(c28);
|
||||
|
||||
float2 ddx : register(c29);
|
||||
|
||||
sampler samplerPosition : register(s0);
|
||||
sampler samplerNormal : register(s1);
|
||||
sampler samplerDiffuse : register(s2); //WRAP
|
||||
sampler samplerBackground : register(s3);
|
||||
samplerCUBE envSampler : register(s6);
|
||||
|
||||
struct QuadOutput
|
||||
{
|
||||
float4 p:position;
|
||||
float2 t:texcoord0;
|
||||
float4 q:texcoord1;
|
||||
};
|
||||
|
||||
struct IndexedQuadOutput
|
||||
{
|
||||
float4 q:position;
|
||||
float3 n:normal;
|
||||
float4 p:texcoord0;
|
||||
float4 k:texcoord1;
|
||||
float2 t:texcoord2;
|
||||
float size:texcoord3;
|
||||
};
|
||||
|
||||
struct BlurResult
|
||||
{
|
||||
float4 position : color0;
|
||||
float4 normal : color1;
|
||||
};
|
||||
|
||||
|
||||
struct ColorDepth
|
||||
{
|
||||
float4 color : color0;
|
||||
float depth : depth;
|
||||
};
|
||||
|
||||
float CalcDepth(float4 pos, float difference)
|
||||
{
|
||||
float3 eyeVector = viewProj._m02_m12_m22;
|
||||
pos.xyz -= eyeVector * difference;
|
||||
float4 finalDepth = mul(pos, viewProj);
|
||||
return finalDepth.z / finalDepth.w;
|
||||
}
|
||||
|
||||
float4 psDepth(IndexedQuadOutput i):color
|
||||
{
|
||||
float l = length(i.t.xy * 2 - 1.0);
|
||||
if (l > 1.0)
|
||||
discard;
|
||||
|
||||
float dist = cos(asin(l));
|
||||
float3 eyeVector = viewProj._m02_m12_m22;
|
||||
float3 pos = i.p.xyz;
|
||||
//pos -= eyeVector * dist;
|
||||
return distance(eye, pos);
|
||||
}
|
||||
|
||||
ColorDepth psPosition(IndexedQuadOutput i)
|
||||
{
|
||||
float l = length(i.t.xy * 2 - 1.0);
|
||||
if (l > 1.0)
|
||||
discard;
|
||||
float dist = cos(asin(l));
|
||||
|
||||
ColorDepth result;
|
||||
float3 eyeVector = viewProj._m02_m12_m22;
|
||||
float3 pos = i.p.xyz;
|
||||
pos -= eyeVector * dist;
|
||||
|
||||
result.color = float4(pos, i.k.w);
|
||||
result.depth = CalcDepth(i.p, dist);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
ColorDepth psNormal(IndexedQuadOutput i)
|
||||
{
|
||||
float l = length(i.t.xy * 2 - 1.0);
|
||||
if (l > 1.0)
|
||||
discard;
|
||||
float dist = cos(asin(l));
|
||||
|
||||
ColorDepth result;
|
||||
float3 normal = float3(i.t.xy * 2 - 1.0, 0.0);
|
||||
normal.z = 1.0 - length(normal.xy);
|
||||
normal = normalize(normal);
|
||||
normal = mul(normal, (float3x3)view);
|
||||
result.color = float4(normal, 1.0);
|
||||
result.depth = CalcDepth(i.p, dist);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
BlurResult psBlur(QuadOutput input)
|
||||
{
|
||||
const int strength = 8;
|
||||
|
||||
float2 SamplePos = input.t;
|
||||
float pi4 = 3.141 * 2.0 / strength;
|
||||
|
||||
float4 resultPosition = tex2D(samplerPosition, SamplePos);
|
||||
|
||||
// distance dependend blur
|
||||
float dist = length(resultPosition.xyz - eye);
|
||||
float finalSoftness = softness * (10 / dist) * 3;
|
||||
|
||||
float3 centerPos = resultPosition.xyz;
|
||||
float4 resultNormal = tex2D(samplerNormal, SamplePos);
|
||||
|
||||
int cnt = 1;
|
||||
int normalCnt = 1;
|
||||
for (int i = 0; i < strength; i++)
|
||||
{
|
||||
SamplePos = input.t + ddx * finalSoftness * float2(sin(pi4 * i), cos(pi4 * i));
|
||||
float4 sampledPos = tex2D(samplerPosition, SamplePos);
|
||||
if (distance(sampledPos.xyz, centerPos) > depthDifferenceBlur)
|
||||
continue;
|
||||
|
||||
resultPosition += sampledPos;
|
||||
float4 sampledNormal = tex2D(samplerNormal, SamplePos);
|
||||
if (sampledNormal.a >= 0.0 || resultNormal.a == 0.0)
|
||||
{
|
||||
resultNormal += sampledNormal;
|
||||
normalCnt ++;
|
||||
}
|
||||
cnt++;
|
||||
}
|
||||
|
||||
BlurResult result;
|
||||
resultNormal /= normalCnt;
|
||||
resultNormal.xyz = normalize(resultNormal.xyz);
|
||||
result.normal = resultNormal;
|
||||
result.position = resultPosition / cnt;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
float4 psCompose(QuadOutput i):color0
|
||||
{
|
||||
float4 normal = tex2D(samplerNormal, i.t);
|
||||
float4 simpleBackgroundColor = tex2D(samplerBackground, i.t);
|
||||
if (normal.a < 0.9)
|
||||
return simpleBackgroundColor;
|
||||
|
||||
float3 viewDir = viewProj._m02_m12_m22;
|
||||
|
||||
float4 position = tex2D(samplerPosition, i.t);
|
||||
float intensity = position.a;
|
||||
normal.xyz *= lerp(tex3D(samplerDiffuse, normal.xyz*0.25).xyz, float3(1.0, 1.0, 1.0), intensity);
|
||||
normal.xyz = normalize(normal.xyz);
|
||||
|
||||
float4 lightColor = float4(0.925f, 1.0f, 0.75f, 1.f);
|
||||
float3 sssNormal = normalize(normal.xyz + g_vLightDir * lightTransferAmmount);
|
||||
|
||||
float fDiffuse = dot(sssNormal, g_vLightDir);
|
||||
|
||||
float3 h = normalize( normalize(viewDir) + g_vLightDir );
|
||||
float fSpecular = dot(normal.xyz, h);
|
||||
fSpecular = fSpecular > 0 ? pow( fSpecular, specularPower) * specularFactor : 0.0;
|
||||
|
||||
float4 diffuse = lightColor * fDiffuse * float4(0.8, 1.0, 1.0, 1.0);
|
||||
|
||||
float d = saturate(pow(1.2*(1.0 - dot(normal.xyz, viewDir)), 10.0))*0.5;
|
||||
float f = dot(viewDir,normal.xyz);// * 2 - 1;
|
||||
float2 texDuDv = mul((float3x3)view, normal.xyz).yx * -refractAmmount * (f * 2 - 1);
|
||||
|
||||
float4 background = 1.0;
|
||||
background.x = tex2D(samplerBackground, i.t + texDuDv * 1.1).x;
|
||||
background.y = tex2D(samplerBackground, i.t + texDuDv * 1.05).y;
|
||||
background.z = tex2D(samplerBackground, i.t + texDuDv * 1.0 ).z;
|
||||
|
||||
return lerp(diffuse, background, min(1.0, translucencyAmmount + intensity)) + texCUBE(envSampler, normal.xyz) * (1-f) * specularFactor * 0.5 + fSpecular * lightColor;
|
||||
}
|
||||
139
evoke-64k/trunk/ev10/cfg/psocean.txt
Normal file
139
evoke-64k/trunk/ev10/cfg/psocean.txt
Normal file
@@ -0,0 +1,139 @@
|
||||
float4 g_fResolution : register(c0);
|
||||
float3 g_vLightDir : register(c1);
|
||||
float3 g_vViewPos : register(c2);
|
||||
float3 g_fTime : register(c3);
|
||||
|
||||
sampler2D waveSampler : register(s0);
|
||||
sampler2D reflectionSampler : register(s1);
|
||||
sampler2D refractionSampler : 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 = 0.1f;
|
||||
static float3 g_vTexSpeed = float3(0.04f, 0.0f, 0.04f);
|
||||
static float g_fSpecularPower = 0.5f;
|
||||
static float g_fSpecularHardness = 128.f;
|
||||
|
||||
static float4 g_vWaveDirX = float4(0.07f, -0.035f, 0.03f, -0.05f);
|
||||
static float4 g_vWaveDirY = float4(0.07f, 0.005f, 0.11f, -0.09f);
|
||||
|
||||
static float3 g_vWaveVec = float3(4.0f, 0.0f, 0.9f);
|
||||
static float3 g_vWaveVecOrtho = 0.2f * float3(-0.9f, 0.0f, 4.0f);
|
||||
static float4 g_fWaveScale = float4(0.2f, 0.1f, 0.3f, 0.7f);
|
||||
static float4 g_fWaveNoise = float4(1.0f, 2.0f, 3.0f, 4.0f);
|
||||
//static float4 g_fWaveDistortion = float4(0.025f, 0.15f, 0.1f, 0.05f);
|
||||
static float4 g_fWaveDistortion = float4(0.025f, 0.1f, 0.03f, 0.01f);
|
||||
static float4 g_fWaveVariation = float4(3.0f, 4.0f, 17.0f, 23.0f);
|
||||
static float4 g_fWaveHeightVariation = float4(9.0f, 4.0f, 1.0f, 0.5f);
|
||||
|
||||
static float4 g_fLightFilterColor = float4(0.3f, 0.45f, 0.5f, 0.99f);
|
||||
static float4 g_fFogColor = float4(0.1f, 0.18f, 0.17f, 0.0f);
|
||||
|
||||
struct psIn
|
||||
{
|
||||
float2 t : TEXCOORD0;
|
||||
float3 n : TEXCOORD1;
|
||||
float3 v : TEXCOORD2;
|
||||
float4 s : TEXCOORD3;
|
||||
float3 w : TEXCOORD4;
|
||||
};
|
||||
|
||||
float4 ps_main(psIn i) : COLOR0
|
||||
{
|
||||
float st = g_fTime.z * 0.000035f;
|
||||
|
||||
float wt = (0.75f + 0.25f * sin(st)) * 0.05f;
|
||||
|
||||
float3 t = i.w * g_fTexScale;
|
||||
float3 dt = st * g_fTexScale * g_vTexSpeed;
|
||||
|
||||
float3 bx = float3(2.0f, 1.0f, 0.0f);
|
||||
|
||||
float4 fWave11 = tex2D(waveSampler, 0.13f * (t + 8 * dt).xz).xzyw * bx.xyxy - bx.yzyz;
|
||||
float4 fWave12 = tex2D(waveSampler, 0.13f * (t - 8 * dt).zx).xzyw * bx.xyxy - bx.yzyz;
|
||||
float4 fWave21 = tex2D(waveSampler, (t + 2 * dt).xz).xzyw * bx.xyxy - bx.yzyz;
|
||||
float4 fWave22 = tex2D(waveSampler, (t - 2 * dt).zx).xzyw * bx.xyxy - bx.yzyz;
|
||||
float4 fWave31 = tex2D(waveSampler, 11.0f * (t + 0.5f * dt).xz).xzyw * bx.xyxy - bx.yzyz;
|
||||
float4 fWave32 = tex2D(waveSampler, 11.0f * (t - 0.5f * dt).zx).xzyw * bx.xyxy - bx.yzyz;
|
||||
|
||||
float3 fWaveWeights = 1.0f; // float3(1.0f, 0.5f, 0.25f);
|
||||
|
||||
// Decode
|
||||
float4 fWave = (fWave11 * fWaveWeights.x + fWave21 * fWaveWeights.y + fWave31 * fWaveWeights.z
|
||||
+ fWave12 * fWaveWeights.x + fWave22 * fWaveWeights.y + fWave32 * fWaveWeights.z) / dot(fWaveWeights, 2.0f);
|
||||
fWave.xyz += (reflect(fWave11.xyz, fWave12.xyz) * fWaveWeights.x
|
||||
+ reflect(fWave21.xyz, fWave22.xyz) * fWaveWeights.y
|
||||
+ reflect(fWave31.xyz, fWave32.xyz) * fWaveWeights.z) / dot(fWaveWeights, 1.0f);
|
||||
fWave.y *= sign(fWave.y) * 11.0f;
|
||||
|
||||
float3 vNormal = normalize(fWave.xyz);
|
||||
|
||||
float4 fBigWaveX = g_vWaveDirX * i.w.x;
|
||||
fBigWaveX += g_vWaveDirY * i.w.z;
|
||||
fBigWaveX += fWave.w * 3 + st * 0.2f;
|
||||
fBigWaveX -= round(fBigWaveX);
|
||||
float4 fBigWave = 8.1688f * sin(fBigWaveX) * 0.02f;
|
||||
|
||||
float4 fBigWaveLength = 1.0f
|
||||
/ sqrt(g_vWaveDirX * g_vWaveDirX + g_vWaveDirY * g_vWaveDirY);
|
||||
|
||||
float fNormalDisplacement = 1.0f - saturate( dot(i.v, i.v) / 300000.0f + fwidth(dot(i.v, i.v)) / 5000.0f );
|
||||
vNormal.x -= dot(fBigWave, g_vWaveDirX * fBigWaveLength) * fNormalDisplacement;
|
||||
vNormal.z -= dot(fBigWave, g_vWaveDirY * fBigWaveLength) * fNormalDisplacement;
|
||||
vNormal = normalize(vNormal);
|
||||
|
||||
// Determine whether under water
|
||||
float4 fSubmerged = g_vViewPos.y - 5.0f;
|
||||
fSubmerged.y = sign(fSubmerged);
|
||||
fSubmerged.z = saturate(fSubmerged.y);
|
||||
fSubmerged.w = saturate(-fSubmerged.y);
|
||||
|
||||
// Invert normal under water
|
||||
vNormal.y *= fSubmerged.y;
|
||||
|
||||
// Evaluate fresnel term
|
||||
float3 vToEyeDir = normalize(i.v);
|
||||
float fFresnel = 1.0f - saturate( dot(vNormal, vToEyeDir) );
|
||||
float fPlaneFresnel = 1.0f - abs( dot(i.n, vToEyeDir) );
|
||||
fFresnel = lerp( fPlaneFresnel, max( fFresnel, fPlaneFresnel ), 0.5f );
|
||||
fFresnel = saturate( pow(fFresnel, 5) );
|
||||
|
||||
// Compute refraction
|
||||
float2 vRefractionOffset = vNormal.xz
|
||||
* lerp( 0.02f, 0.005f, saturate(dot(i.v, i.v) / 1000.0f) );
|
||||
float2 vRefractionCoord = i.s.xy / i.s.w;
|
||||
|
||||
// Compute depths
|
||||
float fEyeDepth = tex2D(depthSampler, vRefractionCoord).x;
|
||||
float fEyeRefractionDepth = tex2D(depthSampler, vRefractionCoord + vRefractionOffset).x;
|
||||
|
||||
// Compute fades
|
||||
float fWaterFade = saturate( 1.0f * abs(i.s.z - fEyeDepth) );
|
||||
float fRefractionFade = 1.0f - saturate(10.0f * (i.s.z - fEyeRefractionDepth));
|
||||
|
||||
// Compute corrected refraction coords
|
||||
vRefractionCoord += vRefractionOffset * fRefractionFade * fWaterFade;
|
||||
|
||||
// Fade water
|
||||
fFresnel *= fWaterFade;
|
||||
float fTransmissivity = saturate(2.0f - fFresnel - fWaterFade);
|
||||
|
||||
// Colorize
|
||||
float3 fColor = lerp( g_fFogColor.xyz,
|
||||
float3(0.8f, 0.8f, 0.85f) * tex2D(reflectionSampler, vRefractionCoord).xyz,
|
||||
fSubmerged.z )
|
||||
* fFresnel;
|
||||
fColor += tex2D(refractionSampler, vRefractionCoord).xyz
|
||||
* fTransmissivity;
|
||||
|
||||
// Specular highlights
|
||||
float3 vHalf = normalize( vToEyeDir + -g_vLightDir );
|
||||
float fSpecularity = saturate( dot(vNormal, vHalf) ); // * tex2Dproj(shadowSampler, i.s).x;
|
||||
fColor += g_fSpecularPower * pow(fSpecularity, g_fSpecularHardness) * fWaterFade;
|
||||
|
||||
return float4(fColor, 1.0f);
|
||||
}
|
||||
43
evoke-64k/trunk/ev10/cfg/psphong.txt
Normal file
43
evoke-64k/trunk/ev10/cfg/psphong.txt
Normal 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;
|
||||
}
|
||||
108
evoke-64k/trunk/ev10/cfg/pspssm.txt
Normal file
108
evoke-64k/trunk/ev10/cfg/pspssm.txt
Normal 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);
|
||||
}
|
||||
297
evoke-64k/trunk/ev10/cfg/psray.txt
Normal file
297
evoke-64k/trunk/ev10/cfg/psray.txt
Normal file
@@ -0,0 +1,297 @@
|
||||
float3 lightDir : register(c1);
|
||||
float3 viewPos : register(c2);
|
||||
float3 viewDir : register(c4);
|
||||
float3 passID2expIsLast : register(c23);
|
||||
|
||||
float4 g_fGlow : register(c61);
|
||||
|
||||
sampler2D colorSampler : register(s0);
|
||||
sampler2D depthSampler : register(s1);
|
||||
sampler2D waveSampler : register(s3);
|
||||
sampler2D shadowSampler : register(s4);
|
||||
|
||||
// Tweakables
|
||||
static float4 g_fRayColor = float4(1.75f * 0.45f, 1.75f * 0.4f, 1.75f * 0.35f, 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.xyz *= 1.0f + 0.25f * g_fGlow.z;
|
||||
r.a = min(ro.a, r.a);
|
||||
|
||||
return r * saturate(1.f - passID2expIsLast.z * r.a);
|
||||
}
|
||||
|
||||
float3 g_fTime : register(c3);
|
||||
|
||||
// Tweakables
|
||||
static float g_fWaterLevel = 5.0f;
|
||||
|
||||
static float4 g_fLightFilterColor = float4(0.4f, 0.75f, 0.8f, 0.99f); // float4(0.8f, 0.85f, 0.9f, 0.8f);
|
||||
static float g_fFilterOffset = 0.0f;
|
||||
static float g_fLightFilterDensity = 0.02f;
|
||||
|
||||
static float g_fCausticScaling = 0.004f;
|
||||
static float g_fCausticDistortion = 0.1f;
|
||||
static float4 g_fCausticPatternScaling = 0.25f;
|
||||
static float2 g_vCausticSpeed = float2(0.05f, 0.1f);
|
||||
static float g_fCausticBrightness = 0.35f;
|
||||
|
||||
float4 ps_underwater_filter(float2 TexCoord : TEXCOORD0, float3 EyeDir : TEXCOORD1,
|
||||
float2 LightPos : TEXCOORD2) : COLOR0
|
||||
{
|
||||
// Compute eye space position
|
||||
float fEyeDepth = tex2D(depthSampler, TexCoord).x;
|
||||
float3 vEyePoint = viewPos + fEyeDepth * EyeDir;
|
||||
float3 vEyeNormal = normalize( cross( ddx(vEyePoint), ddy(vEyePoint) ) );
|
||||
|
||||
// Compute distance to water level
|
||||
float fUnderWater = g_fWaterLevel - vEyePoint.y;
|
||||
float fLightTravel = max( fUnderWater / max(-lightDir.y, 0.0001f), 0.0f );
|
||||
|
||||
// Intersect water plane
|
||||
float3 vSubmerged = vEyePoint - viewPos;
|
||||
float fSubmergedBelow = (fUnderWater >= 0.0f)
|
||||
? abs(vSubmerged.y)
|
||||
: (g_fWaterLevel - viewPos.y);
|
||||
float fSubmerged = (viewPos.y > g_fWaterLevel)
|
||||
? max(fUnderWater, 0.0f)
|
||||
: fSubmergedBelow;
|
||||
vSubmerged *= fSubmerged / max( abs(vSubmerged.y), 0.0001f );
|
||||
|
||||
// Compute submerged length
|
||||
fSubmerged = length(vSubmerged);
|
||||
|
||||
// Compute light color
|
||||
float4 fFilterDist= fLightTravel + float2(fSubmerged, 0.0f).xxxy;
|
||||
float4 fLightColor = pow(g_fLightFilterColor, g_fLightFilterDensity * fFilterDist );
|
||||
|
||||
// Color hack
|
||||
fLightColor.xyz *= pow(g_fLightFilterColor.xyz, max(fLightTravel - 30, 0) * 0.08f);
|
||||
|
||||
// Compute light coordinate space
|
||||
float3 vLightU = normalize( cross( lightDir, float3(1.0f, 0.0f, 0.0f) ) );
|
||||
float3 vLightV = normalize( cross( vLightU, lightDir ) );
|
||||
|
||||
// Scale time
|
||||
float fTime = g_fTime.z * 0.000095f;
|
||||
|
||||
// Animate caustics
|
||||
float2 fCausticCoord = float2( dot(vLightU, vEyePoint), dot(vLightV, vEyePoint) ) * g_fCausticScaling;
|
||||
float2 fCausticCoordDelta = fTime * g_vCausticSpeed * g_fCausticScaling;
|
||||
|
||||
float3 bx = float3(2.0f, 1.0f, 0.0f);
|
||||
|
||||
// Get caustic normal
|
||||
float3 vCausticNormal1 = normalize( tex2D(waveSampler, fCausticCoord - fCausticCoordDelta).xzy * bx.xyx - bx.yzy );
|
||||
float3 vCausticNormal2 = normalize( tex2D(waveSampler, fCausticCoord.yx + fCausticCoordDelta).xzy * bx.xyx - bx.yzy );
|
||||
float3 vCausticNormal3 = normalize( tex2D(waveSampler, 5 * (fCausticCoord - 2 * fCausticCoordDelta)).xzy * bx.xyx - bx.yzy );
|
||||
float3 vCausticNormal4 = normalize( tex2D(waveSampler, 5 * (fCausticCoord.yx + 2 * fCausticCoordDelta)).xzy * bx.xyx - bx.yzy );
|
||||
|
||||
// Compute normals used for distortion & lighting
|
||||
float3 vCausticNormalX1 = vCausticNormal1 + vCausticNormal4 / 3.0f;
|
||||
float3 vCausticNormalX2 = vCausticNormal2 + vCausticNormal3 / 3.0f;
|
||||
float3 vCausticNormal = vCausticNormalX1 + vCausticNormalX2;
|
||||
vCausticNormal = normalize(vCausticNormal);
|
||||
|
||||
// Compute caustic pattern
|
||||
float4 fCausticPattern = float2( dot(vEyePoint, vLightU), dot(vEyePoint, vLightV) ).xyxy;
|
||||
fCausticPattern.xy += g_fCausticDistortion * vCausticNormalX1.xz * (1.0f + fEyeDepth); // + 1000 * dc.yx;
|
||||
fCausticPattern.zw += g_fCausticDistortion * vCausticNormalX2.xz * (1.0f + fEyeDepth); // - 1000 * dc.xy;
|
||||
fCausticPattern *= g_fCausticPatternScaling;
|
||||
fCausticPattern = 2.0f * (fCausticPattern - round(fCausticPattern));
|
||||
float fCaustics = dot(fCausticPattern, fCausticPattern) * g_fCausticBrightness;
|
||||
|
||||
// Sharpen
|
||||
fCaustics *= fCaustics;
|
||||
fCaustics *= fCaustics;
|
||||
|
||||
// Cut at surface
|
||||
fCaustics *= saturate(fUnderWater);
|
||||
|
||||
// Remove underside lighting
|
||||
fCaustics *= saturate( dot(vEyeNormal, -lightDir) ) * tex2D(shadowSampler, TexCoord).x;
|
||||
|
||||
float3 vSurfacePoint = vEyePoint - vSubmerged;
|
||||
vSurfacePoint.y = 0.0f;
|
||||
float fFadeOut = saturate( max(dot(vSurfacePoint, vSurfacePoint) - 2000000.0f, 0.0f) / 10000000.0f )
|
||||
* saturate(fUnderWater);
|
||||
|
||||
// Filter light
|
||||
return lerp(float4(fLightColor.xyz, fLightColor.w * fCaustics), float2(1, 0).xxxy, fFadeOut);
|
||||
}
|
||||
|
||||
// Tweakables
|
||||
static float4 g_fFogColor = float4(0.1f, 0.18f, 0.17f, 0.0f); // float4(0.6f, 0.7f, 0.9f, 0.25f);
|
||||
static float g_fFogDensity = 0.7f;
|
||||
static float g_fSceneFog = 0.6f;
|
||||
static float g_fRayScaling = 0.024f;
|
||||
static float2 g_vRaySpeed = float2(0.03f, 0.02f);
|
||||
|
||||
float4 ps_underwater(float2 TexCoord : TEXCOORD0, float3 EyeDir : TEXCOORD1,
|
||||
float2 LightPos : TEXCOORD2) : COLOR0
|
||||
{
|
||||
// Compute eye space position
|
||||
float fEyeDepth = tex2D(depthSampler, TexCoord).x;
|
||||
float3 vEyePoint = viewPos + fEyeDepth * EyeDir;
|
||||
|
||||
// Compute distance to water level
|
||||
float fUnderWater = g_fWaterLevel - vEyePoint.y;
|
||||
|
||||
// Intersect water plane
|
||||
float3 vSubmerged = vEyePoint - viewPos;
|
||||
float fSubmergedBelow = (fUnderWater >= 0.0f)
|
||||
? abs(vSubmerged.y)
|
||||
: (g_fWaterLevel - viewPos.y);
|
||||
float fSubmerged = (viewPos.y > g_fWaterLevel)
|
||||
? max(fUnderWater, 0.0f)
|
||||
: fSubmergedBelow;
|
||||
vSubmerged *= fSubmerged / max( abs(vSubmerged.y), 0.0001f );
|
||||
|
||||
// Compute submerged length & normalize
|
||||
fSubmerged = length(vSubmerged);
|
||||
float3 vSubmergedDir = vSubmerged / max(fSubmerged, 0.0001f);
|
||||
|
||||
// Pre-compute light travel quantities
|
||||
float fEyeLightTravel = max( (g_fWaterLevel - viewPos.y) / max(-lightDir.y, 0.0001f), 0.0f );
|
||||
float fDeltaLightTravel = vSubmergedDir.y / min(lightDir.y, -0.0001f);
|
||||
float fSubmergedLightTravel = fEyeLightTravel + fDeltaLightTravel * fSubmerged;
|
||||
|
||||
float4 fLogLightFilterColor = log(g_fLightFilterColor);
|
||||
float4 fFog = g_fFogColor / (fLogLightFilterColor * g_fLightFilterDensity * fDeltaLightTravel - g_fFogDensity);
|
||||
fFog *= exp(fLogLightFilterColor * (g_fFilterOffset + g_fLightFilterDensity * fSubmergedLightTravel) - g_fFogDensity * fSubmerged)
|
||||
- exp(fLogLightFilterColor * (g_fFilterOffset + g_fLightFilterDensity) * fEyeLightTravel);
|
||||
|
||||
// "Absorb" more scene light
|
||||
fFog.w = g_fSceneFog * (1.0f - exp(-g_fFogDensity * fSubmerged));
|
||||
// fFog.w = dot(fFog.xyz, 0.1f);
|
||||
// fFog.w = 1.0f - fFog.w;
|
||||
// fFog.w = 0;
|
||||
|
||||
// Compute light coordinate space
|
||||
float3 vLightU = normalize( cross( lightDir, float3(1.0f, 0.0f, 0.0f) ) );
|
||||
float3 vLightV = normalize( cross( vLightU, lightDir ) );
|
||||
|
||||
// Parallel ray direction vector
|
||||
float3 vRayDir = EyeDir - lightDir * dot(lightDir, EyeDir);
|
||||
vRayDir = normalize(vRayDir);
|
||||
float3 vFullRayDir = EyeDir / dot(EyeDir, vRayDir);
|
||||
|
||||
// 1 / submerged flat
|
||||
float3 vSubmergedFlatInvScale = vSubmerged - lightDir * dot(lightDir, vSubmerged);
|
||||
vSubmergedFlatInvScale /= max( dot(vSubmergedFlatInvScale, vSubmergedFlatInvScale), 0.0001f );
|
||||
|
||||
// 4 ray Planes
|
||||
float4 fPlanes = float4(5.0f, 10.0f, 20.0f, 40.0f);
|
||||
float4 fPlaneIntersect = fPlanes * dot(vRayDir, vSubmergedFlatInvScale);
|
||||
float4 fPlaneSubmerged = vSubmerged.y * fPlaneIntersect;
|
||||
// float fWeightScaling = saturate( 1.0f - 0.1f * dot(viewDir, -lightDir) ); // polar
|
||||
float4 fPlaneWeight = 1.0f - saturate( 0.5f * (fPlaneIntersect - 1.0f) );
|
||||
|
||||
// Compute light travel
|
||||
float4 fPlanesY = g_fWaterLevel - (viewPos.y + vFullRayDir.y * fPlanes);
|
||||
float4 fPlanesLightTravel = max( fPlanesY / max(-lightDir.y, 0.0001f), 0.0f );
|
||||
float4 fPlanesLightInt = 1.0f / (1.0f + 0.01f * fPlanesLightTravel * fPlanesLightTravel);
|
||||
|
||||
// return float4(fPlanesLightInt.yyy, 1.0f);
|
||||
|
||||
// Snap view pos
|
||||
// float3 vSnappedViewPos = vLightU * floor( dot(vLightU, viewPos) / 25.0f ) * 25.0f
|
||||
// + vLightV * floor( dot(vLightV, viewPos) / 25.0f ) * 25.0f;
|
||||
// fPlanes += dot(viewPos - vSnappedViewPos, vRayDir);
|
||||
|
||||
// Scale time
|
||||
float fTime = g_fTime.z * 0.000075f;
|
||||
|
||||
// Animate rays
|
||||
float4 fRayCoordsX = dot(vLightU, viewPos) + dot(vLightU, vRayDir) * fPlanes;
|
||||
float4 fRayCoordsY = dot(vLightV, viewPos) + dot(vLightV, vRayDir) * fPlanes;
|
||||
// fPlanes = dot(vLightU, vRayDir) * tx - dot(vLightV, vRayDir) * ty - 2.0f * dot(viewPos, vRayDir);
|
||||
fRayCoordsX *= g_fRayScaling; fRayCoordsY *= g_fRayScaling;
|
||||
float2 fRayCoordDelta = fTime * g_vRaySpeed * g_fRayScaling;
|
||||
|
||||
// Sample rays
|
||||
float4 fRay1 = tex2D(waveSampler, float2(fRayCoordsX.x, fRayCoordsY.x) + fPlanes.x * fRayCoordDelta).xzyw;
|
||||
float4 fRay2 = tex2D(waveSampler, float2(fRayCoordsX.y, fRayCoordsY.y) - fPlanes.y * fRayCoordDelta).xzyw;
|
||||
float4 fRay3 = tex2D(waveSampler, float2(fRayCoordsX.z, fRayCoordsY.z) + fPlanes.z * fRayCoordDelta).xzyw;
|
||||
float4 fRay4 = tex2D(waveSampler, float2(fRayCoordsX.w, fRayCoordsY.w) - fPlanes.w * fRayCoordDelta).xzyw;
|
||||
|
||||
// Decode Normal
|
||||
float3 vRayNormal = (fRay1.xyz + fRay2.xyz + fRay3.xyz + fRay4.xyz) / 4.0f;
|
||||
vRayNormal.xz = vRayNormal.xz * 2.0f - 1.0f;
|
||||
vRayNormal = normalize(vRayNormal);
|
||||
|
||||
float4 fLight;
|
||||
|
||||
// Light
|
||||
fLight.x = fRay1.w;
|
||||
fLight.y = fRay2.w;
|
||||
fLight.z = fRay3.w;
|
||||
fLight.w = fRay4.w;
|
||||
|
||||
// fLight *= fLight * fLight;
|
||||
|
||||
float fLightSubmerged = 0.05f * max( fPlaneIntersect * dot(vSubmerged, lightDir), 0.0f);
|
||||
|
||||
// Fade rays
|
||||
fLight *= fPlanesLightInt * fPlaneWeight * saturate(fSubmerged) / (1.0f + fLightSubmerged * fLightSubmerged);
|
||||
fLight *= saturate(g_fWaterLevel - viewPos.y + 1.0f);
|
||||
|
||||
float fRayAngle = saturate( 1.0f - dot(vRayNormal, -lightDir) );
|
||||
float fRayColor = 0.1f * saturate( dot(EyeDir, vRayNormal - lightDir) );
|
||||
fRayAngle = frac( fRayAngle );
|
||||
|
||||
float3 fLightColor = 1.0f;
|
||||
fLightColor.r += saturate( 1.0f - pow(3.0f * fRayAngle - 3.0f * (fRayAngle > 1.0f / 3.0f), 2) ) * fRayColor;
|
||||
fLightColor.g += saturate( 1.0f - pow(3.0f * fRayAngle - 1.0f, 2) ) * fRayColor;
|
||||
fLightColor.b += saturate( 1.0f - pow(3.0f * fRayAngle - 2.0f, 2) ) * fRayColor;
|
||||
|
||||
// God rays
|
||||
fFog.xyz += dot(fLight, 0.04f) * fLightColor;
|
||||
|
||||
float3 vSurfacePoint = vEyePoint - vSubmerged;
|
||||
vSurfacePoint.y = 0.0f;
|
||||
float fFadeOut = 1.0f - saturate( max(dot(vSurfacePoint, vSurfacePoint) - 2000000.0f, 0.0f) / 10000000.0f )
|
||||
* saturate(fUnderWater);
|
||||
|
||||
return fFog * fFadeOut;
|
||||
}
|
||||
97
evoke-64k/trunk/ev10/cfg/pssky.txt
Normal file
97
evoke-64k/trunk/ev10/cfg/pssky.txt
Normal file
@@ -0,0 +1,97 @@
|
||||
float3 g_vLightDir : register(c1); // = normalize( float3(1.f,-3.f,-2.f) );
|
||||
float3 g_fTime : register(c3);
|
||||
|
||||
sampler3D randomSampler : register(s0);
|
||||
samplerCUBE envSampler : register(s6);
|
||||
|
||||
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);
|
||||
|
||||
// { Outside, Cave }
|
||||
static float g_fSunSize[] = { .0025f, .01f };
|
||||
static float g_fCoronaSize[] = { .005f, 0.02f };
|
||||
static float4 g_fSunColor[] = { float4(0.925f, 1.0f, 0.75f, 1.f), float4(0.925f, 1.0f, 0.85f, 1.0f) * 8.0f };
|
||||
static float cover[] = { 0.275f, 0.0275f };
|
||||
|
||||
float4 clouds(float3 d, float4 color, uniform int iConfig)
|
||||
{
|
||||
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);
|
||||
|
||||
float3 smoothAlpha = float3(cloud.a, cloud1.a, cloud2.a);
|
||||
smoothAlpha = saturate( smoothAlpha - max(cover[iConfig] - 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[iConfig] - cloud.a, 0.f) * 25.f );
|
||||
|
||||
float3 sdd = d + g_vLightDir;
|
||||
float sd = dot(sdd, sdd);
|
||||
float s = g_fCoronaSize[iConfig] / ( g_fCoronaSize[iConfig] + saturate(sd - g_fSunSize[iConfig]) );
|
||||
|
||||
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[iConfig]));
|
||||
cloud.xyz = dot(cloud.xyz, .3f) + 0.1f * cloud.xyz;
|
||||
cloud.xyz = 1.f - .65f * cloud.xyz * (1.f - 0.2f * cover[iConfig]);
|
||||
cloud.xyz += 0.4f * light * saturate(cover[iConfig]);
|
||||
|
||||
cloud.xyz = cloud.a * cloud.xyz + (1 - cloud.a) * color.xyz;
|
||||
cloud.xyz += (1 - 0.5f * cloud.a) * g_fSunColor[iConfig].xyz * s;
|
||||
|
||||
float3 riseColor = float3(0.9,0.8,0) * (1 - cover[iConfig] * 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_sky_temp(float3 w : TEXCOORD4, uniform int iConfig):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, iConfig);
|
||||
}
|
||||
|
||||
float4 ps_sky(float3 w : TEXCOORD4):color { return ps_sky_temp(w, 0); }
|
||||
float4 ps_cave_sky(float3 w : TEXCOORD4):color { return ps_sky_temp(w, 1); }
|
||||
|
||||
float4 ps_env(float3 w : TEXCOORD4):color
|
||||
{
|
||||
float4 fColor = texCUBE(envSampler, w);
|
||||
|
||||
// Interpret brightness > 1 as glow, ATTENTION: smaller glow value means MORE glow [0,1]
|
||||
float fGlow = max( 0.65f, saturate( 2.0f - dot(fColor, 0.333f) ) );
|
||||
|
||||
// Linear fake "tone mapping", remap color back into range [0,1] (glow will overbright area anyways)
|
||||
fColor.xyz /= max( 1.0f, dot(fColor.xyz, 0.333f) );
|
||||
|
||||
return float4( fColor.xyz, fGlow );
|
||||
}
|
||||
342
evoke-64k/trunk/ev10/cfg/psterrain.txt
Normal file
342
evoke-64k/trunk/ev10/cfg/psterrain.txt
Normal file
@@ -0,0 +1,342 @@
|
||||
float4x4 viewProj : register(c31);
|
||||
float4 resolution : register(c0);
|
||||
float3 lightDir : register(c1);
|
||||
|
||||
sampler2D waveSampler : register(s0);
|
||||
sampler3D randomSampler : register(s1);
|
||||
|
||||
sampler1D dif : register(s2);
|
||||
sampler1D spec : register(s3);
|
||||
sampler2D shadowSampler : register(s4);
|
||||
sampler2D depthSampler : register(s5);
|
||||
samplerCUBE envSampler : register(s6);
|
||||
|
||||
static float3 lightSources[] = {
|
||||
float3(19.6f, 8.9f, 2.0f),
|
||||
float3(40.3f, 0.7f, 26.1f),
|
||||
float3(22.5f, -6.2f, -9.2f),
|
||||
float3(-15.9f, 6.8f, -23.9f),
|
||||
float3(-5.2f, 8.9f, -29.2f),
|
||||
float3(10.1f, 11.4f, -13.6f) };
|
||||
static float4 lightColors[] = {
|
||||
8.0 * float4(0.7f, 0.6f, 1.0f, 1.0f),
|
||||
8.0 * float4(0.7f, 0.6f, 1.0f, 1.0f),
|
||||
8.0 * float4(0.7f, 0.6f, 1.0f, 1.0f),
|
||||
8.0 * float4(0.7f, 0.6f, 1.0f, 1.0f),
|
||||
8.0 * float4(0.7f, 0.6f, 1.0f, 1.0f),
|
||||
8.0 * float4(0.7f, 0.6f, 1.0f, 1.0f) };
|
||||
static float lightRanges[] = {
|
||||
3.0f / 2.6f,
|
||||
3.0f / 3.5f,
|
||||
3.0f / 5.3f,
|
||||
3.0f / 1.0f,
|
||||
3.0f / 1.2f,
|
||||
3.0f / 1.6f };
|
||||
static int lightCount = 6;
|
||||
|
||||
struct psIn
|
||||
{
|
||||
float4 c : COLOR0;
|
||||
float2 t : TEXCOORD0;
|
||||
float3 n : TEXCOORD1;
|
||||
float3 v : TEXCOORD2;
|
||||
float4 s : TEXCOORD3;
|
||||
float3 w : TEXCOORD4;
|
||||
};
|
||||
|
||||
float4 tex2D_3D(uniform sampler2D smplr, in float3 t, in float3 n)
|
||||
{
|
||||
float4 front = tex2D(smplr, t.xy);
|
||||
float4 side = tex2D(smplr, t.zy);
|
||||
float4 floor = tex2D(smplr, t.xz);
|
||||
|
||||
return lerp( lerp(side, front, abs(n.z)), floor, abs(n.y) );
|
||||
}
|
||||
|
||||
float4 ps_main(psIn i, uniform bool bCrystalLight) : color0
|
||||
{
|
||||
// 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) * resolution.zw;
|
||||
sc += aaetc * saturate(4.f * aa);
|
||||
|
||||
float3 t = i.w / 128;
|
||||
float3 n = normalize(i.n);
|
||||
float3 v = normalize(i.v);
|
||||
|
||||
// Composition
|
||||
float iceAmount = 0.68f;
|
||||
float rock = smoothstep(iceAmount - 0.05f, iceAmount, tex2D_3D(waveSampler, 0.6f * t, n).a);
|
||||
float rockBlend = smoothstep( -0.7f, 1.0f, rock );
|
||||
float transition = 1.0f - abs( 2.0f * rock - 1.0f );
|
||||
|
||||
// Surface
|
||||
float3 vSurfacePoint = i.w - n * rock;
|
||||
float3 vSurfacePointDDX = ddx(vSurfacePoint), vSurfacePointDDY = ddy(vSurfacePoint);
|
||||
float3 vSurfaceNormal = normalize( cross(vSurfacePointDDX, vSurfacePointDDY) );
|
||||
float3 vFlatSurfaceNormal = vSurfaceNormal - n * dot(n, vSurfaceNormal);
|
||||
|
||||
float4 fShadow = float4(0.2f, 0.4f, 0.6f, 0.8f) + float4(0.8f, 0.6f, 0.4f, 0.2f) * tex2D(shadowSampler, sc).x;
|
||||
|
||||
float3 tc = (i.w - v) * 8;
|
||||
|
||||
float3 vCellCoord1 = tc + 1.5f * tex3D(randomSampler, tc / 48).xyz;
|
||||
float3 vCellCoord2 = 1.25f * tc + 3.0f * tex3D(randomSampler, tc / 32).xyz;
|
||||
float3 vCellCoord1Frac = frac(vCellCoord1) * 2.0f - 1.0f;
|
||||
float3 vCellCoord2Frac = frac(vCellCoord2) * 2.0f - 1.0f;
|
||||
vCellCoord1 = floor(vCellCoord1) + sign(vCellCoord1Frac) * pow( abs(vCellCoord1Frac), 8 ) * 0.5f + 0.5f;
|
||||
vCellCoord2 = floor(vCellCoord2) + sign(vCellCoord2Frac) * pow( abs(vCellCoord2Frac), 8 ) * 0.5f + 0.5f;
|
||||
|
||||
float3 vCellNormal1 = normalize( tex3D(randomSampler, vCellCoord1 / 32).xyz * 2.0f - 1.0f );
|
||||
float3 vCellNormal2 = normalize( tex3D(randomSampler, vCellCoord2 / 32).xyz * 2.0f - 1.0f );
|
||||
float3 vFlatCellNormal1 = vCellNormal1 - n * dot(n, vCellNormal1);
|
||||
float3 vFlatCellNormal2 = vCellNormal2 - n * dot(n, vCellNormal2);
|
||||
|
||||
float3 rockN = tex2D_3D(waveSampler, t, n).xyz
|
||||
* (0.5 - abs( cos( (t.x + 0.1 * tex2D_3D(waveSampler, t * 2, n).a) * 20 ) ) );
|
||||
float3 roughN = tex2D_3D(waveSampler, t * 10, n).xyz * 0.3
|
||||
+ tex2D_3D(waveSampler, t * 100, n).xyz * 0.4;
|
||||
|
||||
float3 fIceNormal = normalize( n + 0.2f * roughN + transition * vFlatSurfaceNormal );
|
||||
float3 fIceNormalEx = normalize(fIceNormal - 0.7f * n * dot(fIceNormal, n));
|
||||
float3 fRockNormal = normalize( n + 0.4f * (roughN + rockN) );
|
||||
float3 fRockNormalEx = normalize(fRockNormal - 0.6f * n * dot(fRockNormal, n));
|
||||
|
||||
float3 fIceCellNormal1 = normalize(fIceNormalEx - 0.1f * vFlatCellNormal1);
|
||||
float3 fIceCellNormal2 = vCellNormal2; // normalize(fIceNormalEx - 0.7f * vFlatCellNormal2);
|
||||
|
||||
float2 fLight = float2( dot(fIceNormal, -lightDir), dot(fRockNormal, -lightDir) );
|
||||
float2 fRimLight = 1.0f - abs(fLight); // * saturate( dot(lightDir, v) );
|
||||
fLight = min(fShadow.y * fLight, fLight); // Occlude only direct lighting (back-shadowing artifacts otherwise)
|
||||
fLight = saturate( 0.2f * saturate(1.0f + 2.0f * fLight) + 0.8f * saturate(fLight) ); // Ambient, Diffuse
|
||||
fRimLight *= fShadow.w;
|
||||
|
||||
float3 h = normalize( v + -lightDir );
|
||||
float4 hdn = float4( abs( dot( h, fIceNormalEx ) ), dot( h, fRockNormalEx ), dot( h, fIceCellNormal1 ), dot( h, fIceCellNormal2 ) );
|
||||
float4 fSpecularity = fShadow.ywww * pow( saturate( hdn ), float4(8.0f, 4.0f, 4.0f, 8.0f) );
|
||||
|
||||
float4 fIceCrystalLight = 0.0f;
|
||||
float4 fRockCrystalLight = 0.0f;
|
||||
|
||||
if(bCrystalLight)
|
||||
{
|
||||
for (int l = 0; l < lightCount; l++)
|
||||
{
|
||||
float3 toW = (i.w - lightSources[l]) * lightRanges[l];
|
||||
float3 dirToW = normalize(toW);
|
||||
float2 lgt = 1.0f / ( 1.0f + dot(toW, toW) );
|
||||
lgt *= saturate( float2( dot(-dirToW, fIceNormal) , dot(-dirToW, fRockNormal) ) );
|
||||
|
||||
fIceCrystalLight += lgt.x * lightColors[l];
|
||||
fRockCrystalLight += lgt.y * lightColors[l];
|
||||
}
|
||||
}
|
||||
|
||||
// Ice
|
||||
float fIceSpecBoost = 0.4f * saturate( 0.5f - 0.5f * dot(lightDir, v) );
|
||||
// return float2(fIceSpecBoost, 1).xxxy;
|
||||
float fIceSpecularity = dot( fSpecularity.xzw, float3(0.35f, 0.35f, 0.4f + fIceSpecBoost) ); // float3(0.35f, 0.35f, 0.5f)
|
||||
float4 fIceSpecLighting = 0.4f * tex1D(spec, 0.85f + 0.15f * fIceSpecularity) * fIceSpecularity;
|
||||
|
||||
float4 fIceLighting = tex1D(dif, fLight.x) + fIceCrystalLight;
|
||||
float4 fIceRimLighting = tex1D(dif, fRimLight.x);
|
||||
|
||||
float fIceRimFresnel = pow( saturate( 1.0f - dot(fIceNormal, v) ), 8 ) * saturate( 0.5f + 0.5f * dot(lightDir, v) );
|
||||
|
||||
float fIceFresnel = 0.5f + dot(0.5f / 3, float3( dot(v, fIceNormalEx), dot(v, fIceCellNormal1), dot(v, fIceCellNormal2) ));
|
||||
float fPlaneIceFresnel = 0.5f + 0.5f * dot(v, n);
|
||||
fIceFresnel = lerp(fPlaneIceFresnel, max(fIceFresnel, fPlaneIceFresnel), 0.5f);
|
||||
fIceFresnel = pow(fIceFresnel, 4);
|
||||
|
||||
float4 fIceColor = lerp(
|
||||
float4(0.665f, 0.738f, 0.901f, 1.0f),
|
||||
float4(0.965f, 0.938f, 0.901f, 1.0f),
|
||||
fIceFresnel );
|
||||
fIceSpecLighting *= fIceColor;
|
||||
fIceColor *= fIceLighting;
|
||||
fIceColor += float4(0.905f, 0.908f, 0.901f, 1.0f) * fIceRimFresnel * fIceRimLighting;
|
||||
|
||||
fIceColor.w *= saturate( 1.0f - dot( float2(0.3f, 0.7f), fSpecularity.zw ) );
|
||||
|
||||
// Rock
|
||||
float4 fRockLighting = tex1D(dif, fLight.y) + fRockCrystalLight
|
||||
+ 0.2f * tex1D(spec, 0.75f + 0.25f * fSpecularity.y) * fSpecularity.y;
|
||||
float4 fRockColor = float4(0.45f, 0.4f, 0.5f, 1.0f);
|
||||
fRockColor *= fRockLighting;
|
||||
|
||||
// Compose
|
||||
float4 fColor = lerp( fIceColor, fRockColor, saturate(rockBlend) ); // saturate(rock)
|
||||
fColor += fIceSpecLighting * (rock < 0.5f);
|
||||
|
||||
return fColor;
|
||||
}
|
||||
|
||||
static float3 g_fLightFilterColor = float3(0.3f, 0.45f, 0.5f);
|
||||
|
||||
float4 ps_main_isle(psIn i) : color0
|
||||
{
|
||||
// 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) * resolution.zw;
|
||||
sc += aaetc * saturate(4.f * aa);
|
||||
|
||||
float3 t = i.w / 128;
|
||||
float3 n = normalize(i.n);
|
||||
float3 v = normalize(i.v);
|
||||
|
||||
// Composition
|
||||
float shore = 0.4f * (i.w.y - 5) + tex2D_3D(waveSampler, t * 3, n).a;
|
||||
// shore = max(0.02, smoothstep(0.0, 1.5, shore) * (smoothstep(0.6, 0.7, n.y)) * 0.5);
|
||||
shore = saturate(1.0f - shore);
|
||||
|
||||
float rock = (1 - smoothstep(0.6, 0.8, n.y)) * smoothstep(0.5, 0.7, tex2D_3D(waveSampler, t * 2, n).a);
|
||||
rock += (1 - smoothstep(0.4, 0.8, n.y)) * smoothstep(0.35, 0.45, tex2D_3D(waveSampler, t * 2, n).a);
|
||||
rock = rock / 2 + shore;
|
||||
float rockBlend = smoothstep( -0.7f, 1.0f, rock );
|
||||
float transition = saturate( 1.0f - 5.0f * abs( 2.0f * rock - 1.0f ) );
|
||||
|
||||
// Surface
|
||||
float3 vSurfacePoint = i.w - n * rock;
|
||||
float3 vSurfacePointDDX = ddx(vSurfacePoint), vSurfacePointDDY = ddy(vSurfacePoint);
|
||||
float3 vSurfaceNormal = normalize( cross(vSurfacePointDDX, vSurfacePointDDY) );
|
||||
float3 vFlatSurfaceNormal = vSurfaceNormal - n * dot(n, vSurfaceNormal);
|
||||
|
||||
float4 fShadow = float4(0.2f, 0.4f, 0.6f, 0.8f) + float4(0.8f, 0.6f, 0.4f, 0.2f) * tex2D(shadowSampler, sc).x;
|
||||
|
||||
float3 tc = (i.w - v) * 8;
|
||||
|
||||
float3 vCellCoord1 = tc + 1.5f * tex3D(randomSampler, tc / 48).xyz;
|
||||
float3 vCellCoord2 = 1.25f * tc + 3.0f * tex3D(randomSampler, tc / 32).xyz;
|
||||
float3 vCellCoord1Frac = frac(vCellCoord1) * 2.0f - 1.0f;
|
||||
float3 vCellCoord2Frac = frac(vCellCoord2) * 2.0f - 1.0f;
|
||||
vCellCoord1 = floor(vCellCoord1) + sign(vCellCoord1Frac) * pow( abs(vCellCoord1Frac), 8 ) * 0.5f + 0.5f;
|
||||
vCellCoord2 = floor(vCellCoord2) + sign(vCellCoord2Frac) * pow( abs(vCellCoord2Frac), 8 ) * 0.5f + 0.5f;
|
||||
|
||||
float3 vCellNormal1 = normalize( tex3D(randomSampler, vCellCoord1 / 32).xyz * 2.0f - 1.0f );
|
||||
float3 vCellNormal2 = normalize( tex3D(randomSampler, vCellCoord2 / 32).xyz * 2.0f - 1.0f );
|
||||
float3 vFlatCellNormal1 = vCellNormal1 - n * dot(n, vCellNormal1);
|
||||
float3 vFlatCellNormal2 = vCellNormal2 - n * dot(n, vCellNormal2);
|
||||
|
||||
float3 rockN = tex2D_3D(waveSampler, t, n).xyz
|
||||
* (0.5 - abs( cos( (t.x + 0.1 * tex2D_3D(waveSampler, t * 2, n).a) * 20 ) ) );
|
||||
float3 roughN = tex2D_3D(waveSampler, t * 10, n).xyz * 0.3
|
||||
+ tex2D_3D(waveSampler, t * 100, n).xyz * 0.4;
|
||||
|
||||
float3 fIceNormal = normalize( n + 0.2f * roughN + transition * vFlatSurfaceNormal );
|
||||
float3 fIceNormalEx = normalize(fIceNormal - 0.7f * n * dot(fIceNormal, n));
|
||||
float3 fRockNormal = normalize( n + 0.4f * (roughN + rockN) );
|
||||
float3 fRockNormalEx = normalize(fRockNormal - 0.6f * n * dot(fRockNormal, n));
|
||||
|
||||
float3 fIceCellNormal1 = normalize(fIceNormalEx - 0.1f * vFlatCellNormal1);
|
||||
float3 fIceCellNormal2 = vCellNormal2; // normalize(fIceNormalEx - 0.7f * vFlatCellNormal2);
|
||||
|
||||
float2 fLight = float2( dot(fIceNormal, -lightDir), dot(fRockNormal, -lightDir) );
|
||||
float2 fRimLight = 1.0f - abs(fLight); // * saturate( dot(lightDir, v) );
|
||||
fLight = min(fShadow.y * fLight, fLight); // Occlude only direct lighting (back-shadowing artifacts otherwise)
|
||||
fLight = saturate( 0.2f * saturate(1.0f + 2.0f * fLight) + 0.8f * saturate(fLight) ); // Ambient, Diffuse
|
||||
fRimLight *= fShadow.w;
|
||||
|
||||
float3 h = normalize( v + -lightDir );
|
||||
float4 hdn = float4( abs( dot( h, fIceNormalEx ) ), dot( h, fRockNormalEx ), dot( h, fIceCellNormal1 ), dot( h, fIceCellNormal2 ) );
|
||||
float4 fSpecularity = fShadow.ywww * pow( saturate( hdn ), float4(8.0f, 4.0f, 4.0f, 8.0f) );
|
||||
|
||||
// Ice
|
||||
float fIceSpecBoost = 0.4f * saturate( 0.5f - 0.5f * dot(lightDir, v) );
|
||||
// return float2(fIceSpecBoost, 1).xxxy;
|
||||
float fIceSpecularity = dot( fSpecularity.xzw, float3(0.35f, 0.35f, 0.4f + fIceSpecBoost) ); // float3(0.35f, 0.35f, 0.5f)
|
||||
float4 fIceSpecLighting = 0.4f * tex1D(spec, 0.85f + 0.15f * fIceSpecularity) * fIceSpecularity;
|
||||
|
||||
float4 fIceLighting = tex1D(dif, fLight.x);
|
||||
float4 fIceRimLighting = tex1D(dif, fRimLight.x);
|
||||
|
||||
float fIceRimFresnel = pow( saturate( 1.0f - dot(fIceNormal, v) ), 8 ) * saturate( 0.5f + 0.5f * dot(lightDir, v) );
|
||||
|
||||
float fIceFresnel = 0.5f + dot(0.5f / 3, float3( dot(v, fIceNormalEx), dot(v, fIceCellNormal1), dot(v, fIceCellNormal2) ));
|
||||
float fPlaneIceFresnel = 0.5f + 0.5f * dot(v, n);
|
||||
fIceFresnel = lerp(fPlaneIceFresnel, max(fIceFresnel, fPlaneIceFresnel), 0.5f);
|
||||
fIceFresnel = pow(fIceFresnel, 4);
|
||||
|
||||
float4 fIceColor = lerp(
|
||||
float4(0.665f, 0.738f, 0.901f, 1.0f),
|
||||
float4(0.965f, 0.938f, 0.901f, 1.0f),
|
||||
fIceFresnel );
|
||||
fIceSpecLighting *= fIceColor;
|
||||
fIceColor *= fIceLighting;
|
||||
fIceColor += float4(0.905f, 0.908f, 0.901f, 1.0f) * fIceRimFresnel * fIceRimLighting;
|
||||
|
||||
fIceColor.w *= saturate( 1.0f - dot( float2(0.3f, 0.7f), fSpecularity.zw ) );
|
||||
|
||||
// Rock
|
||||
float4 fRockLighting = tex1D(dif, fLight.y)
|
||||
+ 0.2f * tex1D(spec, 0.75f + 0.25f * fSpecularity.y) * fSpecularity.y;
|
||||
float4 fRockColor = float4(0.45f, 0.4f, 0.5f, 1.0f);
|
||||
fRockColor *= fRockLighting;
|
||||
|
||||
// Compose
|
||||
float4 fColor = lerp( fIceColor, fRockColor, saturate(rockBlend) ); // saturate(rock)
|
||||
fColor += fIceSpecLighting * (rock < 0.5f);
|
||||
|
||||
// Fade edge
|
||||
fColor.xyz *= pow(g_fLightFilterColor, max(-15 - i.w.y, 0) * 0.2f);
|
||||
|
||||
return fColor;
|
||||
}
|
||||
|
||||
float4 ps_main_old(psIn i) : color0
|
||||
{
|
||||
return ps_main_isle(i);
|
||||
|
||||
// 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) * resolution.zw;
|
||||
sc += aaetc * saturate(4.f * aa);
|
||||
|
||||
float fShadow = 0.2f + 0.8f * tex2D(shadowSampler, sc);
|
||||
float3 n = normalize(i.n);
|
||||
float3 t = i.w / 128;
|
||||
|
||||
float shore = i.w.y - 5 + tex2D_3D(waveSampler, t * 3, n).a;
|
||||
shore = 0.2 + max(0.02, smoothstep(0.0, 1.5, shore) * (smoothstep(0.6, 0.7, n.y)) * 0.5);
|
||||
|
||||
float rock = 1-((1-smoothstep(0.6, 0.7, n.y)) * smoothstep(0.5, 0.7, tex2D_3D(waveSampler, t * 2, n).a));
|
||||
return shore;
|
||||
|
||||
float3 pn = n;
|
||||
pn += shore * tex2D_3D(waveSampler, t, n).xyz * (0.5-abs(cos((t.x + 0.1 * tex2D_3D(waveSampler, t * 2, n).a) * 20)));
|
||||
pn += shore * tex2D_3D(waveSampler, t * 10, n).xyz * 0.3;
|
||||
pn += shore * tex2D_3D(waveSampler, t * 100, n).xyz * 0.4;
|
||||
pn = normalize(pn);
|
||||
float3 pnn = normalize(pn - 0.9f * n * dot(pn, n));
|
||||
|
||||
float fIceSpecularity = 0.003f * pow( texCUBE(envSampler, reflect(-i.v, pnn)).g, 16.0f) * fShadow;
|
||||
float fSnowSpecularity = 0.3f * saturate( pow( texCUBE(envSampler, reflect(-i.v, pnn)).g, 6.0f) * fShadow );
|
||||
|
||||
float fLight = dot( pn, -lightDir);
|
||||
fLight = min(fShadow * fLight, fLight); // Occlude only direct lighting (back-shadowing artifacts otherwise)
|
||||
fLight = saturate( 0.2f * saturate(1.0f + 2.0f * fLight) + 0.8f * saturate(fLight) ); // Ambient, Diffuse
|
||||
|
||||
float light = tex1D( dif, 0.3f * (1 - min(0.3, pow(dot(pn, n), 8))) + 0.7f * fLight );
|
||||
float4 reflection = texCUBE(envSampler, reflect(-i.v, pn));
|
||||
float4 fColor = lerp(i.c,
|
||||
light * float4(0.15, 0.2, 0.25, 0.0) + 0.4 * rock * smoothstep(-0.5, 0.5, pn.y),
|
||||
(1.0 - shore));
|
||||
return float4(fColor.xyz, 1.0f);
|
||||
|
||||
// Lighting
|
||||
fColor.xyz *= light;
|
||||
fColor += lerp(fSnowSpecularity, fIceSpecularity, rock * (1.0 - shore));
|
||||
|
||||
return float4(fColor.xyz, 1.0f);
|
||||
}
|
||||
|
||||
float4 ps_terrain(psIn i) : color0 { return ps_main_old(i); };
|
||||
|
||||
float4 ps_cave(psIn i) : color0 { return ps_main(i, true); };
|
||||
|
||||
float4 ps_cave_ground(psIn i) : color0 { return ps_main(i, false); };
|
||||
145
evoke-64k/trunk/ev10/cfg/pstexgen.txt
Normal file
145
evoke-64k/trunk/ev10/cfg/pstexgen.txt
Normal file
@@ -0,0 +1,145 @@
|
||||
float4 g_fResolution : register(c0);
|
||||
float3x3 g_mCubeMatrix : register(c40);
|
||||
float g_fCubeWeight : register(c43);
|
||||
float g_fOverlayFade : register(c50);
|
||||
float4 g_fFadeColor : register(c51);
|
||||
|
||||
sampler2D randomSampler : register(s0);
|
||||
sampler3D randomCubeSampler : register(s1);
|
||||
sampler2D ditherSampler : register(s2);
|
||||
sampler2D inputSampler : register(s3);
|
||||
samplerCUBE inputCubeSampler : register(s4);
|
||||
|
||||
float4 rand_val(float4 r)
|
||||
{
|
||||
return r;
|
||||
// float lr = dot(r, float4(10.f, 100.f, 1000.f, 1.f));
|
||||
// return lr / 1111.f;
|
||||
}
|
||||
|
||||
float4 noise(float2 t)
|
||||
{
|
||||
float4 r = tex2D(randomSampler, .03125f * t);
|
||||
return rand_val(r)* 2.f - 1.f;
|
||||
}
|
||||
float4 noise_grad(float2 t, float2 dtX, float2 dtY)
|
||||
{
|
||||
float4 r = tex2Dgrad(randomSampler, .03125f * t, .0625f * dtX, .0625f * dtY);
|
||||
return rand_val(r)* 2.f - 1.f;
|
||||
}
|
||||
|
||||
float4 abs_noise(float2 t)
|
||||
{
|
||||
return abs( noise(t) );
|
||||
}
|
||||
float4 abs_noise_grad(float2 t, float2 dtX, float2 dtY)
|
||||
{
|
||||
return abs( noise_grad(t, dtX, dtY) );
|
||||
}
|
||||
|
||||
float4 ps_perlin(float2 TexCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float2 t = 32 * TexCoord;
|
||||
|
||||
float4 fNoise = noise(t) / 2.0f;
|
||||
fNoise += noise(2 * t) / 4.0f;
|
||||
fNoise += noise(4 * t) / 8.0f;
|
||||
fNoise += noise(8 * t) / 16.0f;
|
||||
fNoise += noise(16 * t) / 32.0f;
|
||||
fNoise += noise(32 * t) / 64.0f;
|
||||
fNoise += noise(64 * t) / 128.0f;
|
||||
fNoise += noise(128 * t) / 256.0f;
|
||||
fNoise += noise(256 * t) / 512.0f;
|
||||
fNoise += noise(512 * t) / 1024.0f;
|
||||
|
||||
return fNoise * 0.5f + 0.5f;
|
||||
}
|
||||
|
||||
float4 ps_wave(float2 TexCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 fNoise = tex2D(inputSampler, TexCoord);
|
||||
float4 fX = 0.5f * fNoise;
|
||||
fX -= round(fX);
|
||||
float4 fWave = 8.1688f * (1.0f - cos(fX));
|
||||
return fNoise;
|
||||
}
|
||||
|
||||
float4 ps_normal(float2 TexCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
// Construct pixels
|
||||
float3 vPixel = TexCoord.xyy;
|
||||
vPixel.z = tex2D(inputSampler, vPixel.xy).r;
|
||||
|
||||
float3 vRightPixel = TexCoord.xyy;
|
||||
vRightPixel.x += g_fResolution.z;
|
||||
vRightPixel.z = tex2D(inputSampler, vRightPixel.xy).r;
|
||||
|
||||
float3 vBottomPixel = TexCoord.xyy;
|
||||
vBottomPixel.y += g_fResolution.w;
|
||||
vBottomPixel.z = tex2D(inputSampler, vBottomPixel.xy).r;
|
||||
|
||||
// Get change rates
|
||||
float3 vRight = vRightPixel - vPixel;
|
||||
float3 vDown = vBottomPixel - vPixel;
|
||||
|
||||
// Compute normal
|
||||
float3 vNormal = cross(vRight, vDown);
|
||||
vNormal.z = max(vNormal.z, 0.0f);
|
||||
vNormal = normalize(vNormal);
|
||||
|
||||
// Encode & return
|
||||
vNormal.xy = vNormal.xy * 0.5f + 0.5f;
|
||||
return float4(saturate(vNormal), vPixel.z);
|
||||
}
|
||||
|
||||
float4 ps_cube_blur(float2 TexCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float3 vCubeDir = float3(TexCoord * float2(2.0f, -2.0f) - float2(1.0f, -1.0f), 1.0f);
|
||||
float3 vCubeCoord = mul(vCubeDir, transpose(g_mCubeMatrix));
|
||||
return texCUBE(inputCubeSampler, vCubeCoord) * g_fCubeWeight;
|
||||
}
|
||||
|
||||
bool flame(float2 o)
|
||||
{
|
||||
return (o.x < -0.52) && (pow(2 * (o.x + 0.52), 2.0) + pow(o.y - 0.33, 2.0) < 1) ||
|
||||
(o.x >= -0.52 && o.x < 1.57 && o.y <= 1 - sin(3 * o.x) / 3 || o.x >= 1.57 && o.y < 1.33 - pow(o.x - 1.57, 2.0)) &&
|
||||
(o.x >= -0.52 && o.y >= -0.01 + sin(1.5 * o.x - 0.9) / 1.5);
|
||||
}
|
||||
|
||||
float4 ps_logo(float2 TexCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 fColor = 0.0f;
|
||||
float2 o;
|
||||
|
||||
TexCoord.y = (TexCoord.y - 0.5f) * (g_fResolution.y * 16) / (g_fResolution.x * 9) + 0.5f;
|
||||
|
||||
TexCoord.y = 1.0f - TexCoord.y;
|
||||
TexCoord *= float2(1024, 768);
|
||||
|
||||
// 4x sampling
|
||||
for (float x = 0; x < 1/128.0; x += 1/256.0)
|
||||
for (float y = 0; y < 1/128.0; y += 1/256.0)
|
||||
{
|
||||
o = (TexCoord.yx - float2(384.0f, 512.0f)) / 128.0f + float2(0.5f + y, 0.3f + x);
|
||||
o.y *= (3.0f * 16) / (4.0f * 9);
|
||||
o.x /= 1.1;
|
||||
o.y *= 1.2;
|
||||
fColor += flame(o) * float4(0, 0.5, 1, 1);
|
||||
|
||||
o.y /= -1.2;
|
||||
o.x *= 1.1;
|
||||
o += float2(0.2, 0.3);
|
||||
fColor += flame(o) * float4(0, 0.75, 1, 1);
|
||||
}
|
||||
|
||||
fColor /= 8.0f;
|
||||
fColor *= g_fOverlayFade * length((o+float2(.4,0))*.8);
|
||||
return fColor;
|
||||
}
|
||||
|
||||
float4 ps_fade() : COLOR0
|
||||
{
|
||||
float4 fColor = g_fFadeColor;
|
||||
fColor.xyz *= fColor.w;
|
||||
return fColor;
|
||||
}
|
||||
58
evoke-64k/trunk/ev10/cfg/pstext.txt
Normal file
58
evoke-64k/trunk/ev10/cfg/pstext.txt
Normal file
@@ -0,0 +1,58 @@
|
||||
float4 g_fResolution : register(c0);
|
||||
float3 g_vLightDir : register(c1);
|
||||
|
||||
float4 g_fTime : register(c3);
|
||||
|
||||
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 = lerp( float3(1, 0.126, 0.251), float3(255, 224, 32) / 255, 0.5f + 0.5f * cos( g_fTime.x * 0.1f ) );
|
||||
fColor = lerp( fColor, float3(64, 192, 96) / 255, 0.5f + 0.5f * cos( g_fTime.x * 0.3f ) );
|
||||
|
||||
fColor = lerp(i.c.xyz, fColor, 0.75f * (g_fTime.x > 130 * 64) * saturate(-i.w.x + 0.5f) );
|
||||
|
||||
//float fS= 0.2f + 0.8f * tex2D(shadowSampler, sc);
|
||||
float3 n = normalize(i.n);
|
||||
float3 v = normalize(i.v);
|
||||
|
||||
// Lighting
|
||||
//fColor.xyz *= tex1D( dif, fS * ( 0.5f + 0.5f * dot( n, -g_vLightDir) ) );
|
||||
fColor.xyz *= tex1D( dif, ( 0.5f + 0.5f * dot( n, -g_vLightDir) ) );
|
||||
|
||||
// Specular highlights
|
||||
float3 h = normalize( v + -g_vLightDir );
|
||||
float s = dot(n, h);
|
||||
//fColor += g_fSpecularPower * tex1D(spec, fS * ( 0.5f + 0.5f * s ) );
|
||||
fColor += g_fSpecularPower * tex1D(spec,( 0.5f + 0.5f * s ) );
|
||||
|
||||
float fGlow = ( g_fTime.x < 0 )
|
||||
? saturate( -106.5f - ( g_fTime.x / 32.0f ) )
|
||||
: 1.0f - saturate( g_fTime.w );
|
||||
|
||||
fGlow = saturate( fGlow - ( 0.5f + 0.5f * cos(g_fTime.x * 0.5f + i.w.x * 0.1f) ) * (g_fTime.x > 130 * 64) );
|
||||
|
||||
return float4(fColor, fGlow );
|
||||
}
|
||||
14
evoke-64k/trunk/ev10/cfg/scene.txt
Normal file
14
evoke-64k/trunk/ev10/cfg/scene.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
SCENE000= . . . . . . x . . . . . . . x
|
||||
SCENE001= . x . . x x . . . . . . . . x
|
||||
SCENE002= . x . . x x . . . . . . . . .
|
||||
SCENE003= . . . x . . . x x . . . . . . x
|
||||
SCENE004= . . . x . . . x . x . . . . . x
|
||||
SCENE005= . . . x . . . x . . x . . . . . x
|
||||
SCENE006= . . . x . . . x . . . x . . .
|
||||
SCENE007= . . . x . . . x . . . . x . .
|
||||
SCENE008= . . . x . . . x . . . . . x .
|
||||
SCENE009= x . . . . . . . x . . . . .
|
||||
SCENE010= . x . . . . x
|
||||
SCENE011= . . . x . . . x . . . . . . . . x x
|
||||
SCENE012= . . . x . . . x . . . . . . x . x . x
|
||||
SCENE013= . x . . x x . . . . . . . . . . . . . x
|
||||
91
evoke-64k/trunk/ev10/cfg/text.txt
Normal file
91
evoke-64k/trunk/ev10/cfg/text.txt
Normal file
@@ -0,0 +1,91 @@
|
||||
Text=liquidiced
|
||||
Pos= 250 -12 -180
|
||||
Scale= 16 16 4
|
||||
Rot= 0 0 0
|
||||
Move= 0 0 0
|
||||
Time= -80000 40000
|
||||
|
||||
Text=GFX
|
||||
Pos= 320 -12 -300
|
||||
Rot= -10 0 0
|
||||
Scale= 6 6 3
|
||||
Move= 0 0 0
|
||||
Time= -80000 40000
|
||||
|
||||
Text=rip
|
||||
Pos= 320 -17 -300
|
||||
Rot= -10 0 0
|
||||
Scale= 6 6 3
|
||||
Move= 0 0 0
|
||||
Time= -80000 40000
|
||||
|
||||
Text=TGGC
|
||||
Pos= 320 -22 -300
|
||||
Rot= -10 0 0
|
||||
Scale= 6 6 3
|
||||
Move= 0 0 0
|
||||
Time= -80000 40000
|
||||
|
||||
Text=Music
|
||||
Pos= 350 -15 -380
|
||||
Rot= -10 0 0
|
||||
Scale= 6 6 3
|
||||
Move= 0 0 0
|
||||
Time= -80000 40000
|
||||
|
||||
Text=LPChip
|
||||
Pos= 350 -20 -380
|
||||
Rot= -10 0 0
|
||||
Scale= 6 6 3
|
||||
Move= 0 0 0
|
||||
Time= -80000 40000
|
||||
|
||||
Text=xTr1m
|
||||
Pos= 350 -25 -380
|
||||
Rot= -10 0 0
|
||||
Scale= 6 6 3
|
||||
Move= 0 0 0
|
||||
Time= -80000 40000
|
||||
|
||||
Text=Code
|
||||
Pos= 380 -15 -460
|
||||
Rot= -10 0 0
|
||||
Scale= 6 6 3
|
||||
Move= 0 0 0
|
||||
Time= -80000 40000
|
||||
|
||||
Text=CodingCat
|
||||
Pos= 380 -20 -460
|
||||
Rot= -10 0 0
|
||||
Scale= 6 6 3
|
||||
Move= 0 0 0
|
||||
Time= -80000 40000
|
||||
|
||||
Text=Hel
|
||||
Pos= 380 -25 -460
|
||||
Rot= -10 0 0
|
||||
Scale= 6 6 3
|
||||
Move= 0 0 0
|
||||
Time= -80000 40000
|
||||
|
||||
Text=TGGC
|
||||
Pos= 380 -30 -460
|
||||
Rot= -10 0 0
|
||||
Scale= 6 6 3
|
||||
Move= 0 0 0
|
||||
Time= -80000 40000
|
||||
|
||||
Text=xTr1m
|
||||
Pos= 380 -35 -460
|
||||
Rot= -10 0 0
|
||||
Scale= 6 6 3
|
||||
Move= 0 0 0
|
||||
Time= -80000 40000
|
||||
|
||||
Text=ASD - Alcatraz - Brainstorm - Calodox - Conspiracy - Fairlight - Farbrausch - Fuzzion - Kakiarts - Loonies - Mercury - RGBA - Speckdrumm - Still - TBC - TBL - Titan - Traction - Youth Uprising
|
||||
Pos= 700 0 0
|
||||
Rot= 0 0 0
|
||||
Scale= 6 6 3
|
||||
Move= -2000 0 0
|
||||
Time= 100000 80000
|
||||
|
||||
75
evoke-64k/trunk/ev10/cfg/vsfluid.txt
Normal file
75
evoke-64k/trunk/ev10/cfg/vsfluid.txt
Normal file
@@ -0,0 +1,75 @@
|
||||
float4x4 viewProj : register(c31);
|
||||
float2 quadddx : register(c30);
|
||||
|
||||
struct QuadInput
|
||||
{
|
||||
float4 p:position;
|
||||
float2 t:texcoord0;
|
||||
};
|
||||
|
||||
struct QuadOutput
|
||||
{
|
||||
float4 p:position;
|
||||
float2 t:texcoord0;
|
||||
float4 q:texcoord1;
|
||||
};
|
||||
|
||||
struct IndexedQuadInput
|
||||
{
|
||||
float4 p:position;
|
||||
float2 n:normal;
|
||||
float4 i:texcoord0;
|
||||
float k:texcoord1;
|
||||
};
|
||||
|
||||
struct IndexedQuadOutput
|
||||
{
|
||||
float4 q:position;
|
||||
float3 n:normal;
|
||||
float4 p:texcoord0;
|
||||
float4 k:texcoord1;
|
||||
float2 t:texcoord2;
|
||||
float size:texcoord3;
|
||||
};
|
||||
|
||||
void calc(IndexedQuadInput i, out IndexedQuadOutput o, float sizeFactor)
|
||||
{
|
||||
float3 eyeVector = viewProj._m02_m12_m22;
|
||||
float3 side;
|
||||
float3 up;
|
||||
|
||||
side = normalize(cross(eyeVector, float3(0,1,0)));
|
||||
up = normalize(cross(side,eyeVector));
|
||||
|
||||
float3 finalPos = i.i.xyz;
|
||||
float size = i.i.w * sizeFactor;
|
||||
finalPos += (i.p.x) * side * size * (1 - i.k * 0.5);
|
||||
finalPos += (i.p.y) * up * size * (1 + i.k * 5);
|
||||
|
||||
float4 finalPos4 = float4(finalPos, 1);
|
||||
|
||||
o.q = mul(finalPos4, viewProj);
|
||||
|
||||
o.t = i.n;
|
||||
o.n.xy = i.n;
|
||||
o.n.z = 0.0;
|
||||
o.p = finalPos4;
|
||||
o.k.xyz = i.p.xyz;
|
||||
o.k.a = i.k;
|
||||
o.size = size;
|
||||
}
|
||||
|
||||
void vsDeferred(IndexedQuadInput i, out IndexedQuadOutput o) { calc(i, o, 1.0); }
|
||||
|
||||
void vsDepth(IndexedQuadInput i, out IndexedQuadOutput o) { calc(i, o, 0.9); }
|
||||
|
||||
QuadOutput vsCompose(QuadInput i)
|
||||
{
|
||||
QuadOutput o;
|
||||
o.p = i.p;
|
||||
o.q = i.p;
|
||||
o.t = i.t;
|
||||
o.t *= 1.0 + quadddx;
|
||||
|
||||
return o;
|
||||
}
|
||||
29
evoke-64k/trunk/ev10/cfg/vsfsquad.txt
Normal file
29
evoke-64k/trunk/ev10/cfg/vsfsquad.txt
Normal 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;
|
||||
};
|
||||
53
evoke-64k/trunk/ev10/cfg/vsgeneral.txt
Normal file
53
evoke-64k/trunk/ev10/cfg/vsgeneral.txt
Normal file
@@ -0,0 +1,53 @@
|
||||
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;
|
||||
float3 o : TEXCOORD5;
|
||||
};
|
||||
|
||||
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;
|
||||
o.o = i.p;
|
||||
|
||||
// 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;
|
||||
};
|
||||
52
evoke-64k/trunk/ev10/cfg/vsocean.txt
Normal file
52
evoke-64k/trunk/ev10/cfg/vsocean.txt
Normal file
@@ -0,0 +1,52 @@
|
||||
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;
|
||||
};
|
||||
25
evoke-64k/trunk/ev10/cfg/vssky.txt
Normal file
25
evoke-64k/trunk/ev10/cfg/vssky.txt
Normal 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;
|
||||
};
|
||||
Reference in New Issue
Block a user