Commit 16d26c81 authored by Florian Oetke's avatar Florian Oetke
Browse files

fixed reprojection of spec GI

parent 53dca3c9
......@@ -108,12 +108,12 @@ void main() {
float max_distance = min(32, 4 / (tan(coneTheta)*2));
float max_steps = max_distance*8;
vec3 jitter = PDnrand3(vertex_out.tex_coords);
vec3 jitter = PDnrand3(vertex_out.tex_coords + global_uniforms.time.x);
vec2 raycast_hit_uv;
vec3 raycast_hit_point;
if(spec_visible &&
traceScreenSpaceRay1(P+dir*0.25, dir, pcs.projection, depth_sampler,
traceScreenSpaceRay1(P+(dir*0.25+jitter*0.1), dir, pcs.projection, depth_sampler,
depthSize, 1.0, global_uniforms.proj_planes.x,
10, 0.5*jitter.z, max_steps, max_distance, int(startLod + 0.5),
raycast_hit_uv, raycast_hit_point)) {
......@@ -136,7 +136,7 @@ void main() {
out_color.rgb /= (1 + luminance_norm(out_color.rgb));
} else {
out_color.rgb = textureLod(diffuse_sampler, vertex_out.tex_coords, pcs.prev_projection[0][3]).rgb / (PI*PI*4);
out_color.rgb = textureLod(diffuse_sampler, vertex_out.tex_coords, pcs.prev_projection[0][3]).rgb / (PI*PI*2);
}
float history_weight = texelFetch(history_weight_sampler,
......
......@@ -38,5 +38,5 @@ void main() {
color_out = vec4(result / weight_sum, 1.0);
// color_out.rgb = read(vertex_out.uv_center, center_depth, weight_sum, 1.0).rgb;
color_out.rgb = mix(color_out.rgb, read(vertex_out.uv_center, center_depth, weight_sum, 1.0).rgb, 0.5);
}
......@@ -727,7 +727,7 @@ namespace mirrage::renderer {
_min_mip_level,
_color_diffuse_in,
_gi_diffuse_history,
_gi_specular_history,
_gi_specular,
_history_weight,
_reproject_framebuffer))
, _reproject_descriptor_set(_descriptor_set_layout.create_set(renderer.descriptor_pool(),
......@@ -735,7 +735,7 @@ namespace mirrage::renderer {
renderer.gbuffer().mat_data.view(),
renderer.gbuffer().albedo_mat_id.view(0),
_gi_diffuse_result.view(),
_gi_specular.view(),
_gi_specular_history.view(),
renderer.gbuffer().prev_depth.view(),
_integrated_brdf.view(),
_history_weight_prev.view()}))
......@@ -892,6 +892,14 @@ namespace mirrage::renderer {
_history_weight_prev,
vk::ImageLayout::eUndefined,
vk::ImageLayout::eShaderReadOnlyOptimal);
graphic::blit_texture(command_buffer,
_gi_specular,
vk::ImageLayout::eShaderReadOnlyOptimal,
vk::ImageLayout::eShaderReadOnlyOptimal,
_gi_specular_history,
vk::ImageLayout::eUndefined,
vk::ImageLayout::eShaderReadOnlyOptimal);
}
void Gi_pass::_integrate_brdf(vk::CommandBuffer& command_buffer) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment