vk: fix bright artifacts coming from unpatched chrome materials

Fixes a typo that rewrote roughness value with garbage.

Also adds a few more debug channel displays for lighting phases. And
prints out available debug displays.

Fixes #641
This commit is contained in:
Ivan Avdeev 2023-11-06 12:47:21 -05:00
parent 4509e2075d
commit a25bf841ac
6 changed files with 33 additions and 1 deletions

View File

@ -2,6 +2,7 @@
- [x] fix material asserts and inherit
- [x] fixup -vkverboselogs
- [x] changing textures on buttons, etc
- [x] fix unpatched chrome surfaces brightness glitches
# 2023-11-03 E324
- [x] add cvar for displaying only specified channel

View File

@ -149,6 +149,7 @@ void computeBounce(ivec2 pix, vec3 direction, out vec3 diffuse, out vec3 specula
RayPayloadPrimary payload;
payload.base_color_a = vec4(0.);
payload.emissive = vec4(0.);
payload.material_rmxx = vec4(0.);
const vec3 pos = imageLoad(position_t, pix).xyz + geometry_normal * ray_normal_fudge;
if (!getHit(pos, bounce_direction, payload))
return;

View File

@ -213,6 +213,21 @@ void main() {
const Components c = blurSamples(res, pix);
if (ubo.ubo.debug_display_only == DEBUG_DISPLAY_DISABLED) {
} else if (ubo.ubo.debug_display_only == DEBUG_DISPLAY_DIRECT) {
imageStore(out_dest, pix, vec4(LINEARtoSRGB(c.direct_diffuse + c.direct_specular), 0.)); return;
return;
} else if (ubo.ubo.debug_display_only == DEBUG_DISPLAY_INDIRECT) {
imageStore(out_dest, pix, vec4(LINEARtoSRGB(c.indirect_diffuse + c.indirect_specular), 0.)); return;
return;
} else if (ubo.ubo.debug_display_only == DEBUG_DISPLAY_INDIRECT_SPEC) {
imageStore(out_dest, pix, vec4(LINEARtoSRGB(c.indirect_specular), 0.)); return;
return;
} else if (ubo.ubo.debug_display_only == DEBUG_DISPLAY_INDIRECT_DIFF) {
imageStore(out_dest, pix, vec4(LINEARtoSRGB(c.indirect_diffuse), 0.)); return;
return;
}
vec3 colour = vec3(0.);
{
// TODO: need to extract reprojecting from this shader because reprojected stuff need svgf denoising pass after it

View File

@ -176,6 +176,10 @@ struct PushConstants {
#define DEBUG_DISPLAY_NGEOM 5
#define DEBUG_DISPLAY_LIGHTING 6
#define DEBUG_DISPLAY_SURFHASH 7
#define DEBUG_DISPLAY_DIRECT 8
#define DEBUG_DISPLAY_INDIRECT 9
#define DEBUG_DISPLAY_INDIRECT_SPEC 10
#define DEBUG_DISPLAY_INDIRECT_DIFF 11
// add more when needed
struct UniformBuffer {

View File

@ -566,7 +566,7 @@ r_vk_material_t R_VkMaterialGetForTextureWithFlags( int tex_index, uint32_t flag
ret.tex_base_color = tex_index;
if ( flags & kVkMaterialFlagChrome )
ret.roughness = tglob.grayTexture;
ret.tex_roughness = tglob.grayTexture;
//DEBUG("Returning default material with tex_base_color=%d", tex_index);
return ret;

View File

@ -164,6 +164,10 @@ static void parseDebugDisplayValue( void ) {
X(NSHADE) \
X(NGEOM) \
X(SURFHASH) \
X(DIRECT) \
X(INDIRECT) \
X(INDIRECT_SPEC) \
X(INDIRECT_DIFF) \
#define X(suffix) \
if (0 == Q_stricmp(cvalue, #suffix)) { \
@ -174,6 +178,13 @@ static void parseDebugDisplayValue( void ) {
LIST_DISPLAYS(X)
#undef X
if (Q_strlen(cvalue) > 0) {
gEngine.Con_Printf("Invalid rt_debug_display_only mode %s. Valid modes are:\n", cvalue);
#define X(suffix) gEngine.Con_Printf("\t%s\n", #suffix);
LIST_DISPLAYS(X)
#undef X
}
g_rtx.debug.rt_debug_display_only_value = DEBUG_DISPLAY_DISABLED;
}