Skip to content

Commit

Permalink
Shadowmap
Browse files Browse the repository at this point in the history
  • Loading branch information
morganbengtsson committed Aug 28, 2018
1 parent d429050 commit 8a6df52
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions assets/shaders/standard.frag
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,9 @@ void main() {
Lo += (kD * albedo / PI + specular) * radiance * NdotL * spot_effect;

vec3 shadow_map_uv = fragment.proj_shadow[i].xyz / fragment.proj_shadow[i].w;
vec2 texelSize = 1.0 / textureSize(shadow_maps[i], 0);

float s = 0.0;
for(float x = -3; x <= 3; x += 2) {
for(float y = -3; y <= 3; y += 2) {
s += sample_variance_shadow_map(shadow_maps[i], shadow_map_uv.xy + vec2(x, y) * texelSize, shadow_map_uv.z);
}
}
s /= 16;
s += sample_variance_shadow_map(shadow_maps[i], shadow_map_uv.xy, shadow_map_uv.z);
shadow += s * spot_effect;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/mos/gfx/renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Renderer::Renderer(const glm::vec4 &color, const glm::ivec2 &resolution) :
multi_target_(resolution),
blur_target0_(resolution / 4),
blur_target1_(resolution / 4),
shadow_maps_render_buffer_(512),
shadow_maps_render_buffer_(256),
shadow_maps_{ShadowMapTarget(shadow_maps_render_buffer_),
ShadowMapTarget(shadow_maps_render_buffer_)},
environment_render_buffer_(128),
Expand Down

0 comments on commit 8a6df52

Please sign in to comment.