vk: rt: ensure that base_color_a is stored in sRGB-γ
Storing it linearly was a mistake: it is 8-bit only, and lacks enough precision for dark values. It also doesn't really need any more precision, and should be limited to 0..1 range. Therefore, it makes sense to treat it as sRGB explicitly.
This commit is contained in:
parent
7bfba01954
commit
d76d6429d0
|
@ -95,7 +95,7 @@ void computeBounce(ivec2 pix, vec3 direction, out vec3 diffuse, out vec3 specula
|
|||
specular = vec3(0.);
|
||||
|
||||
const vec4 material_data = imageLoad(material_rmxx, pix);
|
||||
const vec4 base_a = imageLoad(base_color_a, pix);
|
||||
const vec4 base_a = SRGBtoLINEAR(imageLoad(base_color_a, pix));
|
||||
|
||||
MaterialProperties material;
|
||||
material.baseColor = vec3(1.f);
|
||||
|
|
|
@ -36,11 +36,13 @@ layout(set = 0, binding = 15, rgba16f) uniform image2D prev_temporal_diffuse;
|
|||
layout(set = 0, binding = 16, rgba16f) uniform image2D out_temporal_specular;
|
||||
layout(set = 0, binding = 17, rgba16f) uniform image2D prev_temporal_specular;
|
||||
|
||||
//layout(set = 0, binding = 19) uniform sampler2D textures[MAX_TEXTURES];
|
||||
|
||||
const int INDIRECT_SCALE = 2;
|
||||
|
||||
//#define DEBUG_TEXTURE normals_gs
|
||||
//#define DEBUG_TEXTURE emissive
|
||||
//#define DEBUG_TEXTURE base_color_a
|
||||
//#define DEBUG_TEXTURE light_point_diffuse
|
||||
//#define DEBUG_NORMAL
|
||||
//layout(set = 0, binding = 18, rgba8) uniform readonly image2D material_rmxx;
|
||||
|
@ -194,6 +196,9 @@ void main() {
|
|||
/* } */
|
||||
|
||||
#if defined(DEBUG_TEXTURE)
|
||||
//if (pix.x < res.x / 2) {
|
||||
//imageStore(out_dest, pix, vec4(LINEARtoSRGB(texture(textures[161], vec2(pix)/vec2(res)).rgb), 0.)); return;
|
||||
//}
|
||||
imageStore(out_dest, pix, vec4(LINEARtoSRGB(imageLoad(DEBUG_TEXTURE, pix).rgb), 0.)); return;
|
||||
#endif
|
||||
|
||||
|
@ -270,7 +275,7 @@ void main() {
|
|||
//imageStore(out_dest, pix, vec4(LINEARtoSRGB(diffuse), 0.)); return;
|
||||
}
|
||||
|
||||
const vec4 base_color_a = imageLoad(base_color_a, pix);
|
||||
const vec4 base_color_a = SRGBtoLINEAR(imageLoad(base_color_a, pix));
|
||||
colour *= base_color_a.rgb;
|
||||
colour += imageLoad(emissive, pix).rgb;
|
||||
colour = LINEARtoSRGB(colour);
|
||||
|
|
|
@ -113,7 +113,7 @@ void main() {
|
|||
traceSimpleBlending(ray.origin, ray.direction, L, payload.emissive.rgb, payload.base_color_a.rgb);
|
||||
|
||||
imageStore(out_position_t, pix, payload.hit_t);
|
||||
imageStore(out_base_color_a, pix, payload.base_color_a);
|
||||
imageStore(out_base_color_a, pix, LINEARtoSRGB(payload.base_color_a));
|
||||
imageStore(out_normals_gs, pix, payload.normals_gs);
|
||||
//imageStore(out_material_rmxx, pix, vec4(payload.material_rmxx.rg, 0, uintToFloat01(xxhash32(debug_geometry_index))));
|
||||
imageStore(out_material_rmxx, pix, payload.material_rmxx);
|
||||
|
|
Loading…
Reference in New Issue