rtx: fix additive when hitting sky
This commit is contained in:
parent
10dab2f021
commit
335be32cff
|
@ -356,21 +356,24 @@ void main() {
|
||||||
const uint flags = gl_RayFlagsCullFrontFacingTrianglesEXT;
|
const uint flags = gl_RayFlagsCullFrontFacingTrianglesEXT;
|
||||||
const uint sbt_offset = 0;
|
const uint sbt_offset = 0;
|
||||||
const uint sbt_stride = 0;
|
const uint sbt_stride = 0;
|
||||||
const uint miss_index = 0;
|
|
||||||
const float L = 10000.; // Why 10k?
|
const float L = 10000.; // Why 10k?
|
||||||
traceRayEXT(tlas, flags, GEOMETRY_BIT_OPAQUE | GEOMETRY_BIT_REFRACTIVE,
|
traceRayEXT(tlas, flags, GEOMETRY_BIT_OPAQUE | GEOMETRY_BIT_REFRACTIVE,
|
||||||
sbt_offset, sbt_stride, miss_index,
|
sbt_offset, sbt_stride, SHADER_OFFSET_MISS_REGULAR,
|
||||||
origin, 0., direction, L,
|
origin, 0., direction, L,
|
||||||
PAYLOAD_LOCATION_OPAQUE);
|
PAYLOAD_LOCATION_OPAQUE);
|
||||||
|
|
||||||
|
vec3 additive = traceAdditive(origin, direction, payload_opaque.hit_pos_t.w <= 0. ? L : payload_opaque.hit_pos_t.w);
|
||||||
|
|
||||||
// Sky/envmap
|
// Sky/envmap
|
||||||
if (payload_opaque.hit_pos_t.w <= 0.) {
|
if (payload_opaque.hit_pos_t.w <= 0.) {
|
||||||
out_accumulated += throughput * payload_opaque.base_color;
|
if (bounce == 0) {
|
||||||
|
out_additive += payload_opaque.emissive * color_factor + additive;
|
||||||
|
} else {
|
||||||
|
out_accumulated += throughput * (payload_opaque.emissive * color_factor + additive);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec3 additive = traceAdditive(origin, direction, payload_opaque.hit_pos_t.w);
|
|
||||||
|
|
||||||
#ifdef DEBUG_LIGHT_CULLING
|
#ifdef DEBUG_LIGHT_CULLING
|
||||||
// light clusters debugging
|
// light clusters debugging
|
||||||
{
|
{
|
||||||
|
@ -423,7 +426,11 @@ void main() {
|
||||||
imageStore(out_image_normals, ivec2(gl_LaunchIDEXT.xy), vec4(geometryNormal.xy, shadingNormal.xy));
|
imageStore(out_image_normals, ivec2(gl_LaunchIDEXT.xy), vec4(geometryNormal.xy, shadingNormal.xy));
|
||||||
payload_opaque.base_color = vec3(1.);
|
payload_opaque.base_color = vec3(1.);
|
||||||
|
|
||||||
|
//out_material_index = float(kusochki[payload_opaque.kusok_index].tex_roughness);
|
||||||
#if 0
|
#if 0
|
||||||
|
//imageStore(out_image_base_color, ivec2(gl_LaunchIDEXT.xy), vec4(fract(payload_opaque.debug.xy), 0., 0.));
|
||||||
|
//imageStore(out_image_base_color, ivec2(gl_LaunchIDEXT.xy), vec4(payload_opaque.kusok_index));
|
||||||
|
imageStore(out_image_base_color, ivec2(gl_LaunchIDEXT.xy), vec4(payload_opaque.roughness));
|
||||||
imageStore(out_image_diffuse_gi, ivec2(gl_LaunchIDEXT.xy), vec4(0));
|
imageStore(out_image_diffuse_gi, ivec2(gl_LaunchIDEXT.xy), vec4(0));
|
||||||
imageStore(out_image_specular, ivec2(gl_LaunchIDEXT.xy), vec4(0.));
|
imageStore(out_image_specular, ivec2(gl_LaunchIDEXT.xy), vec4(0.));
|
||||||
imageStore(out_image_additive, ivec2(gl_LaunchIDEXT.xy), vec4(clamp(payload_opaque.normal, vec3(0.), vec3(1.)), 0.));
|
imageStore(out_image_additive, ivec2(gl_LaunchIDEXT.xy), vec4(clamp(payload_opaque.normal, vec3(0.), vec3(1.)), 0.));
|
||||||
|
|
Loading…
Reference in New Issue