Commit 3ed7dc3d authored by Jerome KASPER's avatar Jerome KASPER

first commit

parents
cbuffer Constants : register(b0) {
float4 Color;
};
struct VS_INPUT {
float4 Pos : POSITION;
float2 Tex : TEXCOORD0;
};
struct PS_INPUT {
float4 Pos : SV_POSITION;
};
PS_INPUT VS(VS_INPUT input) {
PS_INPUT output = (PS_INPUT)0;
output.Pos = input.Pos;
return output;
}
float4 PS(PS_INPUT input) : SV_Target {
return Color;
}
Texture2D DiffuseTexture : register(t0);
SamplerState DiffuseSampler : register(s0);
struct VS_INPUT {
float4 Pos : POSITION;
float2 Tex : TEXCOORD0;
};
struct PS_INPUT {
float4 Pos : SV_POSITION;
float2 Tex : TEXCOORD0;
};
PS_INPUT VS(VS_INPUT input) {
PS_INPUT output = (PS_INPUT)0;
output.Pos = input.Pos;
output.Tex = input.Tex;
return output;
}
float4 PS(PS_INPUT input) : SV_Target {
return DiffuseTexture.Sample(DiffuseSampler, input.Tex);
}
Texture2D DiffuseTexture : register(t0);
SamplerState DiffuseSampler : register(s0);
Texture2D ShadowTextures[4] : register(t1);
SamplerState ShadowSampler : register(s1);
cbuffer Constants : register(b0) {
matrix ModelViewProj;
matrix ShadowTransform[4];
float4 Light[4];
float3 View;
int ShadowCount;
};
struct VS_INPUT {
float4 Pos : POSITION;
float3 Normal : NORMAL;
float2 Tex : TEXCOORD0;
};
struct PS_INPUT {
float4 Pos : SV_POSITION;
float3 Normal : NORMAL;
float2 Tex : TEXCOORD0;
float4 WorldPos : TEXCOORD1;
};
PS_INPUT VS(VS_INPUT input) {
PS_INPUT output = (PS_INPUT)0;
output.Pos = mul(ModelViewProj, input.Pos);
output.Pos.z = (output.Pos.z + output.Pos.w)*0.5f; // From GL-style z.
output.Normal = input.Normal;
output.Tex = input.Tex;
output.WorldPos = input.Pos;
return output;
}
float4 PS(PS_INPUT input) : SV_Target {
float radiance = 0.0f;
float3 n = normalize(input.Normal);
for (int i = 0; i < ShadowCount; ++i) {
float nDotL = max(dot(n, Light[i].xyz), 0.0f);
float3 viewDir = normalize(View - input.WorldPos.xyz);
float3 h = normalize(viewDir + Light[i].xyz);
float specLighting = pow(max(dot(h, n), 0.0f), 32.0f)*0.5f;
nDotL += specLighting;
float4 shadow = mul(ShadowTransform[i], input.WorldPos);
shadow.z = (shadow.z + shadow.w)*0.5f; // From GL-style z-clip.
float width, height;
unsigned int mipCount;
ShadowTextures[i].GetDimensions(0, width, height, mipCount);
float2 dim = float2(width, height);
float2 dimInv = float2(1.0f/width, 1.0f/height);
float2 coord = shadow.xy*0.5f + 0.5f;
coord.y = 1.0f-coord.y;
coord *= dim;
coord -= 0.5f;
float2 s = coord;
coord = floor(coord);
s -= coord;
float ref = shadow.z - 1e-2f;
float2 c00 = (coord + float2(0.0f, 0.0f) + 0.5f) * dimInv;
float2 c01 = (coord + float2(0.0f, 1.0f) + 0.5f) * dimInv;
float2 c10 = (coord + float2(1.0f, 0.0f) + 0.5f) * dimInv;
float2 c11 = (coord + float2(1.0f, 1.0f) + 0.5f) * dimInv;
float r00 = ShadowTextures[i].Sample(ShadowSampler, c00).x > ref;
float r01 = ShadowTextures[i].Sample(ShadowSampler, c01).x > ref;
float r10 = ShadowTextures[i].Sample(ShadowSampler, c10).x > ref;
float r11 = ShadowTextures[i].Sample(ShadowSampler, c11).x > ref;
r00 = lerp(r00, r10, s.x);
r01 = lerp(r01, r11, s.x);
r00 = lerp(r00, r01, s.y);
nDotL *= (r00 + 1.0f)*0.5f;
radiance += nDotL;
}
radiance *= 1.0f / ShadowCount;
radiance += 0.25f;
float4 c = float4(radiance, radiance, radiance, 1.0f);
#ifndef NO_DIFFUSE
return c * DiffuseTexture.Sample(DiffuseSampler, input.Tex);
#else
return c;
#endif
}
cbuffer Constants : register(b0) {
matrix ModelViewProj;
};
struct VS_INPUT {
float4 Pos : POSITION;
};
struct PS_INPUT {
float4 Pos : SV_POSITION;
};
PS_INPUT VS(VS_INPUT input) {
PS_INPUT output = (PS_INPUT)0;
output.Pos = mul(ModelViewProj, input.Pos);
output.Pos.z = (output.Pos.z + output.Pos.w)*0.5f; // From GL-style z-clip.
return output;
}
float4 PS(PS_INPUT input) : SV_Target {
float z = input.Pos.z;
return float4(z, z, z, z);
}
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 14.07.2011 16:21:32
newmtl banner
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\gi_flag.png
map_Kd textures\gi_flag.png
This diff is collapsed.
This diff is collapsed.
July 14, 2011 Morgan McGuire modified the model from Crytek's OBJ
export to correct some small errors. He computed bump maps from the
normal maps using <a
href="http://cs.williams.edu/~morgan/code/">normal2bump.cpp</a> (since
MTL files expect height bumps, not normals), put the "mask" textures
into the alpha channel of the associated diffuse texture, cleaned up
noise in the masks, created the missing gi_flag.tga texture, and
removed the long untextured banner floating in the middle of the
atrium that appears in the file but in none of the published images of
the model. The banner is in banner.obj.
http://www.crytek.com/cryengine/cryengine3/downloads
Sponza Model
August 19, 2010
The Atrium Sponza Palace, Dubrovnik, is an elegant and improved model created by Frank Meinl. The original Sponza model was created by Marko Dabrovic in early 2002. Over the years, the Sponza Atrium scene has become one of the most popular 3D scenes for testing global illumination and radiosity due to it's specific architectural structure which is particularly complex for global illumination light.
However, nowadays it is considered as a simple model, thus it was decided to crate a new model with highly improved appearance and scene complexity. It is donated to the public for radiosity and is represented in several different formats (3ds, Obj) for use with various commercial 3D applications and renderers.
Screenshot from the I3D paper
http://crytek.com/sites/default/files/20100301_lpv.pdf
// -*- c++ -*-
// Converts the Crytek Sponza to a convenient scale for G3D
ArticulatedModel::Specification {
filename = "sponza.obj";
preprocess = ArticulatedModel::Preprocess {
xform = Matrix4::scale(0.02);
// Remove the giant glass (?!) tapestry in the middle. It is part 0, triList 271
program = (
remove(0, 271);
);
};
};
\ No newline at end of file
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# File Created: 20.08.2010 18:13:43
newmtl leaf
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_thorn_diff.png
map_Kd textures\sponza_thorn_diff.png
map_d textures\sponza_thorn_mask.png
map_bump textures\sponza_thorn_bump.png
bump textures\sponza_thorn_bump.png
newmtl vase_round
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\vase_round.png
map_Kd textures\vase_round.png
map_bump textures\vase_round_bump.png
bump textures\vase_round_bump.png
newmtl Material__57
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\vase_plant.png
map_Kd textures\vase_plant.png
map_d textures\vase_plant_mask.png
newmtl Material__298
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\background.png
map_Kd textures\background.png
map_bump textures\background_bump.png
bump textures\background_bump.png
newmtl 16___Default
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\gi_flag.png
map_Kd textures\gi_flag.png
newmtl bricks
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\spnza_bricks_a_diff.png
map_Kd textures\spnza_bricks_a_diff.png
map_bump textures\spnza_bricks_a_diff.png
bump textures\spnza_bricks_a_bump.png
newmtl arch
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_arch_diff.png
map_Kd textures\sponza_arch_diff.png
newmtl ceiling
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_ceiling_a_diff.png
map_Kd textures\sponza_ceiling_a_diff.png
newmtl column_a
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_column_a_diff.png
map_Kd textures\sponza_column_a_diff.png
map_bump textures\sponza_column_a_bump.png
bump textures\sponza_column_a_bump.png
newmtl floor
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_floor_a_diff.png
map_Kd textures\sponza_floor_a_diff.png
newmtl column_c
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_column_c_diff.png
map_Kd textures\sponza_column_c_diff.png
map_bump textures\sponza_column_c_bump.png
bump textures\sponza_column_c_bump.png
newmtl details
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_details_diff.png
map_Kd textures\sponza_details_diff.png
newmtl column_b
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_column_b_diff.png
map_Kd textures\sponza_column_b_diff.png
map_bump textures\sponza_column_b_bump.png
bump textures\sponza_column_b_bump.png
newmtl Material__47
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
newmtl flagpole
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_flagpole_diff.png
map_Kd textures\sponza_flagpole_diff.png
newmtl fabric_e
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_fabric_green_diff.png
map_Kd textures\sponza_fabric_green_diff.png
newmtl fabric_d
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_fabric_blue_diff.png
map_Kd textures\sponza_fabric_blue_diff.png
newmtl fabric_a
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_fabric_diff.png
map_Kd textures\sponza_fabric_diff.png
newmtl fabric_g
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_curtain_blue_diff.png
map_Kd textures\sponza_curtain_blue_diff.png
newmtl fabric_c
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_curtain_diff.png
map_Kd textures\sponza_curtain_diff.png
newmtl fabric_f
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_curtain_green_diff.png
map_Kd textures\sponza_curtain_green_diff.png
newmtl chain
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\chain_texture.png
map_Kd textures\chain_texture.png
map_d textures\chain_texture_mask.png
map_bump textures\chain_texture_bump.png
bump textures\chain_texture_bump.png
newmtl vase_hanging
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\vase_hanging.png
map_Kd textures\vase_hanging.png
newmtl vase
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\vase_dif.png
map_Kd textures\vase_dif.png
map_bump textures\vase_bump.png
bump textures\vase_bump.png
newmtl Material__25
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\lion.png
map_Kd textures\lion.png
map_bump textures\lion_bump.png
bump textures\lion_bump.png
newmtl roof
Ns 10.0000
Ni 1.5000
d 1.0000
Tr 0.0000
Tf 1.0000 1.0000 1.0000
illum 2
Ka 0.5880 0.5880 0.5880
Kd 0.5880 0.5880 0.5880
Ks 0.0000 0.0000 0.0000
Ke 0.0000 0.0000 0.0000
map_Ka textures\sponza_roof_diff.png
map_Kd textures\sponza_roof_diff.png
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
File added