Skip to content

Commit

Permalink
party version
Browse files Browse the repository at this point in the history
  • Loading branch information
kusma committed Nov 11, 2014
1 parent c56e5e5 commit cb88a24
Show file tree
Hide file tree
Showing 7 changed files with 1,218 additions and 300 deletions.
2 changes: 1 addition & 1 deletion data/kjennerruhu.fx
Expand Up @@ -71,7 +71,7 @@ float3 sample_spectrum(samplerCUBE tex, float3 start, float3 stop, int samples)
for (int i = 0; i < samples; ++i) {
float3 sample = texCUBE(tex, pos).rgb;
float t = (i + 0.5) / samples;
float3 filter = tex2Dlod(spectrum_samp, float4(t, 0, 0, 0)).rgb;
float3 filter = lerp(tex2Dlod(spectrum_samp, float4(t, 0, 0, 0)).rgb, 0.5, 0.5);
sum += sample * filter;
filter_sum += filter;
pos += delta;
Expand Down
Binary file added data/overlays/0119.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/overlays/0120.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/sphere-lights/0001.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 16 additions & 5 deletions data/tree.fx
Expand Up @@ -6,8 +6,6 @@ float4x4 matWorldViewInverse : WORLDVIEWINVERSE;
float3 fogColor;
float fogDensity;

float3 color;

texture ao_tex;
sampler ao_samp = sampler_state {
Texture = (ao_tex);
Expand All @@ -19,6 +17,18 @@ sampler ao_samp = sampler_state {
sRGBTexture = TRUE;
};

texture3D volume_noise_tex;
sampler3D volume_noise_samp = sampler_state {
Texture = (volume_noise_tex);
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
AddressU = WRAP;
AddressV = WRAP;
AddressW = WRAP;
sRGBTexture = FALSE;
};

struct VS_INPUT {
float4 Position : POSITION0;
float3 Normal : NORMAL;
Expand All @@ -30,6 +40,7 @@ struct VS_OUTPUT {
float3 Normal : TEXCOORD0;
float2 TexCoord : TEXCOORD1;
float4 Pos2 : TEXCOORD2;
float3 Uvw : TEXCOORD3;
};

VS_OUTPUT vs_main(VS_INPUT Input)
Expand All @@ -40,6 +51,7 @@ VS_OUTPUT vs_main(VS_INPUT Input)
Output.Normal = mul(matWorldViewInverse, Input.Normal);
Output.TexCoord = Input.TexCoord;
Output.Pos2 = mul(float4(pos, 1), matWorldView);
Output.Uvw = pos;
return Output;
}

Expand All @@ -51,10 +63,9 @@ struct PS_OUTPUT {
PS_OUTPUT ps_main(VS_OUTPUT Input)
{
PS_OUTPUT o;

// o.col = 1.0 + Input.Normal.z;
// o.col.rgb += + color;
o.col = tex2D(ao_samp, Input.TexCoord);
float noise = tex3D(volume_noise_samp, Input.Uvw).r;
o.col.rgb *= noise;
o.col.rgb = lerp(fogColor, o.col.rgb, exp(-Input.Pos2.z * fogDensity));
o.z = Input.Pos2.z;
return o;
Expand Down
1 change: 1 addition & 0 deletions src/main.cpp
Expand Up @@ -479,6 +479,7 @@ int main(int argc, char *argv[])
Effect *tree_fx = engine::loadEffect(device, "data/tree.fx");
Texture tree_ao_tex = engine::loadTexture(device, "data/tree-ao.png");
tree_fx->setTexture("ao_tex", tree_ao_tex);
tree_fx->setTexture("volume_noise_tex", volume_noise_tex);

Mesh *tree_floor1_x = engine::loadMesh(device, "data/tree-floor1.x");
Mesh *tree_floor2_x = engine::loadMesh(device, "data/tree-floor2.x");
Expand Down

0 comments on commit cb88a24

Please sign in to comment.