From 95e84a440bef694e982961ef9b994b554ac1357f Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Thu, 26 Aug 2021 09:50:04 -0700 Subject: [PATCH 01/55] Extended the supported light style range to 200% to fix over-bright lighting. --- src/refresh/vkpt/vertex_buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/refresh/vkpt/vertex_buffer.c b/src/refresh/vkpt/vertex_buffer.c index c71d80d0b..5bdcec913 100644 --- a/src/refresh/vkpt/vertex_buffer.c +++ b/src/refresh/vkpt/vertex_buffer.c @@ -269,10 +269,10 @@ copy_light(const light_poly_t* light, float* vblight, const float* sky_radiance) if (light->style != 0 && vkpt_refdef.fd->lightstyles) { style_scale = vkpt_refdef.fd->lightstyles[light->style].white; - style_scale = max(0, min(1, style_scale)); + style_scale = max(0.f, min(2.f, style_scale)); prev_style = vkpt_refdef.prev_lightstyles[light->style].white; - prev_style = max(0, min(1, prev_style)); + prev_style = max(0.f, min(2.f, prev_style)); } float mat_scale = light->material ? light->material->emissive_factor : 1.f; From da7a2e698e19cfe5bdacdb17d66b5ab9bc213a1e Mon Sep 17 00:00:00 2001 From: Jonathan Date: Sun, 29 Aug 2021 16:50:11 -0400 Subject: [PATCH 02/55] Fix cluster nums --- inc/common/bsp.h | 2 ++ src/common/bsp.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/inc/common/bsp.h b/inc/common/bsp.h index 83de60aa4..b374a5b59 100644 --- a/inc/common/bsp.h +++ b/inc/common/bsp.h @@ -287,6 +287,8 @@ typedef struct bsp_s { byte *pvs2_matrix; qboolean pvs_patched; + qboolean extended; + // WARNING: the 'name' string is actually longer than this, and the bsp_t structure is allocated larger than sizeof(bsp_t) in BSP_Load char name[1]; } bsp_t; diff --git a/src/common/bsp.c b/src/common/bsp.c index 93150f83d..c9dd41249 100644 --- a/src/common/bsp.c +++ b/src/common/bsp.c @@ -76,7 +76,7 @@ LOAD(Visibility) memcpy(bsp->vis, base, count); numclusters = LittleLong(bsp->vis->numclusters); - if (numclusters > MAX_MAP_LEAFS) { + if (numclusters > (bsp->extended ? MAX_QBSP_MAP_LEAFS : MAX_MAP_LEAFS)) { DEBUG("bad numclusters"); return Q_ERR_TOO_MANY; } @@ -1509,6 +1509,8 @@ qerror_t BSP_Load(const char *name, bsp_t **bsp_p) const lump_info_t *lumps = LittleLong(header->ident) == IDBSPHEADER ? bsp_lumps : qbsp_lumps; + bsp->extended = (lumps == qbsp_lumps); + // byte swap and validate all lumps memsize = 0; for (info = lumps; info->load; info++) { From ab4d4705c6371c495ad8eac40e1261db88e815c1 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Tue, 31 Aug 2021 12:52:14 -0700 Subject: [PATCH 03/55] Fixed light styles on poly-lights coming from models. --- src/refresh/vkpt/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/refresh/vkpt/main.c b/src/refresh/vkpt/main.c index 9576144fb..7c4ff6318 100644 --- a/src/refresh/vkpt/main.c +++ b/src/refresh/vkpt/main.c @@ -1617,6 +1617,7 @@ static void instance_model_lights(int num_light_polys, const light_poly_t* light // Copy the other light properties VectorCopy(src_light->color, dst_light->color); dst_light->material = src_light->material; + dst_light->style = src_light->style; num_model_lights++; } From 50e80f3a323a3063d66f57c7e766da83872ffdbf Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Wed, 1 Sep 2021 11:47:17 +0200 Subject: [PATCH 04/55] Fix apparent pipeline layout mismatch between vkpt_asvgf_create_pipelines() and vkpt_taa() --- src/refresh/vkpt/asvgf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/refresh/vkpt/asvgf.c b/src/refresh/vkpt/asvgf.c index 164fea857..c6e918653 100644 --- a/src/refresh/vkpt/asvgf.c +++ b/src/refresh/vkpt/asvgf.c @@ -161,7 +161,7 @@ vkpt_asvgf_create_pipelines() [TAAU] = { .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, .stage = SHADER_STAGE(QVK_MOD_ASVGF_TAAU_COMP, VK_SHADER_STAGE_COMPUTE_BIT), - .layout = pipeline_layout_general, + .layout = pipeline_layout_taa, }, [COMPOSITING] = { .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, From 06cdf99d1907eb4f342cb695d34640e6de5a6ed2 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Wed, 1 Sep 2021 10:57:53 -0700 Subject: [PATCH 05/55] Added support for converting sky surfaces into poly-lights based on their flags. See the "pt_bsp_sky_lights" cvar. --- src/refresh/vkpt/bsp_mesh.c | 57 ++++++++++++++++++++++++++----------- src/refresh/vkpt/main.c | 10 ++++++- 2 files changed, 50 insertions(+), 17 deletions(-) diff --git a/src/refresh/vkpt/bsp_mesh.c b/src/refresh/vkpt/bsp_mesh.c index 928705b22..31d6f7613 100644 --- a/src/refresh/vkpt/bsp_mesh.c +++ b/src/refresh/vkpt/bsp_mesh.c @@ -30,7 +30,8 @@ with this program; if not, write to the Free Software Foundation, Inc., extern cvar_t *cvar_pt_enable_nodraw; extern cvar_t *cvar_pt_enable_surface_lights; extern cvar_t *cvar_pt_enable_surface_lights_warp; -extern cvar_t *cvar_pt_bsp_radiance_scale; +extern cvar_t* cvar_pt_bsp_radiance_scale; +extern cvar_t *cvar_pt_bsp_sky_lights; static void remove_collinear_edges(float* positions, float* tex_coords, int* num_vertices) @@ -249,8 +250,11 @@ belongs_to_model(bsp_t *bsp, mface_t *surf) return 0; } -static int filter_static_masked(int flags) +static int filter_static_masked(int flags, int surf_flags) { + if ((surf_flags & SURF_NODRAW) && cvar_pt_enable_nodraw->integer) + return 0; + const pbr_material_t* mat = MAT_ForIndex(flags & MATERIAL_INDEX_MASK); if (mat && mat->image_mask) @@ -259,9 +263,12 @@ static int filter_static_masked(int flags) return 0; } -static int filter_static_opaque(int flags) +static int filter_static_opaque(int flags, int surf_flags) { - if (filter_static_masked(flags)) + if ((surf_flags & SURF_NODRAW) && cvar_pt_enable_nodraw->integer) + return 0; + + if (filter_static_masked(flags, surf_flags)) return 0; flags &= MATERIAL_KIND_MASK; @@ -271,8 +278,11 @@ static int filter_static_opaque(int flags) return 1; } -static int filter_static_transparent(int flags) +static int filter_static_transparent(int flags, int surf_flags) { + if ((surf_flags & SURF_NODRAW) && cvar_pt_enable_nodraw->integer) + return 0; + flags &= MATERIAL_KIND_MASK; if (flags == MATERIAL_KIND_WATER || flags == MATERIAL_KIND_SLIME || flags == MATERIAL_KIND_GLASS || flags == MATERIAL_KIND_TRANSPARENT) return 1; @@ -280,22 +290,34 @@ static int filter_static_transparent(int flags) return 0; } -static int filter_static_sky(int flags) +static int filter_static_sky(int flags, int surf_flags) { + if ((surf_flags & SURF_NODRAW) && cvar_pt_enable_nodraw->integer) + return 0; + if (MAT_IsKind(flags, MATERIAL_KIND_SKY)) return 1; return 0; } -static int filter_all(int flags) +static int filter_all(int flags, int surf_flags) { + if ((surf_flags & SURF_NODRAW) && cvar_pt_enable_nodraw->integer) + return 0; + if (MAT_IsKind(flags, MATERIAL_KIND_SKY)) return 0; return 1; } +static int filter_nodraw_sky_lights(int flags, int surf_flags) +{ + int expected = SURF_SKY | SURF_LIGHT | SURF_NODRAW; + return (surf_flags & expected) == expected; +} + // Computes a point at a small distance above the center of the triangle. // Returns qfalse if the triangle is degenerate, qtrue otherwise. qboolean @@ -484,7 +506,7 @@ static void build_pvs2(bsp_t* bsp) } static void -collect_surfaces(int *idx_ctr, bsp_mesh_t *wm, bsp_t *bsp, int model_idx, int (*filter)(int)) +collect_surfaces(int *idx_ctr, bsp_mesh_t *wm, bsp_t *bsp, int model_idx, int (*filter)(int, int)) { mface_t *surfaces = model_idx < 0 ? bsp->faces : bsp->models[model_idx].firstface; int num_faces = model_idx < 0 ? bsp->numfaces : bsp->models[model_idx].numfaces; @@ -507,10 +529,7 @@ collect_surfaces(int *idx_ctr, bsp_mesh_t *wm, bsp_t *bsp, int model_idx, int (* if (MAT_IsKind(material_id, MATERIAL_KIND_GLASS) && !(surf_flags & SURF_TRANS_MASK)) material_id = MAT_SetKind(material_id, MATERIAL_KIND_REGULAR); - - if ((surf_flags & SURF_NODRAW) && cvar_pt_enable_nodraw->integer) - continue; - + // custom transparent surfaces if (surf_flags & SURF_SKY) material_id = MAT_SetKind(material_id, MATERIAL_KIND_SKY); @@ -527,7 +546,7 @@ collect_surfaces(int *idx_ctr, bsp_mesh_t *wm, bsp_t *bsp, int model_idx, int (* if (surf_flags & SURF_FLOWING) material_id |= MATERIAL_FLAG_FLOWING; - if (!filter(material_id)) + if (!filter(material_id, surf_flags)) continue; if ((material_id & MATERIAL_FLAG_LIGHT) && surf->texinfo->material->light_styles) @@ -577,7 +596,8 @@ collect_surfaces(int *idx_ctr, bsp_mesh_t *wm, bsp_t *bsp, int model_idx, int (* if (cluster >= 0 && (MAT_IsKind(material_id, MATERIAL_KIND_SKY) || MAT_IsKind(material_id, MATERIAL_KIND_LAVA))) { - if(is_sky_or_lava_cluster(wm, surf, cluster, material_id)) + qboolean is_bsp_sky_light = (surf_flags & (SURF_LIGHT | SURF_SKY)) == (SURF_LIGHT | SURF_SKY); + if (is_sky_or_lava_cluster(wm, surf, cluster, material_id) || (cvar_pt_bsp_sky_lights->integer && is_bsp_sky_light)) { wm->materials[it] |= MATERIAL_FLAG_LIGHT; } @@ -1109,8 +1129,10 @@ collect_sky_and_lava_light_polys(bsp_mesh_t *wm, bsp_t* bsp) if (surf->texinfo) flags |= surf->texinfo->c.flags; qboolean is_sky = !!(flags & SURF_SKY); + qboolean is_light = !!(flags & SURF_LIGHT); + qboolean is_nodraw = !!(flags & SURF_NODRAW); qboolean is_lava = surf->texinfo->material ? MAT_IsKind(surf->texinfo->material->flags, MATERIAL_KIND_LAVA) : qfalse; - + is_lava &= (surf->texinfo->material->image_emissive != NULL); if (!is_sky && !is_lava) @@ -1162,7 +1184,8 @@ collect_sky_and_lava_light_polys(bsp_mesh_t *wm, bsp_t* bsp) light.cluster = BSP_PointLeaf(bsp->nodes, light.off_center)->cluster; - if (is_sky_or_lava_cluster(wm, surf, light.cluster, surf->texinfo->material->flags)) + if (is_sky_or_lava_cluster(wm, surf, light.cluster, surf->texinfo->material->flags) || + cvar_pt_bsp_sky_lights->integer && is_sky && is_light && (cvar_pt_bsp_sky_lights->integer > 1 || !is_nodraw)) { light_poly_t* list_light = append_light_poly(&wm->num_light_polys, &wm->allocated_light_polys, &wm->light_polys); memcpy(list_light, &light, sizeof(light_poly_t)); @@ -1815,6 +1838,8 @@ bsp_mesh_create_from_bsp(bsp_mesh_t *wm, bsp_t *bsp, const char* map_name) wm->world_custom_sky_offset = idx_ctr; bsp_mesh_load_custom_sky(&idx_ctr, wm, bsp, full_game_map_name); + if (cvar_pt_bsp_sky_lights->integer > 1) + collect_surfaces(&idx_ctr, wm, bsp, -1, filter_nodraw_sky_lights); wm->world_custom_sky_count = idx_ctr - wm->world_custom_sky_offset; for (int k = 0; k < bsp->nummodels; k++) { diff --git a/src/refresh/vkpt/main.c b/src/refresh/vkpt/main.c index 7c4ff6318..4052dc0f4 100644 --- a/src/refresh/vkpt/main.c +++ b/src/refresh/vkpt/main.c @@ -55,7 +55,8 @@ cvar_t *cvar_pt_enable_surface_lights = NULL; cvar_t *cvar_pt_enable_surface_lights_warp = NULL; cvar_t* cvar_pt_surface_lights_fake_emissive_algo = NULL; cvar_t* cvar_pt_surface_lights_threshold = NULL; -cvar_t *cvar_pt_bsp_radiance_scale = NULL; +cvar_t* cvar_pt_bsp_radiance_scale = NULL; +cvar_t *cvar_pt_bsp_sky_lights = NULL; cvar_t *cvar_pt_accumulation_rendering = NULL; cvar_t *cvar_pt_accumulation_rendering_framenum = NULL; cvar_t *cvar_pt_projection = NULL; @@ -3373,6 +3374,13 @@ R_Init_RTX(qboolean total) // Multiplier for texinfo radiance field to convert radiance to emissive factors cvar_pt_bsp_radiance_scale = Cvar_Get("pt_bsp_radiance_scale", "0.001", CVAR_FILES); + // Controls which sky surfaces become poly-lights. + // 0 -> only the SKY surfaces in clusters listed in sky_clusters.txt + // 1 -> also surfaces with both SKY and LIGHT flags set + // 2 -> also surfaces with SKY, LIGHT, and NODRAW flags set become invisible portal lights + // Nonzero settings should only be used for custom maps where sky surfaces are marked properly for Q2RTX. + cvar_pt_bsp_sky_lights = Cvar_Get("pt_bsp_sky_lights", "0", 0); + // 0 -> disabled, regular pause; 1 -> enabled; 2 -> enabled, hide GUI cvar_pt_accumulation_rendering = Cvar_Get("pt_accumulation_rendering", "1", CVAR_ARCHIVE); From a476da8236900ec073914654f2d9eed4f44ed9af Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Fri, 3 Sep 2021 20:18:52 -0700 Subject: [PATCH 06/55] Switched to a more physically correct evaluation of the Fresnel term in the GGX function, removed the "specular" G-buffer channel and the hacks related to it. --- src/refresh/vkpt/path_tracer.c | 4 +- src/refresh/vkpt/shader/asvgf_atrous.comp | 14 +- .../vkpt/shader/asvgf_gradient_reproject.comp | 1 + src/refresh/vkpt/shader/brdf.glsl | 75 ++++---- src/refresh/vkpt/shader/compositing.comp | 5 +- src/refresh/vkpt/shader/direct_lighting.rgen | 30 +++- src/refresh/vkpt/shader/global_textures.h | 163 +++++++++--------- .../vkpt/shader/indirect_lighting.rgen | 56 ++++-- src/refresh/vkpt/shader/path_tracer_rgen.h | 37 ++-- .../vkpt/shader/physical_sky_space.comp | 6 +- src/refresh/vkpt/shader/primary_rays.rgen | 19 +- src/refresh/vkpt/shader/reflect_refract.rgen | 22 +-- 12 files changed, 246 insertions(+), 186 deletions(-) diff --git a/src/refresh/vkpt/path_tracer.c b/src/refresh/vkpt/path_tracer.c index 91c6874b1..e202d91af 100644 --- a/src/refresh/vkpt/path_tracer.c +++ b/src/refresh/vkpt/path_tracer.c @@ -1062,7 +1062,7 @@ vkpt_pt_trace_primary_rays(VkCommandBuffer cmd_buf) BARRIER_COMPUTE(cmd_buf, qvk.images[VKPT_IMG_PT_THROUGHPUT]); BARRIER_COMPUTE(cmd_buf, qvk.images[VKPT_IMG_PT_BOUNCE_THROUGHPUT]); BARRIER_COMPUTE(cmd_buf, qvk.images[VKPT_IMG_PT_GODRAYS_THROUGHPUT_DIST]); - BARRIER_COMPUTE(cmd_buf, qvk.images[VKPT_IMG_PT_ALBEDO]); + BARRIER_COMPUTE(cmd_buf, qvk.images[VKPT_IMG_PT_BASE_COLOR_A + frame_idx]); BARRIER_COMPUTE(cmd_buf, qvk.images[VKPT_IMG_PT_METALLIC_A + frame_idx]); BARRIER_COMPUTE(cmd_buf, qvk.images[VKPT_IMG_PT_CLUSTER_A + frame_idx]); BARRIER_COMPUTE(cmd_buf, qvk.images[VKPT_IMG_PT_VIEW_DEPTH_A + frame_idx]); @@ -1098,7 +1098,7 @@ vkpt_pt_trace_reflections(VkCommandBuffer cmd_buf, int bounce) BARRIER_COMPUTE(cmd_buf, qvk.images[VKPT_IMG_PT_VIEW_DIRECTION]); BARRIER_COMPUTE(cmd_buf, qvk.images[VKPT_IMG_PT_THROUGHPUT]); BARRIER_COMPUTE(cmd_buf, qvk.images[VKPT_IMG_PT_GODRAYS_THROUGHPUT_DIST]); - BARRIER_COMPUTE(cmd_buf, qvk.images[VKPT_IMG_PT_ALBEDO]); + BARRIER_COMPUTE(cmd_buf, qvk.images[VKPT_IMG_PT_BASE_COLOR_A + frame_idx]); BARRIER_COMPUTE(cmd_buf, qvk.images[VKPT_IMG_PT_METALLIC_A + frame_idx]); BARRIER_COMPUTE(cmd_buf, qvk.images[VKPT_IMG_PT_CLUSTER_A + frame_idx]); BARRIER_COMPUTE(cmd_buf, qvk.images[VKPT_IMG_PT_VIEW_DEPTH_A + frame_idx]); diff --git a/src/refresh/vkpt/shader/asvgf_atrous.comp b/src/refresh/vkpt/shader/asvgf_atrous.comp index ae5b32de4..224c817a5 100644 --- a/src/refresh/vkpt/shader/asvgf_atrous.comp +++ b/src/refresh/vkpt/shader/asvgf_atrous.comp @@ -316,6 +316,7 @@ main() filtered_spec /= STORAGE_SCALE_SPEC; vec3 normal = decode_normal(texelFetch(TEX_PT_NORMAL_A, ipos, 0).x); + vec3 base_color = texelFetch(TEX_PT_BASE_COLOR_A, ipos, 0).rgb; vec2 metallic_roughness = texelFetch(TEX_PT_METALLIC_A, ipos, 0).rg; float checkerboard_flags = texelFetch(TEX_PT_VIEW_DIRECTION, ipos, 0).a; float metallic = metallic_roughness.x; @@ -358,9 +359,15 @@ main() // Compute the specular color and add it to the specular channel vec3 color = SH_to_irradiance(filtered_lf); - float brdf = GGX(view_direction, incoming_direction, normal, roughness, 0); + vec3 albedo, base_reflectivity; + get_reflectivity(base_color, metallic, albedo, base_reflectivity); - filtered_spec += color * fake_specular_weight * brdf * scale; + vec3 brdf = GGX_times_NdotL(view_direction, incoming_direction, normal, roughness, base_reflectivity, 0); + + vec3 fake_specular = color * fake_specular_weight * brdf * scale; + fake_specular = demodulate_specular(base_reflectivity, fake_specular); + + filtered_spec += fake_specular; } } #endif @@ -369,12 +376,11 @@ main() vec3 projected_lf = project_SH_irradiance(filtered_lf, normal); // Load the other image channels - vec4 albedo = texelFetch(TEX_PT_ALBEDO, ipos, 0).rgba; vec4 transparent = texelFetch(TEX_PT_TRANSPARENT, ipos, 0); vec3 throughput = texelFetch(TEX_PT_THROUGHPUT, ipos, 0).rgb; // Composite - vec3 final_color = composite_color(albedo.rgb, albedo.a, metallic, throughput, projected_lf, filtered_hf, filtered_spec, transparent); + vec3 final_color = composite_color(base_color, metallic, throughput, projected_lf, filtered_hf, filtered_spec, transparent); if(global_ubo.flt_show_gradients != 0) { diff --git a/src/refresh/vkpt/shader/asvgf_gradient_reproject.comp b/src/refresh/vkpt/shader/asvgf_gradient_reproject.comp index 4dc46bcb3..6494816e8 100644 --- a/src/refresh/vkpt/shader/asvgf_gradient_reproject.comp +++ b/src/refresh/vkpt/shader/asvgf_gradient_reproject.comp @@ -267,6 +267,7 @@ main() imageStore(IMG_ASVGF_RNG_SEED_A, ipos, texelFetch(TEX_ASVGF_RNG_SEED_B, found_pos_prev, 0)); imageStore(IMG_PT_NORMAL_A, ipos, texelFetch(TEX_PT_NORMAL_B, found_pos_prev, 0)); + imageStore(IMG_PT_BASE_COLOR_A, ipos, texelFetch(TEX_PT_BASE_COLOR_B, found_pos_prev, 0)); imageStore(IMG_PT_METALLIC_A, ipos, texelFetch(TEX_PT_METALLIC_B, found_pos_prev, 0)); patch_position(ipos, found_pos_prev); diff --git a/src/refresh/vkpt/shader/brdf.glsl b/src/refresh/vkpt/shader/brdf.glsl index 0d0458174..84d9e14d9 100644 --- a/src/refresh/vkpt/shader/brdf.glsl +++ b/src/refresh/vkpt/shader/brdf.glsl @@ -42,7 +42,12 @@ float G_Smith_over_NdotV(float roughness, float NdotV, float NdotL) return 2.0 * NdotL / (g1 + g2); } -float GGX(vec3 V, vec3 L, vec3 N, float roughness, float NoH_offset) +vec3 schlick_fresnel(vec3 F0, float HdotV) +{ + return F0 + (vec3(1.0) - F0) * pow(1 - HdotV, 5); +} + +vec3 GGX_times_NdotL(vec3 V, vec3 L, vec3 N, float roughness, vec3 F0, float NoH_offset) { vec3 H = normalize(L - V); @@ -56,15 +61,15 @@ float GGX(vec3 V, vec3 L, vec3 N, float roughness, float NoH_offset) float G = G_Smith_over_NdotV(roughness, NoV, NoL); float alpha = square(max(roughness, 0.02)); float D = square(alpha) / (M_PI * square(square(NoH) * square(alpha) + (1 - square(NoH)))); + vec3 F = schlick_fresnel(F0, VoH); - // Incident light = SampleColor * NoL - // Microfacet specular = D*G*F / (4*NoL*NoV) - // F = 1, accounted for elsewhere - // NoL = 1, accounted for in the diffuse term - return D * G / 4; + // GGX BRDF = D*G*F / (4*NoL*NoV) + // NoL = 1 by function definition, cancelled out in the rendering integral + // NoV is cancelled out with the same term in G + return F * (D * G / 4.0); } - return 0; + return vec3(0); } vec3 ImportanceSampleGGX_VNDF(vec2 u, float roughness, vec3 V, mat3 basis) @@ -112,9 +117,33 @@ float phong(vec3 N, vec3 L, vec3 V, float phong_exp) return pow(max(0.0, dot(H, N)), phong_exp); } +void get_reflectivity(vec3 base_color, float metallic, out vec3 o_albedo, out vec3 o_base_reflectivity) +{ + const float dielectric_specular = 0.04; + o_albedo = mix(base_color * (1.0 - dielectric_specular), vec3(0), metallic); + o_base_reflectivity = mix(vec3(dielectric_specular), base_color, metallic); +} + +vec3 demodulate_specular(vec3 base_reflectivity, vec3 specular) +{ + if (global_ubo.flt_enable == 0) + return specular; + + return specular / max(vec3(0.01), base_reflectivity); +} + +vec3 modulate_specular(vec3 base_reflectivity, vec3 filtered_specular) +{ + if (global_ubo.flt_enable == 0) + return filtered_specular; + + return filtered_specular * max(vec3(0.01), base_reflectivity); +} + + // Compositing function that combines the lighting channels and material // parameters into the final pixel color (before post-processing effects) -vec3 composite_color(vec3 surf_albedo, float surf_specular, float surf_metallic, vec3 throughput, +vec3 composite_color(vec3 surf_base_color, float surf_metallic, vec3 throughput, vec3 projected_lf, vec3 high_freq, vec3 specular, vec4 transparent) { if(global_ubo.pt_num_bounce_rays == 0) @@ -126,19 +155,16 @@ vec3 composite_color(vec3 surf_albedo, float surf_specular, float surf_metallic, high_freq *= global_ubo.flt_scale_hf; specular *= global_ubo.flt_scale_spec; - vec3 final_color; - if(global_ubo.flt_fixed_albedo == 0) - { - vec3 diff_color = surf_albedo.rgb * (1 - surf_specular); - vec3 spec_color = mix(vec3(1), surf_albedo.rgb, surf_metallic) * surf_specular; - - final_color = (projected_lf.rgb + high_freq.rgb) * diff_color + specular.rgb * spec_color; - } - else - { - final_color = (projected_lf.rgb + high_freq.rgb + specular.rgb) * global_ubo.flt_fixed_albedo; - } + vec3 albedo, base_reflectivity; + get_reflectivity(surf_base_color, surf_metallic, albedo, base_reflectivity); + specular = modulate_specular(base_reflectivity, specular); + + if (global_ubo.flt_fixed_albedo != 0) + albedo = vec3(global_ubo.flt_fixed_albedo); + + vec3 final_color = (projected_lf.rgb + high_freq.rgb) * albedo + specular.rgb; + final_color *= throughput; transparent *= global_ubo.flt_scale_overlay; @@ -146,12 +172,3 @@ vec3 composite_color(vec3 surf_albedo, float surf_specular, float surf_metallic, return final_color; } - -float schlick_ross_fresnel(float F0, float roughness, float NdotV) -{ - if(F0 < 0) - return 0; - - // Shlick's approximation for Ross BRDF -- makes Fresnel converge to less than 1.0 when N.V is low - return F0 + (1 - F0) * pow(1 - NdotV, 5 * exp(-2.69 * roughness)) / (1.0 + 22.7 * pow(roughness, 1.5)); -} \ No newline at end of file diff --git a/src/refresh/vkpt/shader/compositing.comp b/src/refresh/vkpt/shader/compositing.comp index 303cedcfc..49c06bd33 100644 --- a/src/refresh/vkpt/shader/compositing.comp +++ b/src/refresh/vkpt/shader/compositing.comp @@ -60,11 +60,12 @@ main() specular /= STORAGE_SCALE_SPEC; // Load the other image channels - vec4 albedo = texelFetch(TEX_PT_ALBEDO, ipos, 0).rgba; + vec3 base_color = texelFetch(TEX_PT_BASE_COLOR_A, ipos, 0).rgb; + vec2 metal_rough = texelFetch(TEX_PT_METALLIC_A, ipos, 0).rg; vec4 transparent = texelFetch(TEX_PT_TRANSPARENT, ipos, 0); // Composite - vec3 final_color = composite_color(albedo.rgb, albedo.a, metallic, throughput, low_freq, high_freq, specular, transparent); + vec3 final_color = composite_color(base_color.rgb, metal_rough.r, throughput, low_freq, high_freq, specular, transparent); final_color *= STORAGE_SCALE_HDR; diff --git a/src/refresh/vkpt/shader/direct_lighting.rgen b/src/refresh/vkpt/shader/direct_lighting.rgen index 25acf1476..a2c7e3793 100644 --- a/src/refresh/vkpt/shader/direct_lighting.rgen +++ b/src/refresh/vkpt/shader/direct_lighting.rgen @@ -56,9 +56,10 @@ direct_lighting(ivec2 ipos, bool is_odd_checkerboard, out vec3 high_freq, out ve vec4 view_direction = texelFetch(TEX_PT_VIEW_DIRECTION, ipos, 0); vec3 normal = decode_normal(texelFetch(TEX_PT_NORMAL_A, ipos, 0).x); vec3 geo_normal = decode_normal(texelFetch(TEX_PT_GEO_NORMAL_A, ipos, 0).x); - vec3 metal_rough_spec = texelFetch(TEX_PT_METALLIC_A, ipos, 0).xyz; - float primary_roughness = metal_rough_spec.y; - float primary_specular = metal_rough_spec.z; + vec3 primary_base_color = texelFetch(TEX_PT_BASE_COLOR_A, ipos, 0).xyz; + vec2 metal_rough = texelFetch(TEX_PT_METALLIC_A, ipos, 0).xy; + float primary_metallic = metal_rough.x; + float primary_roughness = metal_rough.y; uint cluster_idx = texelFetch(TEX_PT_CLUSTER_A, ipos, 0).x; if(cluster_idx == 0xffff) cluster_idx = ~0u; // because the image is uint16 @@ -79,6 +80,9 @@ direct_lighting(ivec2 ipos, bool is_odd_checkerboard, out vec3 high_freq, out ve bool is_gradient = get_is_gradient(ipos); + vec3 primary_albedo, primary_base_reflectivity; + get_reflectivity(primary_base_color, primary_metallic, primary_albedo, primary_base_reflectivity); + vec3 direct_diffuse, direct_specular; get_direct_illumination( position, @@ -88,10 +92,11 @@ direct_lighting(ivec2 ipos, bool is_odd_checkerboard, out vec3 high_freq, out ve material_id, shadow_cull_mask, view_direction.xyz, + primary_albedo, + primary_base_reflectivity, primary_roughness, primary_medium, spec_enable_caustics != 0, - primary_specular, direct_specular_weight, global_ubo.pt_direct_polygon_lights > 0, global_ubo.pt_direct_sphere_lights > 0, @@ -106,12 +111,27 @@ direct_lighting(ivec2 ipos, bool is_odd_checkerboard, out vec3 high_freq, out ve if(global_ubo.pt_direct_sun_light != 0) { vec3 direct_sun_diffuse, direct_sun_specular; - get_sunlight(cluster_idx, material_id, position, normal, geo_normal, view_direction.xyz, primary_roughness, primary_medium, spec_enable_caustics != 0, direct_sun_diffuse, direct_sun_specular, shadow_cull_mask); + get_sunlight( + cluster_idx, + material_id, + position, + normal, + geo_normal, + view_direction.xyz, + primary_base_reflectivity, + primary_roughness, + primary_medium, + spec_enable_caustics != 0, + direct_sun_diffuse, + direct_sun_specular, + shadow_cull_mask); high_freq += direct_sun_diffuse; o_specular += direct_sun_specular; } + o_specular = demodulate_specular(primary_base_reflectivity, o_specular); + high_freq = clamp_output(high_freq); o_specular = clamp_output(o_specular); } diff --git a/src/refresh/vkpt/shader/global_textures.h b/src/refresh/vkpt/shader/global_textures.h index 4d3528604..83274577c 100644 --- a/src/refresh/vkpt/shader/global_textures.h +++ b/src/refresh/vkpt/shader/global_textures.h @@ -37,101 +37,104 @@ with this program; if not, write to the Free Software Foundation, Inc., /* These are images that are to be used as render targets and buffers, but not textures. */ #define LIST_IMAGES \ - IMG_DO(PT_ALBEDO, 0, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_MOTION, 1, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH, IMG_HEIGHT ) \ - IMG_DO(PT_TRANSPARENT, 2, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_COLOR_HF, 3, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_ATROUS_PING_LF_SH, 4, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ - IMG_DO(ASVGF_ATROUS_PONG_LF_SH, 5, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ - IMG_DO(ASVGF_ATROUS_PING_LF_COCG, 6, R16G16_SFLOAT, rg16f, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ - IMG_DO(ASVGF_ATROUS_PONG_LF_COCG, 7, R16G16_SFLOAT, rg16f, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ - IMG_DO(ASVGF_ATROUS_PING_HF, 8, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_ATROUS_PONG_HF, 9, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_ATROUS_PING_SPEC, 10, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_ATROUS_PONG_SPEC, 11, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_ATROUS_PING_MOMENTS, 12, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_ATROUS_PONG_MOMENTS, 13, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_COLOR, 14, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH, IMG_HEIGHT ) \ - IMG_DO(ASVGF_GRAD_LF_PING, 15, R16G16_SFLOAT, rg16f, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ - IMG_DO(ASVGF_GRAD_LF_PONG, 16, R16G16_SFLOAT, rg16f, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ - IMG_DO(ASVGF_GRAD_HF_SPEC_PING, 17, R16G16_SFLOAT, rg16f, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ - IMG_DO(ASVGF_GRAD_HF_SPEC_PONG, 18, R16G16_SFLOAT, rg16f, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ - IMG_DO(PT_SHADING_POSITION, 19, R32G32B32A32_SFLOAT, rgba32f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(FLAT_COLOR, 20, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH, IMG_HEIGHT ) \ - IMG_DO(FLAT_MOTION, 21, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH, IMG_HEIGHT ) \ - IMG_DO(PT_GODRAYS_THROUGHPUT_DIST,22, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(BLOOM_DOWNSCALE_MIP_1, 23, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA / 2, IMG_HEIGHT_TAA / 2 ) \ - IMG_DO(BLOOM_HBLUR, 24, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA / 4, IMG_HEIGHT_TAA / 4 ) \ - IMG_DO(BLOOM_VBLUR, 25, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA / 4, IMG_HEIGHT_TAA / 4 ) \ - IMG_DO(TAA_OUTPUT, 26, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA, IMG_HEIGHT_TAA ) \ - IMG_DO(PT_VIEW_DIRECTION, 27, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_VIEW_DIRECTION2, 28, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_THROUGHPUT, 29, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_BOUNCE_THROUGHPUT, 30, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(HQ_COLOR_INTERLEAVED, 31, R32G32B32A32_SFLOAT, rgba32f, IMG_WIDTH, IMG_HEIGHT ) \ - IMG_DO(PT_COLOR_LF_SH, 32, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_COLOR_LF_COCG, 33, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_COLOR_HF, 34, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_COLOR_SPEC, 35, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_GEO_NORMAL2, 36, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_MOTION, 0, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH, IMG_HEIGHT ) \ + IMG_DO(PT_TRANSPARENT, 1, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_HIST_COLOR_HF, 2, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_ATROUS_PING_LF_SH, 3, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ + IMG_DO(ASVGF_ATROUS_PONG_LF_SH, 4, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ + IMG_DO(ASVGF_ATROUS_PING_LF_COCG, 5, R16G16_SFLOAT, rg16f, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ + IMG_DO(ASVGF_ATROUS_PONG_LF_COCG, 6, R16G16_SFLOAT, rg16f, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ + IMG_DO(ASVGF_ATROUS_PING_HF, 7, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_ATROUS_PONG_HF, 8, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_ATROUS_PING_SPEC, 9, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_ATROUS_PONG_SPEC, 10, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_ATROUS_PING_MOMENTS, 11, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_ATROUS_PONG_MOMENTS, 12, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_COLOR, 13, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH, IMG_HEIGHT ) \ + IMG_DO(ASVGF_GRAD_LF_PING, 14, R16G16_SFLOAT, rg16f, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ + IMG_DO(ASVGF_GRAD_LF_PONG, 15, R16G16_SFLOAT, rg16f, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ + IMG_DO(ASVGF_GRAD_HF_SPEC_PING, 16, R16G16_SFLOAT, rg16f, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ + IMG_DO(ASVGF_GRAD_HF_SPEC_PONG, 17, R16G16_SFLOAT, rg16f, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ + IMG_DO(PT_SHADING_POSITION, 18, R32G32B32A32_SFLOAT, rgba32f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(FLAT_COLOR, 19, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH, IMG_HEIGHT ) \ + IMG_DO(FLAT_MOTION, 20, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH, IMG_HEIGHT ) \ + IMG_DO(PT_GODRAYS_THROUGHPUT_DIST,21, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(BLOOM_DOWNSCALE_MIP_1, 22, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA / 2, IMG_HEIGHT_TAA / 2 ) \ + IMG_DO(BLOOM_HBLUR, 23, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA / 4, IMG_HEIGHT_TAA / 4 ) \ + IMG_DO(BLOOM_VBLUR, 24, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA / 4, IMG_HEIGHT_TAA / 4 ) \ + IMG_DO(TAA_OUTPUT, 25, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA, IMG_HEIGHT_TAA ) \ + IMG_DO(PT_VIEW_DIRECTION, 26, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_VIEW_DIRECTION2, 27, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_THROUGHPUT, 28, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_BOUNCE_THROUGHPUT, 29, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(HQ_COLOR_INTERLEAVED, 30, R32G32B32A32_SFLOAT, rgba32f, IMG_WIDTH, IMG_HEIGHT ) \ + IMG_DO(PT_COLOR_LF_SH, 31, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_COLOR_LF_COCG, 32, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_COLOR_HF, 33, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_COLOR_SPEC, 34, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_GEO_NORMAL2, 35, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ #define LIST_IMAGES_A_B \ - IMG_DO(PT_VISBUF_A, 37, R32G32_UINT, rg32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_VISBUF_B, 38, R32G32_UINT, rg32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_CLUSTER_A, 39, R16_UINT, r16ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_CLUSTER_B, 40, R16_UINT, r16ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_METALLIC_A, 41, R8G8B8A8_UNORM, rgba8, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_METALLIC_B, 42, R8G8B8A8_UNORM, rgba8, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_VIEW_DEPTH_A, 43, R16_SFLOAT, r32f, IMG_WIDTH, IMG_HEIGHT ) \ - IMG_DO(PT_VIEW_DEPTH_B, 44, R16_SFLOAT, r32f, IMG_WIDTH, IMG_HEIGHT ) \ - IMG_DO(PT_NORMAL_A, 45, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_NORMAL_B, 46, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_GEO_NORMAL_A, 47, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_GEO_NORMAL_B, 48, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_FILTERED_SPEC_A, 49, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_FILTERED_SPEC_B, 50, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_MOMENTS_HF_A, 51, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_MOMENTS_HF_B, 52, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_TAA_A, 53, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA, IMG_HEIGHT_TAA ) \ - IMG_DO(ASVGF_TAA_B, 54, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA, IMG_HEIGHT_TAA ) \ - IMG_DO(ASVGF_RNG_SEED_A, 55, R32_UINT, r32ui, IMG_WIDTH, IMG_HEIGHT ) \ - IMG_DO(ASVGF_RNG_SEED_B, 56, R32_UINT, r32ui, IMG_WIDTH, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_COLOR_LF_SH_A, 57, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_COLOR_LF_SH_B, 58, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_COLOR_LF_COCG_A,59, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_COLOR_LF_COCG_B,60, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_GRAD_SMPL_POS_A, 61, R32_UINT, r32ui, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ - IMG_DO(ASVGF_GRAD_SMPL_POS_B, 62, R32_UINT, r32ui, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ - -#define LIST_IMAGES_B_A \ + IMG_DO(PT_VISBUF_A, 36, R32G32_UINT, rg32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ IMG_DO(PT_VISBUF_B, 37, R32G32_UINT, rg32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_VISBUF_A, 38, R32G32_UINT, rg32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_CLUSTER_A, 38, R16_UINT, r16ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ IMG_DO(PT_CLUSTER_B, 39, R16_UINT, r16ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_CLUSTER_A, 40, R16_UINT, r16ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_METALLIC_B, 41, R8G8B8A8_UNORM, rgba8, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_METALLIC_A, 42, R8G8B8A8_UNORM, rgba8, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_VIEW_DEPTH_B, 43, R16_SFLOAT, r32f, IMG_WIDTH, IMG_HEIGHT ) \ + IMG_DO(PT_BASE_COLOR_A, 40, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_BASE_COLOR_B, 41, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_METALLIC_A, 42, R8G8_UNORM, rg8, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_METALLIC_B, 43, R8G8_UNORM, rg8, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ IMG_DO(PT_VIEW_DEPTH_A, 44, R16_SFLOAT, r32f, IMG_WIDTH, IMG_HEIGHT ) \ - IMG_DO(PT_NORMAL_B, 45, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_VIEW_DEPTH_B, 45, R16_SFLOAT, r32f, IMG_WIDTH, IMG_HEIGHT ) \ IMG_DO(PT_NORMAL_A, 46, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_GEO_NORMAL_B, 47, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_NORMAL_B, 47, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ IMG_DO(PT_GEO_NORMAL_A, 48, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_FILTERED_SPEC_B, 49, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_GEO_NORMAL_B, 49, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ IMG_DO(ASVGF_FILTERED_SPEC_A, 50, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_MOMENTS_HF_B, 51, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_FILTERED_SPEC_B, 51, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ IMG_DO(ASVGF_HIST_MOMENTS_HF_A, 52, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_TAA_B, 53, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA, IMG_HEIGHT_TAA ) \ + IMG_DO(ASVGF_HIST_MOMENTS_HF_B, 53, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ IMG_DO(ASVGF_TAA_A, 54, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA, IMG_HEIGHT_TAA ) \ - IMG_DO(ASVGF_RNG_SEED_B, 55, R32_UINT, r32ui, IMG_WIDTH, IMG_HEIGHT ) \ + IMG_DO(ASVGF_TAA_B, 55, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA, IMG_HEIGHT_TAA ) \ IMG_DO(ASVGF_RNG_SEED_A, 56, R32_UINT, r32ui, IMG_WIDTH, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_COLOR_LF_SH_B, 57, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_RNG_SEED_B, 57, R32_UINT, r32ui, IMG_WIDTH, IMG_HEIGHT ) \ IMG_DO(ASVGF_HIST_COLOR_LF_SH_A, 58, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_COLOR_LF_COCG_B,59, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_HIST_COLOR_LF_SH_B, 59, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ IMG_DO(ASVGF_HIST_COLOR_LF_COCG_A,60, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_GRAD_SMPL_POS_B, 61, R32_UINT, r32ui, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ + IMG_DO(ASVGF_HIST_COLOR_LF_COCG_B,61, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ IMG_DO(ASVGF_GRAD_SMPL_POS_A, 62, R32_UINT, r32ui, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ + IMG_DO(ASVGF_GRAD_SMPL_POS_B, 63, R32_UINT, r32ui, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ + +#define LIST_IMAGES_B_A \ + IMG_DO(PT_VISBUF_B, 36, R32G32_UINT, rg32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_VISBUF_A, 37, R32G32_UINT, rg32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_CLUSTER_B, 38, R16_UINT, r16ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_CLUSTER_A, 39, R16_UINT, r16ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_BASE_COLOR_B, 40, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_BASE_COLOR_A, 41, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_METALLIC_B, 42, R8G8_UNORM, rg8, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_METALLIC_A, 43, R8G8_UNORM, rg8, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_VIEW_DEPTH_B, 44, R16_SFLOAT, r32f, IMG_WIDTH, IMG_HEIGHT ) \ + IMG_DO(PT_VIEW_DEPTH_A, 45, R16_SFLOAT, r32f, IMG_WIDTH, IMG_HEIGHT ) \ + IMG_DO(PT_NORMAL_B, 46, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_NORMAL_A, 47, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_GEO_NORMAL_B, 48, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_GEO_NORMAL_A, 49, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_FILTERED_SPEC_B, 50, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_FILTERED_SPEC_A, 51, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_HIST_MOMENTS_HF_B, 52, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_HIST_MOMENTS_HF_A, 53, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_TAA_B, 54, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA, IMG_HEIGHT_TAA ) \ + IMG_DO(ASVGF_TAA_A, 55, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA, IMG_HEIGHT_TAA ) \ + IMG_DO(ASVGF_RNG_SEED_B, 56, R32_UINT, r32ui, IMG_WIDTH, IMG_HEIGHT ) \ + IMG_DO(ASVGF_RNG_SEED_A, 57, R32_UINT, r32ui, IMG_WIDTH, IMG_HEIGHT ) \ + IMG_DO(ASVGF_HIST_COLOR_LF_SH_B, 58, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_HIST_COLOR_LF_SH_A, 59, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_HIST_COLOR_LF_COCG_B,60, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_HIST_COLOR_LF_COCG_A,61, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_GRAD_SMPL_POS_B, 62, R32_UINT, r32ui, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ + IMG_DO(ASVGF_GRAD_SMPL_POS_A, 63, R32_UINT, r32ui, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ -#define NUM_IMAGES 63 /* this really sucks but I don't know how to fix it +#define NUM_IMAGES 64 /* this really sucks but I don't know how to fix it counting with enum does not work in GLSL */ // todo: make naming consistent! diff --git a/src/refresh/vkpt/shader/indirect_lighting.rgen b/src/refresh/vkpt/shader/indirect_lighting.rgen index 014012e58..ae4b791d5 100644 --- a/src/refresh/vkpt/shader/indirect_lighting.rgen +++ b/src/refresh/vkpt/shader/indirect_lighting.rgen @@ -65,8 +65,9 @@ indirect_lighting( vec4 view_direction; vec3 normal; vec3 geo_normal; + vec3 primary_base_color = vec3(0); + float primary_metallic = 0; float primary_roughness = 1; - float primary_specular = 0; if(half_res) throughput.rgb *= 2; @@ -80,12 +81,13 @@ indirect_lighting( view_direction = texelFetch(TEX_PT_VIEW_DIRECTION, ipos, 0); normal = decode_normal(texelFetch(TEX_PT_NORMAL_A, ipos, 0).x); geo_normal = decode_normal(texelFetch(TEX_PT_GEO_NORMAL_A, ipos, 0).x); + primary_base_color = texelFetch(TEX_PT_BASE_COLOR_A, ipos, 0).xyz; if(!half_res) { - vec3 metal_rough_spec = texelFetch(TEX_PT_METALLIC_A, ipos, 0).xyz; - primary_roughness = metal_rough_spec.y; - primary_specular = metal_rough_spec.z; + vec2 metal_rough = texelFetch(TEX_PT_METALLIC_A, ipos, 0).xy; + primary_metallic = metal_rough.x; + primary_roughness = metal_rough.y; } } else @@ -102,6 +104,9 @@ indirect_lighting( normal = geo_normal; } + vec3 primary_albedo, primary_base_reflectivity; + get_reflectivity(primary_base_color, primary_metallic, primary_albedo, primary_base_reflectivity); + bool primary_is_weapon = (material_id & MATERIAL_FLAG_WEAPON) != 0; float direct_specular_weight = smoothstep( @@ -131,7 +136,7 @@ indirect_lighting( #if BOUNCE_SPECULAR if(spec_bounce_index == 0) { - specular_pdf = (primary_specular == 1 && fake_specular_weight == 0) ? 1.0 : 0.5; + specular_pdf = (primary_metallic == 1 && fake_specular_weight == 0) ? 1.0 : 0.5; if(rng_frensel < specular_pdf) { @@ -155,12 +160,12 @@ indirect_lighting( { // See the Heitz paper referenced above for the estimator explanation. // (BRDF / PDF) = F * G2(V, L) / G1(V) - // The Fresnel term F is already embedded into "primary_specular" by direct_lighting.rgen. // Assume G2 = G1(V) * G1(L) here and simplify that expression to just G1(L). float G1_NoL = G1_Smith(primary_roughness, NoL); + vec3 F = schlick_fresnel(primary_base_reflectivity, VoH); - bounce_throughput *= G1_NoL; + bounce_throughput *= G1_NoL * F; bounce_throughput *= 1 / specular_pdf; is_specular_ray = true; @@ -318,15 +323,15 @@ indirect_lighting( bounce_geo_normal = -bounce_geo_normal; vec3 bounce_normal = bounce_geo_normal; - vec3 bounce_albedo = global_textureLod(bounce_minfo.diffuse_texture, tex_coord, 2).rgb; + vec3 bounce_base_color = global_textureLod(bounce_minfo.diffuse_texture, tex_coord, 2).rgb; if((triangle.material_id & MATERIAL_FLAG_CORRECT_ALBEDO) != 0) - bounce_albedo = correct_albedo(bounce_albedo); + bounce_base_color = correct_albedo(bounce_base_color); uint bounce_cluster_idx = triangle.cluster; vec3 emissive = sample_emissive_texture(triangle.material_id, bounce_minfo, tex_coord, vec2(0), vec2(0), is_specular_ray ? 2 : 3); - emissive += get_emissive_shell(triangle.material_id) * bounce_albedo; + emissive += get_emissive_shell(triangle.material_id) * bounce_base_color; if(luminance(emissive) > 0) { @@ -360,7 +365,7 @@ indirect_lighting( if(dot(bounce_direction, bounce_normal) > 0) bounce_normal = -bounce_normal; - bounce_throughput *= bounce_albedo; + bounce_throughput *= bounce_base_color; bounce_throughput *= indirect_specular_weight; float sun_bounce_range = global_ubo.pt_sun_bounce_range; @@ -382,15 +387,16 @@ indirect_lighting( bounce_material_id, shadow_cull_mask, bounce_direction, - 1, + bounce_base_color, + vec3(0), // base_reflectivity + 1.0, // roughness MEDIUM_NONE, - false, - 0, - 0, + false, // enable_caustics + 0.0, // direct_specular_weight global_ubo.pt_indirect_polygon_lights > 0, global_ubo.pt_indirect_sphere_lights > 0, is_gradient, - 1, + 1, // bounce bounce_diffuse, bounce_specular); @@ -400,7 +406,20 @@ indirect_lighting( if(sun_attenuation > 0) { vec3 bounce_sun_diffuse, bounce_sun_specular; - get_sunlight(bounce_cluster_idx, bounce_material_id, bounce_position, bounce_normal, bounce_geo_normal, bounce_direction, 0 /* roughness - don't care */, MEDIUM_NONE, false, bounce_sun_diffuse, bounce_sun_specular, shadow_cull_mask); + get_sunlight( + bounce_cluster_idx, + bounce_material_id, + bounce_position, + bounce_normal, + bounce_geo_normal, + bounce_direction, + vec3(0), // base_reflectivity + 1.0, // roughness + MEDIUM_NONE, + false, // enable_caustics + bounce_sun_diffuse, + bounce_sun_specular, + shadow_cull_mask); bounce_contrib += bounce_throughput * bounce_sun_diffuse * global_ubo.sun_bounce_scale * sun_attenuation; } @@ -414,6 +433,9 @@ indirect_lighting( } } + if (is_specular_ray) + bounce_contrib = demodulate_specular(primary_base_reflectivity, bounce_contrib); + if(spec_bounce_index > 0 && first_bounce_is_specular) is_specular_ray = true; diff --git a/src/refresh/vkpt/shader/path_tracer_rgen.h b/src/refresh/vkpt/shader/path_tracer_rgen.h index 270a17e65..133890dd1 100644 --- a/src/refresh/vkpt/shader/path_tracer_rgen.h +++ b/src/refresh/vkpt/shader/path_tracer_rgen.h @@ -556,10 +556,11 @@ get_direct_illumination( uint material_id, int shadow_cull_mask, vec3 view_direction, + vec3 albedo, + vec3 base_reflectivity, float roughness, int surface_medium, bool enable_caustics, - float surface_specular, float direct_specular_weight, bool enable_polygonal, bool enable_spherical, @@ -580,7 +581,7 @@ get_direct_illumination( float alpha = square(roughness); float phong_exp = RoughnessSquareToSpecPower(alpha); float phong_scale = min(100, 1 / (M_PI * square(alpha))); - float phong_weight = clamp(surface_specular * direct_specular_weight, 0, 0.9); + float phong_weight = clamp(luminance(base_reflectivity) / (luminance(base_reflectivity) + luminance(albedo)), 0, 0.9); int polygonal_light_index = -1; float polygonal_light_pdfw = 0; @@ -695,7 +696,7 @@ get_direct_illumination( if(null_light) return; - diffuse = vis * contrib; + vec3 radiance = vis * contrib; vec3 L = pos_on_light - position; L = normalize(L); @@ -713,12 +714,14 @@ get_direct_illumination( if(vis > 0 && direct_specular_weight > 0) { - specular = diffuse * (GGX(view_direction, normalize(pos_on_light - position), normal, roughness, 0.0) * direct_specular_weight); + vec3 specular_brdf = GGX_times_NdotL(view_direction, normalize(pos_on_light - position), normal, roughness, base_reflectivity, 0.0); + specular = radiance * specular_brdf * direct_specular_weight; } float NdotL = max(0, dot(normal, L)); - diffuse *= NdotL / M_PI; + float diffuse_brdf = NdotL / M_PI; + diffuse = radiance * diffuse_brdf; } void @@ -729,6 +732,7 @@ get_sunlight( vec3 normal, vec3 geo_normal, vec3 view_direction, + vec3 base_reflectivity, float roughness, int surface_medium, bool enable_caustics, @@ -775,27 +779,29 @@ get_sunlight( vec3 envmap = textureLod(TEX_PHYSICAL_SKY, envmap_direction.xzy, 0).rgb; - diffuse = (global_ubo.sun_solid_angle * global_ubo.pt_env_scale) * envmap; + vec3 radiance = (global_ubo.sun_solid_angle * global_ubo.pt_env_scale) * envmap; #else // Fetch the average sun color from the resolved UBO - it's faster. - diffuse = sun_color_ubo.sun_color; + vec3 radiance = sun_color_ubo.sun_color; #endif #ifdef ENABLE_SHADOW_CAUSTICS if(enable_caustics) { - diffuse *= trace_caustic_ray(shadow_ray, surface_medium); + radiance *= trace_caustic_ray(shadow_ray, surface_medium); } #endif if(global_ubo.pt_sun_specular > 0) { float NoH_offset = 0.5 * square(global_ubo.sun_tan_half_angle); - specular = diffuse * GGX(view_direction, global_ubo.sun_direction, normal, roughness, NoH_offset); + vec3 specular_brdf = GGX_times_NdotL(view_direction, global_ubo.sun_direction, normal, roughness, base_reflectivity, NoH_offset); + specular = radiance * specular_brdf; } - diffuse *= NdotL / M_PI; + float diffuse_brdf = NdotL / M_PI; + diffuse = radiance * diffuse_brdf; } vec3 clamp_output(vec3 c) @@ -863,7 +869,7 @@ bool get_is_gradient(ivec2 ipos) void get_material(Triangle triangle, vec3 bary, vec2 tex_coord, vec2 tex_coord_x, vec2 tex_coord_y, float mip_level, vec3 geo_normal, - out vec3 albedo, out vec3 normal, out float metallic, out float specular, out float roughness, out vec3 emissive) + out vec3 base_color, out vec3 normal, out float metallic, out float roughness, out vec3 emissive) { MaterialInfo minfo = get_material_info(triangle.material_id); @@ -876,13 +882,12 @@ get_material(Triangle triangle, vec3 bary, vec2 tex_coord, vec2 tex_coord_x, vec image1 = global_textureGrad(minfo.diffuse_texture, tex_coord, tex_coord_x, tex_coord_y); if((triangle.material_id & MATERIAL_FLAG_CORRECT_ALBEDO) != 0) - albedo = correct_albedo(image1.rgb); + base_color = correct_albedo(image1.rgb); else - albedo = image1.rgb; + base_color = image1.rgb; normal = geo_normal; metallic = 0; - specular = 0; roughness = 1; if (minfo.normals_texture != 0) @@ -944,8 +949,6 @@ get_material(Triangle triangle, vec3 bary, vec2 tex_coord, vec2 tex_coord_x, vec if(global_ubo.pt_roughness_override >= 0) roughness = global_ubo.pt_roughness_override; if(global_ubo.pt_metallic_override >= 0) metallic = global_ubo.pt_metallic_override; - specular = mix(0.05, 1.0, metallic); - if (triangle.emissive_factor > 0) { emissive = sample_emissive_texture(triangle.material_id, minfo, tex_coord, tex_coord_x, tex_coord_y, mip_level); @@ -954,7 +957,7 @@ get_material(Triangle triangle, vec3 bary, vec2 tex_coord, vec2 tex_coord_x, vec else emissive = vec3(0); - emissive += get_emissive_shell(triangle.material_id) * albedo * (1 - metallic * 0.9); + emissive += get_emissive_shell(triangle.material_id) * base_color * (1 - metallic * 0.9); } bool get_camera_uv(vec2 tex_coord, out vec2 cameraUV) diff --git a/src/refresh/vkpt/shader/physical_sky_space.comp b/src/refresh/vkpt/shader/physical_sky_space.comp index 02bdd2536..bc5c531c6 100644 --- a/src/refresh/vkpt/shader/physical_sky_space.comp +++ b/src/refresh/vkpt/shader/physical_sky_space.comp @@ -171,13 +171,13 @@ vec3 planetSurfaceColor(SunInfo sun, PlanetInfo planet, vec3 v, vec3 n) { // lighting - float ggx = 0; + vec3 ggx = vec3(0); if (oceanAlpha > 0) { - ggx = GGX(v, sun.direction, normal, 0.4, 0); + ggx = GGX_times_NdotL(v, sun.direction, normal, 0.4, vec3(0.02), 0); } vec3 diff = (max(0, dot(normal, sun.direction) + 0.3*ndotl) * sun.color * sun.intensity ) * albedo; - vec3 spec = 0.02 * oceanAlpha * ggx * sun.color; + vec3 spec = oceanAlpha * ggx * sun.color; vec3 emit = (1.0-smoothstep(-0.3, 0.1, ndotl)) * city_lights; vec3 surfColor = diff + spec + emit; diff --git a/src/refresh/vkpt/shader/primary_rays.rgen b/src/refresh/vkpt/shader/primary_rays.rgen index 4d9a2963c..f34087f30 100644 --- a/src/refresh/vkpt/shader/primary_rays.rgen +++ b/src/refresh/vkpt/shader/primary_rays.rgen @@ -192,7 +192,7 @@ main() imageStore(IMG_PT_SHADING_POSITION, ipos, vec4(global_ubo.cam_pos.xyz + direction * PRIMARY_RAY_T_MAX, 0)); imageStore(IMG_PT_MOTION, ipos, vec4(motion, 0, 0)); imageStore(IMG_PT_VISBUF_A, ipos, uvec4(0)); - imageStore(IMG_PT_ALBEDO, ipos, vec4(0)); + imageStore(IMG_PT_BASE_COLOR_A, ipos, vec4(0)); imageStore(IMG_PT_TRANSPARENT, ipos, transparent); return; } @@ -277,9 +277,8 @@ main() // Compute angle between adjacent rays using approximate acos(dot(...)), assume horizontal angle == vertical angle float footprint_size_over_distance = sqrt(max(0, 2.0 - 2.0 * dot(ray_x.direction, ray_0.direction))); - vec3 primary_albedo = vec3(1); + vec3 primary_base_color = vec3(1); float primary_metallic = 0; - float primary_specular = 0; float primary_roughness = 1; vec3 primary_emissive = vec3(0); vec3 throughput = vec3(1); @@ -294,10 +293,9 @@ main() tex_coord_y, -1, geo_normal, - primary_albedo, + primary_base_color, normal, primary_metallic, - primary_specular, primary_roughness, primary_emissive); @@ -307,10 +305,6 @@ main() throughput *= extinction(global_ubo.medium, length(position - global_ubo.cam_pos.xyz)); } - float NdotV = clamp(-dot(normal, direction), 0, 1); - primary_specular = schlick_ross_fresnel(primary_specular, primary_roughness, NdotV); - primary_specular *= (1 - primary_roughness * (1 - primary_metallic) * 0.9); - uint material_id = triangle.material_id; if((is_chrome(material_id) || is_screen(material_id) || is_camera(material_id)) && primary_roughness >= MAX_MIRROR_ROUGHNESS) @@ -365,10 +359,9 @@ main() if(!is_odd_checkerboard) { // Black out the surface material for the emissive parts of reflective screens, keep only MVs and emissive channel - primary_specular = 0; primary_roughness = 1; primary_metallic = 1; - primary_albedo = vec3(0); + primary_base_color = vec3(0); material_id = (material_id & ~MATERIAL_KIND_MASK) | MATERIAL_KIND_REGULAR; } else @@ -415,8 +408,8 @@ main() imageStore(IMG_PT_THROUGHPUT, ipos, vec4(throughput, distance_curr)); imageStore(IMG_PT_BOUNCE_THROUGHPUT, ipos, vec4(1, 1, 1, footprint_size_over_distance)); imageStore(IMG_PT_CLUSTER_A, ipos, ivec4(triangle.cluster)); - imageStore(IMG_PT_ALBEDO, ipos, vec4(primary_albedo, primary_specular)); - imageStore(IMG_PT_METALLIC_A, ipos, vec4(primary_metallic, primary_roughness, primary_specular, 0)); + imageStore(IMG_PT_BASE_COLOR_A, ipos, vec4(primary_base_color, 0)); + imageStore(IMG_PT_METALLIC_A, ipos, vec4(primary_metallic, primary_roughness, 0, 0)); imageStore(IMG_PT_GODRAYS_THROUGHPUT_DIST, ipos, vec4(1, 1, 1, distance_curr)); // Debug visualization of the PVS (Potentially Visible Set) diff --git a/src/refresh/vkpt/shader/reflect_refract.rgen b/src/refresh/vkpt/shader/reflect_refract.rgen index 7a4767223..30c1e6ff4 100644 --- a/src/refresh/vkpt/shader/reflect_refract.rgen +++ b/src/refresh/vkpt/shader/reflect_refract.rgen @@ -104,7 +104,7 @@ main() vec3 throughput = throughput_distance.rgb; float optical_path_length = throughput_distance.a; vec4 transparent = imageLoad(IMG_PT_TRANSPARENT, ipos); - vec3 primary_albedo = imageLoad(IMG_PT_ALBEDO, ipos).rgb; + vec3 primary_base_color = imageLoad(IMG_PT_BASE_COLOR_A, ipos).rgb; vec3 geo_normal = decode_normal(imageLoad(IMG_PT_GEO_NORMAL_A, ipos).x); vec3 normal = decode_normal(imageLoad(IMG_PT_NORMAL_A, ipos).x); uint cluster_idx = imageLoad(IMG_PT_CLUSTER_A, ipos).r; @@ -281,7 +281,7 @@ main() { // Chrome is just reflective metal - throughput *= primary_albedo; + throughput *= primary_base_color; direction = reflect(direction, normal); @@ -378,7 +378,7 @@ main() direction = refracted_direction; if(primary_medium == MEDIUM_NONE) { - throughput *= primary_albedo; + throughput *= primary_base_color; primary_medium = MEDIUM_GLASS; } else @@ -437,7 +437,7 @@ main() } correction_factor = (1 - F); - throughput *= primary_albedo; + throughput *= primary_base_color; correct_motion_vector = 2; } else @@ -504,7 +504,7 @@ main() imageStore(IMG_PT_NORMAL_A, ipos, uvec4(0)); imageStore(IMG_PT_GEO_NORMAL_A, ipos, uvec4(0)); - imageStore(IMG_PT_ALBEDO, ipos, vec4(0)); + imageStore(IMG_PT_BASE_COLOR_A, ipos, vec4(0)); imageStore(IMG_PT_METALLIC_A, ipos, vec4(0)); imageStore(IMG_PT_TRANSPARENT, ipos, transparent); imageStore(IMG_PT_SHADING_POSITION, ipos, vec4(position + direction * PRIMARY_RAY_T_MAX, uintBitsToFloat(material_id))); @@ -626,7 +626,6 @@ main() geo_normal = -geo_normal; float primary_metallic = 0; - float primary_specular = 0; float primary_roughness = 1; vec3 primary_emissive = vec3(0); @@ -638,17 +637,12 @@ main() vec2(0), lod, geo_normal, - primary_albedo, + primary_base_color, normal, primary_metallic, - primary_specular, primary_roughness, primary_emissive); - float NdotV = clamp(-dot(normal, direction), 0, 1); - primary_specular = schlick_ross_fresnel(primary_specular, primary_roughness, NdotV); - primary_specular *= (1 - primary_roughness * (1 - primary_metallic) * 0.9); - primary_is_weapon = false; if((is_chrome(material_id) || is_screen(material_id) || is_camera(material_id)) && primary_roughness >= MAX_MIRROR_ROUGHNESS) @@ -734,6 +728,6 @@ main() imageStore(IMG_PT_THROUGHPUT, ipos, vec4(throughput, optical_path_length)); imageStore(IMG_PT_TRANSPARENT, ipos, transparent); imageStore(IMG_PT_CLUSTER_A, ipos, uvec4(cluster_idx)); - imageStore(IMG_PT_ALBEDO, ipos, vec4(primary_albedo, primary_specular)); - imageStore(IMG_PT_METALLIC_A, ipos, vec4(primary_metallic, primary_roughness, primary_specular, 0)); + imageStore(IMG_PT_BASE_COLOR_A, ipos, vec4(primary_base_color, 0)); + imageStore(IMG_PT_METALLIC_A, ipos, vec4(primary_metallic, primary_roughness, 0, 0)); } From bebcee799635cd098eab4df9c008269b6d6018e6 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Fri, 3 Sep 2021 20:24:34 -0700 Subject: [PATCH 07/55] Added a toggle for the correct_albedo behavior. --- src/refresh/vkpt/shader/global_ubo.h | 1 + src/refresh/vkpt/shader/path_tracer_rgen.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/refresh/vkpt/shader/global_ubo.h b/src/refresh/vkpt/shader/global_ubo.h index abcde8273..ad0f1136f 100644 --- a/src/refresh/vkpt/shader/global_ubo.h +++ b/src/refresh/vkpt/shader/global_ubo.h @@ -71,6 +71,7 @@ with this program; if not, write to the Free Software Foundation, Inc., UBO_CVAR_DO(pt_beam_softness, 1.0) /* beam softness */ \ UBO_CVAR_DO(pt_bump_scale, 1.0) /* scale for normal maps [0..1] */ \ UBO_CVAR_DO(pt_cameras, 1) /* switch for security cameras, 0 or 1 */ \ + UBO_CVAR_DO(pt_correct_albedo, 1) /* enables the correct_albedo material setting, 0 or 1 */ \ UBO_CVAR_DO(pt_direct_polygon_lights, 1) /* switch for direct lighting from local polygon lights, 0 or 1 */ \ UBO_CVAR_DO(pt_direct_roughness_threshold, 0.18) /* roughness value where the path tracer switches direct light specular sampling from NDF based to light based, [0..1] */ \ UBO_CVAR_DO(pt_direct_sphere_lights, 1) /* switch for direct lighting from local sphere lights, 0 or 1 */ \ diff --git a/src/refresh/vkpt/shader/path_tracer_rgen.h b/src/refresh/vkpt/shader/path_tracer_rgen.h index 133890dd1..01858f6c1 100644 --- a/src/refresh/vkpt/shader/path_tracer_rgen.h +++ b/src/refresh/vkpt/shader/path_tracer_rgen.h @@ -251,6 +251,9 @@ is_camera(uint material) vec3 correct_albedo(vec3 albedo) { + if (global_ubo.pt_correct_albedo == 0) + return albedo; + return max(vec3(0), pow(albedo, vec3(ALBEDO_TRANSFORM_POWER)) * ALBEDO_TRANSFORM_SCALE + vec3(ALBEDO_TRANSFORM_BIAS)); } From 144b4021a0f6747e3df77eef94380e2adacf36c6 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Sat, 4 Sep 2021 11:16:19 -0700 Subject: [PATCH 08/55] More BRDF improvements: energy conservative (1-F) scaling for the diffuse term, separable Smith shadowing-masking function. --- src/refresh/vkpt/shader/asvgf_atrous.comp | 3 ++- src/refresh/vkpt/shader/brdf.glsl | 21 ++++++++++--------- .../vkpt/shader/indirect_lighting.rgen | 9 ++++++++ src/refresh/vkpt/shader/path_tracer_rgen.h | 12 +++++++---- .../vkpt/shader/physical_sky_space.comp | 3 ++- 5 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/refresh/vkpt/shader/asvgf_atrous.comp b/src/refresh/vkpt/shader/asvgf_atrous.comp index 224c817a5..027322de6 100644 --- a/src/refresh/vkpt/shader/asvgf_atrous.comp +++ b/src/refresh/vkpt/shader/asvgf_atrous.comp @@ -362,7 +362,8 @@ main() vec3 albedo, base_reflectivity; get_reflectivity(base_color, metallic, albedo, base_reflectivity); - vec3 brdf = GGX_times_NdotL(view_direction, incoming_direction, normal, roughness, base_reflectivity, 0); + vec3 F; + vec3 brdf = GGX_times_NdotL(view_direction, incoming_direction, normal, roughness, base_reflectivity, 0, F); vec3 fake_specular = color * fake_specular_weight * brdf * scale; fake_specular = demodulate_specular(base_reflectivity, fake_specular); diff --git a/src/refresh/vkpt/shader/brdf.glsl b/src/refresh/vkpt/shader/brdf.glsl index 84d9e14d9..07f55af77 100644 --- a/src/refresh/vkpt/shader/brdf.glsl +++ b/src/refresh/vkpt/shader/brdf.glsl @@ -34,12 +34,12 @@ float G1_Smith(float roughness, float NdotL) return 2.0 * NdotL / (NdotL + sqrt(square(alpha) + (1.0 - square(alpha)) * square(NdotL))); } -float G_Smith_over_NdotV(float roughness, float NdotV, float NdotL) +float G_Smith_over_4_NdotV(float roughness, float NdotV, float NdotL) { float alpha = square(roughness); - float g1 = NdotV * sqrt(square(alpha) + (1.0 - square(alpha)) * square(NdotL)); - float g2 = NdotL * sqrt(square(alpha) + (1.0 - square(alpha)) * square(NdotV)); - return 2.0 * NdotL / (g1 + g2); + float g1 = NdotL / (NdotL + sqrt(square(alpha) + (1.0 - square(alpha)) * square(NdotL))); + float g2 = 1.0 / (NdotV + sqrt(square(alpha) + (1.0 - square(alpha)) * square(NdotV))); + return g1 * g2; } vec3 schlick_fresnel(vec3 F0, float HdotV) @@ -47,7 +47,7 @@ vec3 schlick_fresnel(vec3 F0, float HdotV) return F0 + (vec3(1.0) - F0) * pow(1 - HdotV, 5); } -vec3 GGX_times_NdotL(vec3 V, vec3 L, vec3 N, float roughness, vec3 F0, float NoH_offset) +vec3 GGX_times_NdotL(vec3 V, vec3 L, vec3 N, float roughness, vec3 F0, float NoH_offset, out vec3 F) { vec3 H = normalize(L - V); @@ -55,18 +55,19 @@ vec3 GGX_times_NdotL(vec3 V, vec3 L, vec3 N, float roughness, vec3 F0, float NoH float VoH = max(0, -dot(V, H)); float NoV = max(0, -dot(N, V)); float NoH = clamp(dot(N, H) + NoH_offset, 0, 1); + + F = schlick_fresnel(F0, VoH); - if (NoL > 0) + if (NoL > 0 && VoH > 0) { - float G = G_Smith_over_NdotV(roughness, NoV, NoL); + float G = G_Smith_over_4_NdotV(roughness, NoV, NoL); float alpha = square(max(roughness, 0.02)); float D = square(alpha) / (M_PI * square(square(NoH) * square(alpha) + (1 - square(NoH)))); - vec3 F = schlick_fresnel(F0, VoH); // GGX BRDF = D*G*F / (4*NoL*NoV) // NoL = 1 by function definition, cancelled out in the rendering integral - // NoV is cancelled out with the same term in G - return F * (D * G / 4.0); + // NoV and 4 are cancelled out with the same terms in G + return F * (D * G); } return vec3(0); diff --git a/src/refresh/vkpt/shader/indirect_lighting.rgen b/src/refresh/vkpt/shader/indirect_lighting.rgen index ae4b791d5..d95a411a3 100644 --- a/src/refresh/vkpt/shader/indirect_lighting.rgen +++ b/src/refresh/vkpt/shader/indirect_lighting.rgen @@ -194,6 +194,15 @@ indirect_lighting( mat3 basis = construct_ONB_frisvad(basis_normal); bounce_direction = normalize(basis * dir_sphere); bounce_throughput *= 1 / (1 - specular_pdf); + + vec3 L = bounce_direction.xyz; + vec3 V = -view_direction.xyz; + vec3 H = normalize(V + L); + float VoH = max(0, dot(V, H)); + + vec3 F = schlick_fresnel(primary_base_reflectivity, VoH); + + bounce_throughput *= vec3(1.0) - F; } } diff --git a/src/refresh/vkpt/shader/path_tracer_rgen.h b/src/refresh/vkpt/shader/path_tracer_rgen.h index 01858f6c1..723abbb1e 100644 --- a/src/refresh/vkpt/shader/path_tracer_rgen.h +++ b/src/refresh/vkpt/shader/path_tracer_rgen.h @@ -715,16 +715,18 @@ get_direct_illumination( normal, -view_direction, L, polygonal_light_pdfw); } + vec3 F = vec3(0); + if(vis > 0 && direct_specular_weight > 0) { - vec3 specular_brdf = GGX_times_NdotL(view_direction, normalize(pos_on_light - position), normal, roughness, base_reflectivity, 0.0); + vec3 specular_brdf = GGX_times_NdotL(view_direction, normalize(pos_on_light - position), normal, roughness, base_reflectivity, 0.0, F); specular = radiance * specular_brdf * direct_specular_weight; } float NdotL = max(0, dot(normal, L)); float diffuse_brdf = NdotL / M_PI; - diffuse = radiance * diffuse_brdf; + diffuse = radiance * diffuse_brdf * (vec3(1.0) - F); } void @@ -796,15 +798,17 @@ get_sunlight( } #endif + vec3 F = vec3(0); + if(global_ubo.pt_sun_specular > 0) { float NoH_offset = 0.5 * square(global_ubo.sun_tan_half_angle); - vec3 specular_brdf = GGX_times_NdotL(view_direction, global_ubo.sun_direction, normal, roughness, base_reflectivity, NoH_offset); + vec3 specular_brdf = GGX_times_NdotL(view_direction, global_ubo.sun_direction, normal, roughness, base_reflectivity, NoH_offset, F); specular = radiance * specular_brdf; } float diffuse_brdf = NdotL / M_PI; - diffuse = radiance * diffuse_brdf; + diffuse = radiance * diffuse_brdf * (vec3(1.0) - F); } vec3 clamp_output(vec3 c) diff --git a/src/refresh/vkpt/shader/physical_sky_space.comp b/src/refresh/vkpt/shader/physical_sky_space.comp index bc5c531c6..38ac745b9 100644 --- a/src/refresh/vkpt/shader/physical_sky_space.comp +++ b/src/refresh/vkpt/shader/physical_sky_space.comp @@ -173,7 +173,8 @@ vec3 planetSurfaceColor(SunInfo sun, PlanetInfo planet, vec3 v, vec3 n) { vec3 ggx = vec3(0); if (oceanAlpha > 0) { - ggx = GGX_times_NdotL(v, sun.direction, normal, 0.4, vec3(0.02), 0); + vec3 F; + ggx = GGX_times_NdotL(v, sun.direction, normal, 0.4, vec3(0.02), 0, F); } vec3 diff = (max(0, dot(normal, sun.direction) + 0.3*ndotl) * sun.color * sun.intensity ) * albedo; From d26aa3668bb4bef409c8618bf78ef5366878f313 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Sat, 4 Sep 2021 11:58:39 -0700 Subject: [PATCH 09/55] Added the "specular_factor" material parameter, following the glTF "KHR_materials_specular" extension spec. --- src/refresh/vkpt/material.c | 9 +++++- src/refresh/vkpt/material.h | 1 + src/refresh/vkpt/shader/asvgf_atrous.comp | 9 +++--- src/refresh/vkpt/shader/brdf.glsl | 11 ++++--- src/refresh/vkpt/shader/direct_lighting.rgen | 7 +++-- .../vkpt/shader/indirect_lighting.rgen | 14 +++++---- src/refresh/vkpt/shader/path_tracer_rgen.h | 29 +++++++++++++++---- .../vkpt/shader/physical_sky_space.comp | 2 +- src/refresh/vkpt/shader/primary_rays.rgen | 6 ++-- src/refresh/vkpt/shader/reflect_refract.rgen | 6 ++-- src/refresh/vkpt/shader/vertex_buffer.h | 5 +++- src/refresh/vkpt/vertex_buffer.c | 1 + 12 files changed, 73 insertions(+), 27 deletions(-) diff --git a/src/refresh/vkpt/material.c b/src/refresh/vkpt/material.c index 463e49076..14164c757 100644 --- a/src/refresh/vkpt/material.c +++ b/src/refresh/vkpt/material.c @@ -164,6 +164,7 @@ static void MAT_Reset(pbr_material_t * mat) mat->roughness_override = -1.0f; mat->metalness_factor = 1.f; mat->emissive_factor = 1.f; + mat->specular_factor = 1.f; mat->light_styles = qtrue; mat->bsp_radiance = qtrue; mat->flags = MATERIAL_KIND_REGULAR; @@ -298,6 +299,7 @@ static struct MaterialAttribute { {12, "texture_mask", ATTR_STRING}, {13, "synth_emissive", ATTR_BOOL}, {14, "emissive_threshold", ATTR_INT}, + {15, "specular_factor", ATTR_FLOAT}, }; static int c_NumAttributes = sizeof(c_Attributes) / sizeof(struct MaterialAttribute); @@ -440,6 +442,7 @@ static qerror_t set_material_attribute(pbr_material_t* mat, const char* attribut mat->emissive_threshold = ivalue; if (reload_flags) *reload_flags |= RELOAD_EMISSIVE; break; + case 15: mat->specular_factor = fvalue; break; default: assert(!"unknown PBR MAT attribute index"); } @@ -641,7 +644,10 @@ static void save_materials(const char* file_name, qboolean save_all, qboolean fo if (mat->emissive_factor != 1.f) FS_FPrintf(file, "\temissive_factor %f\n", mat->emissive_factor); - + + if (mat->specular_factor != 1.f) + FS_FPrintf(file, "\tspecular_factor %f\n", mat->specular_factor); + if (!MAT_IsKind(mat->flags, MATERIAL_KIND_REGULAR)) { const char* kind = getMaterialKindName(mat->flags); FS_FPrintf(file, "\tkind %s\n", kind ? kind : ""); @@ -941,6 +947,7 @@ void MAT_Print(pbr_material_t const * mat) Com_Printf(" roughness_override %f\n", mat->roughness_override); Com_Printf(" metalness_factor %f\n", mat->metalness_factor); Com_Printf(" emissive_factor %f\n", mat->emissive_factor); + Com_Printf(" specular_factor %f\n", mat->specular_factor); const char * kind = getMaterialKindName(mat->flags); Com_Printf(" kind %s\n", kind ? kind : ""); Com_Printf(" is_light %d\n", (mat->flags & MATERIAL_FLAG_LIGHT) != 0); diff --git a/src/refresh/vkpt/material.h b/src/refresh/vkpt/material.h index c11be8479..d7f97de45 100644 --- a/src/refresh/vkpt/material.h +++ b/src/refresh/vkpt/material.h @@ -49,6 +49,7 @@ typedef struct pbr_material_s { float roughness_override; float metalness_factor; float emissive_factor; + float specular_factor; uint32_t flags; int registration_sequence; int num_frames; diff --git a/src/refresh/vkpt/shader/asvgf_atrous.comp b/src/refresh/vkpt/shader/asvgf_atrous.comp index 027322de6..430b98672 100644 --- a/src/refresh/vkpt/shader/asvgf_atrous.comp +++ b/src/refresh/vkpt/shader/asvgf_atrous.comp @@ -316,8 +316,9 @@ main() filtered_spec /= STORAGE_SCALE_SPEC; vec3 normal = decode_normal(texelFetch(TEX_PT_NORMAL_A, ipos, 0).x); - vec3 base_color = texelFetch(TEX_PT_BASE_COLOR_A, ipos, 0).rgb; + vec4 base_color = texelFetch(TEX_PT_BASE_COLOR_A, ipos, 0); vec2 metallic_roughness = texelFetch(TEX_PT_METALLIC_A, ipos, 0).rg; + float specular_factor = base_color.a; float checkerboard_flags = texelFetch(TEX_PT_VIEW_DIRECTION, ipos, 0).a; float metallic = metallic_roughness.x; float roughness = metallic_roughness.y; @@ -360,10 +361,10 @@ main() vec3 color = SH_to_irradiance(filtered_lf); vec3 albedo, base_reflectivity; - get_reflectivity(base_color, metallic, albedo, base_reflectivity); + get_reflectivity(base_color.rgb, metallic, albedo, base_reflectivity); vec3 F; - vec3 brdf = GGX_times_NdotL(view_direction, incoming_direction, normal, roughness, base_reflectivity, 0, F); + vec3 brdf = GGX_times_NdotL(view_direction, incoming_direction, normal, roughness, base_reflectivity, 0, specular_factor, F); vec3 fake_specular = color * fake_specular_weight * brdf * scale; fake_specular = demodulate_specular(base_reflectivity, fake_specular); @@ -381,7 +382,7 @@ main() vec3 throughput = texelFetch(TEX_PT_THROUGHPUT, ipos, 0).rgb; // Composite - vec3 final_color = composite_color(base_color, metallic, throughput, projected_lf, filtered_hf, filtered_spec, transparent); + vec3 final_color = composite_color(base_color.rgb, metallic, throughput, projected_lf, filtered_hf, filtered_spec, transparent); if(global_ubo.flt_show_gradients != 0) { diff --git a/src/refresh/vkpt/shader/brdf.glsl b/src/refresh/vkpt/shader/brdf.glsl index 07f55af77..8496e4394 100644 --- a/src/refresh/vkpt/shader/brdf.glsl +++ b/src/refresh/vkpt/shader/brdf.glsl @@ -42,12 +42,15 @@ float G_Smith_over_4_NdotV(float roughness, float NdotV, float NdotL) return g1 * g2; } -vec3 schlick_fresnel(vec3 F0, float HdotV) +vec3 schlick_fresnel(vec3 F0, float HdotV, float specular_factor) { - return F0 + (vec3(1.0) - F0) * pow(1 - HdotV, 5); + vec3 F = F0 + (vec3(1.0) - F0) * pow(1 - HdotV, 5); + F *= specular_factor; + F = clamp(F, vec3(0.0), vec3(1.0)); + return F; } -vec3 GGX_times_NdotL(vec3 V, vec3 L, vec3 N, float roughness, vec3 F0, float NoH_offset, out vec3 F) +vec3 GGX_times_NdotL(vec3 V, vec3 L, vec3 N, float roughness, vec3 F0, float NoH_offset, float specular_factor, out vec3 F) { vec3 H = normalize(L - V); @@ -56,7 +59,7 @@ vec3 GGX_times_NdotL(vec3 V, vec3 L, vec3 N, float roughness, vec3 F0, float NoH float NoV = max(0, -dot(N, V)); float NoH = clamp(dot(N, H) + NoH_offset, 0, 1); - F = schlick_fresnel(F0, VoH); + F = schlick_fresnel(F0, VoH, specular_factor); if (NoL > 0 && VoH > 0) { diff --git a/src/refresh/vkpt/shader/direct_lighting.rgen b/src/refresh/vkpt/shader/direct_lighting.rgen index a2c7e3793..949d8df60 100644 --- a/src/refresh/vkpt/shader/direct_lighting.rgen +++ b/src/refresh/vkpt/shader/direct_lighting.rgen @@ -56,7 +56,8 @@ direct_lighting(ivec2 ipos, bool is_odd_checkerboard, out vec3 high_freq, out ve vec4 view_direction = texelFetch(TEX_PT_VIEW_DIRECTION, ipos, 0); vec3 normal = decode_normal(texelFetch(TEX_PT_NORMAL_A, ipos, 0).x); vec3 geo_normal = decode_normal(texelFetch(TEX_PT_GEO_NORMAL_A, ipos, 0).x); - vec3 primary_base_color = texelFetch(TEX_PT_BASE_COLOR_A, ipos, 0).xyz; + vec4 primary_base_color = texelFetch(TEX_PT_BASE_COLOR_A, ipos, 0); + float primary_specular_factor = primary_base_color.a; vec2 metal_rough = texelFetch(TEX_PT_METALLIC_A, ipos, 0).xy; float primary_metallic = metal_rough.x; float primary_roughness = metal_rough.y; @@ -81,7 +82,7 @@ direct_lighting(ivec2 ipos, bool is_odd_checkerboard, out vec3 high_freq, out ve bool is_gradient = get_is_gradient(ipos); vec3 primary_albedo, primary_base_reflectivity; - get_reflectivity(primary_base_color, primary_metallic, primary_albedo, primary_base_reflectivity); + get_reflectivity(primary_base_color.rgb, primary_metallic, primary_albedo, primary_base_reflectivity); vec3 direct_diffuse, direct_specular; get_direct_illumination( @@ -94,6 +95,7 @@ direct_lighting(ivec2 ipos, bool is_odd_checkerboard, out vec3 high_freq, out ve view_direction.xyz, primary_albedo, primary_base_reflectivity, + primary_specular_factor, primary_roughness, primary_medium, spec_enable_caustics != 0, @@ -119,6 +121,7 @@ direct_lighting(ivec2 ipos, bool is_odd_checkerboard, out vec3 high_freq, out ve geo_normal, view_direction.xyz, primary_base_reflectivity, + primary_specular_factor, primary_roughness, primary_medium, spec_enable_caustics != 0, diff --git a/src/refresh/vkpt/shader/indirect_lighting.rgen b/src/refresh/vkpt/shader/indirect_lighting.rgen index d95a411a3..a268c236e 100644 --- a/src/refresh/vkpt/shader/indirect_lighting.rgen +++ b/src/refresh/vkpt/shader/indirect_lighting.rgen @@ -65,9 +65,10 @@ indirect_lighting( vec4 view_direction; vec3 normal; vec3 geo_normal; - vec3 primary_base_color = vec3(0); + vec4 primary_base_color = vec4(0); float primary_metallic = 0; float primary_roughness = 1; + float primary_specular_factor = 0; if(half_res) throughput.rgb *= 2; @@ -81,7 +82,8 @@ indirect_lighting( view_direction = texelFetch(TEX_PT_VIEW_DIRECTION, ipos, 0); normal = decode_normal(texelFetch(TEX_PT_NORMAL_A, ipos, 0).x); geo_normal = decode_normal(texelFetch(TEX_PT_GEO_NORMAL_A, ipos, 0).x); - primary_base_color = texelFetch(TEX_PT_BASE_COLOR_A, ipos, 0).xyz; + primary_base_color = texelFetch(TEX_PT_BASE_COLOR_A, ipos, 0); + primary_specular_factor = primary_base_color.a; if(!half_res) { @@ -105,7 +107,7 @@ indirect_lighting( } vec3 primary_albedo, primary_base_reflectivity; - get_reflectivity(primary_base_color, primary_metallic, primary_albedo, primary_base_reflectivity); + get_reflectivity(primary_base_color.rgb, primary_metallic, primary_albedo, primary_base_reflectivity); bool primary_is_weapon = (material_id & MATERIAL_FLAG_WEAPON) != 0; @@ -163,7 +165,7 @@ indirect_lighting( // Assume G2 = G1(V) * G1(L) here and simplify that expression to just G1(L). float G1_NoL = G1_Smith(primary_roughness, NoL); - vec3 F = schlick_fresnel(primary_base_reflectivity, VoH); + vec3 F = schlick_fresnel(primary_base_reflectivity, VoH, primary_specular_factor); bounce_throughput *= G1_NoL * F; @@ -200,7 +202,7 @@ indirect_lighting( vec3 H = normalize(V + L); float VoH = max(0, dot(V, H)); - vec3 F = schlick_fresnel(primary_base_reflectivity, VoH); + vec3 F = schlick_fresnel(primary_base_reflectivity, VoH, primary_specular_factor); bounce_throughput *= vec3(1.0) - F; } @@ -398,6 +400,7 @@ indirect_lighting( bounce_direction, bounce_base_color, vec3(0), // base_reflectivity + 0.0, // specular_factor 1.0, // roughness MEDIUM_NONE, false, // enable_caustics @@ -423,6 +426,7 @@ indirect_lighting( bounce_geo_normal, bounce_direction, vec3(0), // base_reflectivity + 0.0, // specular_factor 1.0, // roughness MEDIUM_NONE, false, // enable_caustics diff --git a/src/refresh/vkpt/shader/path_tracer_rgen.h b/src/refresh/vkpt/shader/path_tracer_rgen.h index 723abbb1e..ac6de8e8c 100644 --- a/src/refresh/vkpt/shader/path_tracer_rgen.h +++ b/src/refresh/vkpt/shader/path_tracer_rgen.h @@ -561,6 +561,7 @@ get_direct_illumination( vec3 view_direction, vec3 albedo, vec3 base_reflectivity, + float specular_factor, float roughness, int surface_medium, bool enable_caustics, @@ -584,7 +585,7 @@ get_direct_illumination( float alpha = square(roughness); float phong_exp = RoughnessSquareToSpecPower(alpha); float phong_scale = min(100, 1 / (M_PI * square(alpha))); - float phong_weight = clamp(luminance(base_reflectivity) / (luminance(base_reflectivity) + luminance(albedo)), 0, 0.9); + float phong_weight = clamp(specular_factor * luminance(base_reflectivity) / (luminance(base_reflectivity) + luminance(albedo)), 0, 0.9); int polygonal_light_index = -1; float polygonal_light_pdfw = 0; @@ -719,7 +720,8 @@ get_direct_illumination( if(vis > 0 && direct_specular_weight > 0) { - vec3 specular_brdf = GGX_times_NdotL(view_direction, normalize(pos_on_light - position), normal, roughness, base_reflectivity, 0.0, F); + vec3 specular_brdf = GGX_times_NdotL(view_direction, normalize(pos_on_light - position), + normal, roughness, base_reflectivity, 0.0, specular_factor, F); specular = radiance * specular_brdf * direct_specular_weight; } @@ -738,6 +740,7 @@ get_sunlight( vec3 geo_normal, vec3 view_direction, vec3 base_reflectivity, + float specular_factor, float roughness, int surface_medium, bool enable_caustics, @@ -803,7 +806,8 @@ get_sunlight( if(global_ubo.pt_sun_specular > 0) { float NoH_offset = 0.5 * square(global_ubo.sun_tan_half_angle); - vec3 specular_brdf = GGX_times_NdotL(view_direction, global_ubo.sun_direction, normal, roughness, base_reflectivity, NoH_offset, F); + vec3 specular_brdf = GGX_times_NdotL(view_direction, global_ubo.sun_direction, + normal,roughness, base_reflectivity, NoH_offset, specular_factor, F); specular = radiance * specular_brdf; } @@ -875,8 +879,20 @@ bool get_is_gradient(ivec2 ipos) void -get_material(Triangle triangle, vec3 bary, vec2 tex_coord, vec2 tex_coord_x, vec2 tex_coord_y, float mip_level, vec3 geo_normal, - out vec3 base_color, out vec3 normal, out float metallic, out float roughness, out vec3 emissive) +get_material( + Triangle triangle, + vec3 bary, + vec2 tex_coord, + vec2 tex_coord_x, + vec2 tex_coord_y, + float mip_level, + vec3 geo_normal, + out vec3 base_color, + out vec3 normal, + out float metallic, + out float roughness, + out vec3 emissive, + out float specular_factor) { MaterialInfo minfo = get_material_info(triangle.material_id); @@ -955,6 +971,9 @@ get_material(Triangle triangle, vec3 bary, vec2 tex_coord, vec2 tex_coord_x, vec if(global_ubo.pt_roughness_override >= 0) roughness = global_ubo.pt_roughness_override; if(global_ubo.pt_metallic_override >= 0) metallic = global_ubo.pt_metallic_override; + + // The specular factor parameter should only affect dielectrics, so make it 1.0 for metals + specular_factor = mix(minfo.specular_factor, 1.0, metallic); if (triangle.emissive_factor > 0) { diff --git a/src/refresh/vkpt/shader/physical_sky_space.comp b/src/refresh/vkpt/shader/physical_sky_space.comp index 38ac745b9..5438e27f4 100644 --- a/src/refresh/vkpt/shader/physical_sky_space.comp +++ b/src/refresh/vkpt/shader/physical_sky_space.comp @@ -174,7 +174,7 @@ vec3 planetSurfaceColor(SunInfo sun, PlanetInfo planet, vec3 v, vec3 n) { vec3 ggx = vec3(0); if (oceanAlpha > 0) { vec3 F; - ggx = GGX_times_NdotL(v, sun.direction, normal, 0.4, vec3(0.02), 0, F); + ggx = GGX_times_NdotL(v, sun.direction, normal, 0.4, vec3(0.02), 0, 1.0, F); } vec3 diff = (max(0, dot(normal, sun.direction) + 0.3*ndotl) * sun.color * sun.intensity ) * albedo; diff --git a/src/refresh/vkpt/shader/primary_rays.rgen b/src/refresh/vkpt/shader/primary_rays.rgen index f34087f30..1fc7b6b13 100644 --- a/src/refresh/vkpt/shader/primary_rays.rgen +++ b/src/refresh/vkpt/shader/primary_rays.rgen @@ -281,6 +281,7 @@ main() float primary_metallic = 0; float primary_roughness = 1; vec3 primary_emissive = vec3(0); + float primary_specular_factor = 1; vec3 throughput = vec3(1); vec3 normal; @@ -297,7 +298,8 @@ main() normal, primary_metallic, primary_roughness, - primary_emissive); + primary_emissive, + primary_specular_factor); // Extinction in the primary ray if(global_ubo.medium != MEDIUM_NONE) @@ -408,7 +410,7 @@ main() imageStore(IMG_PT_THROUGHPUT, ipos, vec4(throughput, distance_curr)); imageStore(IMG_PT_BOUNCE_THROUGHPUT, ipos, vec4(1, 1, 1, footprint_size_over_distance)); imageStore(IMG_PT_CLUSTER_A, ipos, ivec4(triangle.cluster)); - imageStore(IMG_PT_BASE_COLOR_A, ipos, vec4(primary_base_color, 0)); + imageStore(IMG_PT_BASE_COLOR_A, ipos, vec4(primary_base_color, primary_specular_factor)); imageStore(IMG_PT_METALLIC_A, ipos, vec4(primary_metallic, primary_roughness, 0, 0)); imageStore(IMG_PT_GODRAYS_THROUGHPUT_DIST, ipos, vec4(1, 1, 1, distance_curr)); diff --git a/src/refresh/vkpt/shader/reflect_refract.rgen b/src/refresh/vkpt/shader/reflect_refract.rgen index 30c1e6ff4..18cd7f995 100644 --- a/src/refresh/vkpt/shader/reflect_refract.rgen +++ b/src/refresh/vkpt/shader/reflect_refract.rgen @@ -628,6 +628,7 @@ main() float primary_metallic = 0; float primary_roughness = 1; vec3 primary_emissive = vec3(0); + float primary_specular_factor = 1; get_material( triangle, @@ -641,7 +642,8 @@ main() normal, primary_metallic, primary_roughness, - primary_emissive); + primary_emissive, + primary_specular_factor); primary_is_weapon = false; @@ -728,6 +730,6 @@ main() imageStore(IMG_PT_THROUGHPUT, ipos, vec4(throughput, optical_path_length)); imageStore(IMG_PT_TRANSPARENT, ipos, transparent); imageStore(IMG_PT_CLUSTER_A, ipos, uvec4(cluster_idx)); - imageStore(IMG_PT_BASE_COLOR_A, ipos, vec4(primary_base_color, 0)); + imageStore(IMG_PT_BASE_COLOR_A, ipos, vec4(primary_base_color, primary_specular_factor)); imageStore(IMG_PT_METALLIC_A, ipos, vec4(primary_metallic, primary_roughness, 0, 0)); } diff --git a/src/refresh/vkpt/shader/vertex_buffer.h b/src/refresh/vkpt/shader/vertex_buffer.h index 8297fa4ba..95f39e237 100644 --- a/src/refresh/vkpt/shader/vertex_buffer.h +++ b/src/refresh/vkpt/shader/vertex_buffer.h @@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #define MAX_LIGHT_POLYS 4096 #define LIGHT_POLY_VEC4S 4 -#define MATERIAL_UINTS 5 +#define MATERIAL_UINTS 6 // should match the same constant declared in material.h #define MAX_PBR_MATERIALS 4096 @@ -211,6 +211,7 @@ struct MaterialInfo float roughness_override; float metalness_factor; float emissive_factor; + float specular_factor; float light_style_scale; uint num_frames; uint next_frame; @@ -547,6 +548,7 @@ get_material_info(uint material_id) data[2] = get_material_table(material_index * MATERIAL_UINTS + 2); data[3] = get_material_table(material_index * MATERIAL_UINTS + 3); data[4] = get_material_table(material_index * MATERIAL_UINTS + 4); + data[5] = get_material_table(material_index * MATERIAL_UINTS + 5); MaterialInfo minfo; minfo.diffuse_texture = data[0] & 0xffff; @@ -557,6 +559,7 @@ get_material_info(uint material_id) minfo.roughness_override = unpackHalf2x16(data[2]).y; minfo.metalness_factor = unpackHalf2x16(data[3]).x; minfo.emissive_factor = unpackHalf2x16(data[3]).y; + minfo.specular_factor = unpackHalf2x16(data[5]).x; minfo.num_frames = data[4] & 0xffff; minfo.next_frame = (data[4] >> 16) & (MAX_PBR_MATERIALS - 1); diff --git a/src/refresh/vkpt/vertex_buffer.c b/src/refresh/vkpt/vertex_buffer.c index 5bdcec913..af3c9dd40 100644 --- a/src/refresh/vkpt/vertex_buffer.c +++ b/src/refresh/vkpt/vertex_buffer.c @@ -397,6 +397,7 @@ vkpt_light_buffer_upload_to_staging(qboolean render_world, bsp_mesh_t *bsp_mesh, mat_data[3] |= floatToHalf(material->emissive_factor) << 16; mat_data[4] |= (material->num_frames & 0xffff); mat_data[4] |= (material->next_frame & 0xffff) << 16; + mat_data[5] = floatToHalf(material->specular_factor); } memcpy(lbo->cluster_debug_mask, cluster_debug_mask, MAX_LIGHT_LISTS / 8); From 921bce60d3a611c828ca7eac97b66f3582de90f3 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Tue, 7 Sep 2021 07:32:03 -0700 Subject: [PATCH 10/55] Replaced the correct_albedo flag with base_factor. --- src/refresh/vkpt/material.c | 14 +++---- src/refresh/vkpt/material.h | 1 + src/refresh/vkpt/shader/constants.h | 5 --- .../vkpt/shader/indirect_lighting.rgen | 7 ++-- .../vkpt/shader/path_tracer_hit_shaders.h | 2 +- src/refresh/vkpt/shader/path_tracer_rgen.h | 38 ++++++++----------- src/refresh/vkpt/shader/vertex_buffer.h | 6 ++- src/refresh/vkpt/vertex_buffer.c | 1 + 8 files changed, 33 insertions(+), 41 deletions(-) diff --git a/src/refresh/vkpt/material.c b/src/refresh/vkpt/material.c index 14164c757..f0c3d0975 100644 --- a/src/refresh/vkpt/material.c +++ b/src/refresh/vkpt/material.c @@ -165,6 +165,7 @@ static void MAT_Reset(pbr_material_t * mat) mat->metalness_factor = 1.f; mat->emissive_factor = 1.f; mat->specular_factor = 1.f; + mat->base_factor = 1.f; mat->light_styles = qtrue; mat->bsp_radiance = qtrue; mat->flags = MATERIAL_KIND_REGULAR; @@ -290,7 +291,7 @@ static struct MaterialAttribute { {3, "emissive_factor", ATTR_FLOAT}, {4, "kind", ATTR_STRING}, {5, "is_light", ATTR_BOOL}, - {6, "correct_albedo", ATTR_BOOL}, + {6, "base_factor", ATTR_FLOAT}, {7, "texture_base", ATTR_STRING}, {8, "texture_normals", ATTR_STRING}, {9, "texture_emissive", ATTR_STRING}, @@ -410,8 +411,7 @@ static qerror_t set_material_attribute(pbr_material_t* mat, const char* attribut if (reload_flags) *reload_flags |= RELOAD_MAP; break; case 6: - mat->flags = bvalue == qtrue ? mat->flags | MATERIAL_FLAG_CORRECT_ALBEDO : mat->flags & ~(MATERIAL_FLAG_CORRECT_ALBEDO); - if (reload_flags) *reload_flags |= RELOAD_MAP; + mat->base_factor = fvalue; break; case 7: set_material_texture(mat, svalue, mat->filename_base, &mat->image_base, IF_SRGB, !sourceFile); @@ -648,6 +648,9 @@ static void save_materials(const char* file_name, qboolean save_all, qboolean fo if (mat->specular_factor != 1.f) FS_FPrintf(file, "\tspecular_factor %f\n", mat->specular_factor); + if (mat->base_factor != 1.f) + FS_FPrintf(file, "\tbase_factor %f\n", mat->base_factor); + if (!MAT_IsKind(mat->flags, MATERIAL_KIND_REGULAR)) { const char* kind = getMaterialKindName(mat->flags); FS_FPrintf(file, "\tkind %s\n", kind ? kind : ""); @@ -656,9 +659,6 @@ static void save_materials(const char* file_name, qboolean save_all, qboolean fo if (mat->flags & MATERIAL_FLAG_LIGHT) FS_FPrintf(file, "\tis_light 1\n"); - if (mat->flags & MATERIAL_FLAG_CORRECT_ALBEDO) - FS_FPrintf(file, "\tcorrect_albedo 1\n"); - if (!mat->light_styles) FS_FPrintf(file, "\tlight_styles 0\n"); @@ -948,10 +948,10 @@ void MAT_Print(pbr_material_t const * mat) Com_Printf(" metalness_factor %f\n", mat->metalness_factor); Com_Printf(" emissive_factor %f\n", mat->emissive_factor); Com_Printf(" specular_factor %f\n", mat->specular_factor); + Com_Printf(" base_factor %f\n", mat->base_factor); const char * kind = getMaterialKindName(mat->flags); Com_Printf(" kind %s\n", kind ? kind : ""); Com_Printf(" is_light %d\n", (mat->flags & MATERIAL_FLAG_LIGHT) != 0); - Com_Printf(" correct_albedo %d\n", (mat->flags & MATERIAL_FLAG_CORRECT_ALBEDO) != 0); Com_Printf(" light_styles %d\n", mat->light_styles ? 1 : 0); Com_Printf(" bsp_radiance %d\n", mat->bsp_radiance ? 1 : 0); Com_Printf(" synth_emissive %d\n", mat->synth_emissive ? 1 : 0); diff --git a/src/refresh/vkpt/material.h b/src/refresh/vkpt/material.h index d7f97de45..e6dd27d42 100644 --- a/src/refresh/vkpt/material.h +++ b/src/refresh/vkpt/material.h @@ -50,6 +50,7 @@ typedef struct pbr_material_s { float metalness_factor; float emissive_factor; float specular_factor; + float base_factor; uint32_t flags; int registration_sequence; int num_frames; diff --git a/src/refresh/vkpt/shader/constants.h b/src/refresh/vkpt/shader/constants.h index 8c0b7308f..1a399ee9a 100644 --- a/src/refresh/vkpt/shader/constants.h +++ b/src/refresh/vkpt/shader/constants.h @@ -25,10 +25,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #define HISTOGRAM_BINS 128 -#define ALBEDO_TRANSFORM_SCALE 1.0 -#define ALBEDO_TRANSFORM_BIAS -0.05 -#define ALBEDO_TRANSFORM_POWER 0.4545 - #define EMISSIVE_TRANSFORM_BIAS -0.001 #define MAX_MIRROR_ROUGHNESS 0.02 @@ -72,7 +68,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #define MATERIAL_KIND_CHROME_MODEL 0xd0000000 #define MATERIAL_FLAG_LIGHT 0x08000000 -#define MATERIAL_FLAG_CORRECT_ALBEDO 0x04000000 #define MATERIAL_FLAG_HANDEDNESS 0x02000000 #define MATERIAL_FLAG_WEAPON 0x01000000 #define MATERIAL_FLAG_WARP 0x00800000 diff --git a/src/refresh/vkpt/shader/indirect_lighting.rgen b/src/refresh/vkpt/shader/indirect_lighting.rgen index a268c236e..40f3ff10d 100644 --- a/src/refresh/vkpt/shader/indirect_lighting.rgen +++ b/src/refresh/vkpt/shader/indirect_lighting.rgen @@ -334,9 +334,10 @@ indirect_lighting( bounce_geo_normal = -bounce_geo_normal; vec3 bounce_normal = bounce_geo_normal; - vec3 bounce_base_color = global_textureLod(bounce_minfo.diffuse_texture, tex_coord, 2).rgb; - if((triangle.material_id & MATERIAL_FLAG_CORRECT_ALBEDO) != 0) - bounce_base_color = correct_albedo(bounce_base_color); + vec3 bounce_base_color = vec3(bounce_minfo.base_factor); + if (bounce_minfo.base_texture != 0) + bounce_base_color *= global_textureLod(bounce_minfo.base_texture, tex_coord, 2).rgb; + bounce_base_color = clamp(bounce_base_color, vec3(0), vec3(1)); uint bounce_cluster_idx = triangle.cluster; diff --git a/src/refresh/vkpt/shader/path_tracer_hit_shaders.h b/src/refresh/vkpt/shader/path_tracer_hit_shaders.h index 7123514df..0c30f3c84 100644 --- a/src/refresh/vkpt/shader/path_tracer_hit_shaders.h +++ b/src/refresh/vkpt/shader/path_tracer_hit_shaders.h @@ -151,7 +151,7 @@ void pt_logic_explosion(inout RayPayload ray_payload, int primitiveID, uint inst const vec2 tex_coord = triangle.tex_coords * barycentric; MaterialInfo minfo = get_material_info(triangle.material_id); - vec4 emission = global_textureLod(minfo.diffuse_texture, tex_coord, 0); + vec4 emission = global_textureLod(minfo.base_texture, tex_coord, 0); if((triangle.material_id & MATERIAL_KIND_MASK) == MATERIAL_KIND_EXPLOSION) { diff --git a/src/refresh/vkpt/shader/path_tracer_rgen.h b/src/refresh/vkpt/shader/path_tracer_rgen.h index ac6de8e8c..7d415b005 100644 --- a/src/refresh/vkpt/shader/path_tracer_rgen.h +++ b/src/refresh/vkpt/shader/path_tracer_rgen.h @@ -248,15 +248,6 @@ is_camera(uint material) return (material & MATERIAL_KIND_MASK) == MATERIAL_KIND_CAMERA; } -vec3 -correct_albedo(vec3 albedo) -{ - if (global_ubo.pt_correct_albedo == 0) - return albedo; - - return max(vec3(0), pow(albedo, vec3(ALBEDO_TRANSFORM_POWER)) * ALBEDO_TRANSFORM_SCALE + vec3(ALBEDO_TRANSFORM_BIAS)); -} - vec3 correct_emissive(uint material_id, vec3 emissive) { @@ -509,12 +500,12 @@ trace_caustic_ray(Ray ray, int surface_medium) MaterialInfo minfo = get_material_info(triangle.material_id); - vec3 albedo = global_textureLod(minfo.diffuse_texture, tex_coord, 2).rgb; - - if((triangle.material_id & MATERIAL_FLAG_CORRECT_ALBEDO) != 0) - albedo = correct_albedo(albedo); + vec3 base_color = vec3(minfo.base_factor); + if (minfo.base_texture > 0) + base_color *= global_textureLod(minfo.base_texture, tex_coord, 2).rgb; + base_color = clamp(base_color, vec3(0), vec3(1)); - throughput = albedo; + throughput = base_color; } } @@ -898,16 +889,17 @@ get_material( perturb_tex_coord(triangle.material_id, global_ubo.time, tex_coord); - vec4 image1; - if (mip_level >= 0) - image1 = global_textureLod(minfo.diffuse_texture, tex_coord, mip_level); - else - image1 = global_textureGrad(minfo.diffuse_texture, tex_coord, tex_coord_x, tex_coord_y); + vec4 image1 = vec4(1); + if (minfo.base_texture != 0) + { + if (mip_level >= 0) + image1 = global_textureLod(minfo.base_texture, tex_coord, mip_level); + else + image1 = global_textureGrad(minfo.base_texture, tex_coord, tex_coord_x, tex_coord_y); + } - if((triangle.material_id & MATERIAL_FLAG_CORRECT_ALBEDO) != 0) - base_color = correct_albedo(image1.rgb); - else - base_color = image1.rgb; + base_color = image1.rgb * minfo.base_factor; + base_color = clamp(base_color, vec3(0), vec3(1)); normal = geo_normal; metallic = 0; diff --git a/src/refresh/vkpt/shader/vertex_buffer.h b/src/refresh/vkpt/shader/vertex_buffer.h index 95f39e237..dc79ad618 100644 --- a/src/refresh/vkpt/shader/vertex_buffer.h +++ b/src/refresh/vkpt/shader/vertex_buffer.h @@ -203,7 +203,7 @@ typedef struct struct MaterialInfo { - uint diffuse_texture; + uint base_texture; uint normals_texture; uint emissive_texture; uint mask_texture; @@ -212,6 +212,7 @@ struct MaterialInfo float metalness_factor; float emissive_factor; float specular_factor; + float base_factor; float light_style_scale; uint num_frames; uint next_frame; @@ -551,7 +552,7 @@ get_material_info(uint material_id) data[5] = get_material_table(material_index * MATERIAL_UINTS + 5); MaterialInfo minfo; - minfo.diffuse_texture = data[0] & 0xffff; + minfo.base_texture = data[0] & 0xffff; minfo.normals_texture = data[0] >> 16; minfo.emissive_texture = data[1] & 0xffff; minfo.mask_texture = data[1] >> 16; @@ -560,6 +561,7 @@ get_material_info(uint material_id) minfo.metalness_factor = unpackHalf2x16(data[3]).x; minfo.emissive_factor = unpackHalf2x16(data[3]).y; minfo.specular_factor = unpackHalf2x16(data[5]).x; + minfo.base_factor = unpackHalf2x16(data[5]).y; minfo.num_frames = data[4] & 0xffff; minfo.next_frame = (data[4] >> 16) & (MAX_PBR_MATERIALS - 1); diff --git a/src/refresh/vkpt/vertex_buffer.c b/src/refresh/vkpt/vertex_buffer.c index af3c9dd40..4c6a438c2 100644 --- a/src/refresh/vkpt/vertex_buffer.c +++ b/src/refresh/vkpt/vertex_buffer.c @@ -398,6 +398,7 @@ vkpt_light_buffer_upload_to_staging(qboolean render_world, bsp_mesh_t *bsp_mesh, mat_data[4] |= (material->num_frames & 0xffff); mat_data[4] |= (material->next_frame & 0xffff) << 16; mat_data[5] = floatToHalf(material->specular_factor); + mat_data[5] |= floatToHalf(material->base_factor) << 16; } memcpy(lbo->cluster_debug_mask, cluster_debug_mask, MAX_LIGHT_LISTS / 8); From f1dd4c3256f9c07111732fe1c7e599f63260c50c Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Tue, 7 Sep 2021 07:45:27 -0700 Subject: [PATCH 11/55] Material updates: base_factor instead of correct_albedo, specular_factor added on some materials. --- baseq2/maps/lab.mat | 6 +- baseq2/materials/baseq2.mat | 4765 ++++++++++++++++++----------------- 2 files changed, 2478 insertions(+), 2293 deletions(-) diff --git a/baseq2/maps/lab.mat b/baseq2/maps/lab.mat index 2c3893287..72636c441 100644 --- a/baseq2/maps/lab.mat +++ b/baseq2/maps/lab.mat @@ -3,7 +3,7 @@ textures/e1u1/jaildr1_3: texture_base overrides/jaildr1_3.tga texture_normals overrides/jaildr1_3_n.tga texture_emissive overrides/jaildr1_3_light.tga - correct_albedo 1 + base_factor 2.5 is_light 1 textures/e3u2/ceil1_2: @@ -12,7 +12,7 @@ textures/e3u2/ceil1_2: texture_emissive overrides/ceil1_2_light.tga bump_scale 0.5 is_light 1 - correct_albedo 1 + base_factor 2.5 bsp_radiance 0 emissive_factor 10 @@ -21,5 +21,5 @@ textures/e3u2/ceil1_8: texture_normals overrides/ceil1_8_n.tga texture_emissive overrides/ceil1_8_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 emissive_factor 0.3 diff --git a/baseq2/materials/baseq2.mat b/baseq2/materials/baseq2.mat index 2127c97e4..d59ce543a 100644 --- a/baseq2/materials/baseq2.mat +++ b/baseq2/materials/baseq2.mat @@ -67,151 +67,151 @@ models/deadbods/dude/dead1: texture_base models/deadbods/dude/dead1.tga texture_normals models/deadbods/dude/dead1_n.tga roughness_override 1 - correct_albedo 1 + base_factor 2.5 models/items/adrenal/adrenal: texture_base models/items/adrenal/adrenal.tga texture_normals models/items/adrenal/adrenal_n.tga texture_emissive models/items/adrenal/adrenal_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/adrenal/skin: texture_base models/items/adrenal/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/ammo/bullets/medium/skin: texture_base models/items/ammo/bullets/medium/skin.tga texture_normals models/items/ammo/bullets/medium/skin_n.tga bump_scale 0.5 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/ammo/cells/medium/skin: texture_base models/items/ammo/cells/medium/skin.tga texture_normals models/items/ammo/cells/medium/skin_n.tga texture_emissive models/items/ammo/cells/medium/skin_light.tga emissive_factor 0.02 - correct_albedo 1 + base_factor 2.5 models/items/ammo/grenades/medium/skin: texture_base models/items/ammo/grenades/medium/skin.tga texture_normals models/items/ammo/grenades/medium/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/ammo/mines/skin: texture_base models/items/ammo/mines/skin.tga texture_normals models/items/ammo/mines/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/ammo/nuke/skin: texture_base models/items/ammo/nuke/skin.tga texture_normals models/items/ammo/nuke/skin_n.tga texture_emissive models/items/ammo/nuke/skin_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/ammo/rockets/medium/skin: texture_base models/items/ammo/rockets/medium/skin.tga texture_normals models/items/ammo/rockets/medium/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/ammo/shells/medium/skin: texture_base models/items/ammo/shells/medium/skin.tga texture_normals models/items/ammo/shells/medium/skin_n.tga bump_scale 0.5 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/ammo/slugs/medium/skin: texture_base models/items/ammo/slugs/medium/skin.tga texture_normals models/items/ammo/slugs/medium/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/armor/body/skin: texture_base models/items/armor/body/skin.tga texture_normals models/items/armor/body/skin_n.tga bump_scale 0.5 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/armor/combat/skin: texture_base models/items/armor/combat/skin.tga texture_normals models/items/armor/combat/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/armor/effect/skin: texture_base models/items/armor/effect/skin.tga texture_normals models/items/armor/effect/skin_n.tga emissive_factor 0.1 kind GLASS - correct_albedo 1 + base_factor 2.5 models/items/armor/jacket/skin: texture_base models/items/armor/jacket/skin.tga texture_normals models/items/armor/jacket/skin_n.tga bump_scale 0.5 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/armor/screen/skin: texture_base models/items/armor/screen/skin.tga texture_normals models/items/armor/screen/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/armor/shard/skin: texture_base models/items/armor/shard/skin.tga texture_normals models/items/armor/shard/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/armor/shield/skin: texture_base models/items/armor/shield/skin.tga texture_normals models/items/armor/shield/skin_n.tga texture_emissive models/items/armor/shield/skin_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/band/skin: texture_base models/items/band/skin.tga texture_normals models/items/band/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/band/skin_rgh: texture_base models/items/band/skin_rgh.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/breather/skin: texture_base models/items/breather/skin.tga texture_normals models/items/breather/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/breather/skin_rgh: texture_base models/items/breather/skin_rgh.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/c_head/skin: texture_base models/items/c_head/skin.tga texture_normals models/items/c_head/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/enviro/skin: texture_base models/items/enviro/skin.tga texture_normals models/items/enviro/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/healing/large/glass: texture_base models/items/healing/large/glass.tga @@ -219,58 +219,58 @@ models/items/healing/large/glass: bump_scale 0.1 emissive_factor 0.1 kind GLASS - correct_albedo 1 + base_factor 2.5 models/items/healing/large/glow: texture_base models/items/healing/large/glow.tga texture_normals models/items/healing/large/glow_n.tga texture_emissive models/items/healing/large/glow_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/healing/large/health: texture_base models/items/healing/large/health.tga texture_normals models/items/healing/large/health_n.tga emissive_factor 0.02 - correct_albedo 1 + base_factor 2.5 models/items/healing/large/skin: texture_base models/items/healing/large/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/healing/medium/glass: texture_base models/items/healing/medium/glass.tga texture_normals models/items/healing/medium/glass_n.tga bump_scale 0.1 kind GLASS - correct_albedo 1 + base_factor 2.5 models/items/healing/medium/health: texture_base models/items/healing/medium/health.tga texture_normals models/items/healing/medium/health_n.tga texture_emissive models/items/healing/medium/health_light.tga emissive_factor 0.02 - correct_albedo 1 + base_factor 2.5 models/items/healing/medium/skin: texture_base models/items/healing/medium/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/healing/stimpack/skin: texture_base models/items/healing/stimpack/skin.tga texture_normals models/items/healing/stimpack/skin_n.tga texture_emissive models/items/healing/stimpack/skin_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/invulner/skin: texture_base models/items/invulner/skin.tga texture_normals models/items/invulner/skin_n.tga texture_emissive models/items/invulner/skin_light.tga emissive_factor 0.05 - correct_albedo 1 + base_factor 2.5 models/items/keys/data_cd/skin: texture_base models/items/keys/data_cd/skin.tga @@ -283,96 +283,96 @@ models/items/keys/key/skin: texture_normals models/items/keys/key/skin_n.tga texture_emissive models/items/keys/key/skin_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/keys/pass/skin: texture_base models/items/keys/pass/skin.tga texture_normals models/items/keys/pass/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/keys/power/skin: texture_base models/items/keys/power/skin.tga texture_normals models/items/keys/power/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/keys/pyramid/skin: texture_base models/items/keys/pyramid/skin.tga texture_normals models/items/keys/pyramid/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/keys/red_key/red_skin: texture_base models/items/keys/red_key/red_skin.tga texture_normals models/items/keys/red_key/red_skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/keys/spinner/skin: texture_base models/items/keys/spinner/skin.tga texture_normals models/items/keys/spinner/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/keys/target/skin: texture_base models/items/keys/target/skin.tga texture_normals models/items/keys/target/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/mega_h/skin: texture_base models/items/mega_h/skin.tga texture_normals models/items/mega_h/skin_n.tga texture_emissive models/items/mega_h/skin_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/pack/skin: texture_base models/items/pack/skin.tga texture_normals models/items/pack/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/pda/pda: texture_base models/items/pda/pda.tga texture_normals models/items/pda/pda_n.tga texture_emissive models/items/pda/pda_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/predator/skin: texture_base models/items/predator/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/quaddama/skin: texture_base models/items/quaddama/skin.tga texture_normals models/items/quaddama/skin_n.tga texture_emissive models/items/quaddama/skin_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/items/silencer/skin: texture_base models/items/silencer/skin.tga texture_normals models/items/silencer/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/menu/idlogo: texture_base models/menu/idlogo.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/menu/idlogo_rgh: texture_base models/menu/idlogo_rgh.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/misc/skin: texture_base models/misc/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/monsters/berserk/pain: texture_base models/monsters/berserk/pain.tga @@ -380,7 +380,8 @@ models/monsters/berserk/pain: texture_emissive models/monsters/berserk/pain_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/berserk/skin: texture_base models/monsters/berserk/skin.tga @@ -388,7 +389,8 @@ models/monsters/berserk/skin: texture_emissive models/monsters/berserk/skin_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/bitch/pain: texture_base models/monsters/bitch/pain.tga @@ -396,7 +398,8 @@ models/monsters/bitch/pain: texture_emissive models/monsters/bitch/pain_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/bitch/skin: texture_base models/monsters/bitch/skin.tga @@ -404,7 +407,8 @@ models/monsters/bitch/skin: texture_emissive models/monsters/bitch/skin_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/boss1/pain: texture_base models/monsters/boss1/pain.tga @@ -412,7 +416,8 @@ models/monsters/boss1/pain: texture_emissive models/monsters/boss1/pain_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/boss1/skin: texture_base models/monsters/boss1/skin.tga @@ -420,7 +425,8 @@ models/monsters/boss1/skin: texture_emissive models/monsters/boss1/skin_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/boss2/pain: texture_base models/monsters/boss2/pain.tga @@ -428,7 +434,8 @@ models/monsters/boss2/pain: texture_emissive models/monsters/boss2/pain_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/boss2/skin: texture_base models/monsters/boss2/skin.tga @@ -436,21 +443,24 @@ models/monsters/boss2/skin: texture_emissive models/monsters/boss2/skin_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/boss3/jorg/pain: texture_base models/monsters/boss3/jorg/pain.tga texture_normals models/monsters/boss3/jorg/pain_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/boss3/jorg/skin: texture_base models/monsters/boss3/jorg/skin.tga texture_normals models/monsters/boss3/jorg/skin_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/boss3/rider/pain: texture_base models/monsters/boss3/rider/pain.tga @@ -458,7 +468,8 @@ models/monsters/boss3/rider/pain: texture_emissive models/monsters/boss3/rider/pain_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/boss3/rider/skin: texture_base models/monsters/boss3/rider/skin.tga @@ -466,75 +477,86 @@ models/monsters/boss3/rider/skin: texture_emissive models/monsters/boss3/rider/skin_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/boss5/pain: texture_base models/monsters/boss5/pain.tga texture_normals models/monsters/boss5/pain_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/boss5/skin: texture_base models/monsters/boss5/skin.tga texture_normals models/monsters/boss5/skin_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/brain/pain: texture_base models/monsters/brain/pain.tga texture_normals models/monsters/brain/pain_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/brain/skin: texture_base models/monsters/brain/skin.tga texture_normals models/monsters/brain/skin_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/commandr/head/skin: texture_base models/monsters/commandr/head/skin.tga texture_normals models/monsters/commandr/head/skin_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/commandr/skin: texture_base models/monsters/commandr/skin.tga texture_normals models/monsters/commandr/skin_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/ctank/pain: texture_base models/monsters/ctank/pain.pcx roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/ctank/skin: texture_base models/monsters/ctank/skin.pcx roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/flipper/pain: texture_base models/monsters/flipper/pain.tga texture_normals models/monsters/flipper/pain_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/flipper/skin: texture_base models/monsters/flipper/skin.tga texture_normals models/monsters/flipper/skin_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/float/pain: texture_base models/monsters/float/pain.tga @@ -542,7 +564,8 @@ models/monsters/float/pain: texture_emissive models/monsters/float/pain_light.tga roughness_override 1 emissive_factor 0.02 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/float/skin: texture_base models/monsters/float/skin.tga @@ -550,21 +573,24 @@ models/monsters/float/skin: texture_emissive models/monsters/float/skin_light.tga roughness_override 1 emissive_factor 0.02 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/flyer/pain: texture_base models/monsters/flyer/pain.tga texture_normals models/monsters/flyer/pain_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/flyer/skin: texture_base models/monsters/flyer/skin.tga texture_normals models/monsters/flyer/skin_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/gladiatr/pain: texture_base models/monsters/gladiatr/pain.tga @@ -572,7 +598,8 @@ models/monsters/gladiatr/pain: texture_emissive models/monsters/gladiatr/pain_light.tga roughness_override 1 emissive_factor 0.02 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/gladiatr/skin: texture_base models/monsters/gladiatr/skin.tga @@ -580,7 +607,7 @@ models/monsters/gladiatr/skin: texture_emissive models/monsters/gladiatr/skin_light.tga roughness_override 1 emissive_factor 0.02 - correct_albedo 1 + base_factor 2.5 models/monsters/gunner/pain: texture_base models/monsters/gunner/pain.tga @@ -588,7 +615,8 @@ models/monsters/gunner/pain: texture_emissive models/monsters/gunner/pain_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/gunner/skin: texture_base models/monsters/gunner/skin.tga @@ -596,7 +624,8 @@ models/monsters/gunner/skin: texture_emissive models/monsters/gunner/skin_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/hover/pain: texture_base models/monsters/hover/pain.tga @@ -604,7 +633,8 @@ models/monsters/hover/pain: texture_emissive models/monsters/hover/pain_light.tga roughness_override 1 emissive_factor 0.02 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/hover/skin: texture_base models/monsters/hover/skin.tga @@ -612,49 +642,56 @@ models/monsters/hover/skin: texture_emissive models/monsters/hover/skin_light.tga roughness_override 1 emissive_factor 0.02 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/infantry/pain: texture_base models/monsters/infantry/pain.tga texture_normals models/monsters/infantry/pain_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/infantry/skin: texture_base models/monsters/infantry/skin.tga texture_normals models/monsters/infantry/skin_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/insane/i_skin: texture_base models/monsters/insane/i_skin.tga texture_normals models/monsters/insane/i_skin_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/insane/i_skin02: texture_base models/monsters/insane/i_skin02.tga texture_normals models/monsters/insane/i_skin02_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/insane/i_skin03: texture_base models/monsters/insane/i_skin03.tga texture_normals models/monsters/insane/i_skin03_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/medic/pain: texture_base models/monsters/medic/pain.tga texture_normals models/monsters/medic/pain_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/medic/skin: texture_base models/monsters/medic/skin.tga @@ -662,35 +699,40 @@ models/monsters/medic/skin: texture_emissive models/monsters/medic/skin_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/mutant/pain: texture_base models/monsters/mutant/pain.tga texture_normals models/monsters/mutant/pain_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/mutant/skin: texture_base models/monsters/mutant/skin.tga texture_normals models/monsters/mutant/skin_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/parasite/pain: texture_base models/monsters/parasite/pain.tga texture_normals models/monsters/parasite/pain_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/parasite/segment/skin: texture_base models/monsters/parasite/segment/skin.tga texture_normals models/monsters/parasite/segment/skin_n.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/parasite/skin: texture_base models/monsters/parasite/skin.tga @@ -698,13 +740,15 @@ models/monsters/parasite/skin: texture_emissive models/monsters/parasite/skin_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/parasite/tip/base: texture_base models/monsters/parasite/tip/base.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/soldier/pain: texture_base models/monsters/soldier/pain.tga @@ -712,7 +756,8 @@ models/monsters/soldier/pain: texture_emissive models/monsters/soldier/pain_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/soldier/skin: texture_base models/monsters/soldier/skin.tga @@ -720,7 +765,8 @@ models/monsters/soldier/skin: texture_emissive models/monsters/soldier/skin_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/soldier/skin_lt: texture_base models/monsters/soldier/skin_lt.tga @@ -728,7 +774,8 @@ models/monsters/soldier/skin_lt: texture_emissive models/monsters/soldier/skin_lt_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/soldier/skin_ltp: texture_base models/monsters/soldier/skin_ltp.tga @@ -736,7 +783,8 @@ models/monsters/soldier/skin_ltp: texture_emissive models/monsters/soldier/skin_ltp_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/soldier/skin_ss: texture_base models/monsters/soldier/skin_ss.tga @@ -744,7 +792,8 @@ models/monsters/soldier/skin_ss: texture_emissive models/monsters/soldier/skin_ss_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/soldier/skin_ssp: texture_base models/monsters/soldier/skin_ssp.tga @@ -752,7 +801,8 @@ models/monsters/soldier/skin_ssp: texture_emissive models/monsters/soldier/skin_ssp_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/tank/ctank/pain: texture_base models/monsters/tank/ctank/pain.tga @@ -760,7 +810,8 @@ models/monsters/tank/ctank/pain: texture_emissive models/monsters/tank/ctank/pain_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/tank/ctank/skin: texture_base models/monsters/tank/ctank/skin.tga @@ -768,7 +819,8 @@ models/monsters/tank/ctank/skin: texture_emissive models/monsters/tank/ctank/skin_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/tank/pain: texture_base models/monsters/tank/pain.tga @@ -776,7 +828,8 @@ models/monsters/tank/pain: texture_emissive models/monsters/tank/pain_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/monsters/tank/skin: texture_base models/monsters/tank/skin.tga @@ -784,257 +837,296 @@ models/monsters/tank/skin: texture_emissive models/monsters/tank/skin_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/banner/skin: texture_base models/objects/banner/skin.tga texture_normals models/objects/banner/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/barrels/skin: texture_base models/objects/barrels/skin.tga texture_normals models/objects/barrels/skin_n.tga texture_emissive models/objects/barrels/skin_light.tga emissive_factor 0.2 - correct_albedo 1 + base_factor 2.5 models/objects/black/skin: texture_base models/objects/black/skin.tga texture_normals models/objects/black/skin_n.tga emissive_factor 0.1 kind CHROME - correct_albedo 1 + base_factor 2.5 models/objects/bomb/skin: texture_base models/objects/bomb/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/objects/debris1/skin: texture_base models/objects/debris1/skin.tga texture_normals models/objects/debris1/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/debris2/skin: texture_base models/objects/debris2/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/debris3/skin: texture_base models/objects/debris3/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/dmspot/skin: texture_base models/objects/dmspot/skin.tga texture_normals models/objects/dmspot/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/dmspot/skin2: texture_base models/objects/dmspot/skin2.tga texture_normals models/objects/dmspot/skin2_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/explode/skin: texture_base models/objects/explode/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/objects/flash/skin: texture_base models/objects/flash/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/objects/gibs/arm/skin: texture_base models/objects/gibs/arm/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/gibs/bone/skin: texture_base models/objects/gibs/bone/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/gibs/bone2/skin: texture_base models/objects/gibs/bone2/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/gibs/chest/skin: texture_base models/objects/gibs/chest/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/gibs/gear/skin: texture_base models/objects/gibs/gear/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/gibs/head/skin: texture_base models/objects/gibs/head/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/gibs/head2/player: texture_base models/objects/gibs/head2/player.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/gibs/head2/skin: texture_base models/objects/gibs/head2/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/gibs/leg/skin: texture_base models/objects/gibs/leg/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/gibs/skull/skin: texture_base models/objects/gibs/skull/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/gibs/sm_meat/skin: texture_base models/objects/gibs/sm_meat/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/objects/gibs/sm_metal/skin: texture_base models/objects/gibs/sm_metal/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/grenade/skin: texture_base models/objects/grenade/skin.tga texture_normals models/objects/grenade/skin_n.tga texture_emissive models/objects/grenade/skin_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/grenade/tris: texture_base models/objects/grenade/tris.tga texture_emissive models/objects/grenade/tris_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/grenade2/skin: texture_base models/objects/grenade2/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/laser/skin: texture_base models/objects/laser/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/minelite/light1/base: texture_base models/objects/minelite/light1/base.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/minelite/light1/skin: texture_base models/objects/minelite/light1/skin.tga texture_normals models/objects/minelite/light1/skin_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/minelite/light2/base: texture_base models/objects/minelite/light2/base.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/minelite/light2/skin: texture_base models/objects/minelite/light2/skin.tga texture_normals models/objects/minelite/light2/skin_n.tga texture_emissive models/objects/minelite/light2/skin_light.tga - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/r_explode/skin1: texture_base models/objects/r_explode/skin1.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/r_explode/skin2: texture_base models/objects/r_explode/skin2.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/r_explode/skin3: texture_base models/objects/r_explode/skin3.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/r_explode/skin4: texture_base models/objects/r_explode/skin4.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/r_explode/skin5: texture_base models/objects/r_explode/skin5.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/r_explode/skin6: texture_base models/objects/r_explode/skin6.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/r_explode/skin7: texture_base models/objects/r_explode/skin7.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/rocket/skin: texture_base models/objects/rocket/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/satellite/skin: texture_base models/objects/satellite/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/objects/smoke/skin: texture_base models/objects/smoke/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/shells/m_shell: texture_base models/shells/m_shell.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/shells/s_shell: texture_base models/shells/s_shell.tga texture_normals models/shells/s_shell_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/ships/bigviper/skin: texture_base models/ships/bigviper/skin.tga texture_normals models/ships/bigviper/skin_n.tga texture_emissive models/ships/bigviper/skin_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/ships/strogg1/skin: texture_base models/ships/strogg1/skin.tga texture_normals models/ships/strogg1/skin_n.tga texture_emissive models/ships/strogg1/skin_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/ships/viper/skin: texture_base models/ships/viper/skin.tga texture_normals models/ships/viper/skin_n.tga texture_emissive models/ships/viper/skin_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/weapons/g_bfg/skin: texture_base models/weapons/g_bfg/skin.pcx @@ -1049,39 +1141,48 @@ models/weapons/g_chain/skin: texture_normals models/weapons/g_chain/skin_n.tga texture_emissive models/weapons/g_chain/skin_light.tga emissive_factor 0.1 + specular_factor 0 models/weapons/g_disint/skin: texture_base models/weapons/g_disint/skin.pcx emissive_factor 0.1 + specular_factor 0 models/weapons/g_flareg/base: texture_base models/weapons/g_flareg/base.pcx emissive_factor 0.1 + specular_factor 0 models/weapons/g_hyperb/skin: texture_base models/weapons/g_hyperb/skin.pcx emissive_factor 0.1 + specular_factor 0 models/weapons/g_launch/skin: texture_base models/weapons/g_launch/skin.pcx emissive_factor 0.1 + specular_factor 0 models/weapons/g_machn/skin: texture_base models/weapons/g_machn/skin.pcx emissive_factor 0.1 + specular_factor 0 models/weapons/g_rail/skin: texture_base models/weapons/g_rail/skin.pcx emissive_factor 0.1 + specular_factor 0 models/weapons/g_rocket/skin: texture_base models/weapons/g_rocket/skin.pcx emissive_factor 0.1 + specular_factor 0 models/weapons/g_shotg/skin: texture_base models/weapons/g_shotg/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 models/weapons/g_shotg2/skin: texture_base models/weapons/g_shotg2/skin.pcx @@ -1099,7 +1200,7 @@ models/weapons/v_bfg/skin_hands: texture_normals models/weapons/v_bfg/skin_hands_n.tga bump_scale 0 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/weapons/v_blast/skin: texture_base models/weapons/v_blast/skin.tga @@ -1107,31 +1208,31 @@ models/weapons/v_blast/skin: texture_emissive models/weapons/v_blast/skin_light.tga emissive_factor 0.1 kind CHROME - correct_albedo 1 + base_factor 2.5 models/weapons/v_blast/skin_hand: texture_base models/weapons/v_blast/skin_hand.tga texture_normals models/weapons/v_blast/skin_hand_n.tga bump_scale 0 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/weapons/v_blaster/skin: texture_base models/weapons/v_blaster/skin.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/weapons/v_chain/skin: texture_base models/weapons/v_chain/skin.tga texture_normals models/weapons/v_chain/skin_n.tga emissive_factor 0.1 kind CHROME - correct_albedo 1 + base_factor 2.5 models/weapons/v_flareg/base: texture_base models/weapons/v_flareg/base.pcx emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/weapons/v_flareg/skin: texture_base models/weapons/v_flareg/skin.tga @@ -1152,7 +1253,7 @@ models/weapons/v_handgr/skin: texture_emissive models/weapons/v_handgr/skin_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/weapons/v_hyperb/skin: texture_base models/weapons/v_hyperb/skin.tga @@ -1160,14 +1261,14 @@ models/weapons/v_hyperb/skin: texture_emissive models/weapons/v_hyperb/skin_light.tga emissive_factor 0.1 kind CHROME - correct_albedo 1 + base_factor 2.5 models/weapons/v_hyperb/skin_hands: texture_base models/weapons/v_hyperb/skin_hands.tga texture_normals models/weapons/v_hyperb/skin_hands_n.tga bump_scale 0 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/weapons/v_launch/skin: texture_base models/weapons/v_launch/skin.tga @@ -1175,34 +1276,34 @@ models/weapons/v_launch/skin: texture_emissive models/weapons/v_launch/skin_light.tga emissive_factor 0.1 kind CHROME - correct_albedo 1 + base_factor 2.5 models/weapons/v_launch/skin_hands: texture_base models/weapons/v_launch/skin_hands.tga texture_normals models/weapons/v_launch/skin_hands_n.tga bump_scale 0 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/weapons/v_machn/mf: texture_base models/weapons/v_machn/mf.tga emissive_factor 0.1 kind INVISIBLE - correct_albedo 1 + base_factor 2.5 models/weapons/v_machn/skin: texture_base models/weapons/v_machn/skin.tga texture_normals models/weapons/v_machn/skin_n.tga emissive_factor 0.1 kind CHROME - correct_albedo 1 + base_factor 2.5 models/weapons/v_machn/skin_hands: texture_base models/weapons/v_machn/skin_hands.tga texture_normals models/weapons/v_machn/skin_hands_n.tga bump_scale 0 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/weapons/v_rail/skin: texture_base models/weapons/v_rail/skin.tga @@ -1217,21 +1318,21 @@ models/weapons/v_rocket/skin: texture_emissive models/weapons/v_rocket/skin_light.tga emissive_factor 0.1 kind CHROME - correct_albedo 1 + base_factor 2.5 models/weapons/v_shotg/skin: texture_base models/weapons/v_shotg/skin.tga texture_normals models/weapons/v_shotg/skin_n.tga texture_emissive models/weapons/v_shotg/skin_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/weapons/v_shotg/skin_hands: texture_base models/weapons/v_shotg/skin_hands.tga texture_normals models/weapons/v_shotg/skin_hands_n.tga bump_scale 0 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 models/weapons/v_shotg2/skin: texture_base models/weapons/v_shotg2/skin.tga @@ -1245,112 +1346,143 @@ models/weapons/v_shotg2/skin_hands: texture_normals models/weapons/v_shotg2/skin_hands_n.tga bump_scale 0 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 players/cyborg/oni911: texture_base players/cyborg/oni911.tga + specular_factor 0 players/cyborg/ps9000: texture_base players/cyborg/ps9000.tga + specular_factor 0 players/cyborg/tyr574: texture_base players/cyborg/tyr574.tga texture_emissive players/cyborg/tyr574_light.tga + specular_factor 0 players/cyborg/weapon: texture_base players/cyborg/weapon.pcx texture_emissive players/cyborg/weapon_light.tga + specular_factor 0 players/female/athena: texture_base players/female/athena.tga + specular_factor 0 players/female/brianna: texture_base players/female/brianna.tga texture_emissive players/female/brianna_light.jpg + specular_factor 0 players/female/cobalt: texture_base players/female/cobalt.tga + specular_factor 0 players/female/ensign: texture_base players/female/ensign.tga + specular_factor 0 players/female/jezebel: texture_base players/female/jezebel.tga texture_emissive players/female/jezebel_light.jpg + specular_factor 0 players/female/jungle: texture_base players/female/jungle.tga + specular_factor 0 players/female/lotus: texture_base players/female/lotus.tga texture_emissive players/female/lotus_light.tga + specular_factor 0 players/female/stiletto: texture_base players/female/stiletto.tga texture_emissive players/female/stiletto_light.tga + specular_factor 0 players/female/venus: texture_base players/female/venus.tga + specular_factor 0 players/female/voodoo: texture_base players/female/voodoo.tga + specular_factor 0 players/female/weapon: texture_base players/female/weapon.pcx texture_emissive players/female/weapon_light.tga + specular_factor 0 players/male/cipher: texture_base players/male/cipher.tga + specular_factor 0 players/male/claymore: texture_base players/male/claymore.tga texture_emissive players/male/claymore_light.jpg + specular_factor 0 players/male/flak: texture_base players/male/flak.tga texture_emissive players/male/flak_light.jpg + specular_factor 0 players/male/grunt: texture_base players/male/grunt.tga + specular_factor 0 players/male/howitzer: texture_base players/male/howitzer.tga + specular_factor 0 players/male/major: texture_base players/male/major.tga texture_emissive players/male/major_light.jpg + specular_factor 0 players/male/nightops: texture_base players/male/nightops.tga + specular_factor 0 players/male/pointman: texture_base players/male/pointman.tga + specular_factor 0 players/male/psycho: texture_base players/male/psycho.tga + specular_factor 0 players/male/rampage: texture_base players/male/rampage.tga + specular_factor 0 players/male/razor: texture_base players/male/razor.tga + specular_factor 0 players/male/recon: texture_base players/male/recon.tga texture_emissive players/male/recon_light.jpg + specular_factor 0 players/male/scout: texture_base players/male/scout.tga + specular_factor 0 players/male/sniper: texture_base players/male/sniper.tga + specular_factor 0 players/male/viper: texture_base players/male/viper.tga + specular_factor 0 players/male/weapon: texture_base players/male/weapon.pcx texture_emissive players/male/weapon_light.tga + specular_factor 0 textures/e1u1/+0btshoot1, textures/e1u1/+0btshoot2, @@ -1366,7 +1498,7 @@ textures/e3u1/+0btshoot2: texture_normals overrides/*_n.tga texture_emissive overrides/*_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/+abtshoot2, textures/e1u1/+abtshoot3, @@ -1382,7 +1514,7 @@ textures/e3u1/+abtshoot3: texture_normals overrides/*_n.tga texture_emissive overrides/*_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/+0cgrate1_1: texture_base overrides/+0cgrate1_1.tga @@ -1390,7 +1522,7 @@ textures/e1u1/+0cgrate1_1: texture_emissive overrides/+0cgrate1_1_light.tga emissive_factor 0.1 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u1/+0cgrate2_1: texture_base overrides/+0cgrate2_1.tga @@ -1398,7 +1530,7 @@ textures/e1u1/+0cgrate2_1: texture_emissive overrides/+0cgrate2_1_light.tga emissive_factor 0.1 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u1/+0cgrate3_1: texture_base overrides/+0cgrate3_1.tga @@ -1406,7 +1538,7 @@ textures/e1u1/+0cgrate3_1: texture_emissive overrides/+0cgrate3_1_light.tga emissive_factor 0.1 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u1/+0comp10_1: texture_base overrides/+0comp10_1.tga @@ -1420,7 +1552,7 @@ textures/e1u1/+0comp11_1: texture_normals overrides/+0comp11_1_n.tga texture_emissive overrides/+0comp11_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/+1cgrate1_1: texture_base overrides/+1cgrate1_1.tga @@ -1428,7 +1560,7 @@ textures/e1u1/+1cgrate1_1: texture_emissive overrides/+1cgrate1_1_light.tga emissive_factor 0.1 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u1/+1cgrate2_1: texture_base overrides/+1cgrate2_1.tga @@ -1436,7 +1568,7 @@ textures/e1u1/+1cgrate2_1: texture_emissive overrides/+1cgrate2_1_light.tga emissive_factor 0.1 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u1/+1cgrate3_1: texture_base overrides/+1cgrate3_1.tga @@ -1444,7 +1576,7 @@ textures/e1u1/+1cgrate3_1: texture_emissive overrides/+1cgrate3_1_light.tga emissive_factor 0.1 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u1/+1comp10_1: texture_base overrides/+1comp10_1.tga @@ -1458,7 +1590,7 @@ textures/e1u1/+1comp11_1: texture_normals overrides/+1comp11_1_n.tga texture_emissive overrides/+1comp11_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/+2comp10_1: texture_base overrides/+2comp10_1.tga @@ -1472,7 +1604,7 @@ textures/e1u1/+2comp11_1: texture_normals overrides/+2comp11_1_n.tga texture_emissive overrides/+2comp11_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/+3comp10_1: texture_base overrides/+3comp10_1.tga @@ -1486,7 +1618,7 @@ textures/e1u1/+3comp11_1: texture_normals overrides/+3comp11_1_n.tga texture_emissive overrides/+3comp11_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/+4comp10_1: texture_base overrides/+4comp10_1.tga @@ -1500,152 +1632,152 @@ textures/e1u1/+4comp11_1: texture_normals overrides/+4comp11_1_n.tga texture_emissive overrides/+4comp11_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/+5comp11_1: texture_base overrides/+5comp11_1.tga texture_normals overrides/+5comp11_1_n.tga texture_emissive overrides/+5comp11_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/+6comp11_1: texture_base overrides/+6comp11_1.tga texture_normals overrides/+6comp11_1_n.tga texture_emissive overrides/+6comp11_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/+7comp11_1: texture_base overrides/+7comp11_1.tga texture_normals overrides/+7comp11_1_n.tga texture_emissive overrides/+7comp11_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/+8comp11_1: texture_base overrides/+8comp11_1.tga texture_normals overrides/+8comp11_1_n.tga texture_emissive overrides/+8comp11_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/+9comp11_1: texture_base overrides/+9comp11_1.tga texture_normals overrides/+9comp11_1_n.tga texture_emissive overrides/+9comp11_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/alarm0: texture_base overrides/alarm0.tga texture_normals overrides/alarm0_n.tga texture_emissive overrides/alarm0_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/alarm1: texture_base overrides/alarm1.tga texture_normals overrides/alarm1_n.tga texture_emissive overrides/alarm1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/alarm2: texture_base overrides/alarm2.tga texture_normals overrides/alarm2_n.tga texture_emissive overrides/alarm2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/alarm3: texture_base overrides/alarm3.tga texture_normals overrides/alarm3_n.tga texture_emissive overrides/alarm3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/arrow0: texture_base overrides/arrow0.tga texture_normals overrides/arrow0_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/arrow1: texture_base overrides/arrow1.tga texture_normals overrides/arrow1_n.tga texture_emissive overrides/arrow1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/arrow2: texture_base overrides/arrow2.tga texture_normals overrides/arrow2_n.tga texture_emissive overrides/arrow2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/arrow3: texture_base overrides/arrow3.tga texture_normals overrides/arrow3_n.tga texture_emissive overrides/arrow3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/arrow4: texture_base overrides/arrow4.tga texture_normals overrides/arrow4_n.tga texture_emissive overrides/arrow4_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/arrowup0: texture_base overrides/arrowup0.tga texture_normals overrides/arrowup0_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/arrowup1: texture_base overrides/arrowup1.tga texture_normals overrides/arrowup1_n.tga texture_emissive overrides/arrowup1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/arrowup2: texture_base overrides/arrowup2.tga texture_normals overrides/arrowup2_n.tga texture_emissive overrides/arrowup2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/arrowup3: texture_base overrides/arrowup3.tga texture_normals overrides/arrowup3_n.tga texture_emissive overrides/arrowup3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/baselt_2: texture_base overrides/baselt_2.tga texture_normals overrides/baselt_2_n.tga texture_emissive overrides/baselt_2_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/baselt_3: texture_base overrides/baselt_3.tga texture_normals overrides/baselt_3_n.tga texture_emissive overrides/baselt_3_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/baselt_4: texture_base overrides/baselt_4.tga texture_normals overrides/baselt_4_n.tga texture_emissive overrides/baselt_4_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/baselt_5: texture_base overrides/baselt_5.tga @@ -1653,13 +1785,13 @@ textures/e1u1/baselt_5: texture_emissive overrides/baselt_5_light.tga emissive_factor 0.2 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/baselt_7: texture_base overrides/baselt_7.tga texture_normals overrides/baselt_7_n.tga texture_emissive overrides/baselt_7_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/baselt_b: texture_base overrides/baselt_b.png @@ -1667,14 +1799,14 @@ textures/e1u1/baselt_b: texture_emissive overrides/baselt_b_light.tga bump_scale 0.5 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/baselt_c: texture_base overrides/baselt_c.tga texture_normals overrides/baselt_c_n.tga texture_emissive overrides/baselt_c_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/basemap: texture_base overrides/basemap.tga @@ -1683,112 +1815,112 @@ textures/e1u1/basemap: roughness_override 0 emissive_factor 0.02 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u1/baslt3_1: texture_base overrides/baslt3_1.tga texture_normals overrides/baslt3_1_n.tga texture_emissive overrides/baslt3_1_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/belt1_2: texture_base overrides/belt1_2.tga texture_normals overrides/belt1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/black: texture_base overrides/black.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/bluekeypad: texture_base overrides/bluekeypad.tga texture_normals overrides/bluekeypad_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/bluwter: texture_base overrides/bluwter.tga kind WATER - correct_albedo 1 + base_factor 2.5 textures/e1u1/box1_1: texture_base overrides/box1_1.tga texture_normals overrides/box1_1_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u1/box1_3: texture_base overrides/box1_3.tga texture_normals overrides/box1_3_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u1/box1_4: texture_base overrides/box1_4.tga texture_normals overrides/box1_4_n.tga bump_scale 0.8 roughness_override 0.3 - correct_albedo 1 + base_factor 2.5 textures/e1u1/box1_5: texture_base overrides/box1_5.tga texture_normals overrides/box1_5_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u1/box1_6: texture_base overrides/box1_6.tga texture_normals overrides/box1_6_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u1/box3_1: texture_base overrides/box3_1.tga texture_normals overrides/box3_1_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u1/box3_2: texture_base overrides/box3_2.tga texture_normals overrides/box3_2_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u1/box3_3: texture_base overrides/box3_3.tga texture_normals overrides/box3_3_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u1/box3_4: texture_base overrides/box3_4.tga texture_normals overrides/box3_4_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u1/box3_5: texture_base overrides/box3_5.tga texture_normals overrides/box3_5_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u1/box3_6: texture_base overrides/box3_6.tga texture_normals overrides/box3_6_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u1/box3_7: texture_base overrides/box3_7.tga texture_normals overrides/box3_7_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u1/box3_8: texture_base overrides/box3_8.tga texture_normals overrides/box3_8_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u1/brlava: texture_base overrides/brlava.tga @@ -1796,175 +1928,175 @@ textures/e1u1/brlava: texture_emissive overrides/brlava_light.tga emissive_factor 0.2 kind LAVA - correct_albedo 1 + base_factor 2.5 textures/e1u1/broken1_1: texture_base overrides/broken1_1.tga texture_normals overrides/broken1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/broken2_1: texture_base overrides/broken2_1.tga texture_normals overrides/broken2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/broken2_2: texture_base overrides/broken2_2.tga texture_normals overrides/broken2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/broken2_3: texture_base overrides/broken2_3.tga texture_normals overrides/broken2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/broken2_4: texture_base overrides/broken2_4.tga texture_normals overrides/broken2_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/brwater: texture_base textures/e1u1/brwater.wal kind WATER - correct_albedo 1 + base_factor 2.5 textures/e1u1/btactmach: texture_base overrides/btactmach.tga texture_normals overrides/btactmach_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/btactmach0: texture_base overrides/btactmach0.tga texture_normals overrides/btactmach0_n.tga texture_emissive overrides/btactmach0_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/btactmach1: texture_base overrides/btactmach1.tga texture_normals overrides/btactmach1_n.tga texture_emissive overrides/btactmach1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/btactmach2: texture_base overrides/btactmach2.tga texture_normals overrides/btactmach2_n.tga texture_emissive overrides/btactmach2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/btactmach3: texture_base overrides/btactmach3.tga texture_normals overrides/btactmach3_n.tga texture_emissive overrides/btactmach3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/btdoor: texture_base overrides/btdoor.tga texture_normals overrides/btdoor_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/btdoor_op: texture_base overrides/btdoor_op.tga texture_normals overrides/btdoor_op_n.tga texture_emissive overrides/btdoor_op_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/btelev: texture_base overrides/btelev.tga texture_emissive overrides/btelev_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/btelev_dn: texture_base overrides/btelev_dn.tga texture_normals overrides/btelev_dn_n.tga texture_emissive overrides/btelev_dn_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/btelev_dn3: texture_base overrides/btelev_dn3.tga texture_normals overrides/btelev_dn3_n.tga texture_emissive overrides/btelev_dn3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/btelev_up: texture_base overrides/btelev_up.tga texture_normals overrides/btelev_up_n.tga texture_emissive overrides/btelev_up_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/btelev_up3: texture_base overrides/btelev_up3.tga texture_normals overrides/btelev_up3_n.tga texture_emissive overrides/btelev_up3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/c_met11_2: texture_base overrides/c_met11_2.tga texture_normals overrides/c_met11_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/c_met51a: texture_base overrides/c_met51a.tga texture_normals overrides/c_met51a_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/c_met51b: texture_base overrides/c_met51b.tga texture_normals overrides/c_met51b_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/c_met51c: texture_base overrides/c_met51c.tga texture_normals overrides/c_met51c_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/c_met52a: texture_base overrides/c_met52a.tga texture_normals overrides/c_met52a_n.tga texture_emissive overrides/c_met52a_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/c_met5_1: texture_base overrides/c_met5_1.tga texture_normals overrides/c_met5_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/c_met5_2: texture_base overrides/c_met5_2.tga texture_normals overrides/c_met5_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/c_met7_1: texture_base overrides/c_met7_1.tga texture_normals overrides/c_met7_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/c_met7_2: texture_base overrides/c_met7_2.tga texture_normals overrides/c_met7_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/c_met8_2: texture_base overrides/c_met8_2.tga texture_normals overrides/c_met8_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/caution1_1: texture_base overrides/caution1_1.tga texture_normals overrides/caution1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/ceil1_1: texture_base overrides/ceil1_1.tga texture_normals overrides/ceil1_1_n.tga texture_emissive overrides/ceil1_1_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/ceil1_2: texture_base overrides/ceil1_2.tga @@ -1972,102 +2104,109 @@ textures/e1u1/ceil1_2: texture_emissive overrides/ceil1_2_light.tga bump_scale 0.5 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/ceil1_28: texture_base overrides/ceil1_28.tga texture_normals overrides/ceil1_28_n.tga texture_emissive overrides/ceil1_28_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/ceil1_3: texture_base overrides/ceil1_3.tga texture_normals overrides/ceil1_3_n.tga texture_emissive overrides/ceil1_3_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/ceil1_4: texture_base overrides/ceil1_4.tga texture_normals overrides/ceil1_4_n.tga texture_emissive overrides/ceil1_4_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/ceil1_7: texture_base overrides/ceil1_7.tga texture_normals overrides/ceil1_7_n.tga texture_emissive overrides/ceil1_7_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/ceil1_8: texture_base overrides/ceil1_8.tga texture_normals overrides/ceil1_8_n.tga texture_emissive overrides/ceil1_8_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/cgrbase1_1: texture_base overrides/cgrbase1_1.tga texture_normals overrides/cgrbase1_1_n.tga texture_emissive overrides/cgrbase1_1_light.tga kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u1/clip: texture_base overrides/clip.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/clip_mon: texture_base overrides/clip_mon.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/color1_1: texture_base overrides/color1_1.tga texture_normals overrides/color1_1_n.tga - correct_albedo 1 + base_factor 2.5 + specular_factor 0 textures/e1u1/color1_2: texture_base textures/e1u1/color1_2.tga texture_normals textures/e1u1/color1_2_n.tga - correct_albedo 1 + base_factor 2.5 + specular_factor 0 textures/e1u1/color1_3: texture_base overrides/color1_3.tga texture_normals overrides/color1_3_n.tga - correct_albedo 1 + base_factor 2.5 + specular_factor 0 textures/e1u1/color1_4: texture_base textures/e1u1/color1_4.tga texture_normals textures/e1u1/color1_4_n.tga - correct_albedo 1 + base_factor 2.5 + specular_factor 0 textures/e1u1/color1_5: texture_base textures/e1u1/color1_5.tga texture_normals textures/e1u1/color1_5_n.tga - correct_albedo 1 + base_factor 2.5 + specular_factor 0 textures/e1u1/color1_6: texture_base overrides/color1_6.tga texture_normals overrides/color1_6_n.tga - correct_albedo 1 + base_factor 2.5 + specular_factor 0 textures/e1u1/color1_7: texture_base textures/e1u1/color1_7.tga texture_normals textures/e1u1/color1_7_n.tga - correct_albedo 1 + base_factor 2.5 + specular_factor 0 textures/e1u1/color1_8: texture_base textures/e1u1/color1_8.tga texture_normals textures/e1u1/color1_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/color2_4: texture_base overrides/color2_4.tga texture_normals overrides/color2_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/comp1_1: texture_base overrides/comp1_1.tga @@ -2075,7 +2214,7 @@ textures/e1u1/comp1_1: texture_emissive overrides/comp1_1_light.tga emissive_factor 0.02 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u1/comp1_2: texture_base overrides/comp1_2.tga @@ -2083,27 +2222,27 @@ textures/e1u1/comp1_2: texture_emissive overrides/comp1_2_light.tga emissive_factor 0.1 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u1/comp1_4: texture_base overrides/comp1_4.tga texture_normals overrides/comp1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/comp1_5: texture_base overrides/comp1_5.tga texture_normals overrides/comp1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/comp1_7: texture_base overrides/comp1_7.tga texture_normals overrides/comp1_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/comp1_8: texture_base overrides/comp1_8.tga texture_normals overrides/comp1_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/comp2_1: texture_base textures/e1u1/comp2_1.tga @@ -2115,12 +2254,12 @@ textures/e1u1/comp2_1: textures/e1u1/comp2_3: texture_base textures/e1u1/comp2_3.tga texture_normals textures/e1u1/comp2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/comp2_5: texture_base overrides/comp2_5.tga texture_normals overrides/comp2_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/comp3_1: texture_base overrides/comp3_1.tga @@ -2133,7 +2272,7 @@ textures/e1u1/comp3_2: texture_emissive overrides/comp3_2_light.tga emissive_factor 0.2 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u1/comp3_3: texture_base overrides/comp3_3.tga @@ -2142,7 +2281,7 @@ textures/e1u1/comp3_3: bump_scale 0.1 emissive_factor 0.1 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u1/comp3_4: texture_base overrides/comp3_4.tga @@ -2155,7 +2294,7 @@ textures/e1u1/comp3_5: texture_base overrides/comp3_5.tga texture_normals overrides/comp3_5_n.tga texture_emissive overrides/comp3_5_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/comp3_6: texture_base overrides/comp3_6.tga @@ -2178,18 +2317,18 @@ textures/e1u1/comp3_8: texture_emissive overrides/comp3_8_light.tga emissive_factor 0.02 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u1/comp4_1: texture_base overrides/comp4_1.tga texture_normals overrides/comp4_1_n.tga texture_emissive overrides/comp4_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/comp4_2: texture_base overrides/comp4_2.tga texture_normals overrides/comp4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/comp5_1: texture_base overrides/comp5_1.tga @@ -2203,7 +2342,7 @@ textures/e1u1/comp5_2: texture_emissive overrides/comp5_2_light.tga emissive_factor 0.1 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u1/comp5_3: texture_base overrides/comp5_3.tga @@ -2225,156 +2364,159 @@ textures/e1u1/comp7_1: texture_normals overrides/comp7_1_n.tga texture_emissive overrides/comp7_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/comp8_1: texture_base overrides/comp8_1.tga texture_normals overrides/comp8_1_n.tga texture_emissive overrides/comp8_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/comp9_1: texture_base overrides/comp9_1.tga texture_normals overrides/comp9_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/comp9_2: texture_base overrides/comp9_2.tga texture_normals overrides/comp9_2_n.tga texture_emissive overrides/comp9_2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/comp9_3: texture_base overrides/comp9_3.tga texture_normals overrides/comp9_3_n.tga texture_emissive overrides/comp9_3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/crate1_1: texture_base overrides/crate1_1.tga texture_normals overrides/crate1_1_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 textures/e1u1/crate1_3: texture_base overrides/crate1_3.tga texture_normals overrides/crate1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/crate1_4: texture_base overrides/crate1_4.tga texture_normals overrides/crate1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/crate1_6: texture_base overrides/crate1_6.tga texture_normals overrides/crate1_6_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e1u1/crate1_7: texture_base overrides/crate1_7.tga texture_normals overrides/crate1_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/damage1_1: texture_base overrides/damage1_1.tga texture_normals overrides/damage1_1_n.tga - correct_albedo 1 + base_factor 2.5 + specular_factor 0 textures/e1u1/damage1_2: texture_base overrides/damage1_2.tga texture_normals overrides/damage1_2_n.tga - correct_albedo 1 + base_factor 2.5 + specular_factor 0 textures/e1u1/doorbot: texture_base overrides/doorbot.tga texture_normals overrides/doorbot_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/doorswt0: texture_base overrides/doorswt0.tga texture_normals overrides/doorswt0_n.tga texture_emissive overrides/doorswt0_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/doorswt1: texture_base overrides/doorswt1.tga texture_normals overrides/doorswt1_n.tga texture_emissive overrides/doorswt1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/doorswt2: texture_base overrides/doorswt2.tga texture_normals overrides/doorswt2_n.tga texture_emissive overrides/doorswt2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/doorswt3: texture_base overrides/doorswt3.tga texture_normals overrides/doorswt3_n.tga texture_emissive overrides/doorswt3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/dr01_2: texture_base overrides/dr01_2.tga texture_normals overrides/dr01_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/dr02_1: texture_base overrides/dr02_1.tga texture_normals overrides/dr02_1_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e1u1/dr02_2: texture_base overrides/dr02_2.tga texture_normals overrides/dr02_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/dr04_1: texture_base overrides/dr04_1.tga texture_normals overrides/dr04_1_n.tga roughness_override 0.346 - correct_albedo 1 + base_factor 2.5 textures/e1u1/endsign2: texture_base overrides/endsign2.tga texture_normals overrides/endsign2_n.tga texture_emissive overrides/endsign2_light.tga emissive_factor 0.02 - correct_albedo 1 + base_factor 2.5 textures/e1u1/endsign3: texture_base overrides/endsign3.tga texture_normals overrides/endsign3_n.tga texture_emissive overrides/endsign3_light.tga emissive_factor 0.02 - correct_albedo 1 + base_factor 2.5 textures/e1u1/endsign5: texture_base overrides/endsign5.tga texture_normals overrides/endsign5_n.tga texture_emissive overrides/endsign5_light.tga emissive_factor 0.02 - correct_albedo 1 + base_factor 2.5 textures/e1u1/endsign6: texture_base overrides/endsign6.tga texture_normals overrides/endsign6_n.tga texture_emissive overrides/endsign6_light.tga emissive_factor 0.02 - correct_albedo 1 + base_factor 2.5 textures/e1u1/exit1: texture_base overrides/exit1.tga texture_normals overrides/exit1_n.tga texture_emissive overrides/exit1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/exitdr01_1: texture_base overrides/exitdr01_1.tga @@ -2382,7 +2524,7 @@ textures/e1u1/exitdr01_1: texture_emissive overrides/exitdr01_1_light.tga roughness_override 0.661 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/exitdr01_2: texture_base overrides/exitdr01_2.tga @@ -2390,557 +2532,571 @@ textures/e1u1/exitdr01_2: texture_emissive overrides/exitdr01_2_light.tga roughness_override 0.535 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/exitsymbol2: texture_base overrides/exitsymbol2.tga texture_normals overrides/exitsymbol2_n.tga texture_emissive overrides/exitsymbol2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/face: texture_base overrides/face.tga texture_normals overrides/face_n.tga texture_emissive overrides/face_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/flat1_1: texture_base overrides/flat1_1.tga texture_normals overrides/flat1_1_n.tga bump_scale 0.2 - correct_albedo 1 + base_factor 2.5 textures/e1u1/flat1_2: texture_base overrides/flat1_2.tga texture_normals overrides/flat1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/floor1_3: texture_base textures/e1u1/floor1_3.tga texture_normals textures/e1u1/floor1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/floor3_1: texture_base overrides/floor3_1.tga texture_normals overrides/floor3_1_n.tga - bump_scale 0.614 - roughness_override 0.614 - correct_albedo 1 + base_factor 2.5 + specular_factor 0.2 + metalness_factor 0 textures/e1u1/floor3_2: texture_base textures/e1u1/floor3_2.tga texture_normals textures/e1u1/floor3_2_n.tga - correct_albedo 1 + base_factor 2.5 + specular_factor 0.2 + metalness_factor 0 textures/e1u1/floor3_3: texture_base textures/e1u1/floor3_3.tga texture_normals textures/e1u1/floor3_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/floorsw0: texture_base overrides/floorsw0.tga texture_normals overrides/floorsw0_n.tga texture_emissive overrides/floorsw0_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/floorsw1: texture_base overrides/floorsw1.tga texture_normals overrides/floorsw1_n.tga texture_emissive overrides/floorsw1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/floorsw2: texture_base overrides/floorsw2.tga texture_normals overrides/floorsw2_n.tga texture_emissive overrides/floorsw2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/floorsw3: texture_base overrides/floorsw3.tga texture_normals overrides/floorsw3_n.tga texture_emissive overrides/floorsw3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/floorswno: texture_base overrides/floorswno.tga texture_normals overrides/floorswno_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/florr1_2: texture_base overrides/florr1_2.tga texture_normals overrides/florr1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/florr1_5: texture_base overrides/florr1_5.tga texture_normals overrides/florr1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/florr1_6: texture_base overrides/florr1_6.tga texture_normals overrides/florr1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/florr1_8: texture_base overrides/florr1_8.tga texture_normals overrides/florr1_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/florr2_8: texture_base overrides/florr2_8.tga texture_normals overrides/florr2_8_n.tga kind WATER - correct_albedo 1 + base_factor 2.5 textures/e1u1/ggrat12_2: texture_base overrides/ggrat12_2.tga texture_normals overrides/ggrat12_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/ggrat12_4: texture_base overrides/ggrat12_4.tga texture_normals overrides/ggrat12_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/ggrat2_1: texture_base overrides/ggrat2_1.tga texture_normals overrides/ggrat2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/ggrat2_2: texture_base overrides/ggrat2_2.tga texture_normals overrides/ggrat2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/ggrat2_7: texture_base overrides/ggrat2_7.tga texture_normals overrides/ggrat2_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/ggrat4_1: texture_base overrides/ggrat4_1.tga texture_normals overrides/ggrat4_1_n.tga - correct_albedo 1 + base_factor 2.5 + specular_factor 0 textures/e1u1/ggrat4_2: texture_base overrides/ggrat4_2.tga texture_normals overrides/ggrat4_2_n.tga - correct_albedo 1 + base_factor 2.5 + specular_factor 0 textures/e1u1/ggrat4_3: texture_base overrides/ggrat4_3.tga texture_normals overrides/ggrat4_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/ggrat4_4: texture_base overrides/ggrat4_4.tga texture_normals overrides/ggrat4_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/ggrat5_1: texture_base overrides/ggrat5_1.tga texture_normals overrides/ggrat5_1_n.tga - correct_albedo 1 + base_factor 2.5 + specular_factor 0 textures/e1u1/ggrat5_2: texture_base overrides/ggrat5_2.tga texture_normals overrides/ggrat5_2_n.tga - correct_albedo 1 + base_factor 2.5 + specular_factor 0 textures/e1u1/ggrat6_1: texture_base overrides/ggrat6_1.tga texture_normals overrides/ggrat6_1_n.tga - correct_albedo 1 + base_factor 2.5 + specular_factor 0 textures/e1u1/ggrat6_2: texture_base overrides/ggrat6_2.tga texture_normals overrides/ggrat6_2_n.tga - correct_albedo 1 + base_factor 2.5 + specular_factor 0 textures/e1u1/ggrate7_1: texture_base overrides/ggrate7_1.tga texture_normals overrides/ggrate7_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/ggrate8_1: texture_base overrides/ggrate8_1.tga texture_normals overrides/ggrate8_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/ggrate9_2: texture_base overrides/ggrate9_2.tga texture_normals overrides/ggrate9_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/grass1_3: texture_base overrides/grass1_3.tga texture_normals overrides/grass1_3_n.tga - correct_albedo 1 + base_factor 2 + specular_factor 0 textures/e1u1/grass1_4: texture_base overrides/grass1_4.tga texture_normals overrides/grass1_4_n.tga - correct_albedo 1 + base_factor 2 + specular_factor 0 textures/e1u1/grass1_7: texture_base overrides/grass1_7.tga texture_normals overrides/grass1_7_n.tga + base_factor 2 + specular_factor 0 textures/e1u1/grass1_8: texture_base overrides/grass1_8.tga texture_normals overrides/grass1_8_n.tga - correct_albedo 1 + base_factor 2 + specular_factor 0 textures/e1u1/grate1_1: texture_base textures/e1u1/grate1_1.tga texture_normals textures/e1u1/grate1_1_n.tga bump_scale 0.2 - correct_albedo 1 + base_factor 2.5 textures/e1u1/grate1_2: texture_base overrides/grate1_2.tga texture_normals overrides/grate1_2_n.tga bump_scale 0.3 - correct_albedo 1 + base_factor 2.5 textures/e1u1/grate1_3: texture_base textures/e1u1/grate1_3.tga texture_normals textures/e1u1/grate1_3_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e1u1/grate1_4: texture_base textures/e1u1/grate1_4.tga texture_normals textures/e1u1/grate1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/grate1_5: texture_base textures/e1u1/grate1_5.tga texture_normals textures/e1u1/grate1_5_n.tga bump_scale 0.4 - correct_albedo 1 + base_factor 2.5 textures/e1u1/grate1_6: texture_base textures/e1u1/grate1_6.tga texture_normals textures/e1u1/grate1_6_n.tga bump_scale 0.4 - correct_albedo 1 + base_factor 2.5 textures/e1u1/grate2_1: texture_base overrides/grate2_1.tga texture_normals overrides/grate2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/grate2_2: texture_base overrides/grate2_2.tga texture_normals overrides/grate2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/grate2_3: texture_base overrides/grate2_3.tga texture_normals overrides/grate2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/grate2_4: texture_base overrides/grate2_4.tga texture_normals overrides/grate2_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/grate2_5: texture_base overrides/grate2_5.tga texture_normals overrides/grate2_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/grate2_6: texture_base overrides/grate2_6.tga texture_normals overrides/grate2_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/grate2_7: texture_base overrides/grate2_7.tga texture_normals overrides/grate2_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/grate2_8: texture_base overrides/grate2_8.tga texture_normals overrides/grate2_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/grey1_3: texture_base overrides/grey1_3.tga texture_normals overrides/grey1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/grey_p1_3: texture_base overrides/grey_p1_3.tga texture_normals overrides/grey_p1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/grlt1_1: texture_base overrides/grlt1_1.tga texture_normals overrides/grlt1_1_n.tga texture_emissive overrides/grlt1_1_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/grlt2_1: texture_base overrides/grlt2_1.tga texture_normals overrides/grlt2_1_n.tga texture_emissive overrides/grlt2_1_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/grndoor1: texture_base overrides/grndoor1.tga texture_normals overrides/grndoor1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/grnmt1_1: texture_base overrides/grnmt1_1.tga texture_normals overrides/grnmt1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/grnmt2_2: texture_base overrides/grnmt2_2.tga texture_normals overrides/grnmt2_2_n.tga texture_emissive overrides/grnmt2_2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/grnx1_1: texture_base overrides/grnx1_1.tga texture_normals overrides/grnx1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/grnx1_2: texture_base overrides/grnx1_2.tga texture_normals overrides/grnx1_2_n.tga bump_scale 0.4 - correct_albedo 1 + base_factor 2.5 textures/e1u1/grnx2_1: texture_base overrides/grnx2_1.tga texture_normals overrides/grnx2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/grnx2_2: texture_base overrides/grnx2_2.tga texture_normals overrides/grnx2_2_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 textures/e1u1/grnx2_3: texture_base overrides/grnx2_3.tga texture_normals overrides/grnx2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/grnx2_5: texture_base overrides/grnx2_5.tga texture_normals overrides/grnx2_5_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e1u1/grnx2_6: texture_base overrides/grnx2_6.tga texture_normals overrides/grnx2_6_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e1u1/grnx2_7: texture_base overrides/grnx2_7.tga texture_normals overrides/grnx2_7_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e1u1/grnx2_8: texture_base overrides/grnx2_8.tga texture_normals overrides/grnx2_8_n.tga bump_scale 0.3 - correct_albedo 1 + base_factor 2.5 textures/e1u1/grnx2_9: texture_base overrides/grnx2_9.tga texture_normals overrides/grnx2_9_n.tga roughness_override 0.528 - correct_albedo 1 + base_factor 2.5 textures/e1u1/grnx3_1: texture_base overrides/grnx3_1.tga texture_normals overrides/grnx3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/grnx3_2: texture_base overrides/grnx3_2.tga texture_normals overrides/grnx3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/grnx3_3: texture_base overrides/grnx3_3.tga texture_normals overrides/grnx3_3_n.tga roughness_override 0.701 - correct_albedo 1 + base_factor 2.5 textures/e1u1/hint: texture_base overrides/hint.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/jaildr1_3: texture_base overrides/jaildr1_3.tga texture_normals overrides/jaildr1_3_n.tga texture_emissive overrides/jaildr1_3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/jaildr2_3: texture_base overrides/jaildr2_3.tga texture_normals overrides/jaildr2_3_n.tga texture_emissive overrides/jaildr2_3_light.tga emissive_factor 0.3 - correct_albedo 1 + base_factor 2.5 textures/e1u1/kcsign4: texture_base overrides/kcsign4.tga texture_normals overrides/kcsign4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/keydr1_1: texture_base overrides/keydr1_1.tga texture_normals overrides/keydr1_1_n.tga texture_emissive overrides/keydr1_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/keysign2: texture_base overrides/keysign2.tga texture_normals overrides/keysign2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/laserbut0: texture_base overrides/laserbut0.tga texture_normals overrides/laserbut0_n.tga texture_emissive overrides/laserbut0_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/laserbut1: texture_base overrides/laserbut1.tga texture_normals overrides/laserbut1_n.tga texture_emissive overrides/laserbut1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/laserbut2: texture_base overrides/laserbut2.tga texture_normals overrides/laserbut2_n.tga texture_emissive overrides/laserbut2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/laserbut3: texture_base overrides/laserbut3.tga texture_normals overrides/laserbut3_n.tga texture_emissive overrides/laserbut3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/lbutt5_3: texture_base overrides/lbutt5_3.tga texture_normals overrides/lbutt5_3_n.tga texture_emissive overrides/lbutt5_3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/lever2: texture_base overrides/lever2.tga texture_normals overrides/lever2_n.tga texture_emissive overrides/lever2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/lever3: texture_base overrides/lever3.tga texture_normals overrides/lever3_n.tga texture_emissive overrides/lever3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/lever7: texture_base overrides/lever7.tga texture_normals overrides/lever7_n.tga texture_emissive overrides/lever7_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/lever8: texture_base overrides/lever8.tga texture_normals overrides/lever8_n.tga texture_emissive overrides/lever8_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/metal14_1: texture_base textures/e1u1/metal14_1.tga texture_normals textures/e1u1/metal14_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/metal1_1: texture_base textures/e1u1/metal1_1.tga texture_normals textures/e1u1/metal1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/metal1_2: texture_base textures/e1u1/metal1_2.tga texture_normals textures/e1u1/metal1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/metal1_3: texture_base overrides/metal1_3.tga texture_normals overrides/metal1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/metal1_4: texture_base overrides/metal1_4.tga texture_normals overrides/metal1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/metal1_5: texture_base overrides/metal1_5.tga texture_normals overrides/metal1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/metal1_7: texture_base textures/e1u1/metal1_7.tga texture_normals textures/e1u1/metal1_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/metal1_8: texture_base overrides/metal1_8.tga texture_normals overrides/metal1_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/metal2_1: texture_base textures/e1u1/metal2_1.tga texture_normals textures/e1u1/metal2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/metal2_2: texture_base textures/e1u1/metal2_2.tga texture_normals textures/e1u1/metal2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/metal2_3: texture_base textures/e1u1/metal2_3.tga texture_normals textures/e1u1/metal2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/metal2_4: texture_base overrides/metal2_4.tga texture_normals overrides/metal2_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/metal3_1: texture_base textures/e1u1/metal3_1.tga texture_normals textures/e1u1/metal3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/metal3_2: texture_base textures/e1u1/metal3_2.tga texture_normals textures/e1u1/metal3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/metal3_3: texture_base textures/e1u1/metal3_3.tga texture_normals textures/e1u1/metal3_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/metal3_4: texture_base textures/e1u1/metal3_4.tga @@ -2949,137 +3105,142 @@ textures/e1u1/metal3_4: textures/e1u1/metal3_5: texture_base overrides/metal3_5.tga texture_normals overrides/metal3_5_n.tga - correct_albedo 1 + base_factor 4 + specular_factor 0 textures/e1u1/metal3_6: texture_base overrides/metal3_6.tga texture_normals overrides/metal3_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/metal3_7: texture_base overrides/metal3_7.tga texture_normals overrides/metal3_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/metal5_1: texture_base textures/e1u1/metal5_1.tga texture_normals textures/e1u1/metal5_1_n.tga - correct_albedo 1 + base_factor 4 + specular_factor 0 textures/e1u1/metal5_2: texture_base textures/e1u1/metal5_2.tga texture_normals textures/e1u1/metal5_2_n.tga - correct_albedo 1 + base_factor 4 + specular_factor 0 textures/e1u1/metal6_1: texture_base textures/e1u1/metal6_1.tga texture_normals textures/e1u1/metal6_1_n.tga - correct_albedo 1 + base_factor 4 + specular_factor 0 textures/e1u1/metal6_2: texture_base textures/e1u1/metal6_2.tga texture_normals textures/e1u1/metal6_2_n.tga - correct_albedo 1 + base_factor 4 + specular_factor 0 textures/e1u1/origin: texture_base overrides/origin.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/p_lit_02: texture_base overrides/p_lit_02.tga texture_normals overrides/p_lit_02_n.tga texture_emissive overrides/p_lit_02_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/p_lit_03: texture_base overrides/p_lit_03.tga texture_normals overrides/p_lit_03_n.tga texture_emissive overrides/p_lit_03_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/p_swr1_7: texture_base overrides/p_swr1_7.tga texture_normals overrides/p_swr1_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/p_tub1_1: texture_base overrides/p_tub1_1.tga texture_normals overrides/p_tub1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/p_tub2_3: texture_base overrides/p_tub2_3.tga texture_normals overrides/p_tub2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/pip01_1: texture_base overrides/pip01_1.tga texture_normals overrides/pip01_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/pip01_2: texture_base overrides/pip01_2.tga texture_normals overrides/pip01_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/pip01_4: texture_base overrides/pip01_4.tga texture_normals overrides/pip01_4_n.tga roughness_override 0.449 - correct_albedo 1 + base_factor 2.5 textures/e1u1/pip02_1: texture_base overrides/pip02_1.tga texture_normals overrides/pip02_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/pip02_5: texture_base overrides/pip02_5.tga texture_normals overrides/pip02_5_n.tga roughness_override 0.449 - correct_albedo 1 + base_factor 2.5 textures/e1u1/pip02_6: texture_base overrides/pip02_6.tga texture_normals overrides/pip02_6_n.tga roughness_override 0.449 - correct_albedo 1 + base_factor 2.5 textures/e1u1/pip03_4: texture_base overrides/pip03_4.tga texture_normals overrides/pip03_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/PIP04_3: texture_base overrides/PIP04_3.tga texture_normals overrides/PIP04_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/PIP04_4: texture_base overrides/PIP04_4.tga texture_normals overrides/PIP04_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/PIP04_5: texture_base overrides/PIP04_5.tga texture_normals overrides/PIP04_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/PIP04_6: texture_base overrides/PIP04_6.tga texture_normals overrides/PIP04_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/pip05_1: texture_base overrides/pip05_1.tga texture_normals overrides/pip05_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/pipe1_1: texture_base overrides/pipe1_1.tga texture_normals overrides/pipe1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/pipe1_2: texture_base overrides/pipe1_2.tga @@ -3090,7 +3251,7 @@ textures/e1u1/pipe1_3: texture_normals overrides/pipe1_3_n.tga roughness_override 0.362 kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e1u1/pipe1_4: texture_base textures/e1u1/pipe1_4.tga @@ -3106,7 +3267,7 @@ textures/e1u1/plite1_1: texture_normals overrides/plite1_1_n.tga texture_emissive overrides/plite1_1_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/plite1_3: texture_base overrides/plite1_3.tga @@ -3118,131 +3279,131 @@ textures/e1u1/red1_1: texture_base overrides/red1_1.tga texture_normals overrides/red1_1_n.tga roughness_override 0.315 - correct_albedo 1 + base_factor 2.5 textures/e1u1/red1_2: texture_base overrides/red1_2.tga texture_normals overrides/red1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/red1_3: texture_base textures/e1u1/red1_3.tga texture_normals textures/e1u1/red1_3_n.tga roughness_override 0.315 - correct_albedo 1 + base_factor 2.5 textures/e1u1/redfield: texture_base textures/e1u1/redfield.wal kind WATER - correct_albedo 1 + base_factor 2.5 textures/e1u1/redkeypad: texture_base overrides/redkeypad.tga texture_normals overrides/redkeypad_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/rocks16_2: texture_base overrides/rocks16_2.tga texture_normals overrides/rocks16_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/rocks19_1: texture_base overrides/rocks19_1.tga texture_normals overrides/rocks19_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/rocks22_1: texture_base overrides/rocks22_1.tga texture_normals overrides/rocks22_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/rpip2_2: texture_base overrides/rpip2_2.tga texture_normals overrides/rpip2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/sewer1: texture_base textures/e1u1/sewer1.wal kind SLIME - correct_albedo 1 + base_factor 2.5 textures/e1u1/shooter1: texture_base overrides/shooter1.tga texture_normals overrides/shooter1_n.tga texture_emissive overrides/shooter1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/shooter2: texture_base overrides/shooter2.tga texture_normals overrides/shooter2_n.tga texture_emissive overrides/shooter2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/sign1_1: texture_base textures/e1u1/sign1_1.tga texture_normals textures/e1u1/sign1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/sign1_2: texture_base overrides/sign1_2.tga texture_normals overrides/sign1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/skip: texture_base overrides/skip.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/sky1: texture_base overrides/sky1.tga kind SKY - correct_albedo 1 + base_factor 2.5 textures/e1u1/stairs1_1: texture_base overrides/stairs1_1.tga texture_normals overrides/stairs1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/station1: texture_base overrides/station1.tga texture_normals overrides/station1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/station5: texture_base overrides/station5.tga texture_normals overrides/station5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/support1_1: texture_base textures/e1u1/support1_1.tga texture_normals textures/e1u1/support1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/support1_3: texture_base overrides/support1_3.tga texture_normals overrides/support1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/timpod: texture_base overrides/timpod.tga texture_normals overrides/timpod_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/timpod2: texture_base overrides/timpod2.tga texture_normals overrides/timpod2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/timpod3: texture_base overrides/timpod3.tga texture_normals overrides/timpod3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/timpod4: texture_base overrides/timpod4.tga texture_normals overrides/timpod4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/timpod5: texture_base overrides/timpod5.tga @@ -3250,81 +3411,81 @@ textures/e1u1/timpod5: texture_emissive overrides/timpod5_light.tga emissive_factor 0.1 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u1/timpod6: texture_base overrides/timpod6.tga texture_normals overrides/timpod6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/timpod7: texture_base overrides/timpod7.tga texture_normals overrides/timpod7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/timpod8: texture_base overrides/timpod8.tga texture_normals overrides/timpod8_n.tga texture_emissive overrides/timpod8_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/timpod9: texture_base overrides/timpod9.tga texture_normals overrides/timpod9_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/tram01_1: texture_base overrides/tram01_1.tga texture_normals overrides/tram01_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/tram01_2: texture_base overrides/tram01_2.tga texture_normals overrides/tram01_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/tram01_3: texture_base overrides/tram01_3.tga texture_normals overrides/tram01_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/tram01_4: texture_base overrides/tram01_4.tga texture_normals overrides/tram01_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/tram01_5: texture_base overrides/tram01_5.tga texture_normals overrides/tram01_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/tram01_6: texture_base overrides/tram01_6.tga texture_normals overrides/tram01_6_n.tga texture_emissive overrides/tram01_6_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/tram01_8: texture_base overrides/tram01_8.tga texture_normals overrides/tram01_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/tram02_1: texture_base overrides/tram02_1.tga texture_normals overrides/tram02_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/tram02_2: texture_base overrides/tram02_2.tga texture_normals overrides/tram02_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/tram02_3: texture_base overrides/tram02_3.tga texture_normals overrides/tram02_3_n.tga texture_emissive overrides/tram02_3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/tram03_1: texture_base overrides/tram03_1.tga @@ -3332,121 +3493,121 @@ textures/e1u1/tram03_1: texture_emissive overrides/tram03_1_light.tga emissive_factor 0.2 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/tram03_2: texture_base overrides/tram03_2.tga texture_normals overrides/tram03_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/trigger: texture_base overrides/trigger.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/water1_8: texture_base textures/e1u1/water1_8.wal kind WATER - correct_albedo 1 + base_factor 2.5 textures/e1u1/water4: texture_base textures/e1u1/water4.wal kind WATER - correct_albedo 1 + base_factor 2.5 textures/e1u1/water8: texture_base textures/e1u1/water8.wal kind WATER - correct_albedo 1 + base_factor 2.5 textures/e1u1/watrt1_1: texture_base overrides/watrt1_1.tga texture_normals overrides/watrt1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/watrt1_2: texture_base overrides/watrt1_2.tga texture_normals overrides/watrt1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/watrt2_1: texture_base overrides/watrt2_1.tga texture_normals overrides/watrt2_1_n.tga texture_emissive overrides/watrt2_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/watrt2_2: texture_base overrides/watrt2_2.tga texture_normals overrides/watrt2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/watrt3_2: texture_base overrides/watrt3_2.tga texture_normals overrides/watrt3_2_n.tga bump_scale 0.567 roughness_override 0.457 - correct_albedo 1 + base_factor 2.5 textures/e1u1/wbasic1_1: texture_base overrides/wbasic1_1.tga texture_normals overrides/wbasic1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wbasic1_4: texture_base overrides/wbasic1_4.tga texture_normals overrides/wbasic1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wbasic1_7: texture_base overrides/wbasic1_7.tga texture_normals overrides/wbasic1_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wgrate1_1: texture_base overrides/wgrate1_1.tga texture_normals overrides/wgrate1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wgrate1_2: texture_base overrides/wgrate1_2.tga texture_normals overrides/wgrate1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wgrate1_3: texture_base overrides/wgrate1_3.tga texture_normals overrides/wgrate1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wgrate1_4: texture_base overrides/wgrate1_4.tga texture_normals overrides/wgrate1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wgrate1_5: texture_base overrides/wgrate1_5.tga texture_normals overrides/wgrate1_5_n.tga texture_emissive overrides/wgrate1_5_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wgrate1_6: texture_base overrides/wgrate1_6.tga texture_normals overrides/wgrate1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wgrate1_7: texture_base overrides/wgrate1_7.tga texture_normals overrides/wgrate1_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wgrate1_8: texture_base overrides/wgrate1_8.tga texture_normals overrides/wgrate1_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wincomp3_5: texture_base overrides/wincomp3_5.tga texture_normals overrides/wincomp3_5_n.tga texture_emissive overrides/wincomp3_5_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wincomp3_7: texture_base overrides/wincomp3_7.tga @@ -3458,351 +3619,351 @@ textures/e1u1/wincomp3_7: textures/e1u1/window1: texture_base textures/e1u1/window1.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e1u1/wmtal3_5: texture_base overrides/wmtal3_5.tga texture_normals overrides/wmtal3_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wndow0_1: texture_base overrides/wndow0_1.tga texture_normals overrides/wndow0_1_n.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e1u1/wndow0_3: texture_base overrides/wndow0_3.tga texture_normals overrides/wndow0_3_n.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e1u1/wndow1_2: texture_base overrides/wndow1_2.tga texture_normals overrides/wndow1_2_n.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e1u1/wplat1_2: texture_base overrides/wplat1_2.tga texture_normals overrides/wplat1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wslt1_1: texture_base overrides/wslt1_1.tga texture_normals overrides/wslt1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wslt1_2: texture_base overrides/wslt1_2.tga texture_normals overrides/wslt1_2_n.tga roughness_override 0.535 - correct_albedo 1 + base_factor 2.5 textures/e1u1/wslt1_3: texture_base overrides/wslt1_3.tga texture_normals overrides/wslt1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wslt1_4: texture_base overrides/wslt1_4.tga texture_normals overrides/wslt1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wslt1_5: texture_base overrides/wslt1_5.tga texture_normals overrides/wslt1_5_n.tga texture_emissive overrides/wslt1_5_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/wslt1_6: texture_base overrides/wslt1_6.tga texture_normals overrides/wslt1_6_n.tga texture_emissive overrides/wslt1_6_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/wsupprt1_14: texture_base overrides/wsupprt1_14.tga texture_normals overrides/wsupprt1_14_n.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u1/wsupprt1_3: texture_base overrides/wsupprt1_3.tga texture_normals overrides/wsupprt1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wsupprt1_5: texture_base overrides/wsupprt1_5.tga texture_normals overrides/wsupprt1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wsupprt1_6: texture_base overrides/wsupprt1_6.tga texture_normals overrides/wsupprt1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wswall1_1: texture_base overrides/wswall1_1.tga texture_normals overrides/wswall1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wswall1_2: texture_base overrides/wswall1_2.tga texture_normals overrides/wswall1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wtroof1_5: texture_base overrides/wtroof1_5.tga texture_normals overrides/wtroof1_5_n.tga roughness_override 0.622 - correct_albedo 1 + base_factor 2.5 textures/e1u1/wtroof4_2: texture_base overrides/wtroof4_2.tga texture_normals overrides/wtroof4_2_n.tga bump_scale 0.7 roughness_override 0.638 - correct_albedo 1 + base_factor 2.5 textures/e1u1/wtroof4_3: texture_base overrides/wtroof4_3.tga texture_normals overrides/wtroof4_3_n.tga roughness_override 0.638 - correct_albedo 1 + base_factor 2.5 textures/e1u1/wtroof4_5: texture_base overrides/wtroof4_5.tga texture_normals overrides/wtroof4_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wtroof4_6: texture_base overrides/wtroof4_6.tga texture_normals overrides/wtroof4_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/wtroof4_8: texture_base overrides/wtroof4_8.tga texture_normals overrides/wtroof4_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/yellow1_2: texture_base overrides/yellow1_2.tga texture_normals overrides/yellow1_2_n.tga bump_scale 0.331 - correct_albedo 1 + base_factor 2.5 textures/e1u1/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u1/yellow1_6: texture_base overrides/yellow1_6.tga texture_normals overrides/yellow1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/+0butn4: texture_base overrides/+0butn4.tga texture_normals overrides/+0butn4_n.tga texture_emissive overrides/+0butn4_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/angle1_1: texture_base overrides/angle1_1.tga texture_normals overrides/angle1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/angle1_2: texture_base overrides/angle1_2.tga texture_normals overrides/angle1_2_n.tga roughness_override 0.378 - correct_albedo 1 + base_factor 2.5 textures/e1u2/arrow0: texture_base overrides/arrow0.tga texture_normals overrides/arrow0_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/arrow1: texture_base overrides/arrow1.tga texture_normals overrides/arrow1_n.tga texture_emissive overrides/arrow1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/arrow2: texture_base overrides/arrow2.tga texture_normals overrides/arrow2_n.tga texture_emissive overrides/arrow2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/arrow3: texture_base overrides/arrow3.tga texture_normals overrides/arrow3_n.tga texture_emissive overrides/arrow3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/basic1_1: texture_base overrides/basic1_1.tga texture_normals overrides/basic1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/basic1_2: texture_base overrides/basic1_2.tga texture_normals overrides/basic1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/basic1_3: texture_base overrides/basic1_3.tga texture_normals overrides/basic1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/basic1_4: texture_base overrides/basic1_4.tga texture_normals overrides/basic1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/basic1_5: texture_base overrides/basic1_5.tga texture_normals overrides/basic1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/basic1_7: texture_base overrides/basic1_7.tga texture_normals overrides/basic1_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/basic1_8: texture_base overrides/basic1_8.tga texture_normals overrides/basic1_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/bigmet1_2: texture_base overrides/bigmet1_2.tga texture_normals overrides/bigmet1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/bluwter: texture_base overrides/bluwter.tga kind WATER - correct_albedo 1 + base_factor 2.5 textures/e1u2/box02_3: texture_base overrides/box02_3.tga texture_normals overrides/box02_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/box1_1: texture_base overrides/box1_1.tga texture_normals overrides/box1_1_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u2/box1_2: texture_base overrides/box1_2.tga texture_normals overrides/box1_2_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u2/box1_3: texture_base overrides/box1_3.tga texture_normals overrides/box1_3_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u2/box1_4: texture_base overrides/box1_4.tga texture_normals overrides/box1_4_n.tga bump_scale 0.8 roughness_override 0.3 - correct_albedo 1 + base_factor 2.5 textures/e1u2/box1_5: texture_base overrides/box1_5.tga texture_normals overrides/box1_5_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u2/box1_6: texture_base overrides/box1_6.tga texture_normals overrides/box1_6_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u2/box3_1: texture_base overrides/box3_1.tga texture_normals overrides/box3_1_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u2/box3_2: texture_base overrides/box3_2.tga texture_normals overrides/box3_2_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u2/box3_3: texture_base overrides/box3_3.tga texture_normals overrides/box3_3_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u2/box3_4: texture_base overrides/box3_4.tga texture_normals overrides/box3_4_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u2/box3_5: texture_base overrides/box3_5.tga texture_normals overrides/box3_5_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u2/box3_6: texture_base overrides/box3_6.tga texture_normals overrides/box3_6_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u2/box3_7: texture_base overrides/box3_7.tga texture_normals overrides/box3_7_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u2/box3_8: texture_base overrides/box3_8.tga texture_normals overrides/box3_8_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e1u2/box4_1: texture_base overrides/box4_1.tga texture_normals overrides/box4_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/box4_2: texture_base overrides/box4_2.tga texture_normals overrides/box4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/box4_3: texture_base overrides/box4_3.tga texture_normals overrides/box4_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/box4_4: texture_base overrides/box4_4.tga texture_normals overrides/box4_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/brlava: texture_base overrides/brlava.tga @@ -3810,18 +3971,18 @@ textures/e1u2/brlava: texture_emissive overrides/brlava_light.tga emissive_factor 0.2 kind LAVA - correct_albedo 1 + base_factor 2.5 textures/e1u2/broken2_3: texture_base overrides/broken2_3.tga texture_normals overrides/broken2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/brwind5_2: texture_base overrides/brwind5_2.tga texture_normals overrides/brwind5_2_n.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e1u2/btactmach0: texture_base overrides/btactmach0.tga @@ -3829,7 +3990,7 @@ textures/e1u2/btactmach0: texture_emissive overrides/btactmach0_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/btactmach1: texture_base overrides/btactmach1.tga @@ -3837,137 +3998,137 @@ textures/e1u2/btactmach1: texture_emissive overrides/btactmach1_light.tga roughness_override 1 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/btactmach2: texture_base overrides/btactmach2.tga texture_normals overrides/btactmach2_n.tga texture_emissive overrides/btactmach2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/btactmach3: texture_base overrides/btactmach3.tga texture_normals overrides/btactmach3_n.tga texture_emissive overrides/btactmach3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/btelev_dn: texture_base overrides/btelev_dn.tga texture_normals overrides/btelev_dn_n.tga texture_emissive overrides/btelev_dn_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/btelev_dn3: texture_base overrides/btelev_dn3.tga texture_normals overrides/btelev_dn3_n.tga texture_emissive overrides/btelev_dn3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/btelev_up: texture_base overrides/btelev_up.tga texture_normals overrides/btelev_up_n.tga texture_emissive overrides/btelev_up_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/btelev_up3: texture_base overrides/btelev_up3.tga texture_normals overrides/btelev_up3_n.tga texture_emissive overrides/btelev_up3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/cable1_1: texture_base overrides/cable1_1.tga texture_normals overrides/cable1_1_n.tga roughness_override 0.622 - correct_albedo 1 + base_factor 2.5 textures/e1u2/caution1_1: texture_base overrides/caution1_1.tga texture_normals overrides/caution1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/ceil1_1: texture_base overrides/ceil1_1.tga texture_normals overrides/ceil1_1_n.tga texture_emissive overrides/ceil1_1_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/ceil1_12: texture_base overrides/ceil1_12.tga texture_normals overrides/ceil1_12_n.tga texture_emissive overrides/ceil1_12_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/ceil1_15: texture_base overrides/ceil1_15.tga texture_normals overrides/ceil1_15_n.tga texture_emissive overrides/ceil1_15_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/ceil1_22: texture_base overrides/ceil1_22.tga texture_normals overrides/ceil1_22_n.tga texture_emissive overrides/ceil1_22_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/ceil1_23: texture_base overrides/ceil1_23.tga texture_normals overrides/ceil1_23_n.tga texture_emissive overrides/ceil1_23_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/ceil1_25: texture_base overrides/ceil1_25.tga texture_normals overrides/ceil1_25_n.tga texture_emissive overrides/ceil1_25_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/ceil1_3: texture_base overrides/ceil1_3.tga texture_normals overrides/ceil1_3_n.tga texture_emissive overrides/ceil1_3_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/ceil1_4: texture_base overrides/ceil1_4.tga texture_normals overrides/ceil1_4_n.tga texture_emissive overrides/ceil1_4_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/ceil1_5: texture_base overrides/ceil1_5.tga texture_normals overrides/ceil1_5_n.tga texture_emissive overrides/ceil1_5_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/ceil1_7: texture_base overrides/ceil1_7.tga texture_normals overrides/ceil1_7_n.tga texture_emissive overrides/ceil1_7_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/ceil1_8: texture_base overrides/ceil1_8.tga texture_normals overrides/ceil1_8_n.tga texture_emissive overrides/ceil1_8_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/clip: texture_base overrides/clip.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/comp1_1: texture_base overrides/comp1_1.tga @@ -3975,7 +4136,7 @@ textures/e1u2/comp1_1: texture_emissive overrides/comp1_1_light.tga emissive_factor 0.02 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u2/comp2_1: texture_base textures/e1u2/comp2_1.tga @@ -3985,84 +4146,85 @@ textures/e1u2/comp2_1: textures/e1u2/comp2_3: texture_base textures/e1u2/comp2_3.tga texture_normals textures/e1u2/comp2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/comp2_4: texture_base overrides/comp2_4.tga texture_normals overrides/comp2_4_n.tga texture_emissive overrides/comp2_4_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/crate1_1: texture_base overrides/crate1_1.tga texture_normals overrides/crate1_1_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 + specular_factor 0 textures/e1u2/crate1_3: texture_base overrides/crate1_3.tga texture_normals overrides/crate1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/crate1_4: texture_base overrides/crate1_4.tga texture_normals overrides/crate1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/crate1_5: texture_base overrides/crate1_5.tga texture_normals overrides/crate1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/crate1_6: texture_base overrides/crate1_6.tga texture_normals overrides/crate1_6_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e1u2/crate1_8: texture_base overrides/crate1_8.tga texture_normals overrides/crate1_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/crate2_2: texture_base overrides/crate2_2.tga texture_normals overrides/crate2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/crate2_6: texture_base overrides/crate2_6.tga texture_normals overrides/crate2_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/doorbot: texture_base overrides/doorbot.tga texture_normals overrides/doorbot_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/doorswt0: texture_base overrides/doorswt0.tga texture_normals overrides/doorswt0_n.tga texture_emissive overrides/doorswt0_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/doorswt1: texture_base overrides/doorswt1.tga texture_normals overrides/doorswt1_n.tga texture_emissive overrides/doorswt1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/doorswt2: texture_base overrides/doorswt2.tga texture_normals overrides/doorswt2_n.tga texture_emissive overrides/doorswt2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/doorswt3: texture_base overrides/doorswt3.tga texture_normals overrides/doorswt3_n.tga texture_emissive overrides/doorswt3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/elev_dr1: texture_base overrides/elev_dr1.tga @@ -4071,7 +4233,7 @@ textures/e1u2/elev_dr1: bump_scale 0.724 roughness_override 0.362 emissive_factor 0.02 - correct_albedo 1 + base_factor 2.5 textures/e1u2/elev_dr2: texture_base overrides/elev_dr2.tga @@ -4080,19 +4242,19 @@ textures/e1u2/elev_dr2: bump_scale 0.724 roughness_override 0.362 emissive_factor 0.02 - correct_albedo 1 + base_factor 2.5 textures/e1u2/endsign1_1: texture_base overrides/endsign1_1.tga texture_emissive overrides/endsign1_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/endsign1_2: texture_base overrides/endsign1_2.tga texture_emissive overrides/endsign1_2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/endsign1_7: texture_base overrides/endsign1_7.tga @@ -4100,7 +4262,7 @@ textures/e1u2/endsign1_7: texture_emissive overrides/endsign1_7_light.tga emissive_factor 0.1 is_light 1 - correct_albedo 1 + base_factor 2.5 light_styles 0 textures/e1u2/endsign1_8: @@ -4109,7 +4271,7 @@ textures/e1u2/endsign1_8: texture_emissive overrides/endsign1_8_light.tga emissive_factor 0.1 is_light 1 - correct_albedo 1 + base_factor 2.5 light_styles 0 textures/e1u2/endsign1_9: @@ -4118,7 +4280,7 @@ textures/e1u2/endsign1_9: texture_emissive overrides/endsign1_9_light.tga emissive_factor 0.1 is_light 1 - correct_albedo 1 + base_factor 2.5 light_styles 0 textures/e1u2/exit1: @@ -4126,13 +4288,13 @@ textures/e1u2/exit1: texture_normals overrides/exit1_n.tga texture_emissive overrides/exit1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/fuse1_1: texture_base overrides/fuse1_1.tga texture_normals overrides/fuse1_1_n.tga roughness_override 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/fuse1_2: texture_base overrides/fuse1_2.tga @@ -4141,14 +4303,14 @@ textures/e1u2/fuse1_2: roughness_override 0.6 emissive_factor 0.1 is_light 1 - correct_albedo 1 + base_factor 2.5 light_styles 0 textures/e1u2/fuse1_3: texture_base overrides/fuse1_3.tga texture_normals overrides/fuse1_3_n.tga roughness_override 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/fuse1_4: texture_base overrides/fuse1_4.tga @@ -4157,7 +4319,7 @@ textures/e1u2/fuse1_4: roughness_override 0.6 emissive_factor 0.1 is_light 1 - correct_albedo 1 + base_factor 2.5 light_styles 0 textures/e1u2/fusedr1: @@ -4165,272 +4327,272 @@ textures/e1u2/fusedr1: texture_normals overrides/fusedr1_n.tga texture_emissive overrides/fusedr1_light.tga emissive_factor 0.01 - correct_albedo 1 + base_factor 2.5 textures/e1u2/fusedr2: texture_base overrides/fusedr2.tga texture_normals overrides/fusedr2_n.tga texture_emissive overrides/fusedr2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/grate1_1: texture_base textures/e1u2/grate1_1.tga texture_normals textures/e1u2/grate1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/grate1_3: texture_base textures/e1u2/grate1_3.tga texture_normals textures/e1u2/grate1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/grate1_4: texture_base textures/e1u2/grate1_4.tga texture_normals textures/e1u2/grate1_4_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e1u2/grate1_5: texture_base textures/e1u2/grate1_5.tga texture_normals textures/e1u2/grate1_5_n.tga texture_emissive textures/e1u2/grate1_5_light.tga emissive_factor 0.005 - correct_albedo 1 + base_factor 2.5 textures/e1u2/grate1_6: texture_base textures/e1u2/grate1_6.tga texture_normals textures/e1u2/grate1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/grate1_8: texture_base textures/e1u2/grate1_8.tga texture_normals textures/e1u2/grate1_8_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e1u2/hint: texture_base overrides/hint.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/hvy_dr1_2: texture_base overrides/hvy_dr1_2.tga texture_normals overrides/hvy_dr1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/hvy_dr2_1: texture_base overrides/hvy_dr2_1.tga texture_normals overrides/hvy_dr2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/hvy_dr3_1: texture_base overrides/hvy_dr3_1.tga texture_normals overrides/hvy_dr3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/hvy_dr3_2: texture_base overrides/hvy_dr3_2.tga texture_normals overrides/hvy_dr3_2_n.tga roughness_override 0.299 - correct_albedo 1 + base_factor 2.5 textures/e1u2/hvy_dr4_1: texture_base overrides/hvy_dr4_1.tga texture_normals overrides/hvy_dr4_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/keydran1_1: texture_base overrides/keydran1_1.tga texture_normals overrides/keydran1_1_n.tga texture_emissive overrides/keydran1_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/keydran2_1: texture_base overrides/keydran2_1.tga texture_normals overrides/keydran2_1_n.tga texture_emissive overrides/keydran2_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/laserbut0: texture_base overrides/laserbut0.tga texture_normals overrides/laserbut0_n.tga texture_emissive overrides/laserbut0_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/laserbut1: texture_base overrides/laserbut1.tga texture_normals overrides/laserbut1_n.tga texture_emissive overrides/laserbut1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/laserbut2: texture_base overrides/laserbut2.tga texture_normals overrides/laserbut2_n.tga texture_emissive overrides/laserbut2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/laserbut3: texture_base overrides/laserbut3.tga texture_normals overrides/laserbut3_n.tga texture_emissive overrides/laserbut3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/light03_2: texture_base overrides/light03_2.tga texture_normals overrides/light03_2_n.tga texture_emissive overrides/light03_2_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/light03_8: texture_base overrides/light03_8.tga texture_normals overrides/light03_8_n.tga texture_emissive overrides/light03_8_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/light1_4: texture_base overrides/light1_4.tga texture_normals overrides/light1_4_n.tga texture_emissive overrides/light1_4_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/light2_1: texture_base overrides/light2_1.tga texture_normals overrides/light2_1_n.tga texture_emissive overrides/light2_1_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/light2_2: texture_base overrides/light2_2.tga texture_normals overrides/light2_2_n.tga texture_emissive overrides/light2_2_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal10_1: texture_base overrides/metal10_1.tga texture_normals overrides/metal10_1_n.tga texture_emissive overrides/metal10_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal10_3: texture_base overrides/metal10_3.tga texture_normals overrides/metal10_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal11_3: texture_base overrides/metal11_3.tga texture_normals overrides/metal11_3_n.tga texture_emissive overrides/metal11_3_light.tga emissive_factor 0.03 - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal11_4: texture_base overrides/metal11_4.tga texture_normals overrides/metal11_4_n.tga texture_emissive overrides/metal11_4_light.tga emissive_factor 0.03 - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal12_1: texture_base overrides/metal12_1.tga texture_normals overrides/metal12_1_n.tga roughness_override 0.339 - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal12_2: texture_base overrides/metal12_2.tga texture_normals overrides/metal12_2_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal12_4: texture_base overrides/metal12_4.tga texture_normals overrides/metal12_4_n.tga texture_emissive overrides/metal12_4_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal13_1: texture_base textures/e1u2/metal13_1.tga texture_normals textures/e1u2/metal13_1_n.tga bump_scale 0.551 roughness_override 0.535 - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal13_2: texture_base overrides/metal13_2.tga texture_normals overrides/metal13_2_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal13_3: texture_base overrides/metal13_3.tga texture_normals overrides/metal13_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal14_1: texture_base textures/e1u2/metal14_1.tga texture_normals textures/e1u2/metal14_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal14_2: texture_base overrides/metal14_2.tga texture_normals overrides/metal14_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal1_1: texture_base textures/e1u2/metal1_1.tga texture_normals textures/e1u2/metal1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal1_2: texture_base textures/e1u2/metal1_2.tga texture_normals textures/e1u2/metal1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal1_3: texture_base overrides/metal1_3.tga texture_normals overrides/metal1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal1_4: texture_base overrides/metal1_4.tga texture_normals overrides/metal1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal1_5: texture_base overrides/metal1_5.tga texture_normals overrides/metal1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal1_6: texture_base textures/e1u2/metal1_6.tga texture_normals textures/e1u2/metal1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal1_7: texture_base textures/e1u2/metal1_7.tga texture_normals textures/e1u2/metal1_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal2_3: texture_base textures/e1u2/metal2_3.tga texture_normals textures/e1u2/metal2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal3_1: texture_base textures/e1u2/metal3_1.tga texture_normals textures/e1u2/metal3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal3_2: texture_base textures/e1u2/metal3_2.tga texture_normals textures/e1u2/metal3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal3_4: texture_base textures/e1u2/metal3_4.tga @@ -4439,152 +4601,152 @@ textures/e1u2/metal3_4: textures/e1u2/metal4_1: texture_base textures/e1u2/metal4_1.tga texture_normals textures/e1u2/metal4_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal4_2: texture_base textures/e1u2/metal4_2.tga texture_normals textures/e1u2/metal4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal5_1: texture_base textures/e1u2/metal5_1.tga texture_normals textures/e1u2/metal5_1_n.tga roughness_override 0.488 - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal5_2: texture_base textures/e1u2/metal5_2.tga texture_normals textures/e1u2/metal5_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal5_3: texture_base overrides/metal5_3.tga texture_normals overrides/metal5_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal5_4: texture_base overrides/metal5_4.tga texture_normals overrides/metal5_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal5_5: texture_base overrides/metal5_5.tga texture_normals overrides/metal5_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal5_6: texture_base overrides/metal5_6.tga texture_normals overrides/metal5_6_n.tga texture_emissive overrides/metal5_6_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal5_7: texture_base overrides/metal5_7.tga texture_normals overrides/metal5_7_n.tga texture_emissive overrides/metal5_7_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal5_8: texture_base overrides/metal5_8.tga texture_normals overrides/metal5_8_n.tga roughness_override 0.3 - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal6_1: texture_base textures/e1u2/metal6_1.tga texture_normals textures/e1u2/metal6_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal6_2: texture_base textures/e1u2/metal6_2.tga texture_normals textures/e1u2/metal6_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal6_3: texture_base overrides/metal6_3.tga texture_normals overrides/metal6_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal8_1: texture_base textures/e1u2/metal8_1.tga texture_normals textures/e1u2/metal8_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal8_2: texture_base overrides/metal8_2.tga texture_normals overrides/metal8_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal8_3: texture_base overrides/metal8_3.tga texture_normals overrides/metal8_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal8_4: texture_base overrides/metal8_4.tga texture_normals overrides/metal8_4_n.tga bump_scale 0.551 - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal8_5: texture_base overrides/metal8_5.tga texture_normals overrides/metal8_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal9_1: texture_base textures/e1u2/metal9_1.tga texture_normals textures/e1u2/metal9_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal9_2: texture_base overrides/metal9_2.tga texture_normals overrides/metal9_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal9_3: texture_base overrides/metal9_3.tga texture_normals overrides/metal9_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal9_4: texture_base overrides/metal9_4.tga texture_normals overrides/metal9_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metal9_6: texture_base overrides/metal9_6.tga texture_normals overrides/metal9_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/metals_1: texture_base overrides/metals_1.tga texture_normals overrides/metals_1_n.tga roughness_override 0.354 - correct_albedo 1 + base_factor 2.5 textures/e1u2/metals_3: texture_base overrides/metals_3.tga texture_normals overrides/metals_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/mvr1_2: texture_base overrides/mvr1_2.tga texture_normals overrides/mvr1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/mvr1_3: texture_base overrides/mvr1_3.tga texture_normals overrides/mvr1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/origin: texture_base overrides/origin.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/pillar1_1: texture_base overrides/pillar1_1.tga texture_normals overrides/pillar1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/pillar1_2: texture_base overrides/pillar1_2.tga @@ -4592,205 +4754,205 @@ textures/e1u2/pillar1_2: texture_emissive overrides/pillar1_2_light.tga emissive_factor 0.1 is_light 1 - correct_albedo 1 + base_factor 2.5 light_styles 0 textures/e1u2/plate1_2: texture_base overrides/plate1_2.tga texture_normals overrides/plate1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/plate1_3: texture_base overrides/plate1_3.tga texture_normals overrides/plate1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/plate1_4: texture_base overrides/plate1_4.tga texture_normals overrides/plate1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/plate1_5: texture_base overrides/plate1_5.tga texture_normals overrides/plate1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/plate1_6: texture_base overrides/plate1_6.tga texture_normals overrides/plate1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/red1_4: texture_base overrides/red1_4.tga texture_normals overrides/red1_4_n.tga bump_scale 0.22 roughness_override 0.276 - correct_albedo 1 + base_factor 2.5 textures/e1u2/reds1_4: texture_base overrides/reds1_4.tga texture_normals overrides/reds1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/rocks19_1: texture_base overrides/rocks19_1.tga texture_normals overrides/rocks19_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/shooter1: texture_base overrides/shooter1.tga texture_normals overrides/shooter1_n.tga texture_emissive overrides/shooter1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/shooter2: texture_base overrides/shooter2.tga texture_normals overrides/shooter2_n.tga texture_emissive overrides/shooter2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/sky1: texture_base overrides/sky1.tga kind SKY - correct_albedo 1 + base_factor 2.5 textures/e1u2/sky2: texture_base overrides/sky2.tga kind SKY - correct_albedo 1 + base_factor 2.5 textures/e1u2/stripe1_1: texture_base overrides/stripe1_1.tga texture_normals overrides/stripe1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/stripe1_2: texture_base overrides/stripe1_2.tga texture_normals overrides/stripe1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/subdr1_1: texture_base overrides/subdr1_1.tga texture_normals overrides/subdr1_1_n.tga roughness_override 1 metalness_factor 0 - correct_albedo 1 + base_factor 2.5 textures/e1u2/subdr2_1: texture_base overrides/subdr2_1.tga texture_normals overrides/subdr2_1_n.tga roughness_override 1 metalness_factor 0 - correct_albedo 1 + base_factor 2.5 textures/e1u2/subdr2_2: texture_base overrides/subdr2_2.tga texture_normals overrides/subdr2_2_n.tga roughness_override 1 metalness_factor 0 - correct_albedo 1 + base_factor 2.5 textures/e1u2/subdr3_1: texture_base overrides/subdr3_1.tga texture_normals overrides/subdr3_1_n.tga roughness_override 1 metalness_factor 0 - correct_albedo 1 + base_factor 2.5 textures/e1u2/subdr3_2: texture_base overrides/subdr3_2.tga texture_normals overrides/subdr3_2_n.tga roughness_override 1 metalness_factor 0 - correct_albedo 1 + base_factor 2.5 textures/e1u2/support1_1: texture_base textures/e1u2/support1_1.tga texture_normals textures/e1u2/support1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/support1_10: texture_base overrides/support1_10.tga texture_normals overrides/support1_10_n.tga texture_emissive overrides/support1_10_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/support1_14: texture_base overrides/support1_14.tga texture_normals overrides/support1_14_n.tga texture_emissive overrides/support1_14_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/support1_2: texture_base overrides/support1_2.tga texture_normals overrides/support1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/support1_5: texture_base overrides/support1_5.tga texture_normals overrides/support1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/support1_6: texture_base overrides/support1_6.tga texture_normals overrides/support1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/support1_7: texture_base overrides/support1_7.tga texture_normals overrides/support1_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/support1_8: texture_base overrides/support1_8.tga texture_normals overrides/support1_8_n.tga texture_emissive overrides/support1_8_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 emissive_factor 0.2 textures/e1u2/sym6_2: texture_base overrides/sym6_2.tga texture_normals overrides/sym6_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/train1_1: texture_base overrides/train1_1.tga texture_normals overrides/train1_1_n.tga texture_emissive overrides/train1_1_light.tga emissive_factor 0.05 - correct_albedo 1 + base_factor 2.5 textures/e1u2/train1_2: texture_base overrides/train1_2.tga texture_normals overrides/train1_2_n.tga roughness_override 0.496 - correct_albedo 1 + base_factor 2.5 textures/e1u2/train1_3: texture_base overrides/train1_3.tga texture_normals overrides/train1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/train1_4: texture_base overrides/train1_4.tga texture_normals overrides/train1_4_n.tga roughness_override 0.409 - correct_albedo 1 + base_factor 2.5 textures/e1u2/train1_5: texture_base overrides/train1_5.tga texture_normals overrides/train1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/train1_6: texture_base overrides/train1_6.tga texture_normals overrides/train1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/train1_7: texture_base overrides/train1_7.tga @@ -4798,317 +4960,317 @@ textures/e1u2/train1_7: texture_emissive overrides/train1_7_light.tga roughness_override 0.496 emissive_factor 0.05 - correct_albedo 1 + base_factor 2.5 textures/e1u2/train1_8: texture_base overrides/train1_8.tga texture_normals overrides/train1_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/trigger: texture_base overrides/trigger.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/troof4_2: texture_base overrides/troof4_2.tga texture_normals overrides/troof4_2_n.tga bump_scale 0.504 roughness_override 0.598 - correct_albedo 1 + base_factor 2.5 textures/e1u2/troof4_4: texture_base overrides/troof4_4.tga texture_normals overrides/troof4_4_n.tga roughness_override 0.614 - correct_albedo 1 + base_factor 2.5 textures/e1u2/troof4_5: texture_base overrides/troof4_5.tga texture_normals overrides/troof4_5_n.tga roughness_override 0.701 - correct_albedo 1 + base_factor 2.5 textures/e1u2/troof4_7: texture_base overrides/troof4_7.tga texture_normals overrides/troof4_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/wall1_1: texture_base overrides/wall1_1.tga texture_normals overrides/wall1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/wall1_2: texture_base overrides/wall1_2.tga texture_normals overrides/wall1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/window4_2: texture_base overrides/window4_2.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e1u2/wndow1_2: texture_base overrides/wndow1_2.tga texture_normals overrides/wndow1_2_n.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e1u2/wslt1_1: texture_base overrides/wslt1_1.tga texture_normals overrides/wslt1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/wslt1_2: texture_base overrides/wslt1_2.tga texture_normals overrides/wslt1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/wslt1_3: texture_base overrides/wslt1_3.tga texture_normals overrides/wslt1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/wslt1_4: texture_base overrides/wslt1_4.tga texture_normals overrides/wslt1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u2/wslt1_5: texture_base overrides/wslt1_5.tga texture_normals overrides/wslt1_5_n.tga texture_emissive overrides/wslt1_5_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/wslt1_6: texture_base overrides/wslt1_6.tga texture_normals overrides/wslt1_6_n.tga texture_emissive overrides/wslt1_6_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u2/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga bump_scale 0.126 - correct_albedo 1 + base_factor 2.5 textures/e1u2/yellow1_6: texture_base overrides/yellow1_6.tga texture_normals overrides/yellow1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/+0butn1: texture_base overrides/+0butn1.tga texture_normals overrides/+0butn1_n.tga texture_emissive overrides/+0butn1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/airduc1_1: texture_base overrides/airduc1_1.tga texture_normals overrides/airduc1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/airduc1_2: texture_base overrides/airduc1_2.tga texture_normals overrides/airduc1_2_n.tga bump_scale 0.3 - correct_albedo 1 + base_factor 2.5 textures/e1u3/airduc1_3: texture_base overrides/airduc1_3.tga texture_normals overrides/airduc1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/arrow0: texture_base overrides/arrow0.tga texture_normals overrides/arrow0_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/arrow1: texture_base overrides/arrow1.tga texture_normals overrides/arrow1_n.tga texture_emissive overrides/arrow1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/arrow2: texture_base overrides/arrow2.tga texture_normals overrides/arrow2_n.tga texture_emissive overrides/arrow2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/arrow3: texture_base overrides/arrow3.tga texture_normals overrides/arrow3_n.tga texture_emissive overrides/arrow3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/arrowup0: texture_base overrides/arrowup0.tga texture_normals overrides/arrowup0_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/arrowup1: texture_base overrides/arrowup1.tga texture_normals overrides/arrowup1_n.tga texture_emissive overrides/arrowup1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/arrowup2: texture_base overrides/arrowup2.tga texture_normals overrides/arrowup2_n.tga texture_emissive overrides/arrowup2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/arrowup3: texture_base overrides/arrowup3.tga texture_normals overrides/arrowup3_n.tga texture_emissive overrides/arrowup3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/bflor3_1: texture_base overrides/bflor3_1.tga texture_normals overrides/bflor3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/bflor3_2: texture_base overrides/bflor3_2.tga texture_normals overrides/bflor3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/bflor3_3: texture_base overrides/bflor3_3.tga texture_normals overrides/bflor3_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/blood1: texture_base overrides/blood1.tga texture_normals overrides/blood1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/blood2: texture_base overrides/blood2.tga texture_normals overrides/blood2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/bluekeypad: texture_base overrides/bluekeypad.tga texture_normals overrides/bluekeypad_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/bluwter: texture_base overrides/bluwter.tga kind WATER - correct_albedo 1 + base_factor 2.5 textures/e1u3/broken1_1: texture_base overrides/broken1_1.tga texture_normals overrides/broken1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/broken2_4: texture_base overrides/broken2_4.tga texture_normals overrides/broken2_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/brwater: texture_base textures/e1u3/brwater.wal kind WATER - correct_albedo 1 + base_factor 2.5 textures/e1u3/btactmach: texture_base overrides/btactmach.tga texture_normals overrides/btactmach_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/btactmach0: texture_base overrides/btactmach0.tga texture_normals overrides/btactmach0_n.tga texture_emissive overrides/btactmach0_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/btactmach1: texture_base overrides/btactmach1.tga texture_normals overrides/btactmach1_n.tga texture_emissive overrides/btactmach1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/btactmach2: texture_base overrides/btactmach2.tga texture_normals overrides/btactmach2_n.tga texture_emissive overrides/btactmach2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/btactmach3: texture_base overrides/btactmach3.tga texture_normals overrides/btactmach3_n.tga texture_emissive overrides/btactmach3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/btelev_dn: texture_base overrides/btelev_dn.tga texture_normals overrides/btelev_dn_n.tga texture_emissive overrides/btelev_dn_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/btelev_dn3: texture_base overrides/btelev_dn3.tga texture_normals overrides/btelev_dn3_n.tga texture_emissive overrides/btelev_dn3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/btelev_up: texture_base overrides/btelev_up.tga texture_normals overrides/btelev_up_n.tga texture_emissive overrides/btelev_up_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/btelev_up3: texture_base overrides/btelev_up3.tga texture_normals overrides/btelev_up3_n.tga texture_emissive overrides/btelev_up3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/butn01_1: texture_base overrides/butn01_1.tga texture_normals overrides/butn01_1_n.tga texture_emissive overrides/butn01_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/ceil1_1: texture_base overrides/ceil1_1.tga texture_normals overrides/ceil1_1_n.tga texture_emissive overrides/ceil1_1_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/ceil1_16: texture_base overrides/ceil1_16.tga texture_normals overrides/ceil1_16_n.tga texture_emissive overrides/ceil1_16_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/ceil1_17: texture_base overrides/ceil1_17.tga texture_normals overrides/ceil1_17_n.tga texture_emissive overrides/ceil1_17_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/ceil1_2: texture_base overrides/ceil1_2.tga @@ -5116,166 +5278,166 @@ textures/e1u3/ceil1_2: texture_emissive overrides/ceil1_2_light.tga bump_scale 0.5 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/ceil1_21: texture_base overrides/ceil1_21.tga texture_normals overrides/ceil1_21_n.tga texture_emissive overrides/ceil1_21_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/ceil1_3: texture_base overrides/ceil1_3.tga texture_normals overrides/ceil1_3_n.tga texture_emissive overrides/ceil1_3_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/ceil1_4: texture_base overrides/ceil1_4.tga texture_normals overrides/ceil1_4_n.tga texture_emissive overrides/ceil1_4_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/ceil1_5: texture_base overrides/ceil1_5.tga texture_normals overrides/ceil1_5_n.tga texture_emissive overrides/ceil1_5_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/ceil1_6: texture_base overrides/ceil1_6.tga texture_normals overrides/ceil1_6_n.tga texture_emissive overrides/ceil1_6_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/ceil1_7: texture_base overrides/ceil1_7.tga texture_normals overrides/ceil1_7_n.tga texture_emissive overrides/ceil1_7_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/ceil1_8: texture_base overrides/ceil1_8.tga texture_normals overrides/ceil1_8_n.tga texture_emissive overrides/ceil1_8_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/cin_flr1_1: texture_base overrides/cin_flr1_1.tga texture_normals overrides/cin_flr1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/cin_flr1_2: texture_base overrides/cin_flr1_2.tga texture_normals overrides/cin_flr1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/cindb2_1: texture_base overrides/cindb2_1.tga texture_normals overrides/cindb2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/cindb2_2: texture_base overrides/cindb2_2.tga texture_normals overrides/cindb2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/cinder1_2: texture_base overrides/cinder1_2.tga texture_normals overrides/cinder1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/cinder1_3: texture_base overrides/cinder1_3.tga texture_normals overrides/cinder1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/cinder1_5: texture_base overrides/cinder1_5.tga texture_normals overrides/cinder1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/cinder1_6: texture_base overrides/cinder1_6.tga texture_normals overrides/cinder1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/cinder1_7: texture_base overrides/cinder1_7.tga texture_normals overrides/cinder1_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/cinder1_8: texture_base overrides/cinder1_8.tga texture_normals overrides/cinder1_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/cindr2_1: texture_base overrides/cindr2_1.tga texture_normals overrides/cindr2_1_n.tga roughness_override 0.4 - correct_albedo 1 + base_factor 2.5 textures/e1u3/cindr2_2: texture_base overrides/cindr2_2.tga texture_normals overrides/cindr2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/cindr3_1: texture_base overrides/cindr3_1.tga texture_normals overrides/cindr3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/cindr3_2: texture_base overrides/cindr3_2.tga texture_normals overrides/cindr3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/cindr4_1: texture_base overrides/cindr4_1.tga texture_normals overrides/cindr4_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/cindr4_2: texture_base overrides/cindr4_2.tga texture_normals overrides/cindr4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/cindr5_1: texture_base overrides/cindr5_1.tga texture_normals overrides/cindr5_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/cindr5_2: texture_base overrides/cindr5_2.tga texture_normals overrides/cindr5_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/cindr6_1: texture_base overrides/cindr6_1.tga texture_normals overrides/cindr6_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/cindr7_1: texture_base overrides/cindr7_1.tga texture_normals overrides/cindr7_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/cindr8_1: texture_base overrides/cindr8_1.tga texture_normals overrides/cindr8_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/clip: texture_base overrides/clip.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/comp1_1: texture_base overrides/comp1_1.tga @@ -5283,7 +5445,7 @@ textures/e1u3/comp1_1: texture_emissive overrides/comp1_1_light.tga emissive_factor 0.02 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u3/comp1_2: texture_base overrides/comp1_2.tga @@ -5291,17 +5453,17 @@ textures/e1u3/comp1_2: texture_emissive overrides/comp1_2_light.tga emissive_factor 0.1 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u3/comp1_4: texture_base overrides/comp1_4.tga texture_normals overrides/comp1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/comp1_5: texture_base overrides/comp1_5.tga texture_normals overrides/comp1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/comp2_1: texture_base textures/e1u3/comp2_1.tga @@ -5313,7 +5475,7 @@ textures/e1u3/comp2_d: texture_base overrides/comp2_d.tga texture_normals overrides/comp2_d_n.tga texture_emissive overrides/comp2_d_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/comp3_1: texture_base overrides/comp3_1.tga @@ -5328,7 +5490,7 @@ textures/e1u3/comp3_2: texture_emissive overrides/comp3_2_light.tga emissive_factor 0.2 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u3/comp3_3: texture_base overrides/comp3_3.tga @@ -5336,7 +5498,7 @@ textures/e1u3/comp3_3: texture_emissive overrides/comp3_3_light.tga emissive_factor 0.1 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u3/comp3_4: texture_base overrides/comp3_4.tga @@ -5349,7 +5511,7 @@ textures/e1u3/comp3_5: texture_base overrides/comp3_5.tga texture_normals overrides/comp3_5_n.tga texture_emissive overrides/comp3_5_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/comp3_6: texture_base overrides/comp3_6.tga @@ -5372,24 +5534,24 @@ textures/e1u3/comp3_8: emissive_factor 0.02 kind SCREEN is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/comp4_1: texture_base overrides/comp4_1.tga texture_normals overrides/comp4_1_n.tga texture_emissive overrides/comp4_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/comp4_2: texture_base overrides/comp4_2.tga texture_normals overrides/comp4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/comp4_3: texture_base overrides/comp4_3.tga texture_normals overrides/comp4_3_n.tga texture_emissive overrides/comp4_3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/comp5_1: texture_base overrides/comp5_1.tga @@ -5403,7 +5565,7 @@ textures/e1u3/comp5_2: texture_emissive overrides/comp5_2_light.tga emissive_factor 0.1 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u3/comp5_3: texture_base overrides/comp5_3.tga @@ -5422,177 +5584,177 @@ textures/e1u3/comp5_4: textures/e1u3/con1_1: texture_base textures/e1u3/con1_1.tga texture_normals textures/e1u3/con1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/con1_2: texture_base overrides/con1_2.tga texture_normals overrides/con1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/con_flr1_1: texture_base overrides/con_flr1_1.tga texture_normals overrides/con_flr1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/con_flr1_2: texture_base overrides/con_flr1_2.tga texture_normals overrides/con_flr1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/doorbot: texture_base overrides/doorbot.tga texture_normals overrides/doorbot_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/doorfc1_1: texture_base overrides/doorfc1_1.tga texture_normals overrides/doorfc1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/doorfc1_3: texture_base overrides/doorfc1_3.tga texture_normals overrides/doorfc1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/doorfc1_4: texture_base overrides/doorfc1_4.tga texture_normals overrides/doorfc1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/doorswt0: texture_base overrides/doorswt0.tga texture_normals overrides/doorswt0_n.tga texture_emissive overrides/doorswt0_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/doorswt1: texture_base overrides/doorswt1.tga texture_normals overrides/doorswt1_n.tga texture_emissive overrides/doorswt1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/doorswt2: texture_base overrides/doorswt2.tga texture_normals overrides/doorswt2_n.tga texture_emissive overrides/doorswt2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/doorswt3: texture_base overrides/doorswt3.tga texture_normals overrides/doorswt3_n.tga texture_emissive overrides/doorswt3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/dr02_1: texture_base overrides/dr02_1.tga texture_normals overrides/dr02_1_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e1u3/exit1: texture_base overrides/exit1.tga texture_normals overrides/exit1_n.tga texture_emissive overrides/exit1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/exitsin1_1: texture_base overrides/exitsin1_1.tga texture_normals overrides/exitsin1_1_n.tga texture_emissive overrides/exitsin1_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/flat1_1: texture_base overrides/flat1_1.tga texture_normals overrides/flat1_1_n.tga bump_scale 0.2 - correct_albedo 1 + base_factor 2.5 textures/e1u3/flat1_2: texture_base overrides/flat1_2.tga texture_normals overrides/flat1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/floor1_1: texture_base overrides/floor1_1.tga texture_normals overrides/floor1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/floorsw0: texture_base overrides/floorsw0.tga texture_normals overrides/floorsw0_n.tga texture_emissive overrides/floorsw0_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/floorsw1: texture_base overrides/floorsw1.tga texture_normals overrides/floorsw1_n.tga texture_emissive overrides/floorsw1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/floorsw2: texture_base overrides/floorsw2.tga texture_normals overrides/floorsw2_n.tga texture_emissive overrides/floorsw2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/floorsw3: texture_base overrides/floorsw3.tga texture_normals overrides/floorsw3_n.tga texture_emissive overrides/floorsw3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/fmet1_2: texture_base overrides/fmet1_2.tga texture_normals overrides/fmet1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/fmet1_3: texture_base overrides/fmet1_3.tga texture_normals overrides/fmet1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/fmet1_4: texture_base overrides/fmet1_4.tga texture_normals overrides/fmet1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/fmet2_2: texture_base overrides/fmet2_2.tga texture_normals overrides/fmet2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/fmet2_3: texture_base overrides/fmet2_3.tga texture_normals overrides/fmet2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/fmet2_4: texture_base overrides/fmet2_4.tga texture_normals overrides/fmet2_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/fmet3_1: texture_base overrides/fmet3_1.tga texture_normals overrides/fmet3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/fmet3_2: texture_base overrides/fmet3_2.tga texture_normals overrides/fmet3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/fmet3_4: texture_base overrides/fmet3_4.tga texture_normals overrides/fmet3_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/fmet3_5: texture_base overrides/fmet3_5.tga texture_normals overrides/fmet3_5_n.tga texture_emissive overrides/fmet3_5_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/fmet3_6: texture_base overrides/fmet3_6.tga @@ -5600,7 +5762,7 @@ textures/e1u3/fmet3_6: texture_emissive overrides/fmet3_6_light.tga emissive_factor 0.1 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/fmet3_7: texture_base overrides/fmet3_7.tga @@ -5608,99 +5770,102 @@ textures/e1u3/fmet3_7: texture_emissive overrides/fmet3_7_light.tga emissive_factor 0.1 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/ggrat2_1: texture_base overrides/ggrat2_1.tga texture_normals overrides/ggrat2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/grass1_5: texture_base overrides/grass1_5.tga texture_normals overrides/grass1_5_n.tga - correct_albedo 1 + base_factor 2 + specular_factor 0 textures/e1u3/grass1_7: texture_base overrides/grass1_7.tga texture_normals overrides/grass1_7_n.tga + base_factor 2 + specular_factor 0 textures/e1u3/grate1_4: texture_base textures/e1u3/grate1_4.tga texture_normals textures/e1u3/grate1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/grate1_5: texture_base textures/e1u3/grate1_5.tga texture_normals textures/e1u3/grate1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/grate1_8: texture_base textures/e1u3/grate1_8.tga texture_normals textures/e1u3/grate1_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/grate2_1: texture_base overrides/grate2_1.tga texture_normals overrides/grate2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/grate2_4: texture_base overrides/grate2_4.tga texture_normals overrides/grate2_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/grnx2_3: texture_base overrides/grnx2_3.tga texture_normals overrides/grnx2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/grnx2_4: texture_base overrides/grnx2_4.tga texture_normals overrides/grnx2_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/grnx2_5: texture_base overrides/grnx2_5.tga texture_normals overrides/grnx2_5_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e1u3/grnx2_7: texture_base overrides/grnx2_7.tga texture_normals overrides/grnx2_7_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e1u3/jaildr1_1: texture_base overrides/jaildr1_1.tga texture_normals overrides/jaildr1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/jaildr1_2: texture_base overrides/jaildr1_2.tga texture_normals overrides/jaildr1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/jaildr1_3: texture_base overrides/jaildr1_3.tga texture_normals overrides/jaildr1_3_n.tga texture_emissive overrides/jaildr1_3_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/jaildr2_1: texture_base overrides/jaildr2_1.tga texture_normals overrides/jaildr2_1_n.tga texture_emissive overrides/jaildr2_1_light.tga emissive_factor 0.05 - correct_albedo 1 + base_factor 2.5 textures/e1u3/jaildr2_2: texture_base overrides/jaildr2_2.tga texture_normals overrides/jaildr2_2_n.tga texture_emissive overrides/jaildr2_2_light.tga emissive_factor 0.05 - correct_albedo 1 + base_factor 2.5 textures/e1u3/jaildr2_3: texture_base overrides/jaildr2_3.tga @@ -5708,105 +5873,105 @@ textures/e1u3/jaildr2_3: texture_emissive overrides/jaildr2_3_light.tga emissive_factor 0.3 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/jsign1_1: texture_base overrides/jsign1_1.tga texture_normals overrides/jsign1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/jsign2_1: texture_base overrides/jsign2_1.tga texture_normals overrides/jsign2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/keydr1_1: texture_base overrides/keydr1_1.tga texture_normals overrides/keydr1_1_n.tga texture_emissive overrides/keydr1_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/keydran1_1: texture_base overrides/keydran1_1.tga texture_normals overrides/keydran1_1_n.tga texture_emissive overrides/keydran1_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/keydran2_1: texture_base overrides/keydran2_1.tga texture_normals overrides/keydran2_1_n.tga texture_emissive overrides/keydran2_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/keysign1: texture_base overrides/keysign1.tga texture_normals overrides/keysign1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/laserbut0: texture_base overrides/laserbut0.tga texture_normals overrides/laserbut0_n.tga texture_emissive overrides/laserbut0_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/laserbut1: texture_base overrides/laserbut1.tga texture_normals overrides/laserbut1_n.tga texture_emissive overrides/laserbut1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/laserbut2: texture_base overrides/laserbut2.tga texture_normals overrides/laserbut2_n.tga texture_emissive overrides/laserbut2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/laserbut3: texture_base overrides/laserbut3.tga texture_normals overrides/laserbut3_n.tga texture_emissive overrides/laserbut3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/laserside: texture_base overrides/laserside.tga texture_normals overrides/laserside_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/lava: texture_base overrides/lava.tga texture_normals overrides/lava_n.tga texture_emissive overrides/lava_light.tga kind LAVA - correct_albedo 1 + base_factor 2.5 textures/e1u3/light03_1: texture_base overrides/light03_1.tga texture_normals overrides/light03_1_n.tga texture_emissive overrides/light03_1_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/light03_5: texture_base overrides/light03_5.tga texture_normals overrides/light03_5_n.tga texture_emissive overrides/light03_5_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/light03_6: texture_base overrides/light03_6.tga texture_normals overrides/light03_6_n.tga texture_emissive overrides/light03_6_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/light03_8: texture_base overrides/light03_8.tga texture_normals overrides/light03_8_n.tga texture_emissive overrides/light03_8_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/location: texture_base overrides/location.tga @@ -5814,62 +5979,62 @@ textures/e1u3/location: texture_emissive overrides/location_light.tga emissive_factor 0.1 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e1u3/mach1_1: texture_base overrides/mach1_1.tga texture_normals overrides/mach1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/mach1_2: texture_base overrides/mach1_2.tga texture_normals overrides/mach1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/met1_1: texture_base overrides/met1_1.tga texture_normals overrides/met1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/met1_2: texture_base overrides/met1_2.tga texture_normals overrides/met1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/met1_3: texture_base overrides/met1_3.tga texture_normals overrides/met1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/met1_4: texture_base overrides/met1_4.tga texture_normals overrides/met1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/met1_5: texture_base overrides/met1_5.tga texture_normals overrides/met1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/met2_1: texture_base overrides/met2_1.tga texture_normals overrides/met2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/met2_2: texture_base overrides/met2_2.tga texture_normals overrides/met2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/met2_3: texture_base overrides/met2_3.tga texture_normals overrides/met2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/met2_4: texture_base overrides/met2_4.tga texture_normals overrides/met2_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/met3_1: texture_base overrides/met3_1.tga @@ -5877,43 +6042,43 @@ textures/e1u3/met3_1: texture_emissive overrides/met3_1_light.tga emissive_factor 0.1 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/met3_2: texture_base overrides/met3_2.tga texture_normals overrides/met3_2_n.tga texture_emissive overrides/met3_2_light.tga emissive_factor 0.05 - correct_albedo 1 + base_factor 2.5 textures/e1u3/met3_3: texture_base overrides/met3_3.tga texture_normals overrides/met3_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/met4_1: texture_base overrides/met4_1.tga texture_normals overrides/met4_1_n.tga texture_emissive overrides/met4_1_light.tga emissive_factor 0.02 - correct_albedo 1 + base_factor 2.5 textures/e1u3/met4_2: texture_base overrides/met4_2.tga texture_normals overrides/met4_2_n.tga texture_emissive overrides/met4_2_light.tga emissive_factor 0.05 - correct_albedo 1 + base_factor 2.5 textures/e1u3/met4_3: texture_base overrides/met4_3.tga texture_normals overrides/met4_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/met4_4: texture_base overrides/met4_4.tga texture_normals overrides/met4_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/met4_5: texture_base overrides/met4_5.tga @@ -5921,135 +6086,136 @@ textures/e1u3/met4_5: texture_emissive overrides/met4_5_light.tga emissive_factor 0.5 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/metal1_3: texture_base overrides/metal1_3.tga texture_normals overrides/metal1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/metal1_4: texture_base overrides/metal1_4.tga texture_normals overrides/metal1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/metal1_5: texture_base overrides/metal1_5.tga texture_normals overrides/metal1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/metal3_1: texture_base textures/e1u3/metal3_1.tga texture_normals textures/e1u3/metal3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/metal3_2: texture_base textures/e1u3/metal3_2.tga texture_normals textures/e1u3/metal3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/metal3_3: texture_base textures/e1u3/metal3_3.tga texture_normals textures/e1u3/metal3_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/metal3_5: texture_base overrides/metal3_5.tga texture_normals overrides/metal3_5_n.tga - correct_albedo 1 + base_factor 4 + specular_factor 0 textures/e1u3/metal4_1: texture_base textures/e1u3/metal4_1.tga texture_normals textures/e1u3/metal4_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/metal4_2: texture_base textures/e1u3/metal4_2.tga texture_normals textures/e1u3/metal4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/mon1_2: texture_base overrides/mon1_2.tga texture_normals overrides/mon1_2_n.tga texture_emissive overrides/mon1_2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/mon1_3: texture_base overrides/mon1_3.tga texture_normals overrides/mon1_3_n.tga texture_emissive overrides/mon1_3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/mon1_6: texture_base overrides/mon1_6.tga texture_normals overrides/mon1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/mon1_8: texture_base overrides/mon1_8.tga texture_normals overrides/mon1_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/origin: texture_base overrides/origin.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/pdor1_1: texture_base overrides/pdor1_1.tga texture_normals overrides/pdor1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/pdor1_2: texture_base overrides/pdor1_2.tga texture_normals overrides/pdor1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/pip01_2: texture_base overrides/pip01_2.tga texture_normals overrides/pip01_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/pip01_4: texture_base overrides/pip01_4.tga texture_normals overrides/pip01_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/pip02_3: texture_base overrides/pip02_3.tga texture_normals overrides/pip02_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/pip02_4: texture_base overrides/pip02_4.tga texture_normals overrides/pip02_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/pip02_5: texture_base overrides/pip02_5.tga texture_normals overrides/pip02_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/pip02_6: texture_base overrides/pip02_6.tga texture_normals overrides/pip02_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/pip03_4: texture_base overrides/pip03_4.tga texture_normals overrides/pip03_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/pipe1_1: texture_base overrides/pipe1_1.tga texture_normals overrides/pipe1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/pipe1_3: texture_base overrides/pipe1_3.tga texture_normals overrides/pipe1_3_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e1u3/pipe1_4: texture_base textures/e1u3/pipe1_4.tga @@ -6060,7 +6226,7 @@ textures/e1u3/plite1_1: texture_normals overrides/plite1_1_n.tga texture_emissive overrides/plite1_1_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/plite1_2: texture_base overrides/plite1_2.tga @@ -6068,7 +6234,7 @@ textures/e1u3/plite1_2: texture_emissive overrides/plite1_2_light.tga bump_scale 0.5 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/plite1_3: texture_base overrides/plite1_3.tga @@ -6079,233 +6245,233 @@ textures/e1u3/plite1_3: textures/e1u3/pow3_2: texture_base overrides/pow3_2.tga texture_normals overrides/pow3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/redfield: texture_base textures/e1u3/redfield.wal kind WATER - correct_albedo 1 + base_factor 2.5 textures/e1u3/redkeypad: texture_base overrides/redkeypad.tga texture_normals overrides/redkeypad_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/reds1_2: texture_base overrides/reds1_2.tga texture_normals overrides/reds1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/refdr3_1: texture_base overrides/refdr3_1.tga texture_normals overrides/refdr3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/reflt3_9: texture_base overrides/reflt3_9.png texture_normals overrides/reflt3_9_n.tga texture_emissive overrides/reflt3_9_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/rocks14_2: texture_base overrides/rocks14_2.tga texture_normals overrides/rocks14_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/rocks16_1: texture_base overrides/rocks16_1.tga texture_normals overrides/rocks16_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/rocks19_1: texture_base overrides/rocks19_1.tga texture_normals overrides/rocks19_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/rpip2_2: texture_base overrides/rpip2_2.tga texture_normals overrides/rpip2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/sflr1_1: texture_base overrides/sflr1_1.tga texture_normals overrides/sflr1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/sflr1_2: texture_base overrides/sflr1_2.tga texture_normals overrides/sflr1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/sflr1_3: texture_base overrides/sflr1_3.tga texture_normals overrides/sflr1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/shiny1_6: texture_base overrides/shiny1_6.tga texture_normals overrides/shiny1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/shooter2: texture_base overrides/shooter2.tga texture_normals overrides/shooter2_n.tga texture_emissive overrides/shooter2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/sign3_1: texture_base overrides/sign3_1.tga texture_normals overrides/sign3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/sign3_2: texture_base overrides/sign3_2.tga texture_normals overrides/sign3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/sky1: texture_base overrides/sky1.tga kind SKY - correct_albedo 1 + base_factor 2.5 textures/e1u3/slots1_1: texture_base overrides/slots1_1.tga texture_normals overrides/slots1_1_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e1u3/slots1_2: texture_base overrides/slots1_2.tga texture_normals overrides/slots1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/slots1_4: texture_base overrides/slots1_4.tga texture_normals overrides/slots1_4_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e1u3/slots1_5: texture_base overrides/slots1_5.tga texture_normals overrides/slots1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/slots1_6: texture_base overrides/slots1_6.tga texture_normals overrides/slots1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/slotwl2_1: texture_base overrides/slotwl2_1.tga texture_normals overrides/slotwl2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/slotwl4_1: texture_base overrides/slotwl4_1.tga texture_normals overrides/slotwl4_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/slotwl4_2: texture_base overrides/slotwl4_2.tga texture_normals overrides/slotwl4_2_n.tga texture_emissive overrides/slotwl4_2_light.tga emissive_factor 0.2 - correct_albedo 1 + base_factor 2.5 textures/e1u3/slotwl4_3: texture_base overrides/slotwl4_3.tga texture_normals overrides/slotwl4_3_n.tga texture_emissive overrides/slotwl4_3_light.tga emissive_factor 0.2 - correct_albedo 1 + base_factor 2.5 textures/e1u3/slotwl4_4: texture_base overrides/slotwl4_4.tga texture_normals overrides/slotwl4_4_n.tga texture_emissive overrides/slotwl4_4_light.tga emissive_factor 0.2 - correct_albedo 1 + base_factor 2.5 textures/e1u3/slotwl5_3: texture_base overrides/slotwl5_3.tga texture_normals overrides/slotwl5_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/slotwl5_5: texture_base overrides/slotwl5_5.tga texture_normals overrides/slotwl5_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/slotwl6_2: texture_base overrides/slotwl6_2.tga texture_normals overrides/slotwl6_2_n.tga texture_emissive overrides/slotwl6_2_light.tga emissive_factor 0.2 - correct_albedo 1 + base_factor 2.5 textures/e1u3/sltfl2_1: texture_base overrides/sltfl2_1.tga texture_normals overrides/sltfl2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/sltfl2_2: texture_base overrides/sltfl2_2.tga texture_normals overrides/sltfl2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/sltfl2_6: texture_base overrides/sltfl2_6.tga texture_normals overrides/sltfl2_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/sltfr2_4: texture_base overrides/sltfr2_4.tga texture_normals overrides/sltfr2_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/stairs1_2: texture_base overrides/stairs1_2.tga texture_normals overrides/stairs1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/stairs1_3: texture_base overrides/stairs1_3.tga texture_normals overrides/stairs1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/stflr1_4: texture_base overrides/stflr1_4.tga texture_normals overrides/stflr1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/stflr1_5: texture_base overrides/stflr1_5.tga texture_normals overrides/stflr1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/support1_1: texture_base textures/e1u3/support1_1.tga texture_normals textures/e1u3/support1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/support1_3: texture_base overrides/support1_3.tga texture_normals overrides/support1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/tcmet4_1: texture_base overrides/tcmet4_1.tga texture_normals overrides/tcmet4_1_n.tga texture_emissive overrides/tcmet4_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/tcmet4_2: texture_base overrides/tcmet4_2.tga texture_normals overrides/tcmet4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/tcmet4_3: texture_base overrides/tcmet4_3.tga @@ -6313,458 +6479,458 @@ textures/e1u3/tcmet4_3: texture_emissive overrides/tcmet4_3_light.tga emissive_factor 0.2 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/tcmet4_4: texture_base overrides/tcmet4_4.tga texture_normals overrides/tcmet4_4_n.tga texture_emissive overrides/tcmet4_4_light.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e1u3/tcmet5_2: texture_base overrides/tcmet5_2.tga texture_normals overrides/tcmet5_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/tcmet5_4: texture_base overrides/tcmet5_4.tga texture_normals overrides/tcmet5_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/tcmt9_1: texture_base overrides/tcmt9_1.tga texture_normals overrides/tcmt9_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/tcmt9_2: texture_base overrides/tcmt9_2.tga texture_normals overrides/tcmt9_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/tcmt9_4: texture_base overrides/tcmt9_4.tga texture_normals overrides/tcmt9_4_n.tga texture_emissive overrides/tcmt9_4_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/tcmt9_7: texture_base overrides/tcmt9_7.tga texture_normals overrides/tcmt9_7_n.tga texture_emissive overrides/tcmt9_7_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/trigger: texture_base overrides/trigger.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/troof1_1: texture_base textures/e1u3/troof1_1.tga texture_normals textures/e1u3/troof1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/troof1_2: texture_base overrides/troof1_2.tga texture_normals overrides/troof1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/troof1_3: texture_base overrides/troof1_3.tga texture_normals overrides/troof1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/troof1_4: texture_base overrides/troof1_4.tga texture_normals overrides/troof1_4_n.tga roughness_override 0.583 - correct_albedo 1 + base_factor 2.5 textures/e1u3/troof1_6: texture_base overrides/troof1_6.tga texture_normals overrides/troof1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/troof3_1: texture_base overrides/troof3_1.tga texture_normals overrides/troof3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/troof3_2: texture_base overrides/troof3_2.tga texture_normals overrides/troof3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/troof4_1: texture_base overrides/troof4_1.tga texture_normals overrides/troof4_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/troof4_2: texture_base overrides/troof4_2.tga texture_normals overrides/troof4_2_n.tga roughness_override 0.457 - correct_albedo 1 + base_factor 2.5 textures/e1u3/troof4_3: texture_base overrides/troof4_3.tga texture_normals overrides/troof4_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/troof4_5: texture_base overrides/troof4_5.tga texture_normals overrides/troof4_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/troof4_6: texture_base overrides/troof4_6.tga texture_normals overrides/troof4_6_n.tga roughness_override 0.26 - correct_albedo 1 + base_factor 2.5 textures/e1u3/troof4_7: texture_base overrides/troof4_7.tga texture_normals overrides/troof4_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/troof4_8: texture_base overrides/troof4_8.tga texture_normals overrides/troof4_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/troof5_3: texture_base overrides/troof5_3.tga texture_normals overrides/troof5_3_n.tga texture_emissive overrides/troof5_3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u3/troof5_4: texture_base overrides/troof5_4.tga texture_normals overrides/troof5_4_n.tga texture_emissive overrides/troof5_4_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/turret2_1: texture_base overrides/turret2_1.tga texture_normals overrides/turret2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/turret3_1: texture_base overrides/turret3_1.tga texture_normals overrides/turret3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/turret5_1: texture_base overrides/turret5_1.tga texture_normals overrides/turret5_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/turret6_1: texture_base overrides/turret6_1.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/turret7_1: texture_base overrides/turret7_1.tga texture_normals overrides/turret7_1_n.tga texture_emissive overrides/turret7_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/turret8_1: texture_base overrides/turret8_1.tga texture_normals overrides/turret8_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/turret9_1: texture_base overrides/turret9_1.tga texture_normals overrides/turret9_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/watrt1_1: texture_base overrides/watrt1_1.tga texture_normals overrides/watrt1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/watrt1_2: texture_base overrides/watrt1_2.tga texture_normals overrides/watrt1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/watrt2_1: texture_base overrides/watrt2_1.tga texture_normals overrides/watrt2_1_n.tga texture_emissive overrides/watrt2_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/watrt2_2: texture_base overrides/watrt2_2.tga texture_normals overrides/watrt2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/watrt3_2: texture_base overrides/watrt3_2.tga texture_normals overrides/watrt3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/wbox3_1: texture_base overrides/wbox3_1.tga texture_normals overrides/wbox3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/wbox3_2: texture_base overrides/wbox3_2.tga texture_normals overrides/wbox3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/wbox3_4: texture_base overrides/wbox3_4.tga texture_normals overrides/wbox3_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/wbox3_5: texture_base overrides/wbox3_5.tga texture_normals overrides/wbox3_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/wire1_3: texture_base overrides/wire1_3.tga texture_normals overrides/wire1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/wires2_1: texture_base overrides/wires2_1.tga texture_normals overrides/wires2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/wires2_2: texture_base overrides/wires2_2.tga texture_normals overrides/wires2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/wmtal3_1: texture_base overrides/wmtal3_1.tga texture_normals overrides/wmtal3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/wmtal3_3: texture_base overrides/wmtal3_3.tga texture_normals overrides/wmtal3_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/wmtal3_4: texture_base overrides/wmtal3_4.tga texture_normals overrides/wmtal3_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/wmtal3_5: texture_base overrides/wmtal3_5.tga texture_normals overrides/wmtal3_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/wmtal4_2: texture_base overrides/wmtal4_2.tga texture_normals overrides/wmtal4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/wmtal4_4: texture_base overrides/wmtal4_4.tga texture_normals overrides/wmtal4_4_n.tga roughness_override 0.25 - correct_albedo 1 + base_factor 2.5 textures/e1u3/wmtal5_1: texture_base overrides/wmtal5_1.tga texture_normals overrides/wmtal5_1_n.tga roughness_override 0.25 - correct_albedo 1 + base_factor 2.5 textures/e1u3/wmtal5_4: texture_base overrides/wmtal5_4.tga texture_normals overrides/wmtal5_4_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e1u3/wmtal9_1: texture_base overrides/wmtal9_1.tga texture_normals overrides/wmtal9_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/wmtal9_2: texture_base overrides/wmtal9_2.tga texture_normals overrides/wmtal9_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/wmtal9_3: texture_base overrides/wmtal9_3.tga texture_normals overrides/wmtal9_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/wndow0_3: texture_base overrides/wndow0_3.tga texture_normals overrides/wndow0_3_n.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e1u3/wndow1_2: texture_base overrides/wndow1_2.tga texture_normals overrides/wndow1_2_n.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e1u3/wngle1_2: texture_base overrides/wngle1_2.tga texture_normals overrides/wngle1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/wplat1_1: texture_base overrides/wplat1_1.tga texture_normals overrides/wplat1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/wplat1_2: texture_base overrides/wplat1_2.tga texture_normals overrides/wplat1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/wstfl2_5: texture_base overrides/wstfl2_5.tga texture_normals overrides/wstfl2_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/wstfl2_6: texture_base overrides/wstfl2_6.tga texture_normals overrides/wstfl2_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u3/yelfield: texture_base textures/e1u3/yelfield.wal kind WATER - correct_albedo 1 + base_factor 2.5 textures/e1u3/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u4/alarm0: texture_base overrides/alarm0.tga texture_normals overrides/alarm0_n.tga texture_emissive overrides/alarm0_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u4/alarm1: texture_base overrides/alarm1.tga texture_normals overrides/alarm1_n.tga texture_emissive overrides/alarm1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u4/alarm2: texture_base overrides/alarm2.tga texture_normals overrides/alarm2_n.tga texture_emissive overrides/alarm2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u4/alarm3: texture_base overrides/alarm3.tga texture_normals overrides/alarm3_n.tga texture_emissive overrides/alarm3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u4/clip: texture_base overrides/clip.tga - correct_albedo 1 + base_factor 2.5 textures/e1u4/exit1: texture_base overrides/exit1.tga texture_normals overrides/exit1_n.tga texture_emissive overrides/exit1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u4/fmet1_2: texture_base overrides/fmet1_2.tga texture_normals overrides/fmet1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u4/fmet3_1: texture_base overrides/fmet3_1.tga texture_normals overrides/fmet3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u4/jaildr2_2: texture_base overrides/jaildr2_2.tga texture_normals overrides/jaildr2_2_n.tga texture_emissive overrides/jaildr2_2_light.tga emissive_factor 0.05 - correct_albedo 1 + base_factor 2.5 textures/e1u4/origin: texture_base overrides/origin.tga - correct_albedo 1 + base_factor 2.5 textures/e1u4/shooter2: texture_base overrides/shooter2.tga texture_normals overrides/shooter2_n.tga texture_emissive overrides/shooter2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e1u4/sky1: texture_base overrides/sky1.tga kind SKY - correct_albedo 1 + base_factor 2.5 textures/e1u4/tcmet4_4: texture_base overrides/tcmet4_4.tga texture_normals overrides/tcmet4_4_n.tga texture_emissive overrides/tcmet4_4_light.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e1u4/tcmet5_2: texture_base overrides/tcmet5_2.tga texture_normals overrides/tcmet5_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u4/tcmt9_7: texture_base overrides/tcmt9_7.tga texture_normals overrides/tcmt9_7_n.tga texture_emissive overrides/tcmt9_7_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u4/trigger: texture_base overrides/trigger.tga - correct_albedo 1 + base_factor 2.5 textures/e1u4/troof4_2: texture_base overrides/troof4_2.tga texture_normals overrides/troof4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u4/troof4_6: texture_base overrides/troof4_6.tga texture_normals overrides/troof4_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u4/troof5_4: texture_base overrides/troof5_4.tga texture_normals overrides/troof5_4_n.tga texture_emissive overrides/troof5_4_light.tga - correct_albedo 1 + base_factor 2.5 textures/e1u4/wires2_1: texture_base overrides/wires2_1.tga texture_normals overrides/wires2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e1u4/wires2_2: texture_base overrides/wires2_2.tga texture_normals overrides/wires2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/baselt_b: texture_base overrides/baselt_b.png @@ -6772,96 +6938,96 @@ textures/e2u1/baselt_b: texture_emissive overrides/baselt_b_light.tga bump_scale 0.5 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/basic1_1: texture_base overrides/basic1_1.tga texture_normals overrides/basic1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/basic1_2: texture_base overrides/basic1_2.tga texture_normals overrides/basic1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/basic1_4: texture_base overrides/basic1_4.tga texture_normals overrides/basic1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/basic1_5: texture_base overrides/basic1_5.tga texture_normals overrides/basic1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/basic1_7: texture_base overrides/basic1_7.tga texture_normals overrides/basic1_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/basic1_8: texture_base overrides/basic1_8.tga texture_normals overrides/basic1_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/belt2_4: texture_base overrides/belt2_4.tga texture_normals overrides/belt2_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/bigmet1_1: texture_base overrides/bigmet1_1.tga texture_normals overrides/bigmet1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/bigmet1_2: texture_base overrides/bigmet1_2.tga texture_normals overrides/bigmet1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/blank: texture_base overrides/blank.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/blbk2_1: texture_base overrides/blbk2_1.tga texture_normals overrides/blbk2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/bmetal11_1: texture_base overrides/bmetal11_1.tga texture_normals overrides/bmetal11_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/box3_1: texture_base overrides/box3_1.tga texture_normals overrides/box3_1_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e2u1/box3_2: texture_base overrides/box3_2.tga texture_normals overrides/box3_2_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e2u1/box3_3: texture_base overrides/box3_3.tga texture_normals overrides/box3_3_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e2u1/box3_4: texture_base overrides/box3_4.tga texture_normals overrides/box3_4_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e2u1/box3_6: texture_base overrides/box3_6.tga texture_normals overrides/box3_6_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e2u1/brlava: texture_base overrides/brlava.tga @@ -6869,314 +7035,314 @@ textures/e2u1/brlava: texture_emissive overrides/brlava_light.tga emissive_factor 0.2 kind LAVA - correct_albedo 1 + base_factor 2.5 textures/e2u1/broken2_3: texture_base overrides/broken2_3.tga texture_normals overrides/broken2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/btactmach0: texture_base overrides/btactmach0.tga texture_normals overrides/btactmach0_n.tga texture_emissive overrides/btactmach0_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/btactmach1: texture_base overrides/btactmach1.tga texture_normals overrides/btactmach1_n.tga texture_emissive overrides/btactmach1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/btactmach2: texture_base overrides/btactmach2.tga texture_normals overrides/btactmach2_n.tga texture_emissive overrides/btactmach2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/btactmach3: texture_base overrides/btactmach3.tga texture_normals overrides/btactmach3_n.tga texture_emissive overrides/btactmach3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/btelev_dn: texture_base overrides/btelev_dn.tga texture_normals overrides/btelev_dn_n.tga texture_emissive overrides/btelev_dn_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/btelev_dn3: texture_base overrides/btelev_dn3.tga texture_normals overrides/btelev_dn3_n.tga texture_emissive overrides/btelev_dn3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/btelev_up: texture_base overrides/btelev_up.tga texture_normals overrides/btelev_up_n.tga texture_emissive overrides/btelev_up_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/btelev_up3: texture_base overrides/btelev_up3.tga texture_normals overrides/btelev_up3_n.tga texture_emissive overrides/btelev_up3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/btf_off: texture_base overrides/btf_off.tga texture_normals overrides/btf_off_n.tga texture_emissive overrides/btf_off_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/c_met14_1: texture_base overrides/c_met14_1.tga texture_normals overrides/c_met14_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/ceil1_1: texture_base overrides/ceil1_1.tga texture_normals overrides/ceil1_1_n.tga texture_emissive overrides/ceil1_1_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/ceil1_11: texture_base overrides/ceil1_11.tga texture_normals overrides/ceil1_11_n.tga texture_emissive overrides/ceil1_11_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/ceil1_3: texture_base overrides/ceil1_3.tga texture_normals overrides/ceil1_3_n.tga texture_emissive overrides/ceil1_3_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/ceil1_8: texture_base overrides/ceil1_8.tga texture_normals overrides/ceil1_8_n.tga texture_emissive overrides/ceil1_8_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/cindr5_2: texture_base overrides/cindr5_2.tga texture_normals overrides/cindr5_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/cindr8_2: texture_base overrides/cindr8_2.tga texture_normals overrides/cindr8_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/clip: texture_base overrides/clip.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/comp7_1: texture_base overrides/comp7_1.tga texture_normals overrides/comp7_1_n.tga texture_emissive overrides/comp7_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/comp7_2: texture_base overrides/comp7_2.tga texture_normals overrides/comp7_2_n.tga texture_emissive overrides/comp7_2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/comp7_3: texture_base overrides/comp7_3.tga texture_normals overrides/comp7_3_n.tga texture_emissive overrides/comp7_3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/comp8_1: texture_base overrides/comp8_1.tga texture_normals overrides/comp8_1_n.tga texture_emissive overrides/comp8_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/comp9_2: texture_base overrides/comp9_2.tga texture_normals overrides/comp9_2_n.tga texture_emissive overrides/comp9_2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/comp9_3: texture_base overrides/comp9_3.tga texture_normals overrides/comp9_3_n.tga texture_emissive overrides/comp9_3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/compu1_2: texture_base overrides/compu1_2.tga texture_normals overrides/compu1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/compu2_1: texture_base overrides/compu2_1.tga texture_normals overrides/compu2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/crush1_1: texture_base overrides/crush1_1.tga texture_normals overrides/crush1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/crush1_2: texture_base overrides/crush1_2.tga texture_normals overrides/crush1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/crys1_1: texture_base overrides/crys1_1.tga texture_normals overrides/crys1_1_n.tga texture_emissive overrides/crys1_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/crys1_2: texture_base overrides/crys1_2.tga texture_normals overrides/crys1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/crys1_3: texture_base overrides/crys1_3.tga texture_normals overrides/crys1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/cur_0: texture_base overrides/cur_0.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/doorbot: texture_base overrides/doorbot.tga texture_normals overrides/doorbot_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/exit1: texture_base overrides/exit1.tga texture_normals overrides/exit1_n.tga texture_emissive overrides/exit1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/floor3_7: texture_base overrides/floor3_7.tga texture_normals overrides/floor3_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/floorsw0: texture_base overrides/floorsw0.tga texture_normals overrides/floorsw0_n.tga texture_emissive overrides/floorsw0_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/floorsw1: texture_base overrides/floorsw1.tga texture_normals overrides/floorsw1_n.tga texture_emissive overrides/floorsw1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/floorsw2: texture_base overrides/floorsw2.tga texture_normals overrides/floorsw2_n.tga texture_emissive overrides/floorsw2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/floorsw3: texture_base overrides/floorsw3.tga texture_normals overrides/floorsw3_n.tga texture_emissive overrides/floorsw3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/floorswno: texture_base overrides/floorswno.tga texture_normals overrides/floorswno_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/florr1_1: texture_base overrides/florr1_1.tga texture_normals overrides/florr1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/florr1_2: texture_base overrides/florr1_2.tga texture_normals overrides/florr1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/florr1_4: texture_base overrides/florr1_4.tga texture_normals overrides/florr1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/florr1_5: texture_base overrides/florr1_5.tga texture_normals overrides/florr1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/florr1_8: texture_base overrides/florr1_8.tga texture_normals overrides/florr1_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/florr2_5: texture_base overrides/florr2_5.tga texture_normals overrides/florr2_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/florr2_6: texture_base overrides/florr2_6.tga texture_normals overrides/florr2_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/florr2_7: texture_base overrides/florr2_7.tga texture_normals overrides/florr2_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/flr1_1: texture_base overrides/flr1_1.tga texture_normals overrides/flr1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/flr1_2: texture_base overrides/flr1_2.tga texture_normals overrides/flr1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/flr1_3: texture_base overrides/flr1_3.tga texture_normals overrides/flr1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/fmet1_2: texture_base overrides/fmet1_2.tga texture_normals overrides/fmet1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/fmet1_3: texture_base overrides/fmet1_3.tga texture_normals overrides/fmet1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/fmet3_1: texture_base overrides/fmet3_1.tga texture_normals overrides/fmet3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/grass1_7: texture_base overrides/grass1_7.tga @@ -7186,24 +7352,24 @@ textures/e2u1/grass1_7: textures/e2u1/grnx2_5: texture_base overrides/grnx2_5.tga texture_normals overrides/grnx2_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/hdoor1_1: texture_base overrides/hdoor1_1.tga texture_normals overrides/hdoor1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/hdoor1_2: texture_base overrides/hdoor1_2.tga texture_normals overrides/hdoor1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/jaildr2_2: texture_base overrides/jaildr2_2.tga texture_normals overrides/jaildr2_2_n.tga texture_emissive overrides/jaildr2_2_light.tga emissive_factor 0.05 - correct_albedo 1 + base_factor 2.5 textures/e2u1/lava: texture_base overrides/lava.tga @@ -7211,274 +7377,274 @@ textures/e2u1/lava: texture_emissive overrides/lava_light.tga emissive_factor 0.5 kind LAVA - correct_albedo 1 + base_factor 2.5 textures/e2u1/lsrlt1: texture_base overrides/lsrlt1.tga texture_emissive overrides/lsrlt1_light.tga emissive_factor 0.2 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/lzr01_1: texture_base overrides/lzr01_1.tga texture_normals overrides/lzr01_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/lzr01_2: texture_base overrides/lzr01_2.tga texture_normals overrides/lzr01_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/lzr01_4: texture_base overrides/lzr01_4.tga texture_normals overrides/lzr01_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/lzr01_5: texture_base overrides/lzr01_5.tga texture_normals overrides/lzr01_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/lzr02_1: texture_base overrides/lzr02_1.tga texture_normals overrides/lzr02_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/lzr02_2: texture_base overrides/lzr02_2.tga texture_normals overrides/lzr02_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/lzr03_1: texture_base overrides/lzr03_1.tga texture_normals overrides/lzr03_1_n.tga texture_emissive overrides/lzr03_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/mach1_2: texture_base overrides/mach1_2.tga texture_normals overrides/mach1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/met1_1: texture_base overrides/met1_1.tga texture_normals overrides/met1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal17_2: texture_base textures/e2u1/metal17_2.tga texture_normals textures/e2u1/metal17_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal18_1: texture_base textures/e2u1/metal18_1.tga texture_normals textures/e2u1/metal18_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal24_1: texture_base overrides/metal24_1.tga texture_normals overrides/metal24_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal25_3: texture_base overrides/metal25_3.tga texture_normals overrides/metal25_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal32_2: texture_base overrides/metal32_2.tga texture_normals overrides/metal32_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal33_2: texture_base overrides/metal33_2.tga texture_normals overrides/metal33_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal35_1: texture_base overrides/metal35_1.tga texture_normals overrides/metal35_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal36_1: texture_base overrides/metal36_1.tga texture_normals overrides/metal36_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal36_2: texture_base overrides/metal36_2.tga texture_normals overrides/metal36_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal36_3: texture_base overrides/metal36_3.tga texture_normals overrides/metal36_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal36_4: texture_base overrides/metal36_4.tga texture_normals overrides/metal36_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal37_1: texture_base overrides/metal37_1.tga texture_normals overrides/metal37_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal37_2: texture_base overrides/metal37_2.tga texture_normals overrides/metal37_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal37_3: texture_base overrides/metal37_3.tga texture_normals overrides/metal37_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal37_4: texture_base overrides/metal37_4.tga texture_normals overrides/metal37_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal3_1: texture_base textures/e2u1/metal3_1.tga texture_normals textures/e2u1/metal3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal3_2: texture_base textures/e2u1/metal3_2.tga texture_normals textures/e2u1/metal3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal3_3: texture_base textures/e2u1/metal3_3.tga texture_normals textures/e2u1/metal3_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal46_1: texture_base overrides/metal46_1.tga texture_normals overrides/metal46_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal46_4: texture_base overrides/metal46_4.tga texture_normals overrides/metal46_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal4_2: texture_base textures/e2u1/metal4_2.tga texture_normals textures/e2u1/metal4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/metal6_1: texture_base textures/e2u1/metal6_1.tga texture_normals textures/e2u1/metal6_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/mindr1_1: texture_base overrides/mindr1_1.tga texture_normals overrides/mindr1_1_n.tga texture_emissive overrides/mindr1_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine02_1: texture_base overrides/mine02_1.tga texture_normals overrides/mine02_1_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine02_2: texture_base overrides/mine02_2.tga texture_normals overrides/mine02_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine03_1: texture_base overrides/mine03_1.tga texture_normals overrides/mine03_1_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine03_2: texture_base overrides/mine03_2.tga texture_normals overrides/mine03_2_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine04_1: texture_base overrides/mine04_1.tga texture_normals overrides/mine04_1_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine04_2: texture_base overrides/mine04_2.tga texture_normals overrides/mine04_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine05_1: texture_base overrides/mine05_1.tga texture_normals overrides/mine05_1_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine05_2: texture_base overrides/mine05_2.tga texture_normals overrides/mine05_2_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine06_1: texture_base overrides/mine06_1.tga texture_normals overrides/mine06_1_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine06_2: texture_base overrides/mine06_2.tga texture_normals overrides/mine06_2_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine06_3: texture_base overrides/mine06_3.tga texture_normals overrides/mine06_3_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine06_4: texture_base overrides/mine06_4.tga texture_normals overrides/mine06_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine07_1: texture_base overrides/mine07_1.tga texture_normals overrides/mine07_1_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine07_2: texture_base overrides/mine07_2.tga texture_normals overrides/mine07_2_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine07_3: texture_base overrides/mine07_3.tga texture_normals overrides/mine07_3_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine07_4: texture_base overrides/mine07_4.tga texture_normals overrides/mine07_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine08_1: texture_base overrides/mine08_1.tga texture_normals overrides/mine08_1_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine08_3: texture_base overrides/mine08_3.tga @@ -7486,26 +7652,26 @@ textures/e2u1/mine08_3: texture_emissive overrides/mine08_3_light.tga emissive_factor 0.5 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine08_4: texture_base overrides/mine08_4.tga texture_normals overrides/mine08_4_n.tga texture_emissive overrides/mine08_4_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine10_1: texture_base overrides/mine10_1.tga texture_normals overrides/mine10_1_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine10_2: texture_base overrides/mine10_2.tga texture_normals overrides/mine10_2_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine13_1: texture_base overrides/mine13_1.tga @@ -7514,7 +7680,7 @@ textures/e2u1/mine13_1: emissive_factor 0.05 kind CHROME is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine13_2: texture_base overrides/mine13_2.tga @@ -7523,144 +7689,144 @@ textures/e2u1/mine13_2: emissive_factor 0.05 kind CHROME is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine14_1: texture_base overrides/mine14_1.tga texture_normals overrides/mine14_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine15_1: texture_base overrides/mine15_1.tga texture_normals overrides/mine15_1_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u1/mine9_1: texture_base overrides/mine9_1.tga texture_normals overrides/mine9_1_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u1/minlt1_1: texture_base overrides/minlt1_1.tga texture_emissive overrides/minlt1_1_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/minlt1_2: texture_base overrides/minlt1_2.tga texture_normals overrides/minlt1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/minlt1_3: texture_base overrides/minlt1_3.tga texture_normals overrides/minlt1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/minpn3_1: texture_base overrides/minpn3_1.tga texture_normals overrides/minpn3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/mmtl14_1: texture_base overrides/mmtl14_1.tga texture_normals overrides/mmtl14_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/mmtl15_5: texture_base overrides/mmtl15_5.tga texture_normals overrides/mmtl15_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/mmtl16_6: texture_base overrides/mmtl16_6.tga texture_normals overrides/mmtl16_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/mmtl19_1: texture_base overrides/mmtl19_1.tga texture_normals overrides/mmtl19_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/mmtl19_2: texture_base overrides/mmtl19_2.tga texture_normals overrides/mmtl19_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/mmtl20_1: texture_base overrides/mmtl20_1.tga texture_normals overrides/mmtl20_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/mont3_1: texture_base overrides/mont3_1.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/mont3_2: texture_base overrides/mont3_2.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/mud1_1: texture_base textures/e2u1/mud1_1.wal kind WATER - correct_albedo 1 + base_factor 2.5 textures/e2u1/origin: texture_base overrides/origin.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/pilr01_1: texture_base overrides/pilr01_1.tga texture_normals overrides/pilr01_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/pilr01_2: texture_base overrides/pilr01_2.tga texture_normals overrides/pilr01_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/pilr01_3: texture_base overrides/pilr01_3.tga texture_normals overrides/pilr01_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/pilr02_2: texture_base overrides/pilr02_2.tga texture_normals overrides/pilr02_2_n.tga roughness_override 0.591 - correct_albedo 1 + base_factor 2.5 textures/e2u1/pilr03_1: texture_base overrides/pilr03_1.tga texture_normals overrides/pilr03_1_n.tga roughness_override 0.25 - correct_albedo 1 + base_factor 2.5 textures/e2u1/pilr03_3: texture_base overrides/pilr03_3.tga texture_normals overrides/pilr03_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/plate5_2: texture_base overrides/plate5_2.tga texture_normals overrides/plate5_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/rcomp1_4: texture_base overrides/rcomp1_4.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/red1_4: texture_base overrides/red1_4.tga texture_normals overrides/red1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/redlt1_1: texture_base overrides/redlt1_1.tga texture_normals overrides/redlt1_1_n.tga texture_emissive overrides/redlt1_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/redlt1_3: texture_base overrides/redlt1_3.tga @@ -7668,35 +7834,35 @@ textures/e2u1/redlt1_3: texture_emissive overrides/redlt1_3_light.tga emissive_factor 0.1 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/reflt1_10: texture_base overrides/reflt1_10.png texture_normals overrides/reflt1_10_n.tga texture_emissive overrides/reflt1_10_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/reflt1_9: texture_base overrides/reflt1_9.png texture_normals overrides/reflt1_9_n.tga texture_emissive overrides/reflt1_9_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/reflt3_10: texture_base overrides/reflt3_10.png texture_normals overrides/reflt3_10_n.tga texture_emissive overrides/reflt3_10_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/reflt3_11: texture_base overrides/reflt3_11.tga texture_normals overrides/reflt3_11_n.tga texture_emissive overrides/reflt3_11_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/reflt3_2: texture_base overrides/reflt3_2.tga @@ -7704,290 +7870,290 @@ textures/e2u1/reflt3_2: texture_emissive overrides/reflt3_2_light.tga emissive_factor 0.5 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/reflt3_5: texture_base overrides/reflt3_5.tga texture_normals overrides/reflt3_5_n.tga texture_emissive overrides/reflt3_5_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/rock0_1: texture_base overrides/rock0_1.tga texture_normals overrides/rock0_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/rock1_1: texture_base overrides/rock1_1.tga texture_normals overrides/rock1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/rock6_4: texture_base overrides/rock6_4.tga texture_normals overrides/rock6_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/rocks15_2: texture_base overrides/rocks15_2.tga texture_normals overrides/rocks15_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/rocks16_1: texture_base overrides/rocks16_1.tga texture_normals overrides/rocks16_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/rocks17_2: texture_base overrides/rocks17_2.tga texture_normals overrides/rocks17_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/rocks19_1: texture_base overrides/rocks19_1.tga texture_normals overrides/rocks19_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/rocks21_1: texture_base overrides/rocks21_1.tga texture_normals overrides/rocks21_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/rocks22_1: texture_base overrides/rocks22_1.tga texture_normals overrides/rocks22_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/rocks23_2: texture_base overrides/rocks23_2.tga texture_normals overrides/rocks23_2_n.tga texture_emissive overrides/rocks23_2_light.tga emissive_factor 0.2 - correct_albedo 1 + base_factor 2.5 textures/e2u1/rocks24_2: texture_base overrides/rocks24_2.tga texture_normals overrides/rocks24_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/rpip2_1: texture_base overrides/rpip2_1.tga texture_normals overrides/rpip2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/rrock1_2: texture_base overrides/rrock1_2.tga texture_normals overrides/rrock1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/sky1: texture_base overrides/sky1.tga kind SKY - correct_albedo 1 + base_factor 2.5 textures/e2u1/sltfl2_2: texture_base overrides/sltfl2_2.tga texture_normals overrides/sltfl2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/support1_1: texture_base textures/e2u1/support1_1.tga texture_normals textures/e2u1/support1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/support1_3: texture_base overrides/support1_3.tga texture_normals overrides/support1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/temp1_1: texture_base overrides/temp1_1.tga texture_normals overrides/temp1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/thinm1_1: texture_base overrides/thinm1_1.tga texture_normals overrides/thinm1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/tlight03: texture_base overrides/tlight03.tga texture_normals overrides/tlight03_n.tga texture_emissive overrides/tlight03_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/trigger: texture_base overrides/trigger.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/troof4_2: texture_base overrides/troof4_2.tga texture_normals overrides/troof4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/tunl1_5: texture_base overrides/tunl1_5.tga texture_normals overrides/tunl1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/tunl1_7: texture_base overrides/tunl1_7.tga texture_normals overrides/tunl1_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/tunl1_8: texture_base overrides/tunl1_8.tga texture_normals overrides/tunl1_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/tunl2_1: texture_base overrides/tunl2_1.tga texture_normals overrides/tunl2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/tunl2_3: texture_base overrides/tunl2_3.tga texture_normals overrides/tunl2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/tunl3_1: texture_base overrides/tunl3_1.tga texture_normals overrides/tunl3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/tunl3_2: texture_base overrides/tunl3_2.tga texture_normals overrides/tunl3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/tunl3_3: texture_base overrides/tunl3_3.tga texture_normals overrides/tunl3_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/tunl3_4: texture_base overrides/tunl3_4.tga texture_normals overrides/tunl3_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/tunl3_5: texture_base overrides/tunl3_5.tga texture_normals overrides/tunl3_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/tunl3_6: texture_base overrides/tunl3_6.tga texture_normals overrides/tunl3_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/twall5_1: texture_base overrides/twall5_1.tga texture_normals overrides/twall5_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/twr01_1: texture_base overrides/twr01_1.tga texture_normals overrides/twr01_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/twr03_1: texture_base overrides/twr03_1.tga texture_normals overrides/twr03_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/w_white: texture_base overrides/w_white.tga texture_emissive overrides/w_white_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u1/watrt4_1: texture_base overrides/watrt4_1.tga texture_normals overrides/watrt4_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/wmetl2_4: texture_base overrides/wmetl2_4.tga texture_normals overrides/wmetl2_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/wmetl6_1: texture_base overrides/wmetl6_1.tga texture_normals overrides/wmetl6_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u1/wplat1_3: texture_base overrides/wplat1_3.tga texture_normals overrides/wplat1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/+0butn4: texture_base overrides/+0butn4.tga texture_normals overrides/+0butn4_n.tga texture_emissive overrides/+0butn4_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/+0butn8: texture_base overrides/+0butn8.tga texture_normals overrides/+0butn8_n.tga texture_emissive overrides/+0butn8_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/belt1_2: texture_base overrides/belt1_2.tga texture_normals overrides/belt1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/belt2_1: texture_base overrides/belt2_1.tga texture_normals overrides/belt2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/belt2_2: texture_base overrides/belt2_2.tga texture_normals overrides/belt2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/belt2_3: texture_base overrides/belt2_3.tga texture_normals overrides/belt2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/belt2_5: texture_base overrides/belt2_5.tga texture_normals overrides/belt2_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/bluwter: texture_base overrides/bluwter.tga kind WATER - correct_albedo 1 + base_factor 2.5 textures/e2u2/bmetal11_1: texture_base overrides/bmetal11_1.tga texture_normals overrides/bmetal11_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/bmetal11_2: texture_base overrides/bmetal11_2.tga texture_normals overrides/bmetal11_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/bmetal12_1: texture_base overrides/bmetal12_1.tga texture_normals overrides/bmetal12_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/bmetal13_1: texture_base overrides/bmetal13_1.tga texture_normals overrides/bmetal13_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/bmetal13_2: texture_base overrides/bmetal13_2.tga texture_normals overrides/bmetal13_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/brlava: texture_base overrides/brlava.tga @@ -7995,64 +8161,64 @@ textures/e2u2/brlava: texture_emissive overrides/brlava_light.tga emissive_factor 0.2 kind LAVA - correct_albedo 1 + base_factor 2.5 textures/e2u2/broken1_1: texture_base overrides/broken1_1.tga texture_normals overrides/broken1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/broken2_2: texture_base overrides/broken2_2.tga texture_normals overrides/broken2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/brwind5_2: texture_base overrides/brwind5_2.tga texture_normals overrides/brwind5_2_n.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e2u2/btactmach0: texture_base overrides/btactmach0.tga texture_normals overrides/btactmach0_n.tga texture_emissive overrides/btactmach0_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/btactmach1: texture_base overrides/btactmach1.tga texture_normals overrides/btactmach1_n.tga texture_emissive overrides/btactmach1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/btactmach2: texture_base overrides/btactmach2.tga texture_normals overrides/btactmach2_n.tga texture_emissive overrides/btactmach2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/btactmach3: texture_base overrides/btactmach3.tga texture_normals overrides/btactmach3_n.tga texture_emissive overrides/btactmach3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/btf_off: texture_base overrides/btf_off.tga texture_normals overrides/btf_off_n.tga texture_emissive overrides/btf_off_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/ceil1_1: texture_base overrides/ceil1_1.tga texture_normals overrides/ceil1_1_n.tga texture_emissive overrides/ceil1_1_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/ceil1_2: texture_base overrides/ceil1_2.tga @@ -8060,46 +8226,46 @@ textures/e2u2/ceil1_2: texture_emissive overrides/ceil1_2_light.tga bump_scale 0.5 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/ceil1_3: texture_base overrides/ceil1_3.tga texture_normals overrides/ceil1_3_n.tga texture_emissive overrides/ceil1_3_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/ceil1_4: texture_base overrides/ceil1_4.tga texture_normals overrides/ceil1_4_n.tga texture_emissive overrides/ceil1_4_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/ceil1_5: texture_base overrides/ceil1_5.tga texture_normals overrides/ceil1_5_n.tga texture_emissive overrides/ceil1_5_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/ceil1_6: texture_base overrides/ceil1_6.tga texture_normals overrides/ceil1_6_n.tga texture_emissive overrides/ceil1_6_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/ceil1_8: texture_base overrides/ceil1_8.tga texture_normals overrides/ceil1_8_n.tga texture_emissive overrides/ceil1_8_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/clip: texture_base overrides/clip.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/comp2_1: texture_base textures/e2u2/comp2_1.tga @@ -8110,14 +8276,14 @@ textures/e2u2/comp2_1: textures/e2u2/comp2_6: texture_base overrides/comp2_6.tga texture_normals overrides/comp2_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/comp3_2: texture_base overrides/comp3_2.tga texture_normals overrides/comp3_2_n.tga texture_emissive overrides/comp3_2_light.tga kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e2u2/comp3_7: texture_base overrides/comp3_7.tga @@ -8132,18 +8298,18 @@ textures/e2u2/comp3_8: texture_emissive overrides/comp3_8_light.tga emissive_factor 0.02 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e2u2/comp4_2: texture_base overrides/comp4_2.tga texture_normals overrides/comp4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/comp4_3: texture_base overrides/comp4_3.tga texture_normals overrides/comp4_3_n.tga texture_emissive overrides/comp4_3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/comp5_1: texture_base overrides/comp5_1.tga @@ -8157,19 +8323,19 @@ textures/e2u2/comp9_2: texture_emissive overrides/comp9_2_light.tga emissive_factor 0.1 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/comp9_3: texture_base overrides/comp9_3.tga texture_normals overrides/comp9_3_n.tga texture_emissive overrides/comp9_3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/compu1_2: texture_base overrides/compu1_2.tga texture_normals overrides/compu1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/compu1_3: texture_base overrides/compu1_3.tga @@ -8177,352 +8343,352 @@ textures/e2u2/compu1_3: texture_emissive overrides/compu1_3_light.tga emissive_factor 0.05 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/crush1_1: texture_base overrides/crush1_1.tga texture_normals overrides/crush1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/doorbot: texture_base overrides/doorbot.tga texture_normals overrides/doorbot_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/exit1: texture_base overrides/exit1.tga texture_normals overrides/exit1_n.tga texture_emissive overrides/exit1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/flesh1_1: texture_base overrides/flesh1_1.tga roughness_override 0.142 - correct_albedo 1 + base_factor 2.5 kind SLIME textures/e2u2/floor1_2: texture_base textures/e2u2/floor1_2.tga texture_normals textures/e2u2/floor1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/floor1_3: texture_base textures/e2u2/floor1_3.tga texture_normals textures/e2u2/floor1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/floor1_4: texture_base textures/e2u2/floor1_4.tga texture_normals textures/e2u2/floor1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/floor1_5: texture_base textures/e2u2/floor1_5.tga texture_normals textures/e2u2/floor1_5_n.tga roughness_override 0.244 - correct_albedo 1 + base_factor 2.5 textures/e2u2/floor1_7: texture_base textures/e2u2/floor1_7.tga texture_normals textures/e2u2/floor1_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/floor1_8: texture_base textures/e2u2/floor1_8.tga texture_normals textures/e2u2/floor1_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/floor2_4: texture_base textures/e2u2/floor2_4.tga texture_normals textures/e2u2/floor2_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/floor2_5: texture_base textures/e2u2/floor2_5.tga texture_normals textures/e2u2/floor2_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/floor2_6: texture_base textures/e2u2/floor2_6.tga texture_normals textures/e2u2/floor2_6_n.tga roughness_override 1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/floor2_7: texture_base textures/e2u2/floor2_7.tga texture_normals textures/e2u2/floor2_7_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e2u2/floor2_8: texture_base textures/e2u2/floor2_8.tga texture_normals textures/e2u2/floor2_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/flr1_1: texture_base overrides/flr1_1.tga texture_normals overrides/flr1_1_n.tga roughness_override 0.614 - correct_albedo 1 + base_factor 2.5 textures/e2u2/flr1_2: texture_base overrides/flr1_2.tga texture_normals overrides/flr1_2_n.tga roughness_override 0.622 - correct_albedo 1 + base_factor 2.5 textures/e2u2/flr1_3: texture_base overrides/flr1_3.tga texture_normals overrides/flr1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/hint: texture_base overrides/hint.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/lava: texture_base overrides/lava.tga texture_normals overrides/lava_n.tga texture_emissive overrides/lava_light.tga kind LAVA - correct_albedo 1 + base_factor 2.5 textures/e2u2/mach1_3: texture_base overrides/mach1_3.tga texture_normals overrides/mach1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/mach1_5: texture_base overrides/mach1_5.tga texture_normals overrides/mach1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal16_1: texture_base textures/e2u2/metal16_1.tga texture_normals textures/e2u2/metal16_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal16_4: texture_base overrides/metal16_4.tga texture_normals overrides/metal16_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal18_1: texture_base textures/e2u2/metal18_1.tga texture_normals textures/e2u2/metal18_1_n.tga roughness_override 0.488 - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal18_2: texture_base textures/e2u2/metal18_2.tga texture_normals textures/e2u2/metal18_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal19_1: texture_base textures/e2u2/metal19_1.tga texture_normals textures/e2u2/metal19_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal22_2: texture_base textures/e2u2/metal22_2.tga texture_normals textures/e2u2/metal22_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal24_1: texture_base overrides/metal24_1.tga texture_normals overrides/metal24_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal24_2: texture_base overrides/metal24_2.tga texture_normals overrides/metal24_2_n.tga roughness_override 0.3 - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal24_3: texture_base overrides/metal24_3.tga texture_normals overrides/metal24_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal24_4: texture_base overrides/metal24_4.tga texture_normals overrides/metal24_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal25_2: texture_base overrides/metal25_2.tga texture_normals overrides/metal25_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal25_3: texture_base overrides/metal25_3.tga texture_normals overrides/metal25_3_n.tga roughness_override 0.8 metalness_factor 0 - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal27_1: texture_base overrides/metal27_1.tga texture_normals overrides/metal27_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal28_1: texture_base overrides/metal28_1.tga texture_normals overrides/metal28_1_n.tga roughness_override 0.6 metalness_factor 0 - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal29_2: texture_base overrides/metal29_2.tga texture_normals overrides/metal29_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal33_1: texture_base overrides/metal33_1.tga texture_normals overrides/metal33_1_n.tga roughness_override 0.606 - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal34_2: texture_base overrides/metal34_2.tga texture_normals overrides/metal34_2_n.tga roughness_override 0.504 - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal35_1: texture_base overrides/metal35_1.tga texture_normals overrides/metal35_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal36_3: texture_base overrides/metal36_3.tga texture_normals overrides/metal36_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal36_4: texture_base overrides/metal36_4.tga texture_normals overrides/metal36_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal37_1: texture_base overrides/metal37_1.tga texture_normals overrides/metal37_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal37_2: texture_base overrides/metal37_2.tga texture_normals overrides/metal37_2_n.tga roughness_override 0.488 - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal37_3: texture_base overrides/metal37_3.tga texture_normals overrides/metal37_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal3_1: texture_base textures/e2u2/metal3_1.tga texture_normals textures/e2u2/metal3_1_n.tga roughness_override 0.74 - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal42_2: texture_base overrides/metal42_2.tga texture_normals overrides/metal42_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal43_2: texture_base overrides/metal43_2.tga texture_normals overrides/metal43_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal47_1: texture_base overrides/metal47_1.tga texture_normals overrides/metal47_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/metal47_2: texture_base overrides/metal47_2.tga texture_normals overrides/metal47_2_n.tga roughness_override 0.575 - correct_albedo 1 + base_factor 2.5 textures/e2u2/mine03_1: texture_base overrides/mine03_1.tga texture_normals overrides/mine03_1_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u2/mine03_2: texture_base overrides/mine03_2.tga texture_normals overrides/mine03_2_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u2/mine04_1: texture_base overrides/mine04_1.tga texture_normals overrides/mine04_1_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u2/mine04_2: texture_base overrides/mine04_2.tga texture_normals overrides/mine04_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/mine05_1: texture_base overrides/mine05_1.tga texture_normals overrides/mine05_1_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e2u2/notch1_1: texture_base overrides/notch1_1.tga texture_normals overrides/notch1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/notch1_2: texture_base overrides/notch1_2.tga texture_normals overrides/notch1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/notch3_2: texture_base overrides/notch3_2.tga texture_normals overrides/notch3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/notch4_2: texture_base overrides/notch4_2.tga texture_normals overrides/notch4_2_n.tga texture_emissive overrides/notch4_2_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/origin: texture_base overrides/origin.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/pilr01_1: texture_base overrides/pilr01_1.tga texture_normals overrides/pilr01_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/pilr01_3: texture_base overrides/pilr01_3.tga texture_normals overrides/pilr01_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/pilr02_1: texture_base overrides/pilr02_1.tga texture_normals overrides/pilr02_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/pilr02_2: texture_base overrides/pilr02_2.tga texture_normals overrides/pilr02_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/pipe1_4: texture_base textures/e2u2/pipe1_4.tga @@ -8531,53 +8697,53 @@ textures/e2u2/pipe1_4: textures/e2u2/plate2_1: texture_base overrides/plate2_1.tga texture_normals overrides/plate2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/plate2_5: texture_base overrides/plate2_5.tga texture_normals overrides/plate2_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/red1_4: texture_base overrides/red1_4.tga texture_normals overrides/red1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/red1_6: texture_base overrides/red1_6.tga texture_normals overrides/red1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/redmt1_2: texture_base overrides/redmt1_2.tga texture_normals overrides/redmt1_2_n.tga roughness_override 0.661 - correct_albedo 1 + base_factor 2.5 textures/e2u2/reds1_2: texture_base overrides/reds1_2.tga texture_normals overrides/reds1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/refdr1_1: texture_base overrides/refdr1_1.tga texture_normals overrides/refdr1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/refdr4_4: texture_base overrides/refdr4_4.tga texture_normals overrides/refdr4_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/refdr9_2: texture_base overrides/refdr9_2.tga texture_normals overrides/refdr9_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/refdr9_3: texture_base overrides/refdr9_3.tga texture_normals overrides/refdr9_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/reflt1_1: texture_base overrides/reflt1_1.tga @@ -8586,35 +8752,35 @@ textures/e2u2/reflt1_1: roughness_override 0.3 emissive_factor 0.2 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/reflt1_10: texture_base overrides/reflt1_10.png texture_normals overrides/reflt1_10_n.tga texture_emissive overrides/reflt1_10_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/reflt1_11: texture_base overrides/reflt1_11.tga texture_normals overrides/reflt1_11_n.tga texture_emissive overrides/reflt1_11_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/reflt3_10: texture_base overrides/reflt3_10.png texture_normals overrides/reflt3_10_n.tga texture_emissive overrides/reflt3_10_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/reflt3_11: texture_base overrides/reflt3_11.tga texture_normals overrides/reflt3_11_n.tga texture_emissive overrides/reflt3_11_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/reflt3_2: texture_base overrides/reflt3_2.tga @@ -8622,437 +8788,437 @@ textures/e2u2/reflt3_2: texture_emissive overrides/reflt3_2_light.tga emissive_factor 0.5 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/reflt3_9: texture_base overrides/reflt3_9.png texture_normals overrides/reflt3_9_n.tga texture_emissive overrides/reflt3_9_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u2/rflr2_1: texture_base overrides/rflr2_1.tga texture_normals overrides/rflr2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/rock0_1: texture_base overrides/rock0_1.tga texture_normals overrides/rock0_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/rock25_1: texture_base overrides/rock25_1.tga texture_normals overrides/rock25_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/rocks15_2: texture_base overrides/rocks15_2.tga texture_normals overrides/rocks15_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/rocks19_1: texture_base overrides/rocks19_1.tga texture_normals overrides/rocks19_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/rocks24_1: texture_base overrides/rocks24_1.tga texture_normals overrides/rocks24_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/rpip2_2: texture_base overrides/rpip2_2.tga texture_normals overrides/rpip2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/sign1_1: texture_base textures/e2u2/sign1_1.tga texture_normals textures/e2u2/sign1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/sign1_4: texture_base overrides/sign1_4.tga texture_normals overrides/sign1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/sky1: texture_base overrides/sky1.tga kind SKY - correct_albedo 1 + base_factor 2.5 textures/e2u2/support1_1: texture_base textures/e2u2/support1_1.tga texture_normals textures/e2u2/support1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/temp1_1: texture_base overrides/temp1_1.tga texture_normals overrides/temp1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/timpod5_1: texture_base overrides/timpod5_1.tga texture_normals overrides/timpod5_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/trigger: texture_base overrides/trigger.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/window4_2: texture_base overrides/window4_2.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e2u2/wndow0_1: texture_base overrides/wndow0_1.tga texture_normals overrides/wndow0_1_n.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e2u2/wndow1_1: texture_base overrides/wndow1_1.tga texture_normals overrides/wndow1_1_n.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e2u2/wndow1_2: texture_base overrides/wndow1_2.tga texture_normals overrides/wndow1_2_n.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e2u2/wndow1_8: texture_base overrides/wndow1_8.tga texture_normals overrides/wndow1_8_n.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e2u2/yelfield: texture_base textures/e2u2/yelfield.wal kind WATER - correct_albedo 1 + base_factor 2.5 textures/e2u2/yellow1_2: texture_base overrides/yellow1_2.tga texture_normals overrides/yellow1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u2/yellow1_6: texture_base overrides/yellow1_6.tga texture_normals overrides/yellow1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/baselt_6: texture_base overrides/baselt_6.tga texture_normals overrides/baselt_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/baselt_a: texture_base overrides/baselt_a.png texture_normals overrides/baselt_a_n.tga texture_emissive overrides/baselt_a_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/baselt_blu: texture_base overrides/baselt_blu.tga texture_normals overrides/baselt_blu_n.tga texture_emissive overrides/baselt_blu_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/baselt_c: texture_base overrides/baselt_c.tga texture_normals overrides/baselt_c_n.tga texture_emissive overrides/baselt_c_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/baselt_d: texture_base overrides/baselt_d.tga texture_normals overrides/baselt_d_n.tga texture_emissive overrides/baselt_d_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/baselt_dx: texture_base overrides/baselt_dx.tga texture_normals overrides/baselt_dx_n.tga texture_emissive overrides/baselt_dx_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/baselt_wht: texture_base overrides/baselt_wht.tga texture_normals overrides/baselt_wht_n.tga texture_emissive overrides/baselt_wht_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/baselt_whte: texture_base overrides/baselt_whte.tga texture_normals overrides/baselt_whte_n.tga texture_emissive overrides/baselt_whte_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/belt1_2: texture_base overrides/belt1_2.tga texture_normals overrides/belt1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blbk1_1: texture_base overrides/blbk1_1.tga texture_normals overrides/blbk1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blbk1_2: texture_base overrides/blbk1_2.tga texture_normals overrides/blbk1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blbk2_1: texture_base overrides/blbk2_1.tga texture_normals overrides/blbk2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blum10_2: texture_base overrides/blum10_2.tga texture_normals overrides/blum10_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blum11_1: texture_base overrides/blum11_1.tga texture_normals overrides/blum11_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blum12_1: texture_base overrides/blum12_1.tga texture_normals overrides/blum12_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blum12_2: texture_base overrides/blum12_2.tga texture_normals overrides/blum12_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blum13_1: texture_base overrides/blum13_1.tga texture_normals overrides/blum13_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blum14_1: texture_base overrides/blum14_1.tga texture_normals overrides/blum14_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blum15_1: texture_base overrides/blum15_1.tga texture_normals overrides/blum15_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blum15_2: texture_base overrides/blum15_2.tga texture_normals overrides/blum15_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blume3_1: texture_base overrides/blume3_1.tga texture_normals overrides/blume3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blume4_1: texture_base overrides/blume4_1.tga texture_normals overrides/blume4_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blume4_2: texture_base overrides/blume4_2.tga texture_normals overrides/blume4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blume5_1: texture_base overrides/blume5_1.tga texture_normals overrides/blume5_1_n.tga texture_emissive overrides/blume5_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blume5_2: texture_base overrides/blume5_2.tga texture_normals overrides/blume5_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blume6_1: texture_base overrides/blume6_1.tga texture_normals overrides/blume6_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blume6_2: texture_base overrides/blume6_2.tga texture_normals overrides/blume6_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blume7_1: texture_base overrides/blume7_1.tga texture_normals overrides/blume7_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blume7_2: texture_base overrides/blume7_2.tga texture_normals overrides/blume7_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blume8_1: texture_base overrides/blume8_1.tga texture_normals overrides/blume8_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blume9_1: texture_base overrides/blume9_1.tga texture_normals overrides/blume9_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blume9_2: texture_base overrides/blume9_2.tga texture_normals overrides/blume9_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/blumt2_6: texture_base overrides/blumt2_6.tga texture_normals overrides/blumt2_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/bluwter: texture_base overrides/bluwter.tga kind WATER - correct_albedo 1 + base_factor 2.5 textures/e2u3/bmetal11_1: texture_base overrides/bmetal11_1.tga texture_normals overrides/bmetal11_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/bmetal11_2: texture_base overrides/bmetal11_2.tga texture_normals overrides/bmetal11_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/bmetal12_1: texture_base overrides/bmetal12_1.tga texture_normals overrides/bmetal12_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/bmetal13_2: texture_base overrides/bmetal13_2.tga texture_normals overrides/bmetal13_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/bmetl2_1: texture_base overrides/bmetl2_1.tga texture_normals overrides/bmetl2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/bmtb13_1: texture_base overrides/bmtb13_1.tga texture_normals overrides/bmtb13_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/bossdr1: texture_base overrides/bossdr1.tga texture_normals overrides/bossdr1_n.tga texture_emissive overrides/bossdr1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/bossdr2: texture_base overrides/bossdr2.tga texture_normals overrides/bossdr2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/broken2_3: texture_base overrides/broken2_3.tga texture_normals overrides/broken2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/btactmach0: texture_base overrides/btactmach0.tga texture_normals overrides/btactmach0_n.tga texture_emissive overrides/btactmach0_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/btactmach1: texture_base overrides/btactmach1.tga texture_normals overrides/btactmach1_n.tga texture_emissive overrides/btactmach1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/btactmach2: texture_base overrides/btactmach2.tga texture_normals overrides/btactmach2_n.tga texture_emissive overrides/btactmach2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/btactmach3: texture_base overrides/btactmach3.tga texture_normals overrides/btactmach3_n.tga texture_emissive overrides/btactmach3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/btelev_up: texture_base overrides/btelev_up.tga texture_normals overrides/btelev_up_n.tga texture_emissive overrides/btelev_up_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/btelev_up3: texture_base overrides/btelev_up3.tga texture_normals overrides/btelev_up3_n.tga texture_emissive overrides/btelev_up3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/btf_off: texture_base overrides/btf_off.tga texture_normals overrides/btf_off_n.tga texture_emissive overrides/btf_off_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/ceil1_1: texture_base overrides/ceil1_1.tga texture_normals overrides/ceil1_1_n.tga texture_emissive overrides/ceil1_1_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/ceil1_11: texture_base overrides/ceil1_11.tga texture_normals overrides/ceil1_11_n.tga texture_emissive overrides/ceil1_11_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/ceil1_13: texture_base overrides/ceil1_13.tga texture_normals overrides/ceil1_13_n.tga texture_emissive overrides/ceil1_13_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/ceil1_14: texture_base overrides/ceil1_14.tga texture_normals overrides/ceil1_14_n.tga texture_emissive overrides/ceil1_14_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/ceil1_2: texture_base overrides/ceil1_2.tga @@ -9060,67 +9226,67 @@ textures/e2u3/ceil1_2: texture_emissive overrides/ceil1_2_light.tga bump_scale 0.5 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/ceil1_22: texture_base overrides/ceil1_22.tga texture_normals overrides/ceil1_22_n.tga texture_emissive overrides/ceil1_22_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/ceil1_28: texture_base overrides/ceil1_28.tga texture_normals overrides/ceil1_28_n.tga texture_emissive overrides/ceil1_28_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/ceil1_3: texture_base overrides/ceil1_3.tga texture_normals overrides/ceil1_3_n.tga texture_emissive overrides/ceil1_3_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/ceil1_4: texture_base overrides/ceil1_4.tga texture_normals overrides/ceil1_4_n.tga texture_emissive overrides/ceil1_4_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/ceil1_5: texture_base overrides/ceil1_5.tga texture_normals overrides/ceil1_5_n.tga texture_emissive overrides/ceil1_5_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/ceil1_6: texture_base overrides/ceil1_6.tga texture_normals overrides/ceil1_6_n.tga texture_emissive overrides/ceil1_6_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/ceil1_7: texture_base overrides/ceil1_7.tga texture_normals overrides/ceil1_7_n.tga texture_emissive overrides/ceil1_7_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/ceil1_8: texture_base overrides/ceil1_8.tga texture_normals overrides/ceil1_8_n.tga texture_emissive overrides/ceil1_8_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/clip: texture_base overrides/clip.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/comp1_1: texture_base overrides/comp1_1.tga @@ -9128,7 +9294,7 @@ textures/e2u3/comp1_1: texture_emissive overrides/comp1_1_light.tga emissive_factor 0.02 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e2u3/comp1_3: texture_base overrides/comp1_3.tga @@ -9136,779 +9302,783 @@ textures/e2u3/comp1_3: texture_emissive overrides/comp1_3_light.tga emissive_factor 0.05 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e2u3/comp1_5: texture_base overrides/comp1_5.tga texture_normals overrides/comp1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/comp1_8: texture_base overrides/comp1_8.tga texture_normals overrides/comp1_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/con1_1: texture_base textures/e2u3/con1_1.tga texture_normals textures/e2u3/con1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/core1_1: texture_base overrides/core1_1.tga texture_normals overrides/core1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/core1_3: texture_base overrides/core1_3.tga texture_normals overrides/core1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/core1_4: texture_base overrides/core1_4.tga texture_normals overrides/core1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/core2_3: texture_base overrides/core2_3.tga texture_normals overrides/core2_3_n.tga texture_emissive overrides/core2_3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/core2_4: texture_base overrides/core2_4.tga texture_normals overrides/core2_4_n.tga texture_emissive overrides/core2_4_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/core3_1: texture_base overrides/core3_1.tga texture_normals overrides/core3_1_n.tga texture_emissive overrides/core3_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/core3_3: texture_base overrides/core3_3.tga texture_normals overrides/core3_3_n.tga texture_emissive overrides/core3_3_light.tga emissive_factor 0.005 - correct_albedo 1 + base_factor 2.5 textures/e2u3/core4_1: texture_base overrides/core4_1.tga texture_normals overrides/core4_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/core4_3: texture_base overrides/core4_3.tga texture_normals overrides/core4_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/core4_4: texture_base overrides/core4_4.tga texture_normals overrides/core4_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/core5_1: texture_base overrides/core5_1.tga texture_normals overrides/core5_1_n.tga texture_emissive overrides/core5_1_light.tga emissive_factor 0.05 - correct_albedo 1 + base_factor 2.5 textures/e2u3/core5_3: texture_base overrides/core5_3.tga texture_normals overrides/core5_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/core5_4: texture_base overrides/core5_4.tga texture_normals overrides/core5_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/core6_1: texture_base overrides/core6_1.tga texture_normals overrides/core6_1_n.tga texture_emissive overrides/core6_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/core6_3: texture_base overrides/core6_3.tga texture_normals overrides/core6_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/core7_3: texture_base overrides/core7_3.tga texture_normals overrides/core7_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/core7_4: texture_base overrides/core7_4.tga texture_normals overrides/core7_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/door01: texture_base overrides/door01.tga texture_normals overrides/door01_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/dopfish: texture_base overrides/dopfish.tga texture_normals overrides/dopfish_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/dr03_1: texture_base overrides/dr03_1.tga texture_normals overrides/dr03_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/dr03_2: texture_base overrides/dr03_2.tga texture_normals overrides/dr03_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/drsew1_1: texture_base overrides/drsew1_1.tga texture_normals overrides/drsew1_1_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/drsew2_1: texture_base overrides/drsew2_1.tga texture_normals overrides/drsew2_1_n.tga texture_emissive overrides/drsew2_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/drsew2_2: texture_base overrides/drsew2_2.tga texture_normals overrides/drsew2_2_n.tga texture_emissive overrides/drsew2_2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/dump1_1: texture_base overrides/dump1_1.tga texture_normals overrides/dump1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/dump1_2: texture_base overrides/dump1_2.tga texture_normals overrides/dump1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/dump3_1: texture_base overrides/dump3_1.tga texture_normals overrides/dump3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/dump3_2: texture_base overrides/dump3_2.tga texture_normals overrides/dump3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/exit1: texture_base overrides/exit1.tga texture_normals overrides/exit1_n.tga texture_emissive overrides/exit1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/floor1_2: texture_base textures/e2u3/floor1_2.tga texture_normals textures/e2u3/floor1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floor1_3: texture_base textures/e2u3/floor1_3.tga texture_normals textures/e2u3/floor1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floor1_4: texture_base textures/e2u3/floor1_4.tga texture_normals textures/e2u3/floor1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floor1_5: texture_base textures/e2u3/floor1_5.tga texture_normals textures/e2u3/floor1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floor1_6: texture_base overrides/floor1_6.tga texture_normals overrides/floor1_6_n.tga bump_scale 0.4 - correct_albedo 1 + base_factor 2.5 textures/e2u3/floor1_7: texture_base textures/e2u3/floor1_7.tga texture_normals textures/e2u3/floor1_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floor1_8: texture_base textures/e2u3/floor1_8.tga texture_normals textures/e2u3/floor1_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floor2_1: texture_base overrides/floor2_1.tga texture_normals overrides/floor2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floor2_4: texture_base textures/e2u3/floor2_4.tga texture_normals textures/e2u3/floor2_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floor2_5: texture_base textures/e2u3/floor2_5.tga texture_normals textures/e2u3/floor2_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floor2_6: texture_base textures/e2u3/floor2_6.tga texture_normals textures/e2u3/floor2_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floor2_7: texture_base textures/e2u3/floor2_7.tga texture_normals textures/e2u3/floor2_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floor2_8: texture_base textures/e2u3/floor2_8.tga texture_normals textures/e2u3/floor2_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floor3_2: texture_base textures/e2u3/floor3_2.tga texture_normals textures/e2u3/floor3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floor3_3: texture_base textures/e2u3/floor3_3.tga texture_normals textures/e2u3/floor3_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floor3_5: texture_base overrides/floor3_5.tga texture_normals overrides/floor3_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floor3_6: texture_base overrides/floor3_6.tga texture_normals overrides/floor3_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floor3_7: texture_base overrides/floor3_7.tga texture_normals overrides/floor3_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floorsw0: texture_base overrides/floorsw0.tga texture_normals overrides/floorsw0_n.tga texture_emissive overrides/floorsw0_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floorsw1: texture_base overrides/floorsw1.tga texture_normals overrides/floorsw1_n.tga texture_emissive overrides/floorsw1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floorsw2: texture_base overrides/floorsw2.tga texture_normals overrides/floorsw2_n.tga texture_emissive overrides/floorsw2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floorsw3: texture_base overrides/floorsw3.tga texture_normals overrides/floorsw3_n.tga texture_emissive overrides/floorsw3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/floorswno: texture_base overrides/floorswno.tga texture_normals overrides/floorswno_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/florr1_1: texture_base overrides/florr1_1.tga texture_normals overrides/florr1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/florr1_2: texture_base overrides/florr1_2.tga texture_normals overrides/florr1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/florr1_4: texture_base overrides/florr1_4.tga texture_normals overrides/florr1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/florr1_5: texture_base overrides/florr1_5.tga texture_normals overrides/florr1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/florr1_7: texture_base overrides/florr1_7.tga texture_normals overrides/florr1_7_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e2u3/florr1_8: texture_base overrides/florr1_8.tga texture_normals overrides/florr1_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/florr2_4: texture_base overrides/florr2_4.tga texture_normals overrides/florr2_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/florr2_5: texture_base overrides/florr2_5.tga texture_normals overrides/florr2_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/florr2_7: texture_base overrides/florr2_7.tga texture_normals overrides/florr2_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/flr1_1: texture_base overrides/flr1_1.tga texture_normals overrides/flr1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/flr1_2: texture_base overrides/flr1_2.tga texture_normals overrides/flr1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/flr1_3: texture_base overrides/flr1_3.tga texture_normals overrides/flr1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/grass1_2: texture_base overrides/grass1_2.tga texture_normals overrides/grass1_2_n.tga + base_factor 2 + specular_factor 0 textures/e2u3/grass1_7: texture_base overrides/grass1_7.tga texture_normals overrides/grass1_7_n.tga + base_factor 2 + specular_factor 0 textures/e2u3/grate1_1: texture_base textures/e2u3/grate1_1.tga texture_normals textures/e2u3/grate1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/grate1_2: texture_base overrides/grate1_2.tga texture_normals overrides/grate1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/grate1_4: texture_base textures/e2u3/grate1_4.tga texture_normals textures/e2u3/grate1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/green0_1: texture_base overrides/green0_1.tga texture_normals overrides/green0_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/green0_2: texture_base overrides/green0_2.tga texture_normals overrides/green0_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/green2_1: texture_base overrides/green2_1.tga texture_normals overrides/green2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/green2_2: texture_base overrides/green2_2.tga texture_normals overrides/green2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/green2_3: texture_base overrides/green2_3.tga texture_normals overrides/green2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/green3_1: texture_base overrides/green3_1.tga texture_normals overrides/green3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/green3_2: texture_base overrides/green3_2.tga texture_normals overrides/green3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/green3_3: texture_base overrides/green3_3.tga texture_normals overrides/green3_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/green3_4: texture_base overrides/green3_4.tga texture_normals overrides/green3_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/grnx2_1: texture_base overrides/grnx2_1.tga texture_normals overrides/grnx2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/grnx2_2: texture_base overrides/grnx2_2.tga texture_normals overrides/grnx2_2_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e2u3/grnx2_3: texture_base overrides/grnx2_3.tga texture_normals overrides/grnx2_3_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e2u3/grnx2_5: texture_base overrides/grnx2_5.tga texture_normals overrides/grnx2_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/grnx2_8: texture_base overrides/grnx2_8.tga texture_normals overrides/grnx2_8_n.tga bump_scale 0.3 - correct_albedo 1 + base_factor 2.5 textures/e2u3/head1_1: texture_base overrides/head1_1.tga texture_normals overrides/head1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/hint: texture_base overrides/hint.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/keydran1_1: texture_base overrides/keydran1_1.tga texture_normals overrides/keydran1_1_n.tga texture_emissive overrides/keydran1_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/keydran2_1: texture_base overrides/keydran2_1.tga texture_normals overrides/keydran2_1_n.tga texture_emissive overrides/keydran2_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/laserbut0: texture_base overrides/laserbut0.tga texture_normals overrides/laserbut0_n.tga texture_emissive overrides/laserbut0_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/laserbut1: texture_base overrides/laserbut1.tga texture_normals overrides/laserbut1_n.tga texture_emissive overrides/laserbut1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/laserbut2: texture_base overrides/laserbut2.tga texture_normals overrides/laserbut2_n.tga texture_emissive overrides/laserbut2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/laserbut3: texture_base overrides/laserbut3.tga texture_normals overrides/laserbut3_n.tga texture_emissive overrides/laserbut3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/laserside: texture_base overrides/laserside.tga texture_normals overrides/laserside_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/lbutt5_4: texture_base overrides/lbutt5_4.tga texture_normals overrides/lbutt5_4_n.tga texture_emissive overrides/lbutt5_4_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/lead1_1: texture_base overrides/lead1_1.tga texture_normals overrides/lead1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/lead1_2: texture_base overrides/lead1_2.tga texture_normals overrides/lead1_2_n.tga bump_scale 0.3 - correct_albedo 1 + base_factor 2.5 textures/e2u3/lead2_1: texture_base overrides/lead2_1.tga texture_normals overrides/lead2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/mach1_1: texture_base overrides/mach1_1.tga texture_normals overrides/mach1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/mach1_2: texture_base overrides/mach1_2.tga texture_normals overrides/mach1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/machine1: texture_base overrides/machine1.tga texture_normals overrides/machine1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal14_1: texture_base textures/e2u3/metal14_1.tga texture_normals textures/e2u3/metal14_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal14_3: texture_base overrides/metal14_3.tga texture_normals overrides/metal14_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal15_1: texture_base overrides/metal15_1.tga texture_normals overrides/metal15_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal15_2: texture_base textures/e2u3/metal15_2.tga texture_normals textures/e2u3/metal15_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal16_1: texture_base textures/e2u3/metal16_1.tga texture_normals textures/e2u3/metal16_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal16_2: texture_base textures/e2u3/metal16_2.tga texture_normals textures/e2u3/metal16_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal17_1: texture_base textures/e2u3/metal17_1.tga texture_normals textures/e2u3/metal17_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal17_2: texture_base textures/e2u3/metal17_2.tga texture_normals textures/e2u3/metal17_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal18_2: texture_base textures/e2u3/metal18_2.tga texture_normals textures/e2u3/metal18_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal1_1: texture_base textures/e2u3/metal1_1.tga texture_normals textures/e2u3/metal1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal1_2: texture_base textures/e2u3/metal1_2.tga texture_normals textures/e2u3/metal1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal24_2: texture_base overrides/metal24_2.tga texture_normals overrides/metal24_2_n.tga roughness_override 0.3 - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal24_3: texture_base overrides/metal24_3.tga texture_normals overrides/metal24_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal25_2: texture_base overrides/metal25_2.tga texture_normals overrides/metal25_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal25_3: texture_base overrides/metal25_3.tga texture_normals overrides/metal25_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal2_1: texture_base textures/e2u3/metal2_1.tga texture_normals textures/e2u3/metal2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal2_2: texture_base textures/e2u3/metal2_2.tga texture_normals textures/e2u3/metal2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal33_2: texture_base overrides/metal33_2.tga texture_normals overrides/metal33_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal35_1: texture_base overrides/metal35_1.tga texture_normals overrides/metal35_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal3_1: texture_base textures/e2u3/metal3_1.tga texture_normals textures/e2u3/metal3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal4_1: texture_base textures/e2u3/metal4_1.tga texture_normals textures/e2u3/metal4_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal4_2: texture_base textures/e2u3/metal4_2.tga texture_normals textures/e2u3/metal4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal5_1: texture_base textures/e2u3/metal5_1.tga texture_normals textures/e2u3/metal5_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal5_2: texture_base textures/e2u3/metal5_2.tga texture_normals textures/e2u3/metal5_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal6_1: texture_base textures/e2u3/metal6_1.tga texture_normals textures/e2u3/metal6_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal7_1: texture_base overrides/metal7_1.tga texture_normals overrides/metal7_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal8_1: texture_base textures/e2u3/metal8_1.tga texture_normals textures/e2u3/metal8_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metal9_1: texture_base textures/e2u3/metal9_1.tga texture_normals textures/e2u3/metal9_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metl10_2: texture_base overrides/metl10_2.tga texture_normals overrides/metl10_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metl12_1: texture_base overrides/metl12_1.tga texture_normals overrides/metl12_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/metl5b_1: texture_base overrides/metl5b_1.tga texture_normals overrides/metl5b_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/mont1_1: texture_base overrides/mont1_1.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/mont1_3: texture_base overrides/mont1_3.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/mont1_4: texture_base overrides/mont1_4.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/mont1_4tr: texture_base overrides/mont1_4tr.tga texture_emissive overrides/mont1_4tr_light.tga emissive_factor 0.01 kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e2u3/ometal2_1: texture_base overrides/ometal2_1.tga texture_normals overrides/ometal2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/origin: texture_base overrides/origin.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/ourpic1_1: texture_base overrides/ourpic1_1.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/ourpic2_1: texture_base overrides/ourpic2_1.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/ourpic2_2: texture_base overrides/ourpic2_2.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/ourpic3_1: texture_base overrides/ourpic3_1.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/ourpic3_2: texture_base overrides/ourpic3_2.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/ourpic4_1: texture_base overrides/ourpic4_1.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/ourpic4_2: texture_base overrides/ourpic4_2.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/ourpic5_1: texture_base overrides/ourpic5_1.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/ourpic5_2: texture_base overrides/ourpic5_2.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/ourpic6_1: texture_base overrides/ourpic6_1.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/ourpic6_2: texture_base overrides/ourpic6_2.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/ourpic7_1: texture_base overrides/ourpic7_1.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/pipe1_4: texture_base textures/e2u3/pipe1_4.tga @@ -9918,122 +10088,122 @@ textures/e2u3/pipe3_2: texture_base overrides/pipe3_2.tga texture_normals overrides/pipe3_2_n.tga texture_emissive overrides/pipe3_2_light.tga - correct_albedo 1 + base_factor 2.5 is_light 1 textures/e2u3/pipes1_2: texture_base overrides/pipes1_2.tga texture_normals overrides/pipes1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/pow10_1: texture_base overrides/pow10_1.tga texture_normals overrides/pow10_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/pow15_1: texture_base overrides/pow15_1.tga texture_normals overrides/pow15_1_n.tga texture_emissive overrides/pow15_1_light.tga emissive_factor 0.02 - correct_albedo 1 + base_factor 2.5 textures/e2u3/pow15_2: texture_base overrides/pow15_2.tga texture_normals overrides/pow15_2_n.tga texture_emissive overrides/pow15_2_light.tga emissive_factor 0.02 - correct_albedo 1 + base_factor 2.5 textures/e2u3/pow17_1: texture_base overrides/pow17_1.tga texture_normals overrides/pow17_1_n.tga texture_emissive overrides/pow17_1_light.tga emissive_factor 0.05 - correct_albedo 1 + base_factor 2.5 textures/e2u3/pow17_2: texture_base overrides/pow17_2.tga texture_normals overrides/pow17_2_n.tga texture_emissive overrides/pow17_2_light.tga emissive_factor 0.05 - correct_albedo 1 + base_factor 2.5 textures/e2u3/pow18_1: texture_base overrides/pow18_1.tga texture_normals overrides/pow18_1_n.tga texture_emissive overrides/pow18_1_light.tga emissive_factor 0.05 - correct_albedo 1 + base_factor 2.5 textures/e2u3/pow18_2: texture_base overrides/pow18_2.tga texture_normals overrides/pow18_2_n.tga texture_emissive overrides/pow18_2_light.tga emissive_factor 0.05 - correct_albedo 1 + base_factor 2.5 textures/e2u3/pow1_1: texture_base overrides/pow1_1.tga texture_normals overrides/pow1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/pow1_2: texture_base overrides/pow1_2.tga texture_normals overrides/pow1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/pow2_1: texture_base overrides/pow2_1.tga texture_normals overrides/pow2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/pow3_1: texture_base overrides/pow3_1.tga texture_normals overrides/pow3_1_n.tga texture_emissive overrides/pow3_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/pow3_2: texture_base overrides/pow3_2.tga texture_normals overrides/pow3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/pow4_2: texture_base overrides/pow4_2.tga texture_normals overrides/pow4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/pow5_1: texture_base overrides/pow5_1.tga texture_normals overrides/pow5_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/pow5_2: texture_base overrides/pow5_2.tga texture_normals overrides/pow5_2_n.tga texture_emissive overrides/pow5_2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/pow6_2: texture_base overrides/pow6_2.tga texture_normals overrides/pow6_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/pow8_2: texture_base overrides/pow8_2.tga texture_normals overrides/pow8_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/powr21_1: texture_base overrides/powr21_1.tga texture_normals overrides/powr21_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/powr21_2: texture_base overrides/powr21_2.tga texture_normals overrides/powr21_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/prwlt1_2: texture_base overrides/prwlt1_2.tga @@ -10041,13 +10211,13 @@ textures/e2u3/prwlt1_2: texture_emissive overrides/prwlt1_2_light.tga emissive_factor 0.2 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/prwlt1_4: texture_base overrides/prwlt1_4.tga texture_normals overrides/prwlt1_4_n.tga texture_emissive overrides/prwlt1_4_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/prwlt2_2: texture_base overrides/prwlt2_2.tga @@ -10055,7 +10225,7 @@ textures/e2u3/prwlt2_2: texture_emissive overrides/prwlt2_2_light.tga emissive_factor 0.2 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/prwlt2_3: texture_base overrides/prwlt2_3.tga @@ -10063,88 +10233,88 @@ textures/e2u3/prwlt2_3: texture_emissive overrides/prwlt2_3_light.tga emissive_factor 0.2 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/pwpip1_1: texture_base overrides/pwpip1_1.tga texture_normals overrides/pwpip1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/pwpip1_2: texture_base overrides/pwpip1_2.tga texture_normals overrides/pwpip1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/pwr_dr1_1: texture_base overrides/pwr_dr1_1.tga texture_normals overrides/pwr_dr1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/pwr_dr1_2: texture_base overrides/pwr_dr1_2.tga texture_normals overrides/pwr_dr1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/pyramid0: texture_base overrides/pyramid0.tga texture_normals overrides/pyramid0_n.tga texture_emissive overrides/pyramid0_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/pyramid1: texture_base overrides/pyramid1.tga texture_normals overrides/pyramid1_n.tga texture_emissive overrides/pyramid1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/pyramid2: texture_base overrides/pyramid2.tga texture_normals overrides/pyramid2_n.tga texture_emissive overrides/pyramid2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/pyramid3: texture_base overrides/pyramid3.tga texture_normals overrides/pyramid3_n.tga texture_emissive overrides/pyramid3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/reflt3_1: texture_base overrides/reflt3_1.tga texture_normals overrides/reflt3_1_n.tga texture_emissive overrides/reflt3_1_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/reflt3_10: texture_base overrides/reflt3_10.png texture_normals overrides/reflt3_10_n.tga texture_emissive overrides/reflt3_10_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/reflt3_8: texture_base overrides/reflt3_8.tga texture_normals overrides/reflt3_8_n.tga texture_emissive overrides/reflt3_8_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/rflr2_1: texture_base overrides/rflr2_1.tga texture_normals overrides/rflr2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/rlight1_1: texture_base overrides/rlight1_1.tga texture_normals overrides/rlight1_1_n.tga texture_emissive overrides/rlight1_1_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/rlight1_2: texture_base overrides/rlight1_2.tga @@ -10152,163 +10322,163 @@ textures/e2u3/rlight1_2: texture_emissive overrides/rlight1_2_light.tga emissive_factor 0.05 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/rmetal10_1: texture_base overrides/rmetal10_1.tga texture_normals overrides/rmetal10_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/rmetal3_1: texture_base overrides/rmetal3_1.tga texture_normals overrides/rmetal3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/rmetal3_2: texture_base overrides/rmetal3_2.tga texture_normals overrides/rmetal3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/rmetal3_3: texture_base overrides/rmetal3_3.tga texture_normals overrides/rmetal3_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/rmetal3_4: texture_base overrides/rmetal3_4.tga texture_normals overrides/rmetal3_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/rmetal4_1: texture_base overrides/rmetal4_1.tga texture_normals overrides/rmetal4_1_n.tga roughness_override 0.3 - correct_albedo 1 + base_factor 2.5 textures/e2u3/rmetal4_2: texture_base overrides/rmetal4_2.tga texture_normals overrides/rmetal4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/rmetal5_1: texture_base overrides/rmetal5_1.tga texture_normals overrides/rmetal5_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/rmetal6_1: texture_base overrides/rmetal6_1.tga texture_normals overrides/rmetal6_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/rmtl36_4: texture_base overrides/rmtl36_4.tga texture_normals overrides/rmtl36_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/rmtl37_1: texture_base overrides/rmtl37_1.tga texture_normals overrides/rmtl37_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/rmtl37_2: texture_base overrides/rmtl37_2.tga texture_normals overrides/rmtl37_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/rock2_1: texture_base overrides/rock2_1.tga texture_normals overrides/rock2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/rocks17_2: texture_base overrides/rocks17_2.tga texture_normals overrides/rocks17_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/rocks19_1: texture_base overrides/rocks19_1.tga texture_normals overrides/rocks19_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/rpip2_2: texture_base overrides/rpip2_2.tga texture_normals overrides/rpip2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/sewer1: texture_base textures/e2u3/sewer1.wal kind SLIME - correct_albedo 1 + base_factor 2.5 textures/e2u3/sewer1_300: texture_base textures/e2u3/sewer1_300.wal kind SLIME - correct_albedo 1 + base_factor 2.5 textures/e2u3/skip: texture_base overrides/skip.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/sky1: texture_base overrides/sky1.tga kind SKY - correct_albedo 1 + base_factor 2.5 textures/e2u3/smpow1: texture_base overrides/smpow1.tga texture_normals overrides/smpow1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/smpow2: texture_base overrides/smpow2.tga texture_normals overrides/smpow2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/smpow3: texture_base overrides/smpow3.tga texture_normals overrides/smpow3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/support1_1: texture_base textures/e2u3/support1_1.tga texture_normals textures/e2u3/support1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/temp1_2: texture_base overrides/temp1_2.tga texture_normals overrides/temp1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/thinm1_1: texture_base overrides/thinm1_1.tga texture_normals overrides/thinm1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/thinm1_2: texture_base overrides/thinm1_2.tga texture_normals overrides/thinm1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/thinm1_3: texture_base overrides/thinm1_3.tga texture_normals overrides/thinm1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/thinm2_3: texture_base overrides/thinm2_3.tga texture_normals overrides/thinm2_3_n.tga texture_emissive overrides/thinm2_3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/timpod3_1: texture_base overrides/timpod3_1.tga texture_normals overrides/timpod3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/timpod3_2: texture_base overrides/timpod3_2.tga texture_normals overrides/timpod3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/tlava1_3: texture_base overrides/tlava1_3.tga @@ -10316,11 +10486,11 @@ textures/e2u3/tlava1_3: texture_emissive overrides/tlava1_3_light.tga emissive_factor 0.1 kind LAVA - correct_albedo 1 + base_factor 2.5 textures/e2u3/trigger: texture_base overrides/trigger.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/wastemap: texture_base overrides/wastemap.tga @@ -10328,42 +10498,42 @@ textures/e2u3/wastemap: texture_emissive overrides/wastemap_light.tga emissive_factor 0.02 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e2u3/water6: texture_base textures/e2u3/water6.wal kind WATER - correct_albedo 1 + base_factor 2.5 textures/e2u3/water8: texture_base textures/e2u3/water8.wal kind WATER - correct_albedo 1 + base_factor 2.5 textures/e2u3/window1: texture_base textures/e2u3/window1.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e2u3/window5_1: texture_base overrides/window5_1.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e2u3/wires2_1: texture_base overrides/wires2_1.tga texture_normals overrides/wires2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/wplat1_2: texture_base overrides/wplat1_2.tga texture_normals overrides/wplat1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/wplat1_3: texture_base overrides/wplat1_3.tga texture_normals overrides/wplat1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e2u3/wstlt1_1: texture_base overrides/wstlt1_1.tga @@ -10371,21 +10541,21 @@ textures/e2u3/wstlt1_1: texture_emissive overrides/wstlt1_1_light.tga bump_scale 0.5 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/wstlt1_2: texture_base overrides/wstlt1_2.tga texture_normals overrides/wstlt1_2_n.tga texture_emissive overrides/wstlt1_2_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/wstlt1_3: texture_base overrides/wstlt1_3.tga texture_normals overrides/wstlt1_3_n.tga texture_emissive overrides/wstlt1_3_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/wstlt1_5: texture_base overrides/wstlt1_5.tga @@ -10393,31 +10563,31 @@ textures/e2u3/wstlt1_5: texture_emissive overrides/wstlt1_5_light.tga bump_scale 0.5 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/wstlt1_8: texture_base overrides/wstlt1_8.tga texture_normals overrides/wstlt1_8_n.tga texture_emissive overrides/wstlt1_8_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e2u3/yelfield: texture_base textures/e2u3/yelfield.wal kind WATER - correct_albedo 1 + base_factor 2.5 textures/e2u3/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/+0butn4: texture_base overrides/+0butn4.tga texture_normals overrides/+0butn4_n.tga texture_emissive overrides/+0butn4_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/+0cgrate1_1: texture_base overrides/+0cgrate1_1.tga @@ -10425,131 +10595,131 @@ textures/e3u1/+0cgrate1_1: texture_emissive overrides/+0cgrate1_1_light.tga emissive_factor 0.1 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e3u1/arrow0: texture_base overrides/arrow0.tga texture_normals overrides/arrow0_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/arrow1: texture_base overrides/arrow1.tga texture_normals overrides/arrow1_n.tga texture_emissive overrides/arrow1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/arrow2: texture_base overrides/arrow2.tga texture_normals overrides/arrow2_n.tga texture_emissive overrides/arrow2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/arrow3: texture_base overrides/arrow3.tga texture_normals overrides/arrow3_n.tga texture_emissive overrides/arrow3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/arrowup0: texture_base overrides/arrowup0.tga texture_normals overrides/arrowup0_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/arrowup1: texture_base overrides/arrowup1.tga texture_normals overrides/arrowup1_n.tga texture_emissive overrides/arrowup1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/arrowup2: texture_base overrides/arrowup2.tga texture_normals overrides/arrowup2_n.tga texture_emissive overrides/arrowup2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/arrowup3: texture_base overrides/arrowup3.tga texture_normals overrides/arrowup3_n.tga texture_emissive overrides/arrowup3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/bannerc: texture_base overrides/bannerc.tga texture_normals overrides/bannerc_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/bannerd: texture_base overrides/bannerd.tga texture_normals overrides/bannerd_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/bannere: texture_base overrides/bannere.tga texture_normals overrides/bannere_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/bannerf: texture_base overrides/bannerf.tga texture_normals overrides/bannerf_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/bigred1_1: texture_base overrides/bigred1_1.tga texture_normals overrides/bigred1_1_n.tga roughness_override 0.4 - correct_albedo 1 + base_factor 2.5 textures/e3u1/bigred1_2: texture_base overrides/bigred1_2.tga texture_normals overrides/bigred1_2_n.tga roughness_override 0.4 - correct_albedo 1 + base_factor 2.5 textures/e3u1/bigred8_1: texture_base overrides/bigred8_1.tga texture_normals overrides/bigred8_1_n.tga texture_emissive overrides/bigred8_1_light.tga roughness_override 0.4 - correct_albedo 1 + base_factor 2.5 textures/e3u1/black: texture_base overrides/black.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/bluwter: texture_base overrides/bluwter.tga kind WATER - correct_albedo 1 + base_factor 2.5 textures/e3u1/box1_5: texture_base overrides/box1_5.tga texture_normals overrides/box1_5_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e3u1/box1_6: texture_base overrides/box1_6.tga texture_normals overrides/box1_6_n.tga bump_scale 0.8 - correct_albedo 1 + base_factor 2.5 textures/e3u1/brick1_1: texture_base overrides/brick1_1.tga texture_normals overrides/brick1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/brick1_2: texture_base overrides/brick1_2.tga texture_normals overrides/brick1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/brlava: texture_base overrides/brlava.tga @@ -10557,114 +10727,114 @@ textures/e3u1/brlava: texture_emissive overrides/brlava_light.tga emissive_factor 0.2 kind LAVA - correct_albedo 1 + base_factor 2.5 textures/e3u1/broken2_2: texture_base overrides/broken2_2.tga texture_normals overrides/broken2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/brwater: texture_base textures/e3u1/brwater.wal kind WATER - correct_albedo 1 + base_factor 2.5 textures/e3u1/btactmach: texture_base overrides/btactmach.tga texture_normals overrides/btactmach_n.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/btactmach0: texture_base overrides/btactmach0.tga texture_normals overrides/btactmach0_n.tga texture_emissive overrides/btactmach0_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/btactmach1: texture_base overrides/btactmach1.tga texture_normals overrides/btactmach1_n.tga texture_emissive overrides/btactmach1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/btactmach2: texture_base overrides/btactmach2.tga texture_normals overrides/btactmach2_n.tga texture_emissive overrides/btactmach2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/btactmach3: texture_base overrides/btactmach3.tga texture_normals overrides/btactmach3_n.tga texture_emissive overrides/btactmach3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/btdoor_op: texture_base overrides/btdoor_op.tga texture_normals overrides/btdoor_op_n.tga texture_emissive overrides/btdoor_op_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/btf_off: texture_base overrides/btf_off.tga texture_normals overrides/btf_off_n.tga texture_emissive overrides/btf_off_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/c_met51a: texture_base overrides/c_met51a.tga texture_normals overrides/c_met51a_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/c_met51b: texture_base overrides/c_met51b.tga texture_normals overrides/c_met51b_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/c_met51c: texture_base overrides/c_met51c.tga texture_normals overrides/c_met51c_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/c_met5_1: texture_base overrides/c_met5_1.tga texture_normals overrides/c_met5_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/c_met5_2: texture_base overrides/c_met5_2.tga texture_normals overrides/c_met5_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/c_met7_2: texture_base overrides/c_met7_2.tga texture_normals overrides/c_met7_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/ceil1_1: texture_base overrides/ceil1_1.tga texture_normals overrides/ceil1_1_n.tga texture_emissive overrides/ceil1_1_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/ceil1_13: texture_base overrides/ceil1_13.tga texture_normals overrides/ceil1_13_n.tga texture_emissive overrides/ceil1_13_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/ceil1_14: texture_base overrides/ceil1_14.tga texture_normals overrides/ceil1_14_n.tga texture_emissive overrides/ceil1_14_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/ceil1_2: texture_base overrides/ceil1_2.tga @@ -10672,91 +10842,91 @@ textures/e3u1/ceil1_2: texture_emissive overrides/ceil1_2_light.tga bump_scale 0.5 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/ceil1_22: texture_base overrides/ceil1_22.tga texture_normals overrides/ceil1_22_n.tga texture_emissive overrides/ceil1_22_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/ceil1_24: texture_base overrides/ceil1_24.tga texture_normals overrides/ceil1_24_n.tga texture_emissive overrides/ceil1_24_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/ceil1_25: texture_base overrides/ceil1_25.tga texture_normals overrides/ceil1_25_n.tga texture_emissive overrides/ceil1_25_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/ceil1_28: texture_base overrides/ceil1_28.tga texture_normals overrides/ceil1_28_n.tga texture_emissive overrides/ceil1_28_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/ceil1_3: texture_base overrides/ceil1_3.tga texture_normals overrides/ceil1_3_n.tga texture_emissive overrides/ceil1_3_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/ceil1_4: texture_base overrides/ceil1_4.tga texture_normals overrides/ceil1_4_n.tga texture_emissive overrides/ceil1_4_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/ceil1_5: texture_base overrides/ceil1_5.tga texture_normals overrides/ceil1_5_n.tga texture_emissive overrides/ceil1_5_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/ceil1_6: texture_base overrides/ceil1_6.tga texture_normals overrides/ceil1_6_n.tga texture_emissive overrides/ceil1_6_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/ceil1_7: texture_base overrides/ceil1_7.tga texture_normals overrides/ceil1_7_n.tga texture_emissive overrides/ceil1_7_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/ceil1_8: texture_base overrides/ceil1_8.tga texture_normals overrides/ceil1_8_n.tga texture_emissive overrides/ceil1_8_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/citlit1_1: texture_base overrides/citlit1_1.tga texture_normals overrides/citlit1_1_n.tga texture_emissive overrides/citlit1_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/citlit1_4: texture_base overrides/citlit1_4.tga texture_emissive overrides/citlit1_4_light.tga emissive_factor 0.1 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/citycomp1: texture_base overrides/citycomp1.tga @@ -10764,202 +10934,202 @@ textures/e3u1/citycomp1: texture_emissive overrides/citycomp1_light.tga emissive_factor 0.05 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/citycomp2: texture_base overrides/citycomp2.tga texture_normals overrides/citycomp2_n.tga texture_emissive overrides/citycomp2_light.tga emissive_factor 0.05 - correct_albedo 1 + base_factor 2.5 textures/e3u1/citycomp3: texture_base overrides/citycomp3.tga texture_emissive overrides/citycomp3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/clip: texture_base overrides/clip.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/ctylt1_1: texture_base overrides/ctylt1_1.tga texture_normals overrides/ctylt1_1_n.tga texture_emissive overrides/ctylt1_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/damn1_1: texture_base overrides/damn1_1.tga texture_normals overrides/damn1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/darkmet1_1: texture_base overrides/darkmet1_1.tga texture_normals overrides/darkmet1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/darkmet1_2: texture_base overrides/darkmet1_2.tga texture_normals overrides/darkmet1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/darkmet2_1: texture_base overrides/darkmet2_1.tga texture_normals overrides/darkmet2_1_n.tga texture_emissive overrides/darkmet2_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/darkmet2_2: texture_base overrides/darkmet2_2.tga texture_normals overrides/darkmet2_2_n.tga texture_emissive overrides/darkmet2_2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/dfloor10_1: texture_base overrides/dfloor10_1.tga texture_normals overrides/dfloor10_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/dfloor10_2: texture_base overrides/dfloor10_2.tga texture_normals overrides/dfloor10_2_n.tga roughness_override 0.6 - correct_albedo 1 + base_factor 2.5 textures/e3u1/dfloor1_1: texture_base overrides/dfloor1_1.tga texture_normals overrides/dfloor1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/dfloor1_2: texture_base overrides/dfloor1_2.tga texture_normals overrides/dfloor1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/dfloor1_3: texture_base overrides/dfloor1_3.tga texture_normals overrides/dfloor1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/dfloor1_4: texture_base overrides/dfloor1_4.tga texture_normals overrides/dfloor1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/dfloor2_1: texture_base overrides/dfloor2_1.tga texture_normals overrides/dfloor2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/dfloor2_2: texture_base overrides/dfloor2_2.tga texture_normals overrides/dfloor2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/dfloor3_1: texture_base overrides/dfloor3_1.tga texture_normals overrides/dfloor3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/dfloor3_2: texture_base overrides/dfloor3_2.tga texture_normals overrides/dfloor3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/dfloor4_1: texture_base overrides/dfloor4_1.tga texture_normals overrides/dfloor4_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/dfloor5_2: texture_base overrides/dfloor5_2.tga texture_normals overrides/dfloor5_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/dfloor6_1: texture_base overrides/dfloor6_1.tga texture_normals overrides/dfloor6_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/dfloor6_2: texture_base overrides/dfloor6_2.tga texture_normals overrides/dfloor6_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/dfloor7_1: texture_base overrides/dfloor7_1.tga texture_normals overrides/dfloor7_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/dfloor7_2: texture_base overrides/dfloor7_2.tga texture_normals overrides/dfloor7_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/dfloor8_1: texture_base overrides/dfloor8_1.tga texture_normals overrides/dfloor8_1_n.tga roughness_override 0.3 - correct_albedo 1 + base_factor 2.5 textures/e3u1/dfloor8_2: texture_base overrides/dfloor8_2.tga texture_normals overrides/dfloor8_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/dfloor9_2: texture_base overrides/dfloor9_2.tga texture_normals overrides/dfloor9_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/doom: texture_base overrides/doom.tga texture_normals overrides/doom_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/door2_2: texture_base overrides/door2_2.tga texture_normals overrides/door2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/doorswt0: texture_base overrides/doorswt0.tga texture_normals overrides/doorswt0_n.tga texture_emissive overrides/doorswt0_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/doorswt1: texture_base overrides/doorswt1.tga texture_normals overrides/doorswt1_n.tga texture_emissive overrides/doorswt1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/doorswt2: texture_base overrides/doorswt2.tga texture_normals overrides/doorswt2_n.tga texture_emissive overrides/doorswt2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/doorswt3: texture_base overrides/doorswt3.tga texture_normals overrides/doorswt3_n.tga texture_emissive overrides/doorswt3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/drag1_1: texture_base overrides/drag1_1.tga texture_normals overrides/drag1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/drag1_2: texture_base overrides/drag1_2.tga texture_normals overrides/drag1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/drag1_3: texture_base overrides/drag1_3.tga texture_normals overrides/drag1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/drag2_1: texture_base overrides/drag2_1.tga @@ -10968,150 +11138,150 @@ textures/e3u1/drag2_1: roughness_override 0.25 emissive_factor 1.0 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/drag2_2: texture_base overrides/drag2_2.tga texture_normals overrides/drag2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/drag2_3: texture_base overrides/drag2_3.tga texture_normals overrides/drag2_3_n.tga roughness_override 0.3 - correct_albedo 1 + base_factor 2.5 textures/e3u1/drag3_2: texture_base overrides/drag3_2.tga texture_normals overrides/drag3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/drag3_3: texture_base overrides/drag3_3.tga texture_normals overrides/drag3_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/drag3_4: texture_base overrides/drag3_4.tga texture_normals overrides/drag3_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/drag4_1: texture_base overrides/drag4_1.tga texture_normals overrides/drag4_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/drag4_2: texture_base overrides/drag4_2.tga texture_normals overrides/drag4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/drag4_3: texture_base overrides/drag4_3.tga texture_normals overrides/drag4_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/drag4_4: texture_base overrides/drag4_4.tga texture_normals overrides/drag4_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/exit1: texture_base overrides/exit1.tga texture_normals overrides/exit1_n.tga texture_emissive overrides/exit1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/floor2_2: texture_base overrides/floor2_2.tga texture_normals overrides/floor2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/floor2_3: texture_base overrides/floor2_3.tga texture_normals overrides/floor2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/floor2_5: texture_base textures/e3u1/floor2_5.tga texture_normals textures/e3u1/floor2_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/floor2_6: texture_base textures/e3u1/floor2_6.tga texture_normals textures/e3u1/floor2_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/floor2_7: texture_base textures/e3u1/floor2_7.tga texture_normals textures/e3u1/floor2_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/floor2_8: texture_base textures/e3u1/floor2_8.tga texture_normals textures/e3u1/floor2_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/floorsw0: texture_base overrides/floorsw0.tga texture_normals overrides/floorsw0_n.tga texture_emissive overrides/floorsw0_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/floorsw1: texture_base overrides/floorsw1.tga texture_normals overrides/floorsw1_n.tga texture_emissive overrides/floorsw1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/floorsw2: texture_base overrides/floorsw2.tga texture_normals overrides/floorsw2_n.tga texture_emissive overrides/floorsw2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/floorsw3: texture_base overrides/floorsw3.tga texture_normals overrides/floorsw3_n.tga texture_emissive overrides/floorsw3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/florr1_1: texture_base overrides/florr1_1.tga texture_normals overrides/florr1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/florr1_5: texture_base overrides/florr1_5.tga texture_normals overrides/florr1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/florr1_7: texture_base overrides/florr1_7.tga texture_normals overrides/florr1_7_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e3u1/florr1_8: texture_base overrides/florr1_8.tga texture_normals overrides/florr1_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/florr2_5: texture_base overrides/florr2_5.tga texture_normals overrides/florr2_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/florr2_6: texture_base overrides/florr2_6.tga texture_normals overrides/florr2_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/florr2_8: texture_base overrides/florr2_8.tga texture_normals overrides/florr2_8_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/geolitc1_1: texture_base overrides/geolitc1_1.tga @@ -11119,56 +11289,56 @@ textures/e3u1/geolitc1_1: texture_emissive overrides/geolitc1_1_light.tga emissive_factor 0.1 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/geowal2_1: texture_base overrides/geowal2_1.tga texture_normals overrides/geowal2_1_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e3u1/geowal_02: texture_base overrides/geowal_02.tga texture_normals overrides/geowal_02_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e3u1/geowal_06: texture_base overrides/geowal_06.tga texture_normals overrides/geowal_06_n.tga bump_scale 0.5 roughness_override 0.4 - correct_albedo 1 + base_factor 2.5 textures/e3u1/geowal_10: texture_base overrides/geowal_10.tga texture_normals overrides/geowal_10_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e3u1/geowaldg: texture_base overrides/geowaldg.tga texture_normals overrides/geowaldg_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e3u1/geowaldi_1: texture_base overrides/geowaldi_1.tga texture_normals overrides/geowaldi_1_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e3u1/geowaldi_2: texture_base overrides/geowaldi_2.tga texture_normals overrides/geowaldi_2_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e3u1/geowalj1_4: texture_base overrides/geowalj1_4.tga texture_normals overrides/geowalj1_4_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e3u1/geowalm1_1: texture_base overrides/geowalm1_1.tga @@ -11176,28 +11346,28 @@ textures/e3u1/geowalm1_1: texture_emissive overrides/geowalm1_1_light.tga bump_scale 0.5 roughness_override 0.3 - correct_albedo 1 + base_factor 2.5 textures/e3u1/geowalm1_2: texture_base overrides/geowalm1_2.tga texture_normals overrides/geowalm1_2_n.tga bump_scale 0.5 roughness_override 0.3 - correct_albedo 1 + base_factor 2.5 textures/e3u1/geowaln1_2: texture_base overrides/geowaln1_2.tga texture_normals overrides/geowaln1_2_n.tga texture_emissive overrides/geowaln1_2_light.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e3u1/geowalo1_1: texture_base overrides/geowalo1_1.tga texture_normals overrides/geowalo1_1_n.tga bump_scale 0.5 roughness_override 0.3 - correct_albedo 1 + base_factor 2.5 textures/e3u1/geowalp1_1: texture_base overrides/geowalp1_1.tga @@ -11205,114 +11375,121 @@ textures/e3u1/geowalp1_1: texture_emissive overrides/geowalp1_1_light.tga bump_scale 0.5 emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/glocrys_1: texture_base overrides/glocrys_1.tga textures/e3u1/glocrys_2: texture_base overrides/glocrys_2.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/grass1_2: texture_base overrides/grass1_2.tga texture_normals overrides/grass1_2_n.tga + base_factor 2 + specular_factor 0 textures/e3u1/grass1_3: texture_base overrides/grass1_3.tga texture_normals overrides/grass1_3_n.tga - correct_albedo 1 + base_factor 2 + specular_factor 0 textures/e3u1/grass1_4: texture_base overrides/grass1_4.tga texture_normals overrides/grass1_4_n.tga - correct_albedo 1 + base_factor 2 + specular_factor 0 textures/e3u1/grass1_7: texture_base overrides/grass1_7.tga texture_normals overrides/grass1_7_n.tga + base_factor 2 + specular_factor 0 textures/e3u1/grass1_8: texture_base overrides/grass1_8.tga texture_normals overrides/grass1_8_n.tga - correct_albedo 1 + base_factor 2 + specular_factor 0 textures/e3u1/grate1_4: texture_base textures/e3u1/grate1_4.tga texture_normals textures/e3u1/grate1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/grate1_6: texture_base textures/e3u1/grate1_6.tga texture_normals textures/e3u1/grate1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/grate2_4: texture_base overrides/grate2_4.tga texture_normals overrides/grate2_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/grndoor1: texture_base overrides/grndoor1.tga texture_normals overrides/grndoor1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/grnx2_3: texture_base overrides/grnx2_3.tga texture_normals overrides/grnx2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/grnx2_4: texture_base overrides/grnx2_4.tga texture_normals overrides/grnx2_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/grnx2_5: texture_base overrides/grnx2_5.tga texture_normals overrides/grnx2_5_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e3u1/grnx2_7: texture_base overrides/grnx2_7.tga texture_normals overrides/grnx2_7_n.tga bump_scale 0.5 - correct_albedo 1 + base_factor 2.5 textures/e3u1/grnx2_8: texture_base overrides/grnx2_8.tga texture_normals overrides/grnx2_8_n.tga bump_scale 0.3 - correct_albedo 1 + base_factor 2.5 textures/e3u1/grnx2_9: texture_base overrides/grnx2_9.tga texture_normals overrides/grnx2_9_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/hint: texture_base overrides/hint.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/jaildr03_1: texture_base overrides/jaildr03_1.tga texture_normals overrides/jaildr03_1_n.tga texture_emissive overrides/jaildr03_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/jaildr03_2: texture_base overrides/jaildr03_2.tga texture_normals overrides/jaildr03_2_n.tga texture_emissive overrides/jaildr03_2_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/jaildr1_3: texture_base overrides/jaildr1_3.tga texture_normals overrides/jaildr1_3_n.tga texture_emissive overrides/jaildr1_3_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/jaildr2_3: texture_base overrides/jaildr2_3.tga @@ -11320,485 +11497,485 @@ textures/e3u1/jaildr2_3: texture_emissive overrides/jaildr2_3_light.tga emissive_factor 0.3 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/keysign1: texture_base overrides/keysign1.tga texture_normals overrides/keysign1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/laserbut0: texture_base overrides/laserbut0.tga texture_normals overrides/laserbut0_n.tga texture_emissive overrides/laserbut0_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/laserbut1: texture_base overrides/laserbut1.tga texture_normals overrides/laserbut1_n.tga texture_emissive overrides/laserbut1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/laserbut2: texture_base overrides/laserbut2.tga texture_normals overrides/laserbut2_n.tga texture_emissive overrides/laserbut2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/laserbut3: texture_base overrides/laserbut3.tga texture_normals overrides/laserbut3_n.tga texture_emissive overrides/laserbut3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/laserside: texture_base overrides/laserside.tga texture_normals overrides/laserside_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/marble1_4: texture_base overrides/marble1_4.tga texture_normals overrides/marble1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/marble1_7: texture_base overrides/marble1_7.tga texture_normals overrides/marble1_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/metal1_2: texture_base textures/e3u1/metal1_2.tga texture_normals textures/e3u1/metal1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/metal2_1: texture_base textures/e3u1/metal2_1.tga texture_normals textures/e3u1/metal2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/metal2_2: texture_base textures/e3u1/metal2_2.tga texture_normals textures/e3u1/metal2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/metal3_3: texture_base textures/e3u1/metal3_3.tga texture_normals textures/e3u1/metal3_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/metal3_6: texture_base overrides/metal3_6.tga texture_normals overrides/metal3_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/metal4_1: texture_base textures/e3u1/metal4_1.tga texture_normals textures/e3u1/metal4_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/metal4_2: texture_base textures/e3u1/metal4_2.tga texture_normals textures/e3u1/metal4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/metal6_1: texture_base textures/e3u1/metal6_1.tga texture_normals textures/e3u1/metal6_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/metl5b_1: texture_base overrides/metl5b_1.tga texture_normals overrides/metl5b_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/metl5b_3: texture_base overrides/metl5b_3.tga texture_normals overrides/metl5b_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/origin: texture_base overrides/origin.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/p_flr_05: texture_base overrides/p_flr_05.tga texture_normals overrides/p_flr_05_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/p_flr_10: texture_base overrides/p_flr_10.tga texture_normals overrides/p_flr_10_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/p_tub2_3: texture_base overrides/p_tub2_3.tga texture_normals overrides/p_tub2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/pallt_7: texture_base overrides/pallt_7.tga texture_normals overrides/pallt_7_n.tga texture_emissive overrides/pallt_7_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/palmet10_1: texture_base overrides/palmet10_1.tga texture_normals overrides/palmet10_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/palmet10_2: texture_base overrides/palmet10_2.tga texture_normals overrides/palmet10_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/palmet11_2: texture_base overrides/palmet11_2.tga texture_normals overrides/palmet11_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/palmet12_1: texture_base overrides/palmet12_1.tga texture_normals overrides/palmet12_1_n.tga roughness_override 0.3 - correct_albedo 1 + base_factor 2.5 textures/e3u1/palmet12_2: texture_base overrides/palmet12_2.tga texture_normals overrides/palmet12_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/palmet12_3: texture_base overrides/palmet12_3.tga texture_normals overrides/palmet12_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/palmet13_1: texture_base overrides/palmet13_1.tga texture_normals overrides/palmet13_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/palmet13_4: texture_base overrides/palmet13_4.tga texture_normals overrides/palmet13_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/palmet14_1: texture_base overrides/palmet14_1.tga texture_normals overrides/palmet14_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/palmet14_2: texture_base overrides/palmet14_2.tga texture_normals overrides/palmet14_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/palmet14_3: texture_base overrides/palmet14_3.tga texture_normals overrides/palmet14_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/palmet14_4: texture_base overrides/palmet14_4.tga texture_normals overrides/palmet14_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/palmet1_1: texture_base overrides/palmet1_1.tga texture_normals overrides/palmet1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/palmet2_1: texture_base overrides/palmet2_1.tga texture_normals overrides/palmet2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/palmet3_1: texture_base overrides/palmet3_1.tga texture_normals overrides/palmet3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/palmet3_2: texture_base overrides/palmet3_2.tga texture_normals overrides/palmet3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/palmet5_1: texture_base overrides/palmet5_1.tga texture_normals overrides/palmet5_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/palmet5_2: texture_base overrides/palmet5_2.tga texture_normals overrides/palmet5_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/palmet7_1: texture_base overrides/palmet7_1.tga texture_normals overrides/palmet7_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/palmet9_2: texture_base overrides/palmet9_2.tga texture_normals overrides/palmet9_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/palsup1_5: texture_base overrides/palsup1_5.tga texture_normals overrides/palsup1_5_n.tga texture_emissive overrides/palsup1_5_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/patwall0_2: texture_base overrides/patwall0_2.tga texture_normals overrides/patwall0_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/pip02_1: texture_base overrides/pip02_1.tga texture_normals overrides/pip02_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/plat1_1: texture_base overrides/plat1_1.tga texture_normals overrides/plat1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/plat1_2: texture_base overrides/plat1_2.tga texture_normals overrides/plat1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/plat1_3: texture_base overrides/plat1_3.tga texture_normals overrides/plat1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/pmetal3_1: texture_base overrides/pmetal3_1.tga texture_normals overrides/pmetal3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/pmetal3_2: texture_base overrides/pmetal3_2.tga texture_normals overrides/pmetal3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/pmetal3_3: texture_base overrides/pmetal3_3.tga texture_normals overrides/pmetal3_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/pmetal3_4: texture_base overrides/pmetal3_4.tga texture_normals overrides/pmetal3_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/pmetal4_1: texture_base overrides/pmetal4_1.tga texture_normals overrides/pmetal4_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/pmetal4_2: texture_base overrides/pmetal4_2.tga texture_normals overrides/pmetal4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/pmetal5_1: texture_base overrides/pmetal5_1.tga texture_normals overrides/pmetal5_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/pmetal6_1: texture_base overrides/pmetal6_1.tga texture_normals overrides/pmetal6_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/pow11_2: texture_base overrides/pow11_2.tga texture_normals overrides/pow11_2_n.tga texture_emissive overrides/pow11_2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/pow12_1: texture_base overrides/pow12_1.tga texture_normals overrides/pow12_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/pow2_1: texture_base overrides/pow2_1.tga texture_normals overrides/pow2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/pow3_1: texture_base overrides/pow3_1.tga texture_normals overrides/pow3_1_n.tga texture_emissive overrides/pow3_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/pow4_2: texture_base overrides/pow4_2.tga texture_normals overrides/pow4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/pthnm1_1: texture_base overrides/pthnm1_1.tga texture_normals overrides/pthnm1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/pthnm1_2: texture_base overrides/pthnm1_2.tga texture_normals overrides/pthnm1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/pthnm2_1: texture_base overrides/pthnm2_1.tga texture_normals overrides/pthnm2_1_n.tga roughness_override 0.35 - correct_albedo 1 + base_factor 2.5 textures/e3u1/red1_3: texture_base textures/e3u1/red1_3.tga texture_normals textures/e3u1/red1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/red1_4: texture_base overrides/red1_4.tga texture_normals overrides/red1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/redcar_2: texture_base overrides/redcar_2.tga texture_normals overrides/redcar_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/reddr2_1: texture_base overrides/reddr2_1.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/reddr8_1: texture_base overrides/reddr8_1.tga texture_normals overrides/reddr8_1_n.tga texture_emissive overrides/reddr8_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/reddr8_2: texture_base overrides/reddr8_2.tga texture_normals overrides/reddr8_2_n.tga texture_emissive overrides/reddr8_2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/redfield: texture_base textures/e3u1/redfield.wal kind WATER - correct_albedo 1 + base_factor 2.5 textures/e3u1/reds1_2: texture_base overrides/reds1_2.tga texture_normals overrides/reds1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/reds1_4: texture_base overrides/reds1_4.tga texture_normals overrides/reds1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/reds1_6: texture_base overrides/reds1_6.tga texture_normals overrides/reds1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/rock0_1: texture_base overrides/rock0_1.tga texture_normals overrides/rock0_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/rocks16_2: texture_base overrides/rocks16_2.tga texture_normals overrides/rocks16_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/rocks19_1: texture_base overrides/rocks19_1.tga texture_normals overrides/rocks19_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/rocks22_1: texture_base overrides/rocks22_1.tga texture_normals overrides/rocks22_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/shooter2: texture_base overrides/shooter2.tga texture_normals overrides/shooter2_n.tga texture_emissive overrides/shooter2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u1/skip: texture_base overrides/skip.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/sky1: texture_base overrides/sky1.tga kind SKY - correct_albedo 1 + base_factor 2.5 textures/e3u1/sky2: texture_base overrides/sky2.tga kind SKY - correct_albedo 1 + base_factor 2.5 textures/e3u1/support1_1: texture_base textures/e3u1/support1_1.tga texture_normals textures/e3u1/support1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/support1_2: texture_base overrides/support1_2.tga texture_normals overrides/support1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/trigger: texture_base overrides/trigger.tga - correct_albedo 1 + base_factor 2.5 textures/e3u1/window1: texture_base textures/e3u1/window1.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e3u1/window4_1: texture_base overrides/window4_1.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e3u1/wndow0_1: texture_base overrides/wndow0_1.tga texture_normals overrides/wndow0_1_n.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e3u1/wndow0_3: texture_base overrides/wndow0_3.tga texture_normals overrides/wndow0_3_n.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e3u1/wndw01_2: texture_base overrides/wndw01_2.tga texture_normals overrides/wndw01_2_n.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e3u1/wndw01_3: texture_base overrides/wndw01_3.tga texture_normals overrides/wndw01_3_n.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e3u1/wndw01_4: texture_base overrides/wndw01_4.tga @@ -11806,7 +11983,7 @@ textures/e3u1/wndw01_4: texture_emissive overrides/wndw01_4_light.tga emissive_factor 0.05 kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e3u1/wndw01_5: texture_base overrides/wndw01_5.tga @@ -11814,360 +11991,360 @@ textures/e3u1/wndw01_5: texture_emissive overrides/wndw01_5_light.tga emissive_factor 0.05 kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e3u1/yelfield: texture_base textures/e3u1/yelfield.wal kind WATER - correct_albedo 1 + base_factor 2.5 textures/e3u1/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/+0lcomp: texture_base overrides/+0lcomp.tga texture_normals overrides/+0lcomp_n.tga texture_emissive overrides/+0lcomp_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+0lcompa: texture_base overrides/+0lcompa.tga texture_normals overrides/+0lcompa_n.tga texture_emissive overrides/+0lcompa_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+10lcomp: texture_base overrides/+10lcomp.tga texture_normals overrides/+10lcomp_n.tga texture_emissive overrides/+10lcomp_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+11lcomp: texture_base overrides/+11lcomp.tga texture_normals overrides/+11lcomp_n.tga texture_emissive overrides/+11lcomp_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+12lcomp: texture_base overrides/+12lcomp.tga texture_normals overrides/+12lcomp_n.tga texture_emissive overrides/+12lcomp_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+13lcomp: texture_base overrides/+13lcomp.tga texture_normals overrides/+13lcomp_n.tga texture_emissive overrides/+13lcomp_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+14lcomp: texture_base overrides/+14lcomp.tga texture_normals overrides/+14lcomp_n.tga texture_emissive overrides/+14lcomp_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+15lcomp: texture_base overrides/+15lcomp.tga texture_normals overrides/+15lcomp_n.tga texture_emissive overrides/+15lcomp_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+16lcomp: texture_base overrides/+16lcomp.tga texture_normals overrides/+16lcomp_n.tga texture_emissive overrides/+16lcomp_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+17lcomp: texture_base overrides/+17lcomp.tga texture_normals overrides/+17lcomp_n.tga texture_emissive overrides/+17lcomp_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+18lcomp: texture_base overrides/+18lcomp.tga texture_normals overrides/+18lcomp_n.tga texture_emissive overrides/+18lcomp_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+19lcomp: texture_base overrides/+19lcomp.tga texture_normals overrides/+19lcomp_n.tga texture_emissive overrides/+19lcomp_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+1lcomp: texture_base overrides/+1lcomp.tga texture_normals overrides/+1lcomp_n.tga texture_emissive overrides/+1lcomp_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+1lcompa: texture_base overrides/+1lcompa.tga texture_normals overrides/+1lcompa_n.tga texture_emissive overrides/+1lcompa_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+2lcomp: texture_base overrides/+2lcomp.tga texture_normals overrides/+2lcomp_n.tga texture_emissive overrides/+2lcomp_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+2lcompa: texture_base overrides/+2lcompa.tga texture_normals overrides/+2lcompa_n.tga texture_emissive overrides/+2lcompa_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+3lcomp: texture_base overrides/+3lcomp.tga texture_normals overrides/+3lcomp_n.tga texture_emissive overrides/+3lcomp_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+3lcompa: texture_base overrides/+3lcompa.tga texture_normals overrides/+3lcompa_n.tga texture_emissive overrides/+3lcompa_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+4lcomp: texture_base overrides/+4lcomp.tga texture_normals overrides/+4lcomp_n.tga texture_emissive overrides/+4lcomp_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+4lcompa: texture_base overrides/+4lcompa.tga texture_normals overrides/+4lcompa_n.tga texture_emissive overrides/+4lcompa_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+5lcomp: texture_base overrides/+5lcomp.tga texture_normals overrides/+5lcomp_n.tga texture_emissive overrides/+5lcomp_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+5lcompa: texture_base overrides/+5lcompa.tga texture_normals overrides/+5lcompa_n.tga texture_emissive overrides/+5lcompa_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+6lcomp: texture_base overrides/+6lcomp.tga texture_normals overrides/+6lcomp_n.tga texture_emissive overrides/+6lcomp_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+6lcompa: texture_base overrides/+6lcompa.tga texture_normals overrides/+6lcompa_n.tga texture_emissive overrides/+6lcompa_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+7lcomp: texture_base overrides/+7lcomp.tga texture_normals overrides/+7lcomp_n.tga texture_emissive overrides/+7lcomp_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+7lcompa: texture_base overrides/+7lcompa.tga texture_normals overrides/+7lcompa_n.tga texture_emissive overrides/+7lcompa_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+8lcomp: texture_base overrides/+8lcomp.tga texture_normals overrides/+8lcomp_n.tga texture_emissive overrides/+8lcomp_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+8lcompa: texture_base overrides/+8lcompa.tga texture_normals overrides/+8lcompa_n.tga texture_emissive overrides/+8lcompa_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+9lcomp: texture_base overrides/+9lcomp.tga texture_normals overrides/+9lcomp_n.tga texture_emissive overrides/+9lcomp_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/+9lcompa: texture_base overrides/+9lcompa.tga texture_normals overrides/+9lcompa_n.tga texture_emissive overrides/+9lcompa_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/bed01_1: texture_base overrides/bed01_1.tga texture_normals overrides/bed01_1_n.tga roughness_override 1 metalness_factor 0 - correct_albedo 1 + base_factor 2.5 textures/e3u2/bed02_2: texture_base overrides/bed02_2.tga texture_normals overrides/bed02_2_n.tga roughness_override 1 metalness_factor 0 - correct_albedo 1 + base_factor 2.5 textures/e3u2/bed3_2: texture_base overrides/bed3_2.tga texture_normals overrides/bed3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/bed3_3: texture_base overrides/bed3_3.tga texture_normals overrides/bed3_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/bed3_4: texture_base overrides/bed3_4.tga texture_normals overrides/bed3_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/bed4_1: texture_base overrides/bed4_1.tga texture_normals overrides/bed4_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/bed4_3: texture_base overrides/bed4_3.tga texture_normals overrides/bed4_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/bed4_4: texture_base overrides/bed4_4.tga texture_normals overrides/bed4_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/bed4_7: texture_base overrides/bed4_7.tga texture_normals overrides/bed4_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/block1_5: texture_base overrides/block1_5.tga texture_normals overrides/block1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/block1_6: texture_base overrides/block1_6.tga texture_normals overrides/block1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/block1_7: texture_base overrides/block1_7.tga texture_normals overrides/block1_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/bluekeypad: texture_base overrides/bluekeypad.tga texture_normals overrides/bluekeypad_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/broken2_4: texture_base overrides/broken2_4.tga texture_normals overrides/broken2_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/btactmach0: texture_base overrides/btactmach0.tga texture_normals overrides/btactmach0_n.tga texture_emissive overrides/btactmach0_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/btactmach1: texture_base overrides/btactmach1.tga texture_normals overrides/btactmach1_n.tga texture_emissive overrides/btactmach1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/btactmach2: texture_base overrides/btactmach2.tga texture_normals overrides/btactmach2_n.tga texture_emissive overrides/btactmach2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/btactmach3: texture_base overrides/btactmach3.tga texture_normals overrides/btactmach3_n.tga texture_emissive overrides/btactmach3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/btelev_dn: texture_base overrides/btelev_dn.tga texture_normals overrides/btelev_dn_n.tga texture_emissive overrides/btelev_dn_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/btelev_dn3: texture_base overrides/btelev_dn3.tga texture_normals overrides/btelev_dn3_n.tga texture_emissive overrides/btelev_dn3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/btelev_up: texture_base overrides/btelev_up.tga texture_normals overrides/btelev_up_n.tga texture_emissive overrides/btelev_up_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/btelev_up3: texture_base overrides/btelev_up3.tga texture_normals overrides/btelev_up3_n.tga texture_emissive overrides/btelev_up3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/ceil1_16: texture_base overrides/ceil1_16.tga texture_normals overrides/ceil1_16_n.tga texture_emissive overrides/ceil1_16_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/ceil1_2: texture_base overrides/ceil1_2.tga @@ -12175,38 +12352,38 @@ textures/e3u2/ceil1_2: texture_emissive overrides/ceil1_2_light.tga bump_scale 0.5 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/ceil1_28: texture_base overrides/ceil1_28.tga texture_normals overrides/ceil1_28_n.tga texture_emissive overrides/ceil1_28_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/ceil1_4: texture_base overrides/ceil1_4.tga texture_normals overrides/ceil1_4_n.tga texture_emissive overrides/ceil1_4_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/ceil1_8: texture_base overrides/ceil1_8.tga texture_normals overrides/ceil1_8_n.tga texture_emissive overrides/ceil1_8_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/clip: texture_base overrides/clip.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/comp01_2: texture_base overrides/comp01_2.tga texture_normals overrides/comp01_2_n.tga texture_emissive overrides/comp01_2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/comp3_3: texture_base overrides/comp3_3.tga @@ -12214,7 +12391,7 @@ textures/e3u2/comp3_3: texture_emissive overrides/comp3_3_light.tga emissive_factor 0.1 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e3u2/comp3_7: texture_base overrides/comp3_7.tga @@ -12229,14 +12406,14 @@ textures/e3u2/comp3_8: texture_emissive overrides/comp3_8_light.tga emissive_factor 0.02 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e3u2/comp5_2: texture_base overrides/comp5_2.tga texture_normals overrides/comp5_2_n.tga texture_emissive overrides/comp5_2_light.tga kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e3u2/comp5_3: texture_base overrides/comp5_3.tga @@ -12255,34 +12432,34 @@ textures/e3u2/comp5_4: textures/e3u2/doorbot: texture_base overrides/doorbot.tga texture_normals overrides/doorbot_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/fmet1_2: texture_base overrides/fmet1_2.tga texture_normals overrides/fmet1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/fmet2_3: texture_base overrides/fmet2_3.tga texture_normals overrides/fmet2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/fmet3_1: texture_base overrides/fmet3_1.tga texture_normals overrides/fmet3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/fmet3_3: texture_base overrides/fmet3_3.tga texture_normals overrides/fmet3_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/fmet3_5: texture_base overrides/fmet3_5.tga texture_normals overrides/fmet3_5_n.tga texture_emissive overrides/fmet3_5_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/fmet3_7: texture_base overrides/fmet3_7.tga @@ -12290,341 +12467,341 @@ textures/e3u2/fmet3_7: texture_emissive overrides/fmet3_7_light.tga emissive_factor 0.1 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/hall01_1: texture_base overrides/hall01_1.tga texture_normals overrides/hall01_1_n.tga roughness_override 1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/hall01_2: texture_base overrides/hall01_2.tga texture_normals overrides/hall01_2_n.tga roughness_override 0.3 - correct_albedo 1 + base_factor 2.5 textures/e3u2/hall01_3: texture_base overrides/hall01_3.tga texture_normals overrides/hall01_3_n.tga roughness_override 0.3 - correct_albedo 1 + base_factor 2.5 textures/e3u2/hall07_2: texture_base overrides/hall07_2.tga texture_normals overrides/hall07_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/hall07_3: texture_base overrides/hall07_3.tga texture_normals overrides/hall07_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/hall08_4: texture_base overrides/hall08_4.tga texture_normals overrides/hall08_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/hbut1_1: texture_base overrides/hbut1_1.tga texture_normals overrides/hbut1_1_n.tga texture_emissive overrides/hbut1_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/hbut1_2: texture_base overrides/hbut1_2.tga texture_normals overrides/hbut1_2_n.tga texture_emissive overrides/hbut1_2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/jaildr2_1: texture_base overrides/jaildr2_1.tga texture_normals overrides/jaildr2_1_n.tga texture_emissive overrides/jaildr2_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/jaildr2_3: texture_base overrides/jaildr2_3.tga texture_normals overrides/jaildr2_3_n.tga texture_emissive overrides/jaildr2_3_light.tga emissive_factor 0.3 - correct_albedo 1 + base_factor 2.5 textures/e3u2/keydran1_1: texture_base overrides/keydran1_1.tga texture_normals overrides/keydran1_1_n.tga texture_emissive overrides/keydran1_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/keydran2_1: texture_base overrides/keydran2_1.tga texture_normals overrides/keydran2_1_n.tga texture_emissive overrides/keydran2_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/laserbut0: texture_base overrides/laserbut0.tga texture_normals overrides/laserbut0_n.tga texture_emissive overrides/laserbut0_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/laserbut1: texture_base overrides/laserbut1.tga texture_normals overrides/laserbut1_n.tga texture_emissive overrides/laserbut1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/laserbut2: texture_base overrides/laserbut2.tga texture_normals overrides/laserbut2_n.tga texture_emissive overrides/laserbut2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/laserbut3: texture_base overrides/laserbut3.tga texture_normals overrides/laserbut3_n.tga texture_emissive overrides/laserbut3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/lnum1_1: texture_base overrides/lnum1_1.tga texture_normals overrides/lnum1_1_n.tga texture_emissive overrides/lnum1_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/lnum1_2: texture_base overrides/lnum1_2.tga texture_normals overrides/lnum1_2_n.tga texture_emissive overrides/lnum1_2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/lsign1_1: texture_base overrides/lsign1_1.tga texture_normals overrides/lsign1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/lsign1_2: texture_base overrides/lsign1_2.tga texture_normals overrides/lsign1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/lsign1_3: texture_base overrides/lsign1_3.tga texture_normals overrides/lsign1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/or01_1: texture_base overrides/or01_1.tga texture_normals overrides/or01_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/or01_2: texture_base overrides/or01_2.tga texture_normals overrides/or01_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/or01_3: texture_base overrides/or01_3.tga texture_normals overrides/or01_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/or01_4: texture_base overrides/or01_4.tga texture_normals overrides/or01_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/or02_1: texture_base overrides/or02_1.tga texture_normals overrides/or02_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/or02_2: texture_base overrides/or02_2.tga texture_normals overrides/or02_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/or02_3: texture_base overrides/or02_3.tga texture_normals overrides/or02_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/origin: texture_base overrides/origin.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/pipe1_3: texture_base overrides/pipe1_3.tga texture_normals overrides/pipe1_3_n.tga kind CHROME - correct_albedo 1 + base_factor 2.5 textures/e3u2/pipe1_6: texture_base overrides/pipe1_6.tga texture_normals overrides/pipe1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/sflr1_1: texture_base overrides/sflr1_1.tga texture_normals overrides/sflr1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/shooter2: texture_base overrides/shooter2.tga texture_normals overrides/shooter2_n.tga texture_emissive overrides/shooter2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/sky2: texture_base overrides/sky2.tga kind SKY - correct_albedo 1 + base_factor 2.5 textures/e3u2/slots1_1: texture_base overrides/slots1_1.tga texture_normals overrides/slots1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/slots1_4: texture_base overrides/slots1_4.tga texture_normals overrides/slots1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/stflr1_3: texture_base overrides/stflr1_3.tga texture_normals overrides/stflr1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/stflr1_4: texture_base overrides/stflr1_4.tga texture_normals overrides/stflr1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/tcmet5_4: texture_base overrides/tcmet5_4.tga texture_normals overrides/tcmet5_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/tcmt9_4: texture_base overrides/tcmt9_4.tga texture_normals overrides/tcmt9_4_n.tga texture_emissive overrides/tcmt9_4_light.tga emissive_factor 0 - correct_albedo 1 + base_factor 2.5 textures/e3u2/trigger: texture_base overrides/trigger.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/troof1_1: texture_base textures/e3u2/troof1_1.tga texture_normals textures/e3u2/troof1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/troof3_2: texture_base overrides/troof3_2.tga texture_normals overrides/troof3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/troof4_2: texture_base overrides/troof4_2.tga texture_normals overrides/troof4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/troof4_5: texture_base overrides/troof4_5.tga texture_normals overrides/troof4_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/troof5_1: texture_base overrides/troof5_1.tga texture_normals overrides/troof5_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/troof5_3: texture_base overrides/troof5_3.tga texture_normals overrides/troof5_3_n.tga texture_emissive overrides/troof5_3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u2/water2: texture_base textures/e3u2/water2.wal kind WATER - correct_albedo 1 + base_factor 2.5 textures/e3u2/window4_1: texture_base overrides/window4_1.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e3u2/window4_2: texture_base overrides/window4_2.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e3u2/window6_1: texture_base overrides/window6_1.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e3u2/wndow1_2: texture_base overrides/wndow1_2.tga texture_normals overrides/wndow1_2_n.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e3u2/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u2/yellow1_6: texture_base overrides/yellow1_6.tga texture_normals overrides/yellow1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/arrow4: texture_base overrides/arrow4.tga texture_normals overrides/arrow4_n.tga texture_emissive overrides/arrow4_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/arvnt1_2: texture_base overrides/arvnt1_2.tga texture_normals overrides/arvnt1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/arvnt1_3: texture_base overrides/arvnt1_3.tga texture_normals overrides/arvnt1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/arvnt1_4: texture_base overrides/arvnt1_4.tga texture_normals overrides/arvnt1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/awater: texture_base textures/e3u3/awater.wal kind WATER - correct_albedo 1 + base_factor 2.5 textures/e3u3/baselt_7: texture_base overrides/baselt_7.tga texture_normals overrides/baselt_7_n.tga texture_emissive overrides/baselt_7_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/baselt_c: texture_base overrides/baselt_c.tga texture_normals overrides/baselt_c_n.tga texture_emissive overrides/baselt_c_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/baslt3_1: texture_base overrides/baslt3_1.tga @@ -12632,7 +12809,7 @@ textures/e3u3/baslt3_1: texture_emissive overrides/baslt3_1_light.tga emissive_factor 0.5 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/baslt3_8: texture_base overrides/baslt3_8.tga @@ -12640,125 +12817,125 @@ textures/e3u3/baslt3_8: texture_emissive overrides/baslt3_8_light.tga emissive_factor 0.5 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/bluelite: texture_base overrides/bluelite.tga texture_normals overrides/bluelite_n.tga texture_emissive overrides/bluelite_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/broken1_1: texture_base overrides/broken1_1.tga texture_normals overrides/broken1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/broken2_3: texture_base overrides/broken2_3.tga texture_normals overrides/broken2_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/btactmach0: texture_base overrides/btactmach0.tga texture_normals overrides/btactmach0_n.tga texture_emissive overrides/btactmach0_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/btactmach1: texture_base overrides/btactmach1.tga texture_normals overrides/btactmach1_n.tga texture_emissive overrides/btactmach1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/btactmach2: texture_base overrides/btactmach2.tga texture_normals overrides/btactmach2_n.tga texture_emissive overrides/btactmach2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/btactmach3: texture_base overrides/btactmach3.tga texture_normals overrides/btactmach3_n.tga texture_emissive overrides/btactmach3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/btdoor_op: texture_base overrides/btdoor_op.tga texture_normals overrides/btdoor_op_n.tga texture_emissive overrides/btdoor_op_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/btelev_dn: texture_base overrides/btelev_dn.tga texture_normals overrides/btelev_dn_n.tga texture_emissive overrides/btelev_dn_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/btelev_dn3: texture_base overrides/btelev_dn3.tga texture_normals overrides/btelev_dn3_n.tga texture_emissive overrides/btelev_dn3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/btelev_up: texture_base overrides/btelev_up.tga texture_normals overrides/btelev_up_n.tga texture_emissive overrides/btelev_up_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/btelev_up3: texture_base overrides/btelev_up3.tga texture_normals overrides/btelev_up3_n.tga texture_emissive overrides/btelev_up3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/c_met10_1: texture_base overrides/c_met10_1.tga texture_normals overrides/c_met10_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/c_met51a: texture_base overrides/c_met51a.tga texture_normals overrides/c_met51a_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/c_met5_1: texture_base overrides/c_met5_1.tga texture_normals overrides/c_met5_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/c_met5_2: texture_base overrides/c_met5_2.tga texture_normals overrides/c_met5_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/c_met7_2: texture_base overrides/c_met7_2.tga texture_normals overrides/c_met7_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/c_met8_2: texture_base overrides/c_met8_2.tga texture_normals overrides/c_met8_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/ceil1_1: texture_base overrides/ceil1_1.tga texture_normals overrides/ceil1_1_n.tga texture_emissive overrides/ceil1_1_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/ceil1_13: texture_base overrides/ceil1_13.tga texture_normals overrides/ceil1_13_n.tga texture_emissive overrides/ceil1_13_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/ceil1_2: texture_base overrides/ceil1_2.tga @@ -12766,110 +12943,110 @@ textures/e3u3/ceil1_2: texture_emissive overrides/ceil1_2_light.tga bump_scale 0.5 is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/ceil1_24: texture_base overrides/ceil1_24.tga texture_normals overrides/ceil1_24_n.tga texture_emissive overrides/ceil1_24_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/ceil1_27: texture_base overrides/ceil1_27.tga texture_normals overrides/ceil1_27_n.tga texture_emissive overrides/ceil1_27_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/ceil1_3: texture_base overrides/ceil1_3.tga texture_normals overrides/ceil1_3_n.tga texture_emissive overrides/ceil1_3_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/ceil1_4: texture_base overrides/ceil1_4.tga texture_normals overrides/ceil1_4_n.tga texture_emissive overrides/ceil1_4_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/ceil1_5: texture_base overrides/ceil1_5.tga texture_normals overrides/ceil1_5_n.tga texture_emissive overrides/ceil1_5_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/ceil1_6: texture_base overrides/ceil1_6.tga texture_normals overrides/ceil1_6_n.tga texture_emissive overrides/ceil1_6_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/ceil1_8: texture_base overrides/ceil1_8.tga texture_normals overrides/ceil1_8_n.tga texture_emissive overrides/ceil1_8_light.tga is_light 1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/clip: texture_base overrides/clip.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/color1_2: texture_base textures/e3u3/color1_2.tga texture_normals textures/e3u3/color1_2_n.tga bump_scale 0.1 kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e3u3/color1_4: texture_base textures/e3u3/color1_4.tga texture_normals textures/e3u3/color1_4_n.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e3u3/color1_5: texture_base textures/e3u3/color1_5.tga texture_normals textures/e3u3/color1_5_n.tga bump_scale 0.1 kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e3u3/color1_7: texture_base textures/e3u3/color1_7.tga texture_normals textures/e3u3/color1_7_n.tga bump_scale 0.5 kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e3u3/color1_8: texture_base textures/e3u3/color1_8.tga texture_normals textures/e3u3/color1_8_n.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e3u3/comp1_4: texture_base overrides/comp1_4.tga texture_normals overrides/comp1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/comp1_7: texture_base overrides/comp1_7.tga texture_normals overrides/comp1_7_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/comp3_2: texture_base overrides/comp3_2.tga texture_normals overrides/comp3_2_n.tga texture_emissive overrides/comp3_2_light.tga kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e3u3/comp3_3: texture_base overrides/comp3_3.tga @@ -12877,7 +13054,7 @@ textures/e3u3/comp3_3: texture_emissive overrides/comp3_3_light.tga emissive_factor 0.1 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e3u3/comp3_4: texture_base overrides/comp3_4.tga @@ -12890,7 +13067,7 @@ textures/e3u3/comp3_5: texture_base overrides/comp3_5.tga texture_normals overrides/comp3_5_n.tga texture_emissive overrides/comp3_5_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/comp3_7: texture_base overrides/comp3_7.tga @@ -12905,18 +13082,18 @@ textures/e3u3/comp3_8: texture_emissive overrides/comp3_8_light.tga emissive_factor 0.02 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e3u3/comp4_2: texture_base overrides/comp4_2.tga texture_normals overrides/comp4_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/comp4_3: texture_base overrides/comp4_3.tga texture_normals overrides/comp4_3_n.tga texture_emissive overrides/comp4_3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/comp5_1: texture_base overrides/comp5_1.tga @@ -12929,7 +13106,7 @@ textures/e3u3/comp5_2: texture_normals overrides/comp5_2_n.tga texture_emissive overrides/comp5_2_light.tga kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e3u3/comp5_3: texture_base overrides/comp5_3.tga @@ -12937,83 +13114,83 @@ textures/e3u3/comp5_3: texture_emissive overrides/comp5_3_light.tga emissive_factor 0.1 kind SCREEN - correct_albedo 1 + base_factor 2.5 textures/e3u3/comp7_1: texture_base overrides/comp7_1.tga texture_normals overrides/comp7_1_n.tga texture_emissive overrides/comp7_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/comp7_3: texture_base overrides/comp7_3.tga texture_normals overrides/comp7_3_n.tga texture_emissive overrides/comp7_3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/comp8_1: texture_base overrides/comp8_1.tga texture_normals overrides/comp8_1_n.tga texture_emissive overrides/comp8_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/comp9_1: texture_base overrides/comp9_1.tga texture_normals overrides/comp9_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/comp9_3: texture_base overrides/comp9_3.tga texture_normals overrides/comp9_3_n.tga texture_emissive overrides/comp9_3_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/con1_1: texture_base textures/e3u3/con1_1.tga texture_normals textures/e3u3/con1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/coolant: texture_base overrides/coolant.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/door1_1: texture_base overrides/door1_1.tga texture_normals overrides/door1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/door1_2: texture_base overrides/door1_2.tga texture_normals overrides/door1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/door2_2: texture_base overrides/door2_2.tga texture_normals overrides/door2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/doorbot: texture_base overrides/doorbot.tga texture_normals overrides/doorbot_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/dr01_2: texture_base overrides/dr01_2.tga texture_normals overrides/dr01_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/dr03_2: texture_base overrides/dr03_2.tga texture_normals overrides/dr03_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/dr04_1: texture_base overrides/dr04_1.tga texture_normals overrides/dr04_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/elev_dr1: texture_base overrides/elev_dr1.tga @@ -13022,7 +13199,7 @@ textures/e3u3/elev_dr1: bump_scale 0.724 roughness_override 0.362 emissive_factor 0.02 - correct_albedo 1 + base_factor 2.5 textures/e3u3/elev_dr2: texture_base overrides/elev_dr2.tga @@ -13031,383 +13208,391 @@ textures/e3u3/elev_dr2: bump_scale 0.724 roughness_override 0.362 emissive_factor 0.02 - correct_albedo 1 + base_factor 2.5 textures/e3u3/elevdoor: texture_base overrides/elevdoor.tga texture_normals overrides/elevdoor_n.tga roughness_override 0.3 - correct_albedo 1 + base_factor 2.5 textures/e3u3/flat1_1: texture_base overrides/flat1_1.tga texture_normals overrides/flat1_1_n.tga bump_scale 0.2 - correct_albedo 1 + base_factor 2.5 textures/e3u3/flat1_2: texture_base overrides/flat1_2.tga texture_normals overrides/flat1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/floor1_3: texture_base textures/e3u3/floor1_3.tga texture_normals textures/e3u3/floor1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/floor3_1: texture_base overrides/floor3_1.tga texture_normals overrides/floor3_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/floor3_2: texture_base textures/e3u3/floor3_2.tga texture_normals textures/e3u3/floor3_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/floor3_3: texture_base textures/e3u3/floor3_3.tga texture_normals textures/e3u3/floor3_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/floorsw0: texture_base overrides/floorsw0.tga texture_normals overrides/floorsw0_n.tga texture_emissive overrides/floorsw0_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/floorsw1: texture_base overrides/floorsw1.tga texture_normals overrides/floorsw1_n.tga texture_emissive overrides/floorsw1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/floorsw2: texture_base overrides/floorsw2.tga texture_normals overrides/floorsw2_n.tga texture_emissive overrides/floorsw2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/floorsw3: texture_base overrides/floorsw3.tga texture_normals overrides/floorsw3_n.tga texture_emissive overrides/floorsw3_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/grass1_2: texture_base overrides/grass1_2.tga texture_normals overrides/grass1_2_n.tga + base_factor 2 + specular_factor 0 textures/e3u3/grass1_4: texture_base overrides/grass1_4.tga texture_normals overrides/grass1_4_n.tga - correct_albedo 1 + base_factor 2 + specular_factor 0 textures/e3u3/grass1_5: texture_base overrides/grass1_5.tga texture_normals overrides/grass1_5_n.tga - correct_albedo 1 + base_factor 2 + specular_factor 0 textures/e3u3/grass1_6: texture_base overrides/grass1_6.tga texture_normals overrides/grass1_6_n.tga - correct_albedo 1 + base_factor 2 + specular_factor 0 textures/e3u3/grass1_7: texture_base overrides/grass1_7.tga texture_normals overrides/grass1_7_n.tga + base_factor 2 + specular_factor 0 textures/e3u3/grate1_1: texture_base textures/e3u3/grate1_1.tga texture_normals textures/e3u3/grate1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/grate1_3: texture_base textures/e3u3/grate1_3.tga texture_normals textures/e3u3/grate1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/grate1_5: texture_base textures/e3u3/grate1_5.tga texture_normals textures/e3u3/grate1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/grate2_4: texture_base overrides/grate2_4.tga texture_normals overrides/grate2_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/grnx2_5: texture_base overrides/grnx2_5.tga texture_normals overrides/grnx2_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/grocks22_1: texture_base overrides/grocks22_1.tga texture_normals overrides/grocks22_1_n.tga texture_emissive overrides/grocks22_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/hbut1_1: texture_base overrides/hbut1_1.tga texture_normals overrides/hbut1_1_n.tga texture_emissive overrides/hbut1_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/hbut1_2: texture_base overrides/hbut1_2.tga texture_normals overrides/hbut1_2_n.tga texture_emissive overrides/hbut1_2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/hint: texture_base overrides/hint.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/keydr1_1: texture_base overrides/keydr1_1.tga texture_normals overrides/keydr1_1_n.tga texture_emissive overrides/keydr1_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/keydran1_1: texture_base overrides/keydran1_1.tga texture_normals overrides/keydran1_1_n.tga texture_emissive overrides/keydran1_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/keydran2_1: texture_base overrides/keydran2_1.tga texture_normals overrides/keydran2_1_n.tga texture_emissive overrides/keydran2_1_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/labsign1: texture_base overrides/labsign1.tga texture_normals overrides/labsign1_n.tga texture_emissive overrides/labsign1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/labsign2: texture_base overrides/labsign2.tga texture_normals overrides/labsign2_n.tga texture_emissive overrides/labsign2_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/lever1: texture_base overrides/lever1.tga texture_normals overrides/lever1_n.tga texture_emissive overrides/lever1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/lever6: texture_base overrides/lever6.tga texture_normals overrides/lever6_n.tga texture_emissive overrides/lever6_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal13_1: texture_base textures/e3u3/metal13_1.tga texture_normals textures/e3u3/metal13_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal14_1: texture_base textures/e3u3/metal14_1.tga texture_normals textures/e3u3/metal14_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal15_2: texture_base textures/e3u3/metal15_2.tga texture_normals textures/e3u3/metal15_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal16_2: texture_base textures/e3u3/metal16_2.tga texture_normals textures/e3u3/metal16_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal17_1: texture_base textures/e3u3/metal17_1.tga texture_normals textures/e3u3/metal17_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal17_2: texture_base textures/e3u3/metal17_2.tga texture_normals textures/e3u3/metal17_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal18_1: texture_base textures/e3u3/metal18_1.tga texture_normals textures/e3u3/metal18_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal18_2: texture_base textures/e3u3/metal18_2.tga texture_normals textures/e3u3/metal18_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal19_1: texture_base textures/e3u3/metal19_1.tga texture_normals textures/e3u3/metal19_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal19_2: texture_base overrides/metal19_2.tga texture_normals overrides/metal19_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal1_1: texture_base textures/e3u3/metal1_1.tga texture_normals textures/e3u3/metal1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal1_2: texture_base textures/e3u3/metal1_2.tga texture_normals textures/e3u3/metal1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal1_3: texture_base overrides/metal1_3.tga texture_normals overrides/metal1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal1_4: texture_base overrides/metal1_4.tga texture_normals overrides/metal1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal1_5: texture_base overrides/metal1_5.tga texture_normals overrides/metal1_5_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal1_6: texture_base textures/e3u3/metal1_6.tga texture_normals textures/e3u3/metal1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal20_1: texture_base overrides/metal20_1.tga texture_normals overrides/metal20_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal20_2: texture_base overrides/metal20_2.tga texture_normals overrides/metal20_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal21_1: texture_base overrides/metal21_1.tga texture_normals overrides/metal21_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal21_2: texture_base overrides/metal21_2.tga texture_normals overrides/metal21_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal22_1: texture_base overrides/metal22_1.tga texture_normals overrides/metal22_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal22_2: texture_base textures/e3u3/metal22_2.tga texture_normals textures/e3u3/metal22_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal23_1: texture_base overrides/metal23_1.tga texture_normals overrides/metal23_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal23_2: texture_base overrides/metal23_2.tga texture_normals overrides/metal23_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal23_3: texture_base overrides/metal23_3.tga texture_normals overrides/metal23_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal23_4: texture_base overrides/metal23_4.tga texture_normals overrides/metal23_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal2_1: texture_base textures/e3u3/metal2_1.tga texture_normals textures/e3u3/metal2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal3_3: texture_base textures/e3u3/metal3_3.tga texture_normals textures/e3u3/metal3_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal3_5: texture_base overrides/metal3_5.tga texture_normals overrides/metal3_5_n.tga - correct_albedo 1 + base_factor 4 + specular_factor 0 textures/e3u3/metal4_1: texture_base textures/e3u3/metal4_1.tga texture_normals textures/e3u3/metal4_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal4_4: texture_base overrides/metal4_4.tga texture_normals overrides/metal4_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal5_1: texture_base textures/e3u3/metal5_1.tga texture_normals textures/e3u3/metal5_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal5_2: texture_base textures/e3u3/metal5_2.tga texture_normals textures/e3u3/metal5_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal6_1: texture_base textures/e3u3/metal6_1.tga texture_normals textures/e3u3/metal6_1_n.tga texture_emissive textures/e3u3/metal6_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/metal6_2: texture_base textures/e3u3/metal6_2.tga texture_normals textures/e3u3/metal6_2_n.tga texture_emissive textures/e3u3/metal6_2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/origin: texture_base overrides/origin.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/p_tub2_1: texture_base overrides/p_tub2_1.tga texture_normals overrides/p_tub2_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/pip01_2: texture_base overrides/pip01_2.tga texture_normals overrides/pip01_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/pip01_4: texture_base overrides/pip01_4.tga texture_normals overrides/pip01_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/pip03_1: texture_base overrides/pip03_1.tga texture_normals overrides/pip03_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/pipe1_4: texture_base textures/e3u3/pipe1_4.tga @@ -13416,237 +13601,237 @@ textures/e3u3/pipe1_4: textures/e3u3/redfield: texture_base textures/e3u3/redfield.wal kind WATER - correct_albedo 1 + base_factor 2.5 textures/e3u3/reds1_2: texture_base overrides/reds1_2.tga texture_normals overrides/reds1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/reds1_4: texture_base overrides/reds1_4.tga texture_normals overrides/reds1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/rocks17_2: texture_base overrides/rocks17_2.tga texture_normals overrides/rocks17_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/rocks19_1: texture_base overrides/rocks19_1.tga texture_normals overrides/rocks19_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/rpip2_2: texture_base overrides/rpip2_2.tga texture_normals overrides/rpip2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/shooter2: texture_base overrides/shooter2.tga texture_normals overrides/shooter2_n.tga texture_emissive overrides/shooter2_light.tga emissive_factor 0.1 - correct_albedo 1 + base_factor 2.5 textures/e3u3/shutl1_1: texture_base overrides/shutl1_1.tga texture_normals overrides/shutl1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/shutl21_1: texture_base overrides/shutl21_1.tga texture_normals overrides/shutl21_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/shutl22_2: texture_base overrides/shutl22_2.tga texture_normals overrides/shutl22_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/shutl22_3: texture_base overrides/shutl22_3.tga texture_normals overrides/shutl22_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/shutl2_2: texture_base overrides/shutl2_2.tga texture_normals overrides/shutl2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/sign1: texture_base overrides/sign1.tga texture_normals overrides/sign1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/sign2: texture_base overrides/sign2.tga texture_normals overrides/sign2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/sky1: texture_base overrides/sky1.tga kind SKY - correct_albedo 1 + base_factor 2.5 textures/e3u3/stairs1_3: texture_base overrides/stairs1_3.tga texture_normals overrides/stairs1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/support1_1: texture_base textures/e3u3/support1_1.tga texture_normals textures/e3u3/support1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/support1_6: texture_base overrides/support1_6.tga texture_normals overrides/support1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/trigger: texture_base overrides/trigger.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/water7: texture_base textures/e3u3/water7.wal kind WATER - correct_albedo 1 + base_factor 2.5 textures/e3u3/watrt1_1: texture_base overrides/watrt1_1.tga texture_normals overrides/watrt1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/watrt2_2: texture_base overrides/watrt2_2.tga texture_normals overrides/watrt2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/watrt3_1: texture_base overrides/watrt3_1.tga texture_normals overrides/watrt3_1_n.tga roughness_override 0.35 - correct_albedo 1 + base_factor 2.5 textures/e3u3/windowc1_7: texture_base overrides/windowc1_7.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e3u3/wires2_2: texture_base overrides/wires2_2.tga texture_normals overrides/wires2_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/wndow1_2: texture_base overrides/wndow1_2.tga texture_normals overrides/wndow1_2_n.tga kind GLASS - correct_albedo 1 + base_factor 2.5 textures/e3u3/wplat1_1: texture_base overrides/wplat1_1.tga texture_normals overrides/wplat1_1_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/wplat1_2: texture_base overrides/wplat1_2.tga texture_normals overrides/wplat1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/wplat1_3: texture_base overrides/wplat1_3.tga texture_normals overrides/wplat1_3_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/xsky1: texture_base overrides/xsky1.tga kind SKY - correct_albedo 1 + base_factor 2.5 textures/e3u3/yellow1_2: texture_base overrides/yellow1_2.tga texture_normals overrides/yellow1_2_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga - correct_albedo 1 + base_factor 2.5 textures/e3u3/yellow1_6: texture_base overrides/yellow1_6.tga texture_normals overrides/yellow1_6_n.tga - correct_albedo 1 + base_factor 2.5 textures/REGION: texture_base textures/REGION.tga texture_normals textures/REGION_n.tga - correct_albedo 1 + base_factor 2.5 textures/test/num_0: texture_base textures/test/num_0.tga texture_emissive textures/test/num_0_light.tga - correct_albedo 1 + base_factor 2.5 textures/test/num_1: texture_base textures/test/num_1.tga texture_emissive textures/test/num_1_light.tga - correct_albedo 1 + base_factor 2.5 textures/test/num_2: texture_base textures/test/num_2.tga texture_emissive textures/test/num_2_light.tga - correct_albedo 1 + base_factor 2.5 textures/test/num_3: texture_base textures/test/num_3.tga texture_emissive textures/test/num_3_light.tga - correct_albedo 1 + base_factor 2.5 textures/test/num_4: texture_base textures/test/num_4.tga texture_emissive textures/test/num_4_light.tga - correct_albedo 1 + base_factor 2.5 textures/test/num_5: texture_base textures/test/num_5.tga texture_emissive textures/test/num_5_light.tga - correct_albedo 1 + base_factor 2.5 textures/test/num_6: texture_base textures/test/num_6.tga texture_emissive textures/test/num_6_light.tga - correct_albedo 1 + base_factor 2.5 textures/test/num_7: texture_base textures/test/num_7.tga texture_emissive textures/test/num_7_light.tga - correct_albedo 1 + base_factor 2.5 textures/test/num_8: texture_base textures/test/num_8.tga texture_emissive textures/test/num_8_light.tga - correct_albedo 1 + base_factor 2.5 textures/test/num_9: texture_base textures/test/num_9.tga texture_emissive textures/test/num_9_light.tga - correct_albedo 1 + base_factor 2.5 textures/test/num_colon: texture_base textures/test/num_colon.tga texture_emissive textures/test/num_colon_light.tga - correct_albedo 1 + base_factor 2.5 textures/test/num_minus: texture_base textures/test/num_minus.tga texture_emissive textures/test/num_minus_light.tga - correct_albedo 1 + base_factor 2.5 textures/test/num_space: texture_base textures/test/num_space.wal - correct_albedo 1 + base_factor 2.5 From 14469ac73a86c86234d75d9b59c81ddc9aa2fbe8 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Tue, 7 Sep 2021 07:45:36 -0700 Subject: [PATCH 12/55] Removed the pt_correct_albedo setting. --- src/refresh/vkpt/shader/global_ubo.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/refresh/vkpt/shader/global_ubo.h b/src/refresh/vkpt/shader/global_ubo.h index ad0f1136f..abcde8273 100644 --- a/src/refresh/vkpt/shader/global_ubo.h +++ b/src/refresh/vkpt/shader/global_ubo.h @@ -71,7 +71,6 @@ with this program; if not, write to the Free Software Foundation, Inc., UBO_CVAR_DO(pt_beam_softness, 1.0) /* beam softness */ \ UBO_CVAR_DO(pt_bump_scale, 1.0) /* scale for normal maps [0..1] */ \ UBO_CVAR_DO(pt_cameras, 1) /* switch for security cameras, 0 or 1 */ \ - UBO_CVAR_DO(pt_correct_albedo, 1) /* enables the correct_albedo material setting, 0 or 1 */ \ UBO_CVAR_DO(pt_direct_polygon_lights, 1) /* switch for direct lighting from local polygon lights, 0 or 1 */ \ UBO_CVAR_DO(pt_direct_roughness_threshold, 0.18) /* roughness value where the path tracer switches direct light specular sampling from NDF based to light based, [0..1] */ \ UBO_CVAR_DO(pt_direct_sphere_lights, 1) /* switch for direct lighting from local sphere lights, 0 or 1 */ \ From fb8f14a2e61984767126de1e25ae453611f6e24a Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Tue, 7 Sep 2021 08:03:23 -0700 Subject: [PATCH 13/55] Fixed the dark outlines on some md2 models. --- src/refresh/vkpt/shader/indirect_lighting.rgen | 6 +++++- src/refresh/vkpt/shader/primary_rays.rgen | 6 +++++- src/refresh/vkpt/shader/reflect_refract.rgen | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/refresh/vkpt/shader/indirect_lighting.rgen b/src/refresh/vkpt/shader/indirect_lighting.rgen index 40f3ff10d..adb16b944 100644 --- a/src/refresh/vkpt/shader/indirect_lighting.rgen +++ b/src/refresh/vkpt/shader/indirect_lighting.rgen @@ -330,7 +330,11 @@ indirect_lighting( vec3 bounce_position = triangle.positions * bary; vec3 bounce_geo_normal = normalize(triangle.normals * bary); - if (dot(bounce_geo_normal, bounce_direction) > 0) + vec3 bounce_flat_normal = normalize(cross( + triangle.positions[1] - triangle.positions[0], + triangle.positions[2] - triangle.positions[1])); + + if (dot(bounce_flat_normal, bounce_direction) > 0) bounce_geo_normal = -bounce_geo_normal; vec3 bounce_normal = bounce_geo_normal; diff --git a/src/refresh/vkpt/shader/primary_rays.rgen b/src/refresh/vkpt/shader/primary_rays.rgen index 1fc7b6b13..38bf14e7e 100644 --- a/src/refresh/vkpt/shader/primary_rays.rgen +++ b/src/refresh/vkpt/shader/primary_rays.rgen @@ -229,7 +229,11 @@ main() vec2 tex_coord = triangle.tex_coords * bary; vec3 geo_normal = normalize(triangle.normals * bary); - if (dot(geo_normal, direction) > 0) + vec3 flat_normal = normalize(cross( + triangle.positions[1] - triangle.positions[0], + triangle.positions[2] - triangle.positions[1])); + + if (dot(flat_normal, direction) > 0) geo_normal = -geo_normal; /* compute view-space derivatives of depth and motion vectors */ diff --git a/src/refresh/vkpt/shader/reflect_refract.rgen b/src/refresh/vkpt/shader/reflect_refract.rgen index 18cd7f995..c62430461 100644 --- a/src/refresh/vkpt/shader/reflect_refract.rgen +++ b/src/refresh/vkpt/shader/reflect_refract.rgen @@ -529,7 +529,11 @@ main() vec2 tex_coord = triangle.tex_coords * bary; vec3 new_geo_normal = normalize(triangle.normals * bary); - if (dot(new_geo_normal, direction) > 0) + vec3 new_flat_normal = normalize(cross( + triangle.positions[1] - triangle.positions[0], + triangle.positions[2] - triangle.positions[1])); + + if (dot(new_flat_normal, direction) > 0) new_geo_normal = -new_geo_normal; // Compute the LOD for the texture on the reflected/refracted surface. From 3b7e1231af04adda16211bfd32d66ebbd3c815c5 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Tue, 7 Sep 2021 12:18:04 -0700 Subject: [PATCH 14/55] Material and sky clusters tweaks for baseq2. --- baseq2/materials/baseq2.mat | 256 ++++++++++++++++++++++++------------ baseq2/sky_clusters.txt | 5 +- 2 files changed, 178 insertions(+), 83 deletions(-) diff --git a/baseq2/materials/baseq2.mat b/baseq2/materials/baseq2.mat index d59ce543a..5019cf6be 100644 --- a/baseq2/materials/baseq2.mat +++ b/baseq2/materials/baseq2.mat @@ -86,7 +86,6 @@ models/items/ammo/bullets/medium/skin: texture_normals models/items/ammo/bullets/medium/skin_n.tga bump_scale 0.5 emissive_factor 0.1 - base_factor 2.5 models/items/ammo/cells/medium/skin: texture_base models/items/ammo/cells/medium/skin.tga @@ -125,7 +124,6 @@ models/items/ammo/shells/medium/skin: texture_normals models/items/ammo/shells/medium/skin_n.tga bump_scale 0.5 emissive_factor 0.1 - base_factor 2.5 models/items/ammo/slugs/medium/skin: texture_base models/items/ammo/slugs/medium/skin.tga @@ -251,7 +249,7 @@ models/items/healing/medium/health: texture_normals models/items/healing/medium/health_n.tga texture_emissive models/items/healing/medium/health_light.tga emissive_factor 0.02 - base_factor 2.5 + base_factor 1 models/items/healing/medium/skin: texture_base models/items/healing/medium/skin.pcx @@ -263,7 +261,7 @@ models/items/healing/stimpack/skin: texture_normals models/items/healing/stimpack/skin_n.tga texture_emissive models/items/healing/stimpack/skin_light.tga emissive_factor 0.1 - base_factor 2.5 + base_factor 2 models/items/invulner/skin: texture_base models/items/invulner/skin.tga @@ -398,7 +396,7 @@ models/monsters/bitch/pain: texture_emissive models/monsters/bitch/pain_light.tga roughness_override 1 emissive_factor 0.1 - base_factor 2.5 + base_factor 1 specular_factor 0 models/monsters/bitch/skin: @@ -407,7 +405,7 @@ models/monsters/bitch/skin: texture_emissive models/monsters/bitch/skin_light.tga roughness_override 1 emissive_factor 0.1 - base_factor 2.5 + base_factor 1 specular_factor 0 models/monsters/boss1/pain: @@ -564,7 +562,7 @@ models/monsters/float/pain: texture_emissive models/monsters/float/pain_light.tga roughness_override 1 emissive_factor 0.02 - base_factor 2.5 + base_factor 1.5 specular_factor 0 models/monsters/float/skin: @@ -573,7 +571,7 @@ models/monsters/float/skin: texture_emissive models/monsters/float/skin_light.tga roughness_override 1 emissive_factor 0.02 - base_factor 2.5 + base_factor 1.5 specular_factor 0 models/monsters/flyer/pain: @@ -598,7 +596,7 @@ models/monsters/gladiatr/pain: texture_emissive models/monsters/gladiatr/pain_light.tga roughness_override 1 emissive_factor 0.02 - base_factor 2.5 + base_factor 1.5 specular_factor 0 models/monsters/gladiatr/skin: @@ -607,7 +605,8 @@ models/monsters/gladiatr/skin: texture_emissive models/monsters/gladiatr/skin_light.tga roughness_override 1 emissive_factor 0.02 - base_factor 2.5 + base_factor 1.5 + specular_factor 0 models/monsters/gunner/pain: texture_base models/monsters/gunner/pain.tga @@ -615,7 +614,7 @@ models/monsters/gunner/pain: texture_emissive models/monsters/gunner/pain_light.tga roughness_override 1 emissive_factor 0.1 - base_factor 2.5 + base_factor 1.5 specular_factor 0 models/monsters/gunner/skin: @@ -624,7 +623,7 @@ models/monsters/gunner/skin: texture_emissive models/monsters/gunner/skin_light.tga roughness_override 1 emissive_factor 0.1 - base_factor 2.5 + base_factor 1.5 specular_factor 0 models/monsters/hover/pain: @@ -633,7 +632,7 @@ models/monsters/hover/pain: texture_emissive models/monsters/hover/pain_light.tga roughness_override 1 emissive_factor 0.02 - base_factor 2.5 + base_factor 2 specular_factor 0 models/monsters/hover/skin: @@ -642,7 +641,7 @@ models/monsters/hover/skin: texture_emissive models/monsters/hover/skin_light.tga roughness_override 1 emissive_factor 0.02 - base_factor 2.5 + base_factor 2 specular_factor 0 models/monsters/infantry/pain: @@ -650,7 +649,7 @@ models/monsters/infantry/pain: texture_normals models/monsters/infantry/pain_n.tga roughness_override 1 emissive_factor 0.1 - base_factor 2.5 + base_factor 1.5 specular_factor 0 models/monsters/infantry/skin: @@ -658,7 +657,7 @@ models/monsters/infantry/skin: texture_normals models/monsters/infantry/skin_n.tga roughness_override 1 emissive_factor 0.1 - base_factor 2.5 + base_factor 1.5 specular_factor 0 models/monsters/insane/i_skin: @@ -666,7 +665,7 @@ models/monsters/insane/i_skin: texture_normals models/monsters/insane/i_skin_n.tga roughness_override 1 emissive_factor 0.1 - base_factor 2.5 + base_factor 2 specular_factor 0 models/monsters/insane/i_skin02: @@ -674,7 +673,7 @@ models/monsters/insane/i_skin02: texture_normals models/monsters/insane/i_skin02_n.tga roughness_override 1 emissive_factor 0.1 - base_factor 2.5 + base_factor 2 specular_factor 0 models/monsters/insane/i_skin03: @@ -682,7 +681,7 @@ models/monsters/insane/i_skin03: texture_normals models/monsters/insane/i_skin03_n.tga roughness_override 1 emissive_factor 0.1 - base_factor 2.5 + base_factor 2 specular_factor 0 models/monsters/medic/pain: @@ -707,7 +706,7 @@ models/monsters/mutant/pain: texture_normals models/monsters/mutant/pain_n.tga roughness_override 1 emissive_factor 0.1 - base_factor 2.5 + base_factor 1.5 specular_factor 0 models/monsters/mutant/skin: @@ -715,23 +714,23 @@ models/monsters/mutant/skin: texture_normals models/monsters/mutant/skin_n.tga roughness_override 1 emissive_factor 0.1 - base_factor 2.5 + base_factor 1.5 specular_factor 0 models/monsters/parasite/pain: texture_base models/monsters/parasite/pain.tga texture_normals models/monsters/parasite/pain_n.tga roughness_override 1 - emissive_factor 0.1 - base_factor 2.5 + emissive_factor 0.01 + base_factor 1.5 specular_factor 0 models/monsters/parasite/segment/skin: texture_base models/monsters/parasite/segment/skin.tga texture_normals models/monsters/parasite/segment/skin_n.tga roughness_override 1 - emissive_factor 0.1 - base_factor 2.5 + emissive_factor 0.01 + base_factor 1.5 specular_factor 0 models/monsters/parasite/skin: @@ -739,15 +738,15 @@ models/monsters/parasite/skin: texture_normals models/monsters/parasite/skin_n.tga texture_emissive models/monsters/parasite/skin_light.tga roughness_override 1 - emissive_factor 0.1 - base_factor 2.5 + emissive_factor 0.01 + base_factor 1.5 specular_factor 0 models/monsters/parasite/tip/base: texture_base models/monsters/parasite/tip/base.tga roughness_override 1 emissive_factor 0.1 - base_factor 2.5 + base_factor 1.5 specular_factor 0 models/monsters/soldier/pain: @@ -756,7 +755,7 @@ models/monsters/soldier/pain: texture_emissive models/monsters/soldier/pain_light.tga roughness_override 1 emissive_factor 0.1 - base_factor 2.5 + base_factor 1.5 specular_factor 0 models/monsters/soldier/skin: @@ -765,7 +764,7 @@ models/monsters/soldier/skin: texture_emissive models/monsters/soldier/skin_light.tga roughness_override 1 emissive_factor 0.1 - base_factor 2.5 + base_factor 1.5 specular_factor 0 models/monsters/soldier/skin_lt: @@ -774,7 +773,7 @@ models/monsters/soldier/skin_lt: texture_emissive models/monsters/soldier/skin_lt_light.tga roughness_override 1 emissive_factor 0.1 - base_factor 2.5 + base_factor 1.5 specular_factor 0 models/monsters/soldier/skin_ltp: @@ -783,7 +782,7 @@ models/monsters/soldier/skin_ltp: texture_emissive models/monsters/soldier/skin_ltp_light.tga roughness_override 1 emissive_factor 0.1 - base_factor 2.5 + base_factor 1.5 specular_factor 0 models/monsters/soldier/skin_ss: @@ -792,7 +791,7 @@ models/monsters/soldier/skin_ss: texture_emissive models/monsters/soldier/skin_ss_light.tga roughness_override 1 emissive_factor 0.1 - base_factor 2.5 + base_factor 1.5 specular_factor 0 models/monsters/soldier/skin_ssp: @@ -801,7 +800,7 @@ models/monsters/soldier/skin_ssp: texture_emissive models/monsters/soldier/skin_ssp_light.tga roughness_override 1 emissive_factor 0.1 - base_factor 2.5 + base_factor 1.5 specular_factor 0 models/monsters/tank/ctank/pain: @@ -852,7 +851,8 @@ models/objects/barrels/skin: texture_normals models/objects/barrels/skin_n.tga texture_emissive models/objects/barrels/skin_light.tga emissive_factor 0.2 - base_factor 2.5 + base_factor 3 + metalness_factor 0 models/objects/black/skin: texture_base models/objects/black/skin.tga @@ -1846,8 +1846,7 @@ textures/e1u1/bluwter: textures/e1u1/box1_1: texture_base overrides/box1_1.tga texture_normals overrides/box1_1_n.tga - bump_scale 0.8 - base_factor 2.5 + specular_factor 0 textures/e1u1/box1_3: texture_base overrides/box1_3.tga @@ -1913,14 +1912,14 @@ textures/e1u1/box3_6: textures/e1u1/box3_7: texture_base overrides/box3_7.tga texture_normals overrides/box3_7_n.tga - bump_scale 0.8 base_factor 2.5 + specular_factor 0 textures/e1u1/box3_8: texture_base overrides/box3_8.tga texture_normals overrides/box3_8_n.tga - bump_scale 0.8 base_factor 2.5 + specular_factor 0 textures/e1u1/brlava: texture_base overrides/brlava.tga @@ -1939,16 +1938,19 @@ textures/e1u1/broken2_1: texture_base overrides/broken2_1.tga texture_normals overrides/broken2_1_n.tga base_factor 2.5 + specular_factor 0.1 textures/e1u1/broken2_2: texture_base overrides/broken2_2.tga texture_normals overrides/broken2_2_n.tga base_factor 2.5 + specular_factor 0.1 textures/e1u1/broken2_3: texture_base overrides/broken2_3.tga texture_normals overrides/broken2_3_n.tga base_factor 2.5 + specular_factor 0.1 textures/e1u1/broken2_4: texture_base overrides/broken2_4.tga @@ -2581,6 +2583,8 @@ textures/e1u1/floor3_3: texture_base textures/e1u1/floor3_3.tga texture_normals textures/e1u1/floor3_3_n.tga base_factor 2.5 + specular_factor 0.2 + metalness_factor 0 textures/e1u1/floorsw0: texture_base overrides/floorsw0.tga @@ -2935,6 +2939,7 @@ textures/e1u1/grnx3_3: texture_normals overrides/grnx3_3_n.tga roughness_override 0.701 base_factor 2.5 + specular_factor 0 textures/e1u1/hint: texture_base overrides/hint.tga @@ -3211,6 +3216,7 @@ textures/e1u1/pip03_4: texture_base overrides/pip03_4.tga texture_normals overrides/pip03_4_n.tga base_factor 2.5 + specular_factor 0 textures/e1u1/PIP04_3: texture_base overrides/PIP04_3.tga @@ -3648,6 +3654,7 @@ textures/e1u1/wplat1_2: texture_base overrides/wplat1_2.tga texture_normals overrides/wplat1_2_n.tga base_factor 2.5 + specular_factor 0 textures/e1u1/wslt1_1: texture_base overrides/wslt1_1.tga @@ -3718,15 +3725,16 @@ textures/e1u1/wswall1_2: textures/e1u1/wtroof1_5: texture_base overrides/wtroof1_5.tga texture_normals overrides/wtroof1_5_n.tga - roughness_override 0.622 + roughness_override 0.5 base_factor 2.5 + specular_factor 0.2 textures/e1u1/wtroof4_2: texture_base overrides/wtroof4_2.tga texture_normals overrides/wtroof4_2_n.tga - bump_scale 0.7 - roughness_override 0.638 + roughness_override 0.5 base_factor 2.5 + specular_factor 0.2 textures/e1u1/wtroof4_3: texture_base overrides/wtroof4_3.tga @@ -3758,7 +3766,7 @@ textures/e1u1/yellow1_2: textures/e1u1/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga - base_factor 2.5 + base_factor 0.5 textures/e1u1/yellow1_6: texture_base overrides/yellow1_6.tga @@ -3936,14 +3944,14 @@ textures/e1u2/box3_6: textures/e1u2/box3_7: texture_base overrides/box3_7.tga texture_normals overrides/box3_7_n.tga - bump_scale 0.8 base_factor 2.5 + specular_factor 0 textures/e1u2/box3_8: texture_base overrides/box3_8.tga texture_normals overrides/box3_8_n.tga - bump_scale 0.8 base_factor 2.5 + specular_factor 0 textures/e1u2/box4_1: texture_base overrides/box4_1.tga @@ -3977,6 +3985,7 @@ textures/e1u2/broken2_3: texture_base overrides/broken2_3.tga texture_normals overrides/broken2_3_n.tga base_factor 2.5 + specular_factor 0.1 textures/e1u2/brwind5_2: texture_base overrides/brwind5_2.tga @@ -4394,6 +4403,7 @@ textures/e1u2/hvy_dr3_2: texture_normals overrides/hvy_dr3_2_n.tga roughness_override 0.299 base_factor 2.5 + specular_factor 0.2 textures/e1u2/hvy_dr4_1: texture_base overrides/hvy_dr4_1.tga @@ -4471,6 +4481,7 @@ textures/e1u2/light2_2: texture_emissive overrides/light2_2_light.tga is_light 1 base_factor 2.5 + specular_factor 0.1 textures/e1u2/metal10_1: texture_base overrides/metal10_1.tga @@ -4645,6 +4656,7 @@ textures/e1u2/metal5_7: texture_normals overrides/metal5_7_n.tga texture_emissive overrides/metal5_7_light.tga base_factor 2.5 + specular_factor 0 textures/e1u2/metal5_8: texture_base overrides/metal5_8.tga @@ -4687,6 +4699,7 @@ textures/e1u2/metal8_4: texture_normals overrides/metal8_4_n.tga bump_scale 0.551 base_factor 2.5 + specular_factor 0 textures/e1u2/metal8_5: texture_base overrides/metal8_5.tga @@ -4827,11 +4840,15 @@ textures/e1u2/stripe1_1: texture_base overrides/stripe1_1.tga texture_normals overrides/stripe1_1_n.tga base_factor 2.5 + roughness_override 0.5 + specular_factor 0.2 textures/e1u2/stripe1_2: texture_base overrides/stripe1_2.tga texture_normals overrides/stripe1_2_n.tga base_factor 2.5 + roughness_override 0.5 + specular_factor 0.2 textures/e1u2/subdr1_1: texture_base overrides/subdr1_1.tga @@ -4974,21 +4991,23 @@ textures/e1u2/trigger: textures/e1u2/troof4_2: texture_base overrides/troof4_2.tga texture_normals overrides/troof4_2_n.tga - bump_scale 0.504 - roughness_override 0.598 + roughness_override 0.5 base_factor 2.5 + specular_factor 0.2 textures/e1u2/troof4_4: texture_base overrides/troof4_4.tga texture_normals overrides/troof4_4_n.tga - roughness_override 0.614 + roughness_override 0.5 base_factor 2.5 + specular_factor 0.2 textures/e1u2/troof4_5: texture_base overrides/troof4_5.tga texture_normals overrides/troof4_5_n.tga - roughness_override 0.701 + roughness_override 0.7 base_factor 2.5 + specular_factor 0.1 textures/e1u2/troof4_7: texture_base overrides/troof4_7.tga @@ -4999,11 +5018,13 @@ textures/e1u2/wall1_1: texture_base overrides/wall1_1.tga texture_normals overrides/wall1_1_n.tga base_factor 2.5 + specular_factor 0.1 textures/e1u2/wall1_2: texture_base overrides/wall1_2.tga texture_normals overrides/wall1_2_n.tga base_factor 2.5 + specular_factor 0.1 textures/e1u2/window4_2: texture_base overrides/window4_2.tga @@ -5054,7 +5075,7 @@ textures/e1u2/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga bump_scale 0.126 - base_factor 2.5 + base_factor 0.5 textures/e1u2/yellow1_6: texture_base overrides/yellow1_6.tga @@ -5141,6 +5162,7 @@ textures/e1u3/bflor3_1: texture_base overrides/bflor3_1.tga texture_normals overrides/bflor3_1_n.tga base_factor 2.5 + specular_factor 0.1 textures/e1u3/bflor3_2: texture_base overrides/bflor3_2.tga @@ -5342,12 +5364,14 @@ textures/e1u3/cin_flr1_2: textures/e1u3/cindb2_1: texture_base overrides/cindb2_1.tga texture_normals overrides/cindb2_1_n.tga - base_factor 2.5 + base_factor 0.7 + specular_factor 0 textures/e1u3/cindb2_2: texture_base overrides/cindb2_2.tga texture_normals overrides/cindb2_2_n.tga - base_factor 2.5 + base_factor 1.6 + specular_factor 0 textures/e1u3/cinder1_2: texture_base overrides/cinder1_2.tga @@ -5388,7 +5412,8 @@ textures/e1u3/cindr2_1: textures/e1u3/cindr2_2: texture_base overrides/cindr2_2.tga texture_normals overrides/cindr2_2_n.tga - base_factor 2.5 + base_factor 1 + specular_factor 0 textures/e1u3/cindr3_1: texture_base overrides/cindr3_1.tga @@ -5594,7 +5619,9 @@ textures/e1u3/con1_2: textures/e1u3/con_flr1_1: texture_base overrides/con_flr1_1.tga texture_normals overrides/con_flr1_1_n.tga - base_factor 2.5 + base_factor 2 + specular_factor 0 + metalness_factor 0 textures/e1u3/con_flr1_2: texture_base overrides/con_flr1_2.tga @@ -5780,7 +5807,7 @@ textures/e1u3/ggrat2_1: textures/e1u3/grass1_5: texture_base overrides/grass1_5.tga texture_normals overrides/grass1_5_n.tga - base_factor 2 + base_factor 1 specular_factor 0 textures/e1u3/grass1_7: @@ -5850,7 +5877,6 @@ textures/e1u3/jaildr1_3: texture_base overrides/jaildr1_3.tga texture_normals overrides/jaildr1_3_n.tga texture_emissive overrides/jaildr1_3_light.tga - is_light 1 base_factor 2.5 textures/e1u3/jaildr2_1: @@ -5872,7 +5898,6 @@ textures/e1u3/jaildr2_3: texture_normals overrides/jaildr2_3_n.tga texture_emissive overrides/jaildr2_3_light.tga emissive_factor 0.3 - is_light 1 base_factor 2.5 textures/e1u3/jsign1_1: @@ -5985,11 +6010,13 @@ textures/e1u3/mach1_1: texture_base overrides/mach1_1.tga texture_normals overrides/mach1_1_n.tga base_factor 2.5 + specular_factor 0 textures/e1u3/mach1_2: texture_base overrides/mach1_2.tga texture_normals overrides/mach1_2_n.tga base_factor 2.5 + specular_factor 0 textures/e1u3/met1_1: texture_base overrides/met1_1.tga @@ -6000,6 +6027,7 @@ textures/e1u3/met1_2: texture_base overrides/met1_2.tga texture_normals overrides/met1_2_n.tga base_factor 2.5 + specular_factor 0 textures/e1u3/met1_3: texture_base overrides/met1_3.tga @@ -6020,11 +6048,13 @@ textures/e1u3/met2_1: texture_base overrides/met2_1.tga texture_normals overrides/met2_1_n.tga base_factor 2.5 + specular_factor 0.2 textures/e1u3/met2_2: texture_base overrides/met2_2.tga texture_normals overrides/met2_2_n.tga base_factor 2.5 + specular_factor 0.2 textures/e1u3/met2_3: texture_base overrides/met2_3.tga @@ -6043,6 +6073,7 @@ textures/e1u3/met3_1: emissive_factor 0.1 is_light 1 base_factor 2.5 + specular_factor 0.2 textures/e1u3/met3_2: texture_base overrides/met3_2.tga @@ -6087,6 +6118,7 @@ textures/e1u3/met4_5: emissive_factor 0.5 is_light 1 base_factor 2.5 + specular_factor 0 textures/e1u3/metal1_3: texture_base overrides/metal1_3.tga @@ -6449,7 +6481,7 @@ textures/e1u3/stflr1_4: textures/e1u3/stflr1_5: texture_base overrides/stflr1_5.tga texture_normals overrides/stflr1_5_n.tga - base_factor 2.5 + base_factor 1 textures/e1u3/support1_1: texture_base textures/e1u3/support1_1.tga @@ -6528,12 +6560,16 @@ textures/e1u3/trigger: textures/e1u3/troof1_1: texture_base textures/e1u3/troof1_1.tga texture_normals textures/e1u3/troof1_1_n.tga + roughness_override 0.5 base_factor 2.5 + specular_factor 0.2 textures/e1u3/troof1_2: texture_base overrides/troof1_2.tga texture_normals overrides/troof1_2_n.tga + roughness_override 0.5 base_factor 2.5 + specular_factor 0.2 textures/e1u3/troof1_3: texture_base overrides/troof1_3.tga @@ -6543,8 +6579,9 @@ textures/e1u3/troof1_3: textures/e1u3/troof1_4: texture_base overrides/troof1_4.tga texture_normals overrides/troof1_4_n.tga - roughness_override 0.583 + roughness_override 0.5 base_factor 2.5 + specular_factor 0.2 textures/e1u3/troof1_6: texture_base overrides/troof1_6.tga @@ -6560,6 +6597,8 @@ textures/e1u3/troof3_2: texture_base overrides/troof3_2.tga texture_normals overrides/troof3_2_n.tga base_factor 2.5 + metalness_factor 0 + specular_factor 0.2 textures/e1u3/troof4_1: texture_base overrides/troof4_1.tga @@ -6569,8 +6608,9 @@ textures/e1u3/troof4_1: textures/e1u3/troof4_2: texture_base overrides/troof4_2.tga texture_normals overrides/troof4_2_n.tga - roughness_override 0.457 + roughness_override 0.5 base_factor 2.5 + specular_factor 0.2 textures/e1u3/troof4_3: texture_base overrides/troof4_3.tga @@ -6580,7 +6620,9 @@ textures/e1u3/troof4_3: textures/e1u3/troof4_5: texture_base overrides/troof4_5.tga texture_normals overrides/troof4_5_n.tga + roughness_override 0.5 base_factor 2.5 + specular_factor 0.2 textures/e1u3/troof4_6: texture_base overrides/troof4_6.tga @@ -6597,6 +6639,8 @@ textures/e1u3/troof4_8: texture_base overrides/troof4_8.tga texture_normals overrides/troof4_8_n.tga base_factor 2.5 + roughness_override 0.5 + specular_factor 0.2 textures/e1u3/troof5_3: texture_base overrides/troof5_3.tga @@ -6655,12 +6699,14 @@ textures/e1u3/watrt1_2: texture_base overrides/watrt1_2.tga texture_normals overrides/watrt1_2_n.tga base_factor 2.5 + specular_factor 0 textures/e1u3/watrt2_1: texture_base overrides/watrt2_1.tga texture_normals overrides/watrt2_1_n.tga texture_emissive overrides/watrt2_1_light.tga base_factor 2.5 + specular_factor 0 textures/e1u3/watrt2_2: texture_base overrides/watrt2_2.tga @@ -6791,6 +6837,7 @@ textures/e1u3/wplat1_2: texture_base overrides/wplat1_2.tga texture_normals overrides/wplat1_2_n.tga base_factor 2.5 + specular_factor 0 textures/e1u3/wstfl2_5: texture_base overrides/wstfl2_5.tga @@ -6800,7 +6847,8 @@ textures/e1u3/wstfl2_5: textures/e1u3/wstfl2_6: texture_base overrides/wstfl2_6.tga texture_normals overrides/wstfl2_6_n.tga - base_factor 2.5 + base_factor 5 + specular_factor 0.1 textures/e1u3/yelfield: texture_base textures/e1u3/yelfield.wal @@ -6810,7 +6858,7 @@ textures/e1u3/yelfield: textures/e1u3/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga - base_factor 2.5 + base_factor 0.5 textures/e1u4/alarm0: texture_base overrides/alarm0.tga @@ -6909,7 +6957,9 @@ textures/e1u4/trigger: textures/e1u4/troof4_2: texture_base overrides/troof4_2.tga texture_normals overrides/troof4_2_n.tga + roughness_override 0.5 base_factor 2.5 + specular_factor 0.2 textures/e1u4/troof4_6: texture_base overrides/troof4_6.tga @@ -7041,6 +7091,7 @@ textures/e2u1/broken2_3: texture_base overrides/broken2_3.tga texture_normals overrides/broken2_3_n.tga base_factor 2.5 + specular_factor 0.1 textures/e2u1/btactmach0: texture_base overrides/btactmach0.tga @@ -7348,6 +7399,8 @@ textures/e2u1/grass1_7: texture_base overrides/grass1_7.tga texture_normals overrides/grass1_7_n.tga kind SLIME + base_factor 2 + specular_factor 0 textures/e2u1/grnx2_5: texture_base overrides/grnx2_5.tga @@ -7435,7 +7488,8 @@ textures/e2u1/met1_1: textures/e2u1/metal17_2: texture_base textures/e2u1/metal17_2.tga texture_normals textures/e2u1/metal17_2_n.tga - base_factor 2.5 + base_factor 4 + specular_factor 0 textures/e2u1/metal18_1: texture_base textures/e2u1/metal18_1.tga @@ -7742,7 +7796,8 @@ textures/e2u1/mmtl15_5: textures/e2u1/mmtl16_6: texture_base overrides/mmtl16_6.tga texture_normals overrides/mmtl16_6_n.tga - base_factor 2.5 + base_factor 2 + specular_factor 0.2 textures/e2u1/mmtl19_1: texture_base overrides/mmtl19_1.tga @@ -7989,7 +8044,9 @@ textures/e2u1/trigger: textures/e2u1/troof4_2: texture_base overrides/troof4_2.tga texture_normals overrides/troof4_2_n.tga + roughness_override 0.5 base_factor 2.5 + specular_factor 0.2 textures/e2u1/tunl1_5: texture_base overrides/tunl1_5.tga @@ -8114,6 +8171,7 @@ textures/e2u2/belt2_2: texture_base overrides/belt2_2.tga texture_normals overrides/belt2_2_n.tga base_factor 2.5 + specular_factor 0 textures/e2u2/belt2_3: texture_base overrides/belt2_3.tga @@ -8172,6 +8230,7 @@ textures/e2u2/broken2_2: texture_base overrides/broken2_2.tga texture_normals overrides/broken2_2_n.tga base_factor 2.5 + specular_factor 0.1 textures/e2u2/brwind5_2: texture_base overrides/brwind5_2.tga @@ -8483,7 +8542,8 @@ textures/e2u2/metal18_1: textures/e2u2/metal18_2: texture_base textures/e2u2/metal18_2.tga texture_normals textures/e2u2/metal18_2_n.tga - base_factor 2.5 + base_factor 3 + specular_factor 0 textures/e2u2/metal19_1: texture_base textures/e2u2/metal19_1.tga @@ -8908,7 +8968,7 @@ textures/e2u2/yellow1_2: textures/e2u2/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga - base_factor 2.5 + base_factor 0.5 textures/e2u2/yellow1_6: texture_base overrides/yellow1_6.tga @@ -9007,7 +9067,7 @@ textures/e2u3/blum12_1: textures/e2u3/blum12_2: texture_base overrides/blum12_2.tga texture_normals overrides/blum12_2_n.tga - base_factor 2.5 + base_factor 1.5 textures/e2u3/blum13_1: texture_base overrides/blum13_1.tga @@ -9145,6 +9205,7 @@ textures/e2u3/broken2_3: texture_base overrides/broken2_3.tga texture_normals overrides/broken2_3_n.tga base_factor 2.5 + specular_factor 0.1 textures/e2u3/btactmach0: texture_base overrides/btactmach0.tga @@ -9302,12 +9363,12 @@ textures/e2u3/comp1_3: texture_emissive overrides/comp1_3_light.tga emissive_factor 0.05 kind SCREEN - base_factor 2.5 + base_factor 1.5 textures/e2u3/comp1_5: texture_base overrides/comp1_5.tga texture_normals overrides/comp1_5_n.tga - base_factor 2.5 + base_factor 1.5 textures/e2u3/comp1_8: texture_base overrides/comp1_8.tga @@ -9461,6 +9522,7 @@ textures/e2u3/dump1_2: texture_base overrides/dump1_2.tga texture_normals overrides/dump1_2_n.tga base_factor 2.5 + specular_factor 0.1 textures/e2u3/dump3_1: texture_base overrides/dump3_1.tga @@ -9487,7 +9549,8 @@ textures/e2u3/floor1_2: textures/e2u3/floor1_3: texture_base textures/e2u3/floor1_3.tga texture_normals textures/e2u3/floor1_3_n.tga - base_factor 2.5 + base_factor 1 + roughness_override 0.2 textures/e2u3/floor1_4: texture_base textures/e2u3/floor1_4.tga @@ -9504,6 +9567,7 @@ textures/e2u3/floor1_6: texture_normals overrides/floor1_6_n.tga bump_scale 0.4 base_factor 2.5 + specular_factor 0.5 textures/e2u3/floor1_7: texture_base textures/e2u3/floor1_7.tga @@ -9554,6 +9618,8 @@ textures/e2u3/floor3_3: texture_base textures/e2u3/floor3_3.tga texture_normals textures/e2u3/floor3_3_n.tga base_factor 2.5 + specular_factor 0.2 + metalness_factor 0 textures/e2u3/floor3_5: texture_base overrides/floor3_5.tga @@ -9731,6 +9797,8 @@ textures/e2u3/green3_4: texture_base overrides/green3_4.tga texture_normals overrides/green3_4_n.tga base_factor 2.5 + bump_scale 0.5 + specular_factor 0.2 textures/e2u3/grnx2_1: texture_base overrides/grnx2_1.tga @@ -9825,8 +9893,9 @@ textures/e2u3/lead1_1: textures/e2u3/lead1_2: texture_base overrides/lead1_2.tga texture_normals overrides/lead1_2_n.tga - bump_scale 0.3 - base_factor 2.5 + base_factor 1.5 + metalness_factor 0 + specular_factor 0 textures/e2u3/lead2_1: texture_base overrides/lead2_1.tga @@ -9837,11 +9906,13 @@ textures/e2u3/mach1_1: texture_base overrides/mach1_1.tga texture_normals overrides/mach1_1_n.tga base_factor 2.5 + specular_factor 0 textures/e2u3/mach1_2: texture_base overrides/mach1_2.tga texture_normals overrides/mach1_2_n.tga base_factor 2.5 + specular_factor 0 textures/e2u3/machine1: texture_base overrides/machine1.tga @@ -9886,12 +9957,14 @@ textures/e2u3/metal17_1: textures/e2u3/metal17_2: texture_base textures/e2u3/metal17_2.tga texture_normals textures/e2u3/metal17_2_n.tga - base_factor 2.5 + base_factor 4 + specular_factor 0 textures/e2u3/metal18_2: texture_base textures/e2u3/metal18_2.tga texture_normals textures/e2u3/metal18_2_n.tga - base_factor 2.5 + base_factor 3 + specular_factor 0 textures/e2u3/metal1_1: texture_base textures/e2u3/metal1_1.tga @@ -9933,6 +10006,7 @@ textures/e2u3/metal2_2: texture_base textures/e2u3/metal2_2.tga texture_normals textures/e2u3/metal2_2_n.tga base_factor 2.5 + specular_factor 0 textures/e2u3/metal33_2: texture_base overrides/metal33_2.tga @@ -9953,11 +10027,13 @@ textures/e2u3/metal4_1: texture_base textures/e2u3/metal4_1.tga texture_normals textures/e2u3/metal4_1_n.tga base_factor 2.5 + specular_factor 0 textures/e2u3/metal4_2: texture_base textures/e2u3/metal4_2.tga texture_normals textures/e2u3/metal4_2_n.tga base_factor 2.5 + specular_factor 0 textures/e2u3/metal5_1: texture_base textures/e2u3/metal5_1.tga @@ -9988,11 +10064,13 @@ textures/e2u3/metal9_1: texture_base textures/e2u3/metal9_1.tga texture_normals textures/e2u3/metal9_1_n.tga base_factor 2.5 + specular_factor 0 textures/e2u3/metl10_2: texture_base overrides/metl10_2.tga texture_normals overrides/metl10_2_n.tga base_factor 2.5 + specular_factor 0 textures/e2u3/metl12_1: texture_base overrides/metl12_1.tga @@ -10003,6 +10081,7 @@ textures/e2u3/metl5b_1: texture_base overrides/metl5b_1.tga texture_normals overrides/metl5b_1_n.tga base_factor 2.5 + specular_factor 0 textures/e2u3/mont1_1: texture_base overrides/mont1_1.tga @@ -10529,6 +10608,7 @@ textures/e2u3/wplat1_2: texture_base overrides/wplat1_2.tga texture_normals overrides/wplat1_2_n.tga base_factor 2.5 + specular_factor 0 textures/e2u3/wplat1_3: texture_base overrides/wplat1_3.tga @@ -10580,7 +10660,7 @@ textures/e2u3/yelfield: textures/e2u3/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga - base_factor 2.5 + base_factor 0.5 textures/e3u1/+0butn4: texture_base overrides/+0butn4.tga @@ -10733,6 +10813,7 @@ textures/e3u1/broken2_2: texture_base overrides/broken2_2.tga texture_normals overrides/broken2_2_n.tga base_factor 2.5 + specular_factor 0.1 textures/e3u1/brwater: texture_base textures/e3u1/brwater.wal @@ -11537,6 +11618,7 @@ textures/e3u1/marble1_4: texture_base overrides/marble1_4.tga texture_normals overrides/marble1_4_n.tga base_factor 2.5 + specular_factor 0.2 textures/e3u1/marble1_7: texture_base overrides/marble1_7.tga @@ -12001,7 +12083,7 @@ textures/e3u1/yelfield: textures/e3u1/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga - base_factor 2.5 + base_factor 0.5 textures/e3u2/+0lcomp: texture_base overrides/+0lcomp.tga @@ -12703,11 +12785,15 @@ textures/e3u2/troof3_2: texture_base overrides/troof3_2.tga texture_normals overrides/troof3_2_n.tga base_factor 2.5 + metalness_factor 0 + specular_factor 0.3 textures/e3u2/troof4_2: texture_base overrides/troof4_2.tga texture_normals overrides/troof4_2_n.tga + roughness_override 0.5 base_factor 2.5 + specular_factor 0.2 textures/e3u2/troof4_5: texture_base overrides/troof4_5.tga @@ -12718,6 +12804,7 @@ textures/e3u2/troof5_1: texture_base overrides/troof5_1.tga texture_normals overrides/troof5_1_n.tga base_factor 2.5 + specular_factor 0 textures/e3u2/troof5_3: texture_base overrides/troof5_3.tga @@ -12755,7 +12842,7 @@ textures/e3u2/wndow1_2: textures/e3u2/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga - base_factor 2.5 + base_factor 0.5 textures/e3u2/yellow1_6: texture_base overrides/yellow1_6.tga @@ -12834,6 +12921,7 @@ textures/e3u3/broken2_3: texture_base overrides/broken2_3.tga texture_normals overrides/broken2_3_n.tga base_factor 2.5 + specular_factor 0.1 textures/e3u3/btactmach0: texture_base overrides/btactmach0.tga @@ -13246,6 +13334,8 @@ textures/e3u3/floor3_3: texture_base textures/e3u3/floor3_3.tga texture_normals textures/e3u3/floor3_3_n.tga base_factor 2.5 + specular_factor 0.2 + metalness_factor 0 textures/e3u3/floorsw0: texture_base overrides/floorsw0.tga @@ -13286,7 +13376,7 @@ textures/e3u3/grass1_4: textures/e3u3/grass1_5: texture_base overrides/grass1_5.tga texture_normals overrides/grass1_5_n.tga - base_factor 2 + base_factor 1 specular_factor 0 textures/e3u3/grass1_6: @@ -13419,7 +13509,8 @@ textures/e3u3/metal17_1: textures/e3u3/metal17_2: texture_base textures/e3u3/metal17_2.tga texture_normals textures/e3u3/metal17_2_n.tga - base_factor 2.5 + base_factor 4 + specular_factor 0 textures/e3u3/metal18_1: texture_base textures/e3u3/metal18_1.tga @@ -13429,7 +13520,8 @@ textures/e3u3/metal18_1: textures/e3u3/metal18_2: texture_base textures/e3u3/metal18_2.tga texture_normals textures/e3u3/metal18_2_n.tga - base_factor 2.5 + base_factor 3 + specular_factor 0 textures/e3u3/metal19_1: texture_base textures/e3u3/metal19_1.tga @@ -13465,6 +13557,7 @@ textures/e3u3/metal1_5: texture_base overrides/metal1_5.tga texture_normals overrides/metal1_5_n.tga base_factor 2.5 + specular_factor 0 textures/e3u3/metal1_6: texture_base textures/e3u3/metal1_6.tga @@ -13740,6 +13833,7 @@ textures/e3u3/wplat1_2: texture_base overrides/wplat1_2.tga texture_normals overrides/wplat1_2_n.tga base_factor 2.5 + specular_factor 0 textures/e3u3/wplat1_3: texture_base overrides/wplat1_3.tga @@ -13759,7 +13853,7 @@ textures/e3u3/yellow1_2: textures/e3u3/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga - base_factor 2.5 + base_factor 0.5 textures/e3u3/yellow1_6: texture_base overrides/yellow1_6.tga diff --git a/baseq2/sky_clusters.txt b/baseq2/sky_clusters.txt index c3f9afee1..c651a9e3c 100644 --- a/baseq2/sky_clusters.txt +++ b/baseq2/sky_clusters.txt @@ -10,7 +10,7 @@ base1 537 654 655 651 1326 1330 1337 # more cave 535 536 520 524 # extra cave sky that affects the "crouch here" space near the level entrance 179 # fan shaft in crawl space -807 818 821 # some windows in the final hall +799 807 818 821 855 857 864 867 870 871 872 970 971 972 # some windows in the final hall 992 994 991 989 3 11 670 794 @@ -113,7 +113,8 @@ cool1 653 682 685 671 672 637 fact1 -# 855 +854 855 +834 693 627 629 725 # 514 613 615 501 607 609 499 599 132 123 9 15 498 597 134 From c33e385af019fdc283727dedc7f7d98db1b0cfb9 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Tue, 7 Sep 2021 12:25:29 -0700 Subject: [PATCH 15/55] Automatically enable "diffuse mode" for old materials. --- src/refresh/vkpt/material.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/refresh/vkpt/material.c b/src/refresh/vkpt/material.c index f0c3d0975..b49e8ed78 100644 --- a/src/refresh/vkpt/material.c +++ b/src/refresh/vkpt/material.c @@ -835,6 +835,13 @@ pbr_material_t* MAT_Find(const char* name, imagetype_t type, imageflags_t flags) mat->image_emissive = NULL; else Q_strlcpy(mat->filename_emissive, mat->image_emissive->filepath, sizeof(mat->filename_emissive)); + + // If there is no normals/metalness image, assume that the material is a basic diffuse one. + if (!mat->image_normals) + { + mat->specular_factor = 0.f; + mat->metalness_factor = 0.f; + } } if(mat->synth_emissive && !mat->image_emissive) From 17cad10acb760d7f1e09a1b293f9c8e8b3d862b4 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Tue, 7 Sep 2021 12:57:34 -0700 Subject: [PATCH 16/55] A few more material tweaks. --- baseq2/materials/baseq2.mat | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/baseq2/materials/baseq2.mat b/baseq2/materials/baseq2.mat index 5019cf6be..0cfb288fa 100644 --- a/baseq2/materials/baseq2.mat +++ b/baseq2/materials/baseq2.mat @@ -3072,6 +3072,7 @@ textures/e1u1/metal2_1: texture_base textures/e1u1/metal2_1.tga texture_normals textures/e1u1/metal2_1_n.tga base_factor 2.5 + metalness_factor 0.5 textures/e1u1/metal2_2: texture_base textures/e1u1/metal2_2.tga @@ -3767,6 +3768,7 @@ textures/e1u1/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga base_factor 0.5 + specular_factor 0.1 textures/e1u1/yellow1_6: texture_base overrides/yellow1_6.tga @@ -5076,6 +5078,7 @@ textures/e1u2/yellow1_4: texture_normals overrides/yellow1_4_n.tga bump_scale 0.126 base_factor 0.5 + specular_factor 0.1 textures/e1u2/yellow1_6: texture_base overrides/yellow1_6.tga @@ -6859,6 +6862,7 @@ textures/e1u3/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga base_factor 0.5 + specular_factor 0.1 textures/e1u4/alarm0: texture_base overrides/alarm0.tga @@ -8969,6 +8973,7 @@ textures/e2u2/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga base_factor 0.5 + specular_factor 0.1 textures/e2u2/yellow1_6: texture_base overrides/yellow1_6.tga @@ -10001,6 +10006,7 @@ textures/e2u3/metal2_1: texture_base textures/e2u3/metal2_1.tga texture_normals textures/e2u3/metal2_1_n.tga base_factor 2.5 + metalness_factor 0.5 textures/e2u3/metal2_2: texture_base textures/e2u3/metal2_2.tga @@ -10661,6 +10667,7 @@ textures/e2u3/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga base_factor 0.5 + specular_factor 0.1 textures/e3u1/+0butn4: texture_base overrides/+0butn4.tga @@ -11634,6 +11641,7 @@ textures/e3u1/metal2_1: texture_base textures/e3u1/metal2_1.tga texture_normals textures/e3u1/metal2_1_n.tga base_factor 2.5 + metalness_factor 0.5 textures/e3u1/metal2_2: texture_base textures/e3u1/metal2_2.tga @@ -12084,6 +12092,7 @@ textures/e3u1/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga base_factor 0.5 + specular_factor 0.1 textures/e3u2/+0lcomp: texture_base overrides/+0lcomp.tga @@ -12843,6 +12852,7 @@ textures/e3u2/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga base_factor 0.5 + specular_factor 0.1 textures/e3u2/yellow1_6: texture_base overrides/yellow1_6.tga @@ -13618,6 +13628,7 @@ textures/e3u3/metal2_1: texture_base textures/e3u3/metal2_1.tga texture_normals textures/e3u3/metal2_1_n.tga base_factor 2.5 + metalness_factor 0.5 textures/e3u3/metal3_3: texture_base textures/e3u3/metal3_3.tga @@ -13854,6 +13865,7 @@ textures/e3u3/yellow1_4: texture_base overrides/yellow1_4.tga texture_normals overrides/yellow1_4_n.tga base_factor 0.5 + specular_factor 0.1 textures/e3u3/yellow1_6: texture_base overrides/yellow1_6.tga From 84042660f8783954a51cdb24c8d4f4d861121063 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Tue, 7 Sep 2021 15:06:09 -0700 Subject: [PATCH 17/55] Added a heuristic component to the temporal filter to reduce its smearing of specular reflections. With the new materials and BRDF, specular channel often becomes more pronounced, and the temporal filter blurs it by redistributing the energy between the bilinear taps from the previous frame. Shortening the effective history when the surfaces are moving helps reduce that effect. --- src/refresh/vkpt/shader/asvgf_temporal.comp | 5 ++++- src/refresh/vkpt/shader/global_ubo.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/refresh/vkpt/shader/asvgf_temporal.comp b/src/refresh/vkpt/shader/asvgf_temporal.comp index a72d5508c..f3a4cd612 100644 --- a/src/refresh/vkpt/shader/asvgf_temporal.comp +++ b/src/refresh/vkpt/shader/asvgf_temporal.comp @@ -151,6 +151,8 @@ main() pos_prev = ((vec2(ipos) + vec2(0.5)) * vec2(global_ubo.inv_width * 2, global_ubo.inv_height) + motion.xy) * vec2(global_ubo.prev_width / 2, global_ubo.prev_height); } + float motion_length = length(motion.xy * vec2(global_ubo.width, global_ubo.height)); + // Load the parameters of the target pixel float depth_curr; vec3 normal_curr; @@ -342,7 +344,8 @@ main() if(temporal_sample_valid_spec) { // Same sequence as above, only for the specular channel - float antilag_alpha_spec = clamp(mix(1.0, global_ubo.flt_antilag_spec * grad_hf_spec.y, global_ubo.flt_temporal_spec), 0, 1); + float antilag = grad_hf_spec.y * global_ubo.flt_antilag_spec + motion_length * global_ubo.flt_antilag_spec_motion; + float antilag_alpha_spec = clamp(mix(1.0, antilag, global_ubo.flt_temporal_spec), 0, 1); float hist_len_spec = min(temporal_color_histlen_spec.a * pow(1.0 - antilag_alpha_spec, 10) + 1.0, 256.0); float alpha_color_spec = max(global_ubo.flt_min_alpha_color_spec, 1.0 / hist_len_spec); alpha_color_spec = mix(alpha_color_spec, 1.0, antilag_alpha_spec); diff --git a/src/refresh/vkpt/shader/global_ubo.h b/src/refresh/vkpt/shader/global_ubo.h index abcde8273..32a15c577 100644 --- a/src/refresh/vkpt/shader/global_ubo.h +++ b/src/refresh/vkpt/shader/global_ubo.h @@ -37,6 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc., UBO_CVAR_DO(flt_antilag_hf, 1) /* A-SVGF anti-lag filter strength, [0..inf) */ \ UBO_CVAR_DO(flt_antilag_lf, 0.2) \ UBO_CVAR_DO(flt_antilag_spec, 2) \ + UBO_CVAR_DO(flt_antilag_spec_motion, 0.004) /* scaler for motion vector scaled specular anti-blur adjustment */ \ UBO_CVAR_DO(flt_atrous_depth, 0.5) /* wavelet fitler sensitivity to depth, [0..inf) */ \ UBO_CVAR_DO(flt_atrous_deflicker_lf, 2) /* max brightness difference between adjacent pixels in the LF channel, (0..inf) */ \ UBO_CVAR_DO(flt_atrous_hf, 4) /* number of a-trous wavelet filter iterations on the LF channel, [0..4] */ \ From 3ff404772206d24cd5b9dd3a52abed8d10b45d7e Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Thu, 9 Sep 2021 11:28:53 +0200 Subject: [PATCH 18/55] Create buf_accel_scratch with VK_BUFFER_USAGE_STORAGE_BUFFER_BIT Silences validation error VUID-vkCmdBuildAccelerationStructuresKHR-pInfos-03674 --- src/refresh/vkpt/path_tracer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/refresh/vkpt/path_tracer.c b/src/refresh/vkpt/path_tracer.c index 91c6874b1..c694a1b07 100644 --- a/src/refresh/vkpt/path_tracer.c +++ b/src/refresh/vkpt/path_tracer.c @@ -170,7 +170,7 @@ vkpt_pt_init() minAccelerationStructureScratchOffsetAlignment = accel_struct_properties.minAccelerationStructureScratchOffsetAlignment; buffer_create(&buf_accel_scratch, SIZE_SCRATCH_BUFFER, - VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT, + VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); for(int i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) { From 74c0632b16ebd1564985f4ca2e46df10a34887c2 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Thu, 9 Sep 2021 11:33:06 +0200 Subject: [PATCH 19/55] Fix typo in MZ_IONRIPPER sound (#141) --- src/client/effects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/effects.c b/src/client/effects.c index 344a1002b..2a64225f3 100644 --- a/src/client/effects.c +++ b/src/client/effects.c @@ -401,7 +401,7 @@ void CL_MuzzleFlash(void) break; case MZ_IONRIPPER: DL_COLOR(1, 0.5, 0.5); - S_StartSound(NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/rippfiref.wav"), volume, ATTN_NORM, 0); + S_StartSound(NULL, mz.entity, CHAN_WEAPON, S_RegisterSound("weapons/rippfire.wav"), volume, ATTN_NORM, 0); break; case MZ_ETF_RIFLE: From 8e73b63feaae3361656fd07b0db5cccf7f6b2d31 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Wed, 15 Sep 2021 11:18:14 -0700 Subject: [PATCH 20/55] Include the new materials folder into the media package. --- setup/package_media.bat | 2 +- setup/package_media.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup/package_media.bat b/setup/package_media.bat index 9a37eac35..253bf67d9 100644 --- a/setup/package_media.bat +++ b/setup/package_media.bat @@ -1,7 +1,7 @@ @echo off PUSHD ..\baseq2 SET SEVENZIP="C:\Program Files\7-Zip\7z.exe" -SET SOURCES=env maps models overrides pics sound sprites textures materials.csv prefetch.txt pt_toggles.cfg q2rtx.cfg q2rtx.menu sky_clusters.txt cameras.txt +SET SOURCES=env maps models overrides pics sound sprites textures materials prefetch.txt pt_toggles.cfg q2rtx.cfg q2rtx.menu sky_clusters.txt cameras.txt SET DEST=q2rtx_media.pkz IF EXIST %DEST% DEL %DEST% %SEVENZIP% a -tzip %DEST% %SOURCES% diff --git a/setup/package_media.cmake b/setup/package_media.cmake index b42a4f412..d03d3548d 100644 --- a/setup/package_media.cmake +++ b/setup/package_media.cmake @@ -7,7 +7,7 @@ SET(MEDIA_SOURCES ${SOURCE}/baseq2/sound ${SOURCE}/baseq2/sprites ${SOURCE}/baseq2/textures - ${SOURCE}/baseq2/materials.csv + ${SOURCE}/baseq2/materials ${SOURCE}/baseq2/prefetch.txt ${SOURCE}/baseq2/pt_toggles.cfg ${SOURCE}/baseq2/q2rtx.cfg From 71a09916acea68378a9f0e899e4cdfa8f53054bd Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Thu, 15 Jul 2021 16:55:00 +0200 Subject: [PATCH 21/55] Minimally less hardcoding of image binding indices --- src/refresh/vkpt/shader/global_textures.h | 120 +++++++++++----------- 1 file changed, 61 insertions(+), 59 deletions(-) diff --git a/src/refresh/vkpt/shader/global_textures.h b/src/refresh/vkpt/shader/global_textures.h index 83274577c..97b0a6793 100644 --- a/src/refresh/vkpt/shader/global_textures.h +++ b/src/refresh/vkpt/shader/global_textures.h @@ -74,68 +74,70 @@ with this program; if not, write to the Free Software Foundation, Inc., IMG_DO(PT_COLOR_SPEC, 34, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ IMG_DO(PT_GEO_NORMAL2, 35, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ +#define NUM_IMAGES_BASE 36 + #define LIST_IMAGES_A_B \ - IMG_DO(PT_VISBUF_A, 36, R32G32_UINT, rg32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_VISBUF_B, 37, R32G32_UINT, rg32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_CLUSTER_A, 38, R16_UINT, r16ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_CLUSTER_B, 39, R16_UINT, r16ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_BASE_COLOR_A, 40, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_BASE_COLOR_B, 41, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_METALLIC_A, 42, R8G8_UNORM, rg8, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_METALLIC_B, 43, R8G8_UNORM, rg8, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_VIEW_DEPTH_A, 44, R16_SFLOAT, r32f, IMG_WIDTH, IMG_HEIGHT ) \ - IMG_DO(PT_VIEW_DEPTH_B, 45, R16_SFLOAT, r32f, IMG_WIDTH, IMG_HEIGHT ) \ - IMG_DO(PT_NORMAL_A, 46, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_NORMAL_B, 47, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_GEO_NORMAL_A, 48, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_GEO_NORMAL_B, 49, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_FILTERED_SPEC_A, 50, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_FILTERED_SPEC_B, 51, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_MOMENTS_HF_A, 52, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_MOMENTS_HF_B, 53, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_TAA_A, 54, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA, IMG_HEIGHT_TAA ) \ - IMG_DO(ASVGF_TAA_B, 55, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA, IMG_HEIGHT_TAA ) \ - IMG_DO(ASVGF_RNG_SEED_A, 56, R32_UINT, r32ui, IMG_WIDTH, IMG_HEIGHT ) \ - IMG_DO(ASVGF_RNG_SEED_B, 57, R32_UINT, r32ui, IMG_WIDTH, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_COLOR_LF_SH_A, 58, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_COLOR_LF_SH_B, 59, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_COLOR_LF_COCG_A,60, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_COLOR_LF_COCG_B,61, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_GRAD_SMPL_POS_A, 62, R32_UINT, r32ui, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ - IMG_DO(ASVGF_GRAD_SMPL_POS_B, 63, R32_UINT, r32ui, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ + IMG_DO(PT_VISBUF_A, NUM_IMAGES_BASE + 0, R32G32_UINT, rg32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_VISBUF_B, NUM_IMAGES_BASE + 1, R32G32_UINT, rg32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_CLUSTER_A, NUM_IMAGES_BASE + 2, R16_UINT, r16ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_CLUSTER_B, NUM_IMAGES_BASE + 3, R16_UINT, r16ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_BASE_COLOR_A, NUM_IMAGES_BASE + 4, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_BASE_COLOR_B, NUM_IMAGES_BASE + 5, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_METALLIC_A, NUM_IMAGES_BASE + 6, R8G8_UNORM, rg8, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_METALLIC_B, NUM_IMAGES_BASE + 7, R8G8_UNORM, rg8, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_VIEW_DEPTH_A, NUM_IMAGES_BASE + 8, R16_SFLOAT, r32f, IMG_WIDTH, IMG_HEIGHT ) \ + IMG_DO(PT_VIEW_DEPTH_B, NUM_IMAGES_BASE + 9, R16_SFLOAT, r32f, IMG_WIDTH, IMG_HEIGHT ) \ + IMG_DO(PT_NORMAL_A, NUM_IMAGES_BASE + 10, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_NORMAL_B, NUM_IMAGES_BASE + 11, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_GEO_NORMAL_A, NUM_IMAGES_BASE + 12, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_GEO_NORMAL_B, NUM_IMAGES_BASE + 13, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_FILTERED_SPEC_A, NUM_IMAGES_BASE + 14, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_FILTERED_SPEC_B, NUM_IMAGES_BASE + 15, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_HIST_MOMENTS_HF_A, NUM_IMAGES_BASE + 16, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_HIST_MOMENTS_HF_B, NUM_IMAGES_BASE + 17, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_TAA_A, NUM_IMAGES_BASE + 18, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA, IMG_HEIGHT_TAA ) \ + IMG_DO(ASVGF_TAA_B, NUM_IMAGES_BASE + 19, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA, IMG_HEIGHT_TAA ) \ + IMG_DO(ASVGF_RNG_SEED_A, NUM_IMAGES_BASE + 20, R32_UINT, r32ui, IMG_WIDTH, IMG_HEIGHT ) \ + IMG_DO(ASVGF_RNG_SEED_B, NUM_IMAGES_BASE + 21, R32_UINT, r32ui, IMG_WIDTH, IMG_HEIGHT ) \ + IMG_DO(ASVGF_HIST_COLOR_LF_SH_A, NUM_IMAGES_BASE + 22, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_HIST_COLOR_LF_SH_B, NUM_IMAGES_BASE + 23, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_HIST_COLOR_LF_COCG_A,NUM_IMAGES_BASE + 24, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_HIST_COLOR_LF_COCG_B,NUM_IMAGES_BASE + 25, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_GRAD_SMPL_POS_A, NUM_IMAGES_BASE + 26, R32_UINT, r32ui, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ + IMG_DO(ASVGF_GRAD_SMPL_POS_B, NUM_IMAGES_BASE + 27, R32_UINT, r32ui, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ #define LIST_IMAGES_B_A \ - IMG_DO(PT_VISBUF_B, 36, R32G32_UINT, rg32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_VISBUF_A, 37, R32G32_UINT, rg32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_CLUSTER_B, 38, R16_UINT, r16ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_CLUSTER_A, 39, R16_UINT, r16ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_BASE_COLOR_B, 40, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_BASE_COLOR_A, 41, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_METALLIC_B, 42, R8G8_UNORM, rg8, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_METALLIC_A, 43, R8G8_UNORM, rg8, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_VIEW_DEPTH_B, 44, R16_SFLOAT, r32f, IMG_WIDTH, IMG_HEIGHT ) \ - IMG_DO(PT_VIEW_DEPTH_A, 45, R16_SFLOAT, r32f, IMG_WIDTH, IMG_HEIGHT ) \ - IMG_DO(PT_NORMAL_B, 46, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_NORMAL_A, 47, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_GEO_NORMAL_B, 48, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(PT_GEO_NORMAL_A, 49, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_FILTERED_SPEC_B, 50, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_FILTERED_SPEC_A, 51, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_MOMENTS_HF_B, 52, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_MOMENTS_HF_A, 53, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_TAA_B, 54, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA, IMG_HEIGHT_TAA ) \ - IMG_DO(ASVGF_TAA_A, 55, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA, IMG_HEIGHT_TAA ) \ - IMG_DO(ASVGF_RNG_SEED_B, 56, R32_UINT, r32ui, IMG_WIDTH, IMG_HEIGHT ) \ - IMG_DO(ASVGF_RNG_SEED_A, 57, R32_UINT, r32ui, IMG_WIDTH, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_COLOR_LF_SH_B, 58, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_COLOR_LF_SH_A, 59, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_COLOR_LF_COCG_B,60, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_HIST_COLOR_LF_COCG_A,61, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ - IMG_DO(ASVGF_GRAD_SMPL_POS_B, 62, R32_UINT, r32ui, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ - IMG_DO(ASVGF_GRAD_SMPL_POS_A, 63, R32_UINT, r32ui, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ - -#define NUM_IMAGES 64 /* this really sucks but I don't know how to fix it - counting with enum does not work in GLSL */ + IMG_DO(PT_VISBUF_B, NUM_IMAGES_BASE + 0, R32G32_UINT, rg32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_VISBUF_A, NUM_IMAGES_BASE + 1, R32G32_UINT, rg32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_CLUSTER_B, NUM_IMAGES_BASE + 2, R16_UINT, r16ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_CLUSTER_A, NUM_IMAGES_BASE + 3, R16_UINT, r16ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_BASE_COLOR_B, NUM_IMAGES_BASE + 4, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_BASE_COLOR_A, NUM_IMAGES_BASE + 5, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_METALLIC_B, NUM_IMAGES_BASE + 6, R8G8_UNORM, rg8, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_METALLIC_A, NUM_IMAGES_BASE + 7, R8G8_UNORM, rg8, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_VIEW_DEPTH_B, NUM_IMAGES_BASE + 8, R16_SFLOAT, r32f, IMG_WIDTH, IMG_HEIGHT ) \ + IMG_DO(PT_VIEW_DEPTH_A, NUM_IMAGES_BASE + 9, R16_SFLOAT, r32f, IMG_WIDTH, IMG_HEIGHT ) \ + IMG_DO(PT_NORMAL_B, NUM_IMAGES_BASE + 10, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_NORMAL_A, NUM_IMAGES_BASE + 11, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_GEO_NORMAL_B, NUM_IMAGES_BASE + 12, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(PT_GEO_NORMAL_A, NUM_IMAGES_BASE + 13, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_FILTERED_SPEC_B, NUM_IMAGES_BASE + 14, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_FILTERED_SPEC_A, NUM_IMAGES_BASE + 15, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_HIST_MOMENTS_HF_B, NUM_IMAGES_BASE + 16, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_HIST_MOMENTS_HF_A, NUM_IMAGES_BASE + 17, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_TAA_B, NUM_IMAGES_BASE + 18, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA, IMG_HEIGHT_TAA ) \ + IMG_DO(ASVGF_TAA_A, NUM_IMAGES_BASE + 19, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_TAA, IMG_HEIGHT_TAA ) \ + IMG_DO(ASVGF_RNG_SEED_B, NUM_IMAGES_BASE + 20, R32_UINT, r32ui, IMG_WIDTH, IMG_HEIGHT ) \ + IMG_DO(ASVGF_RNG_SEED_A, NUM_IMAGES_BASE + 21, R32_UINT, r32ui, IMG_WIDTH, IMG_HEIGHT ) \ + IMG_DO(ASVGF_HIST_COLOR_LF_SH_B, NUM_IMAGES_BASE + 22, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_HIST_COLOR_LF_SH_A, NUM_IMAGES_BASE + 23, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_HIST_COLOR_LF_COCG_B,NUM_IMAGES_BASE + 24, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_HIST_COLOR_LF_COCG_A,NUM_IMAGES_BASE + 25, R16G16_SFLOAT, rg16f, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(ASVGF_GRAD_SMPL_POS_B, NUM_IMAGES_BASE + 26, R32_UINT, r32ui, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ + IMG_DO(ASVGF_GRAD_SMPL_POS_A, NUM_IMAGES_BASE + 27, R32_UINT, r32ui, IMG_WIDTH_GRAD_MGPU, IMG_HEIGHT_GRAD) \ + +#define NUM_IMAGES (NUM_IMAGES_BASE + 28) /* this really sucks but I don't know how to fix it + counting with enum does not work in GLSL */ // todo: make naming consistent! #define GLOBAL_TEXTURES_TEX_ARR_BINDING_IDX 0 From 0d5217185c9fe15f531178687355729f9477d8c2 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Mon, 23 Aug 2021 12:24:00 +0200 Subject: [PATCH 22/55] Add INCLUDES arg to compile_shaders cmake command --- cmake/compileShaders.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/compileShaders.cmake b/cmake/compileShaders.cmake index 183ecdd91..916146dcd 100644 --- a/cmake/compileShaders.cmake +++ b/cmake/compileShaders.cmake @@ -38,7 +38,7 @@ endif() function(compile_shader) set(options "") set(oneValueArgs SOURCE_FILE OUTPUT_FILE_NAME OUTPUT_FILE_LIST STAGE) - set(multiValueArgs DEFINES) + set(multiValueArgs DEFINES INCLUDES) cmake_parse_arguments(params "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) if (NOT params_SOURCE_FILE) @@ -74,6 +74,7 @@ function(compile_shader) -DVKPT_SHADER -V ${params_DEFINES} + ${params_INCLUDES} "${src_file}" -o "${out_file}") From b068eeeead5a2eb99cf2ed48b66cf3a99dd2dd35 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Wed, 1 Sep 2021 12:48:09 +0200 Subject: [PATCH 23/55] Add image, extent arguments to vkpt_final_blit_simple() --- src/refresh/vkpt/draw.c | 14 ++++++-------- src/refresh/vkpt/main.c | 4 ++-- src/refresh/vkpt/vkpt.h | 2 +- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/refresh/vkpt/draw.c b/src/refresh/vkpt/draw.c index 4cf8644d1..e97cfe08e 100644 --- a/src/refresh/vkpt/draw.c +++ b/src/refresh/vkpt/draw.c @@ -535,7 +535,7 @@ vkpt_draw_submit_stretch_pics(VkCommandBuffer cmd_buf) } VkResult -vkpt_final_blit_simple(VkCommandBuffer cmd_buf) +vkpt_final_blit_simple(VkCommandBuffer cmd_buf, VkImage image, VkExtent2D extent) { VkImageSubresourceRange subresource_range = { .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, @@ -554,10 +554,8 @@ vkpt_final_blit_simple(VkCommandBuffer cmd_buf) .newLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL ); - int output_img = VKPT_IMG_TAA_OUTPUT; - IMAGE_BARRIER(cmd_buf, - .image = qvk.images[output_img], + .image = image, .subresourceRange = subresource_range, .srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT, .dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT, @@ -566,8 +564,8 @@ vkpt_final_blit_simple(VkCommandBuffer cmd_buf) ); VkOffset3D blit_size = { - .x = qvk.extent_taa_output.width, - .y = qvk.extent_taa_output.height, + .x = extent.width, + .y = extent.height, .z = 1 }; VkOffset3D blit_size_unscaled = { @@ -580,7 +578,7 @@ vkpt_final_blit_simple(VkCommandBuffer cmd_buf) .dstOffsets = { [1] = blit_size_unscaled }, }; vkCmdBlitImage(cmd_buf, - qvk.images[output_img], VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, + image, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, qvk.swap_chain_images[qvk.current_swap_chain_image_index], VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &img_blit, VK_FILTER_NEAREST); @@ -594,7 +592,7 @@ vkpt_final_blit_simple(VkCommandBuffer cmd_buf) ); IMAGE_BARRIER(cmd_buf, - .image = qvk.images[output_img], + .image = image, .subresourceRange = subresource_range, .srcAccessMask = VK_ACCESS_TRANSFER_READ_BIT, .dstAccessMask = VK_ACCESS_SHADER_WRITE_BIT, diff --git a/src/refresh/vkpt/main.c b/src/refresh/vkpt/main.c index 4052dc0f4..22d48b6c5 100644 --- a/src/refresh/vkpt/main.c +++ b/src/refresh/vkpt/main.c @@ -3188,7 +3188,7 @@ R_EndFrame_RTX(void) { if (qvk.effective_aa_mode == AA_MODE_UPSCALE) { - vkpt_final_blit_simple(cmd_buf); + vkpt_final_blit_simple(cmd_buf, qvk.images[VKPT_IMG_TAA_OUTPUT], qvk.extent_taa_output); } else { @@ -3198,7 +3198,7 @@ R_EndFrame_RTX(void) if (extents_equal(qvk.extent_render, qvk.extent_unscaled) || extents_equal(qvk.extent_render, extent_unscaled_half) && drs_effective_scale == 0) // don't do nearest filter 2x upscale with DRS enabled - vkpt_final_blit_simple(cmd_buf); + vkpt_final_blit_simple(cmd_buf, qvk.images[VKPT_IMG_TAA_OUTPUT], qvk.extent_taa_output); else vkpt_final_blit_filtered(cmd_buf); } diff --git a/src/refresh/vkpt/vkpt.h b/src/refresh/vkpt/vkpt.h index 6fdbce235..5774b0429 100644 --- a/src/refresh/vkpt/vkpt.h +++ b/src/refresh/vkpt/vkpt.h @@ -574,7 +574,7 @@ VkResult vkpt_draw_destroy(); VkResult vkpt_draw_destroy_pipelines(); VkResult vkpt_draw_create_pipelines(); VkResult vkpt_draw_submit_stretch_pics(VkCommandBuffer cmd_buf); -VkResult vkpt_final_blit_simple(VkCommandBuffer cmd_buf); +VkResult vkpt_final_blit_simple(VkCommandBuffer cmd_buf, VkImage image, VkExtent2D extent); VkResult vkpt_final_blit_filtered(VkCommandBuffer cmd_buf); VkResult vkpt_draw_clear_stretch_pics(); From 9dc79351c0a4a33c45714156468b22e10ffcb274 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Mon, 23 Aug 2021 12:15:07 +0200 Subject: [PATCH 24/55] Add initial FSR support --- baseq2/q2rtx.menu | 1 + src/CMakeLists.txt | 5 +- src/refresh/vkpt/fsr.c | 197 ++ src/refresh/vkpt/fsr/ffx_a.h | 2656 +++++++++++++++++++++ src/refresh/vkpt/fsr/ffx_fsr1.h | 1199 ++++++++++ src/refresh/vkpt/main.c | 30 +- src/refresh/vkpt/profiler.c | 7 + src/refresh/vkpt/shader/fsr_easu.comp | 81 + src/refresh/vkpt/shader/fsr_rcas.comp | 74 + src/refresh/vkpt/shader/global_textures.h | 4 +- src/refresh/vkpt/shader/global_ubo.h | 6 + src/refresh/vkpt/vkpt.h | 14 + 12 files changed, 4267 insertions(+), 7 deletions(-) create mode 100644 src/refresh/vkpt/fsr.c create mode 100644 src/refresh/vkpt/fsr/ffx_a.h create mode 100644 src/refresh/vkpt/fsr/ffx_fsr1.h create mode 100644 src/refresh/vkpt/shader/fsr_easu.comp create mode 100644 src/refresh/vkpt/shader/fsr_rcas.comp diff --git a/baseq2/q2rtx.menu b/baseq2/q2rtx.menu index f2c4d4caa..9d6f3ca1a 100644 --- a/baseq2/q2rtx.menu +++ b/baseq2/q2rtx.menu @@ -125,6 +125,7 @@ begin video range -p -f "%.0f%%" "contrast" tm_reinhard 0 1 0.1 range "texture LOD bias" pt_texture_lod_bias -2 2 0.5 pairs "anti-aliasing" flt_taa "none" 0 "temporal AA" 1 "temporal upscaling" 2 + toggle "FSR" flt_fsr_enable pairs "global illumination" pt_num_bounce_rays low 0.5 medium 1 high 2 pairs "reflection/refraction depth" pt_reflect_refract off 0 1 1 2 2 4 4 8 8 toggle --status "turn some monitors in the game into security camera views" \ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a95aea35e..3af21e00a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -268,6 +268,7 @@ SET(SRC_VKPT refresh/vkpt/bsp_mesh.c refresh/vkpt/draw.c refresh/vkpt/freecam.c + refresh/vkpt/fsr.c refresh/vkpt/main.c refresh/vkpt/material.c refresh/vkpt/matrix.c @@ -329,6 +330,8 @@ set(SRC_SHADERS refresh/vkpt/shader/stretch_pic.vert refresh/vkpt/shader/final_blit_lanczos.frag refresh/vkpt/shader/final_blit.vert + refresh/vkpt/shader/fsr_easu.comp + refresh/vkpt/shader/fsr_rcas.comp ) set(SRC_RT_SHADERS @@ -362,7 +365,7 @@ IF(IS_64_BIT) endforeach() foreach(s ${SRC_SHADERS}) - compile_shader(SOURCE_FILE ${s} OUTPUT_FILE_LIST shader_bytecode) + compile_shader(SOURCE_FILE ${s} INCLUDES "-I${CMAKE_CURRENT_SOURCE_DIR}/refresh/vkpt/fsr" OUTPUT_FILE_LIST shader_bytecode) endforeach() add_custom_target(shaders DEPENDS ${shader_bytecode}) diff --git a/src/refresh/vkpt/fsr.c b/src/refresh/vkpt/fsr.c new file mode 100644 index 000000000..788c873e5 --- /dev/null +++ b/src/refresh/vkpt/fsr.c @@ -0,0 +1,197 @@ +/* +Copyright (C) 2018 Christoph Schied +Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#include "vkpt.h" + +#define A_CPU +#include "fsr/ffx_a.h" +#include "fsr/ffx_fsr1.h" + +enum { + FSR_EASU, + FSR_RCAS, + FSR_NUM_PIPELINES +}; + +static VkPipeline pipeline_fsr[FSR_NUM_PIPELINES]; +static VkPipelineLayout pipeline_layout_fsr; + +cvar_t *cvar_flt_fsr_enable = NULL; +cvar_t *cvar_flt_fsr_rcas = NULL; +cvar_t *cvar_flt_fsr_sharpness = NULL; + +void vkpt_fsr_init_cvars() +{ + // FSR enable toggle + cvar_flt_fsr_enable = Cvar_Get("flt_fsr_enable", "0", CVAR_ARCHIVE); + // FSR RCAS (sharpening) toggle + cvar_flt_fsr_rcas = Cvar_Get("flt_fsr_rcas", "1", CVAR_ARCHIVE); + // FSR sharpness setting (float, 0..2) + cvar_flt_fsr_sharpness = Cvar_Get("flt_fsr_sharpness", "0.2", CVAR_ARCHIVE); +} + +VkResult +vkpt_fsr_initialize() +{ + VkDescriptorSetLayout desc_set_layouts[] = { + qvk.desc_set_layout_ubo, qvk.desc_set_layout_textures + }; + + CREATE_PIPELINE_LAYOUT(qvk.device, &pipeline_layout_fsr, + .setLayoutCount = LENGTH(desc_set_layouts), + .pSetLayouts = desc_set_layouts, + ); + ATTACH_LABEL_VARIABLE(pipeline_layout_fsr, PIPELINE_LAYOUT); + + return VK_SUCCESS; +} + +VkResult +vkpt_fsr_destroy() +{ + vkDestroyPipelineLayout(qvk.device, pipeline_layout_fsr, NULL); + + return VK_SUCCESS; +} + +VkResult +vkpt_fsr_create_pipelines() +{ + VkComputePipelineCreateInfo pipeline_info[FSR_NUM_PIPELINES] = { + [FSR_EASU] = { + .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, + .stage = SHADER_STAGE(QVK_MOD_FSR_EASU_COMP, VK_SHADER_STAGE_COMPUTE_BIT), + .layout = pipeline_layout_fsr, + }, + [FSR_RCAS] = { + .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, + .stage = SHADER_STAGE(QVK_MOD_FSR_RCAS_COMP, VK_SHADER_STAGE_COMPUTE_BIT), + .layout = pipeline_layout_fsr, + }, + }; + + _VK(vkCreateComputePipelines(qvk.device, 0, LENGTH(pipeline_info), pipeline_info, 0, pipeline_fsr)); + + return VK_SUCCESS; +} + +VkResult +vkpt_fsr_destroy_pipelines() +{ + for(int i = 0; i < FSR_NUM_PIPELINES; i++) + vkDestroyPipeline(qvk.device, pipeline_fsr[i], NULL); + return VK_SUCCESS; +} + +void vkpt_fsr_update_ubo(QVKUniformBuffer_t *ubo) +{ + FsrEasuCon(&ubo->easu_const0[0], &ubo->easu_const1[0], &ubo->easu_const2[0], &ubo->easu_const3[0], + qvk.extent_render.width, qvk.extent_render.height, // render dimensions + IMG_WIDTH_TAA, IMG_HEIGHT_TAA, // container texture dimensions + qvk.extent_unscaled.width, qvk.extent_unscaled.height); // display dimensions + FsrRcasCon(&ubo->rcas_const0[0], cvar_flt_fsr_sharpness->value); +} + +#define BARRIER_COMPUTE(cmd_buf, img) \ + do { \ + VkImageSubresourceRange subresource_range = { \ + .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, \ + .baseMipLevel = 0, \ + .levelCount = 1, \ + .baseArrayLayer = 0, \ + .layerCount = 1 \ + }; \ + IMAGE_BARRIER(cmd_buf, \ + .image = img, \ + .subresourceRange = subresource_range, \ + .srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT, \ + .dstAccessMask = VK_ACCESS_SHADER_READ_BIT, \ + .oldLayout = VK_IMAGE_LAYOUT_GENERAL, \ + .newLayout = VK_IMAGE_LAYOUT_GENERAL, \ + ); \ + } while(0) + +static void vkpt_fsr_easu(VkCommandBuffer cmd_buf) +{ + VkDescriptorSet desc_sets[] = { + qvk.desc_set_ubo, + qvk_get_current_desc_set_textures() + }; + + BEGIN_PERF_MARKER(cmd_buf, PROFILER_FSR_EASU); + + vkCmdBindPipeline(cmd_buf, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline_fsr[FSR_EASU]); + + vkCmdBindDescriptorSets(cmd_buf, VK_PIPELINE_BIND_POINT_COMPUTE, + pipeline_layout_fsr, 0, LENGTH(desc_sets), desc_sets, 0, 0); + + VkExtent2D dispatch_size = qvk.extent_unscaled; + + vkCmdDispatch(cmd_buf, + (dispatch_size.width + 15) / 16, + (dispatch_size.height + 15) / 16, + 1); + BARRIER_COMPUTE(cmd_buf, qvk.images[VKPT_IMG_FSR_EASU_OUTPUT]); + + END_PERF_MARKER(cmd_buf, PROFILER_FSR_EASU); +} + +static void vkpt_fsr_rcas(VkCommandBuffer cmd_buf) +{ + VkDescriptorSet desc_sets[] = { + qvk.desc_set_ubo, + qvk_get_current_desc_set_textures() + }; + + BEGIN_PERF_MARKER(cmd_buf, PROFILER_FSR_RCAS); + + vkCmdBindPipeline(cmd_buf, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline_fsr[FSR_RCAS]); + + vkCmdBindDescriptorSets(cmd_buf, VK_PIPELINE_BIND_POINT_COMPUTE, + pipeline_layout_fsr, 0, LENGTH(desc_sets), desc_sets, 0, 0); + + VkExtent2D dispatch_size = qvk.extent_unscaled; + + vkCmdDispatch(cmd_buf, + (dispatch_size.width + 15) / 16, + (dispatch_size.height + 15) / 16, + 1); + BARRIER_COMPUTE(cmd_buf, qvk.images[VKPT_IMG_FSR_RCAS_OUTPUT]); + + END_PERF_MARKER(cmd_buf, PROFILER_FSR_RCAS); +} + +VkResult vkpt_fsr_do(VkCommandBuffer cmd_buf) +{ + BEGIN_PERF_MARKER(cmd_buf, PROFILER_FSR); + + vkpt_fsr_easu(cmd_buf); + if(cvar_flt_fsr_rcas->integer != 0) + vkpt_fsr_rcas(cmd_buf); + + END_PERF_MARKER(cmd_buf, PROFILER_FSR); + + return VK_SUCCESS; +} + +VkResult vkpt_fsr_final_blit(VkCommandBuffer cmd_buf) +{ + int output_image = cvar_flt_fsr_rcas->integer != 0 ? VKPT_IMG_FSR_RCAS_OUTPUT : VKPT_IMG_FSR_EASU_OUTPUT; + return vkpt_final_blit_simple(cmd_buf, qvk.images[output_image], qvk.extent_unscaled); +} diff --git a/src/refresh/vkpt/fsr/ffx_a.h b/src/refresh/vkpt/fsr/ffx_a.h new file mode 100644 index 000000000..d04bff55c --- /dev/null +++ b/src/refresh/vkpt/fsr/ffx_a.h @@ -0,0 +1,2656 @@ +//============================================================================================================================== +// +// [A] SHADER PORTABILITY 1.20210629 +// +//============================================================================================================================== +// FidelityFX Super Resolution Sample +// +// Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +//------------------------------------------------------------------------------------------------------------------------------ +// MIT LICENSE +// =========== +// Copyright (c) 2014 Michal Drobot (for concepts used in "FLOAT APPROXIMATIONS"). +// ----------- +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, +// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// ----------- +// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the +// Software. +// ----------- +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +//------------------------------------------------------------------------------------------------------------------------------ +// ABOUT +// ===== +// Common central point for high-level shading language and C portability for various shader headers. +//------------------------------------------------------------------------------------------------------------------------------ +// DEFINES +// ======= +// A_CPU ..... Include the CPU related code. +// A_GPU ..... Include the GPU related code. +// A_GLSL .... Using GLSL. +// A_HLSL .... Using HLSL. +// A_HLSL_6_2 Using HLSL 6.2 with new 'uint16_t' and related types (requires '-enable-16bit-types'). +// A_NO_16_BIT_CAST Don't use instructions that are not availabe in SPIR-V (needed for running A_HLSL_6_2 on Vulkan) +// A_GCC ..... Using a GCC compatible compiler (else assume MSVC compatible compiler by default). +// ======= +// A_BYTE .... Support 8-bit integer. +// A_HALF .... Support 16-bit integer and floating point. +// A_LONG .... Support 64-bit integer. +// A_DUBL .... Support 64-bit floating point. +// ======= +// A_WAVE .... Support wave-wide operations. +//------------------------------------------------------------------------------------------------------------------------------ +// To get #include "ffx_a.h" working in GLSL use '#extension GL_GOOGLE_include_directive:require'. +//------------------------------------------------------------------------------------------------------------------------------ +// SIMPLIFIED TYPE SYSTEM +// ====================== +// - All ints will be unsigned with exception of when signed is required. +// - Type naming simplified and shortened "A<#components>", +// - H = 16-bit float (half) +// - F = 32-bit float (float) +// - D = 64-bit float (double) +// - P = 1-bit integer (predicate, not using bool because 'B' is used for byte) +// - B = 8-bit integer (byte) +// - W = 16-bit integer (word) +// - U = 32-bit integer (unsigned) +// - L = 64-bit integer (long) +// - Using "AS<#components>" for signed when required. +//------------------------------------------------------------------------------------------------------------------------------ +// TODO +// ==== +// - Make sure 'ALerp*(a,b,m)' does 'b*m+(-a*m+a)' (2 ops). +//------------------------------------------------------------------------------------------------------------------------------ +// CHANGE LOG +// ========== +// 20200914 - Expanded wave ops and prx code. +// 20200713 - Added [ZOL] section, fixed serious bugs in sRGB and Rec.709 color conversion code, etc. +//============================================================================================================================== +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// COMMON +//============================================================================================================================== +#define A_2PI 6.28318530718 +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// +// +// CPU +// +// +//============================================================================================================================== +#ifdef A_CPU + // Supporting user defined overrides. + #ifndef A_RESTRICT + #define A_RESTRICT __restrict + #endif +//------------------------------------------------------------------------------------------------------------------------------ + #ifndef A_STATIC + #define A_STATIC static + #endif +//------------------------------------------------------------------------------------------------------------------------------ + // Same types across CPU and GPU. + // Predicate uses 32-bit integer (C friendly bool). + typedef uint32_t AP1; + typedef float AF1; + typedef double AD1; + typedef uint8_t AB1; + typedef uint16_t AW1; + typedef uint32_t AU1; + typedef uint64_t AL1; + typedef int8_t ASB1; + typedef int16_t ASW1; + typedef int32_t ASU1; + typedef int64_t ASL1; +//------------------------------------------------------------------------------------------------------------------------------ + #define AD1_(a) ((AD1)(a)) + #define AF1_(a) ((AF1)(a)) + #define AL1_(a) ((AL1)(a)) + #define AU1_(a) ((AU1)(a)) +//------------------------------------------------------------------------------------------------------------------------------ + #define ASL1_(a) ((ASL1)(a)) + #define ASU1_(a) ((ASU1)(a)) +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC AU1 AU1_AF1(AF1 a){union{AF1 f;AU1 u;}bits;bits.f=a;return bits.u;} +//------------------------------------------------------------------------------------------------------------------------------ + #define A_TRUE 1 + #define A_FALSE 0 +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// +// CPU/GPU PORTING +// +//------------------------------------------------------------------------------------------------------------------------------ +// Get CPU and GPU to share all setup code, without duplicate code paths. +// This uses a lower-case prefix for special vector constructs. +// - In C restrict pointers are used. +// - In the shading language, in/inout/out arguments are used. +// This depends on the ability to access a vector value in both languages via array syntax (aka color[2]). +//============================================================================================================================== +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// VECTOR ARGUMENT/RETURN/INITIALIZATION PORTABILITY +//============================================================================================================================== + #define retAD2 AD1 *A_RESTRICT + #define retAD3 AD1 *A_RESTRICT + #define retAD4 AD1 *A_RESTRICT + #define retAF2 AF1 *A_RESTRICT + #define retAF3 AF1 *A_RESTRICT + #define retAF4 AF1 *A_RESTRICT + #define retAL2 AL1 *A_RESTRICT + #define retAL3 AL1 *A_RESTRICT + #define retAL4 AL1 *A_RESTRICT + #define retAU2 AU1 *A_RESTRICT + #define retAU3 AU1 *A_RESTRICT + #define retAU4 AU1 *A_RESTRICT +//------------------------------------------------------------------------------------------------------------------------------ + #define inAD2 AD1 *A_RESTRICT + #define inAD3 AD1 *A_RESTRICT + #define inAD4 AD1 *A_RESTRICT + #define inAF2 AF1 *A_RESTRICT + #define inAF3 AF1 *A_RESTRICT + #define inAF4 AF1 *A_RESTRICT + #define inAL2 AL1 *A_RESTRICT + #define inAL3 AL1 *A_RESTRICT + #define inAL4 AL1 *A_RESTRICT + #define inAU2 AU1 *A_RESTRICT + #define inAU3 AU1 *A_RESTRICT + #define inAU4 AU1 *A_RESTRICT +//------------------------------------------------------------------------------------------------------------------------------ + #define inoutAD2 AD1 *A_RESTRICT + #define inoutAD3 AD1 *A_RESTRICT + #define inoutAD4 AD1 *A_RESTRICT + #define inoutAF2 AF1 *A_RESTRICT + #define inoutAF3 AF1 *A_RESTRICT + #define inoutAF4 AF1 *A_RESTRICT + #define inoutAL2 AL1 *A_RESTRICT + #define inoutAL3 AL1 *A_RESTRICT + #define inoutAL4 AL1 *A_RESTRICT + #define inoutAU2 AU1 *A_RESTRICT + #define inoutAU3 AU1 *A_RESTRICT + #define inoutAU4 AU1 *A_RESTRICT +//------------------------------------------------------------------------------------------------------------------------------ + #define outAD2 AD1 *A_RESTRICT + #define outAD3 AD1 *A_RESTRICT + #define outAD4 AD1 *A_RESTRICT + #define outAF2 AF1 *A_RESTRICT + #define outAF3 AF1 *A_RESTRICT + #define outAF4 AF1 *A_RESTRICT + #define outAL2 AL1 *A_RESTRICT + #define outAL3 AL1 *A_RESTRICT + #define outAL4 AL1 *A_RESTRICT + #define outAU2 AU1 *A_RESTRICT + #define outAU3 AU1 *A_RESTRICT + #define outAU4 AU1 *A_RESTRICT +//------------------------------------------------------------------------------------------------------------------------------ + #define varAD2(x) AD1 x[2] + #define varAD3(x) AD1 x[3] + #define varAD4(x) AD1 x[4] + #define varAF2(x) AF1 x[2] + #define varAF3(x) AF1 x[3] + #define varAF4(x) AF1 x[4] + #define varAL2(x) AL1 x[2] + #define varAL3(x) AL1 x[3] + #define varAL4(x) AL1 x[4] + #define varAU2(x) AU1 x[2] + #define varAU3(x) AU1 x[3] + #define varAU4(x) AU1 x[4] +//------------------------------------------------------------------------------------------------------------------------------ + #define initAD2(x,y) {x,y} + #define initAD3(x,y,z) {x,y,z} + #define initAD4(x,y,z,w) {x,y,z,w} + #define initAF2(x,y) {x,y} + #define initAF3(x,y,z) {x,y,z} + #define initAF4(x,y,z,w) {x,y,z,w} + #define initAL2(x,y) {x,y} + #define initAL3(x,y,z) {x,y,z} + #define initAL4(x,y,z,w) {x,y,z,w} + #define initAU2(x,y) {x,y} + #define initAU3(x,y,z) {x,y,z} + #define initAU4(x,y,z,w) {x,y,z,w} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// SCALAR RETURN OPS +//------------------------------------------------------------------------------------------------------------------------------ +// TODO +// ==== +// - Replace transcendentals with manual versions. +//============================================================================================================================== + #ifdef A_GCC + A_STATIC AD1 AAbsD1(AD1 a){return __builtin_fabs(a);} + A_STATIC AF1 AAbsF1(AF1 a){return __builtin_fabsf(a);} + A_STATIC AU1 AAbsSU1(AU1 a){return AU1_(__builtin_abs(ASU1_(a)));} + A_STATIC AL1 AAbsSL1(AL1 a){return AL1_(__builtin_llabs(ASL1_(a)));} + #else + A_STATIC AD1 AAbsD1(AD1 a){return fabs(a);} + A_STATIC AF1 AAbsF1(AF1 a){return fabsf(a);} + A_STATIC AU1 AAbsSU1(AU1 a){return AU1_(abs(ASU1_(a)));} + A_STATIC AL1 AAbsSL1(AL1 a){return AL1_(labs((long)ASL1_(a)));} + #endif +//------------------------------------------------------------------------------------------------------------------------------ + #ifdef A_GCC + A_STATIC AD1 ACosD1(AD1 a){return __builtin_cos(a);} + A_STATIC AF1 ACosF1(AF1 a){return __builtin_cosf(a);} + #else + A_STATIC AD1 ACosD1(AD1 a){return cos(a);} + A_STATIC AF1 ACosF1(AF1 a){return cosf(a);} + #endif +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC AD1 ADotD2(inAD2 a,inAD2 b){return a[0]*b[0]+a[1]*b[1];} + A_STATIC AD1 ADotD3(inAD3 a,inAD3 b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2];} + A_STATIC AD1 ADotD4(inAD4 a,inAD4 b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3];} + A_STATIC AF1 ADotF2(inAF2 a,inAF2 b){return a[0]*b[0]+a[1]*b[1];} + A_STATIC AF1 ADotF3(inAF3 a,inAF3 b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2];} + A_STATIC AF1 ADotF4(inAF4 a,inAF4 b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3];} +//------------------------------------------------------------------------------------------------------------------------------ + #ifdef A_GCC + A_STATIC AD1 AExp2D1(AD1 a){return __builtin_exp2(a);} + A_STATIC AF1 AExp2F1(AF1 a){return __builtin_exp2f(a);} + #else + A_STATIC AD1 AExp2D1(AD1 a){return exp2(a);} + A_STATIC AF1 AExp2F1(AF1 a){return exp2f(a);} + #endif +//------------------------------------------------------------------------------------------------------------------------------ + #ifdef A_GCC + A_STATIC AD1 AFloorD1(AD1 a){return __builtin_floor(a);} + A_STATIC AF1 AFloorF1(AF1 a){return __builtin_floorf(a);} + #else + A_STATIC AD1 AFloorD1(AD1 a){return floor(a);} + A_STATIC AF1 AFloorF1(AF1 a){return floorf(a);} + #endif +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC AD1 ALerpD1(AD1 a,AD1 b,AD1 c){return b*c+(-a*c+a);} + A_STATIC AF1 ALerpF1(AF1 a,AF1 b,AF1 c){return b*c+(-a*c+a);} +//------------------------------------------------------------------------------------------------------------------------------ + #ifdef A_GCC + A_STATIC AD1 ALog2D1(AD1 a){return __builtin_log2(a);} + A_STATIC AF1 ALog2F1(AF1 a){return __builtin_log2f(a);} + #else + A_STATIC AD1 ALog2D1(AD1 a){return log2(a);} + A_STATIC AF1 ALog2F1(AF1 a){return log2f(a);} + #endif +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC AD1 AMaxD1(AD1 a,AD1 b){return a>b?a:b;} + A_STATIC AF1 AMaxF1(AF1 a,AF1 b){return a>b?a:b;} + A_STATIC AL1 AMaxL1(AL1 a,AL1 b){return a>b?a:b;} + A_STATIC AU1 AMaxU1(AU1 a,AU1 b){return a>b?a:b;} +//------------------------------------------------------------------------------------------------------------------------------ + // These follow the convention that A integer types don't have signage, until they are operated on. + A_STATIC AL1 AMaxSL1(AL1 a,AL1 b){return (ASL1_(a)>ASL1_(b))?a:b;} + A_STATIC AU1 AMaxSU1(AU1 a,AU1 b){return (ASU1_(a)>ASU1_(b))?a:b;} +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC AD1 AMinD1(AD1 a,AD1 b){return a>ASL1_(b));} + A_STATIC AU1 AShrSU1(AU1 a,AU1 b){return AU1_(ASU1_(a)>>ASU1_(b));} +//------------------------------------------------------------------------------------------------------------------------------ + #ifdef A_GCC + A_STATIC AD1 ASinD1(AD1 a){return __builtin_sin(a);} + A_STATIC AF1 ASinF1(AF1 a){return __builtin_sinf(a);} + #else + A_STATIC AD1 ASinD1(AD1 a){return sin(a);} + A_STATIC AF1 ASinF1(AF1 a){return sinf(a);} + #endif +//------------------------------------------------------------------------------------------------------------------------------ + #ifdef A_GCC + A_STATIC AD1 ASqrtD1(AD1 a){return __builtin_sqrt(a);} + A_STATIC AF1 ASqrtF1(AF1 a){return __builtin_sqrtf(a);} + #else + A_STATIC AD1 ASqrtD1(AD1 a){return sqrt(a);} + A_STATIC AF1 ASqrtF1(AF1 a){return sqrtf(a);} + #endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// SCALAR RETURN OPS - DEPENDENT +//============================================================================================================================== + A_STATIC AD1 AClampD1(AD1 x,AD1 n,AD1 m){return AMaxD1(n,AMinD1(x,m));} + A_STATIC AF1 AClampF1(AF1 x,AF1 n,AF1 m){return AMaxF1(n,AMinF1(x,m));} +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC AD1 AFractD1(AD1 a){return a-AFloorD1(a);} + A_STATIC AF1 AFractF1(AF1 a){return a-AFloorF1(a);} +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC AD1 APowD1(AD1 a,AD1 b){return AExp2D1(b*ALog2D1(a));} + A_STATIC AF1 APowF1(AF1 a,AF1 b){return AExp2F1(b*ALog2F1(a));} +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC AD1 ARsqD1(AD1 a){return ARcpD1(ASqrtD1(a));} + A_STATIC AF1 ARsqF1(AF1 a){return ARcpF1(ASqrtF1(a));} +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC AD1 ASatD1(AD1 a){return AMinD1(1.0,AMaxD1(0.0,a));} + A_STATIC AF1 ASatF1(AF1 a){return AMinF1(1.0f,AMaxF1(0.0f,a));} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// VECTOR OPS +//------------------------------------------------------------------------------------------------------------------------------ +// These are added as needed for production or prototyping, so not necessarily a complete set. +// They follow a convention of taking in a destination and also returning the destination value to increase utility. +//============================================================================================================================== + A_STATIC retAD2 opAAbsD2(outAD2 d,inAD2 a){d[0]=AAbsD1(a[0]);d[1]=AAbsD1(a[1]);return d;} + A_STATIC retAD3 opAAbsD3(outAD3 d,inAD3 a){d[0]=AAbsD1(a[0]);d[1]=AAbsD1(a[1]);d[2]=AAbsD1(a[2]);return d;} + A_STATIC retAD4 opAAbsD4(outAD4 d,inAD4 a){d[0]=AAbsD1(a[0]);d[1]=AAbsD1(a[1]);d[2]=AAbsD1(a[2]);d[3]=AAbsD1(a[3]);return d;} +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC retAF2 opAAbsF2(outAF2 d,inAF2 a){d[0]=AAbsF1(a[0]);d[1]=AAbsF1(a[1]);return d;} + A_STATIC retAF3 opAAbsF3(outAF3 d,inAF3 a){d[0]=AAbsF1(a[0]);d[1]=AAbsF1(a[1]);d[2]=AAbsF1(a[2]);return d;} + A_STATIC retAF4 opAAbsF4(outAF4 d,inAF4 a){d[0]=AAbsF1(a[0]);d[1]=AAbsF1(a[1]);d[2]=AAbsF1(a[2]);d[3]=AAbsF1(a[3]);return d;} +//============================================================================================================================== + A_STATIC retAD2 opAAddD2(outAD2 d,inAD2 a,inAD2 b){d[0]=a[0]+b[0];d[1]=a[1]+b[1];return d;} + A_STATIC retAD3 opAAddD3(outAD3 d,inAD3 a,inAD3 b){d[0]=a[0]+b[0];d[1]=a[1]+b[1];d[2]=a[2]+b[2];return d;} + A_STATIC retAD4 opAAddD4(outAD4 d,inAD4 a,inAD4 b){d[0]=a[0]+b[0];d[1]=a[1]+b[1];d[2]=a[2]+b[2];d[3]=a[3]+b[3];return d;} +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC retAF2 opAAddF2(outAF2 d,inAF2 a,inAF2 b){d[0]=a[0]+b[0];d[1]=a[1]+b[1];return d;} + A_STATIC retAF3 opAAddF3(outAF3 d,inAF3 a,inAF3 b){d[0]=a[0]+b[0];d[1]=a[1]+b[1];d[2]=a[2]+b[2];return d;} + A_STATIC retAF4 opAAddF4(outAF4 d,inAF4 a,inAF4 b){d[0]=a[0]+b[0];d[1]=a[1]+b[1];d[2]=a[2]+b[2];d[3]=a[3]+b[3];return d;} +//============================================================================================================================== + A_STATIC retAD2 opAAddOneD2(outAD2 d,inAD2 a,AD1 b){d[0]=a[0]+b;d[1]=a[1]+b;return d;} + A_STATIC retAD3 opAAddOneD3(outAD3 d,inAD3 a,AD1 b){d[0]=a[0]+b;d[1]=a[1]+b;d[2]=a[2]+b;return d;} + A_STATIC retAD4 opAAddOneD4(outAD4 d,inAD4 a,AD1 b){d[0]=a[0]+b;d[1]=a[1]+b;d[2]=a[2]+b;d[3]=a[3]+b;return d;} +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC retAF2 opAAddOneF2(outAF2 d,inAF2 a,AF1 b){d[0]=a[0]+b;d[1]=a[1]+b;return d;} + A_STATIC retAF3 opAAddOneF3(outAF3 d,inAF3 a,AF1 b){d[0]=a[0]+b;d[1]=a[1]+b;d[2]=a[2]+b;return d;} + A_STATIC retAF4 opAAddOneF4(outAF4 d,inAF4 a,AF1 b){d[0]=a[0]+b;d[1]=a[1]+b;d[2]=a[2]+b;d[3]=a[3]+b;return d;} +//============================================================================================================================== + A_STATIC retAD2 opACpyD2(outAD2 d,inAD2 a){d[0]=a[0];d[1]=a[1];return d;} + A_STATIC retAD3 opACpyD3(outAD3 d,inAD3 a){d[0]=a[0];d[1]=a[1];d[2]=a[2];return d;} + A_STATIC retAD4 opACpyD4(outAD4 d,inAD4 a){d[0]=a[0];d[1]=a[1];d[2]=a[2];d[3]=a[3];return d;} +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC retAF2 opACpyF2(outAF2 d,inAF2 a){d[0]=a[0];d[1]=a[1];return d;} + A_STATIC retAF3 opACpyF3(outAF3 d,inAF3 a){d[0]=a[0];d[1]=a[1];d[2]=a[2];return d;} + A_STATIC retAF4 opACpyF4(outAF4 d,inAF4 a){d[0]=a[0];d[1]=a[1];d[2]=a[2];d[3]=a[3];return d;} +//============================================================================================================================== + A_STATIC retAD2 opALerpD2(outAD2 d,inAD2 a,inAD2 b,inAD2 c){d[0]=ALerpD1(a[0],b[0],c[0]);d[1]=ALerpD1(a[1],b[1],c[1]);return d;} + A_STATIC retAD3 opALerpD3(outAD3 d,inAD3 a,inAD3 b,inAD3 c){d[0]=ALerpD1(a[0],b[0],c[0]);d[1]=ALerpD1(a[1],b[1],c[1]);d[2]=ALerpD1(a[2],b[2],c[2]);return d;} + A_STATIC retAD4 opALerpD4(outAD4 d,inAD4 a,inAD4 b,inAD4 c){d[0]=ALerpD1(a[0],b[0],c[0]);d[1]=ALerpD1(a[1],b[1],c[1]);d[2]=ALerpD1(a[2],b[2],c[2]);d[3]=ALerpD1(a[3],b[3],c[3]);return d;} +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC retAF2 opALerpF2(outAF2 d,inAF2 a,inAF2 b,inAF2 c){d[0]=ALerpF1(a[0],b[0],c[0]);d[1]=ALerpF1(a[1],b[1],c[1]);return d;} + A_STATIC retAF3 opALerpF3(outAF3 d,inAF3 a,inAF3 b,inAF3 c){d[0]=ALerpF1(a[0],b[0],c[0]);d[1]=ALerpF1(a[1],b[1],c[1]);d[2]=ALerpF1(a[2],b[2],c[2]);return d;} + A_STATIC retAF4 opALerpF4(outAF4 d,inAF4 a,inAF4 b,inAF4 c){d[0]=ALerpF1(a[0],b[0],c[0]);d[1]=ALerpF1(a[1],b[1],c[1]);d[2]=ALerpF1(a[2],b[2],c[2]);d[3]=ALerpF1(a[3],b[3],c[3]);return d;} +//============================================================================================================================== + A_STATIC retAD2 opALerpOneD2(outAD2 d,inAD2 a,inAD2 b,AD1 c){d[0]=ALerpD1(a[0],b[0],c);d[1]=ALerpD1(a[1],b[1],c);return d;} + A_STATIC retAD3 opALerpOneD3(outAD3 d,inAD3 a,inAD3 b,AD1 c){d[0]=ALerpD1(a[0],b[0],c);d[1]=ALerpD1(a[1],b[1],c);d[2]=ALerpD1(a[2],b[2],c);return d;} + A_STATIC retAD4 opALerpOneD4(outAD4 d,inAD4 a,inAD4 b,AD1 c){d[0]=ALerpD1(a[0],b[0],c);d[1]=ALerpD1(a[1],b[1],c);d[2]=ALerpD1(a[2],b[2],c);d[3]=ALerpD1(a[3],b[3],c);return d;} +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC retAF2 opALerpOneF2(outAF2 d,inAF2 a,inAF2 b,AF1 c){d[0]=ALerpF1(a[0],b[0],c);d[1]=ALerpF1(a[1],b[1],c);return d;} + A_STATIC retAF3 opALerpOneF3(outAF3 d,inAF3 a,inAF3 b,AF1 c){d[0]=ALerpF1(a[0],b[0],c);d[1]=ALerpF1(a[1],b[1],c);d[2]=ALerpF1(a[2],b[2],c);return d;} + A_STATIC retAF4 opALerpOneF4(outAF4 d,inAF4 a,inAF4 b,AF1 c){d[0]=ALerpF1(a[0],b[0],c);d[1]=ALerpF1(a[1],b[1],c);d[2]=ALerpF1(a[2],b[2],c);d[3]=ALerpF1(a[3],b[3],c);return d;} +//============================================================================================================================== + A_STATIC retAD2 opAMaxD2(outAD2 d,inAD2 a,inAD2 b){d[0]=AMaxD1(a[0],b[0]);d[1]=AMaxD1(a[1],b[1]);return d;} + A_STATIC retAD3 opAMaxD3(outAD3 d,inAD3 a,inAD3 b){d[0]=AMaxD1(a[0],b[0]);d[1]=AMaxD1(a[1],b[1]);d[2]=AMaxD1(a[2],b[2]);return d;} + A_STATIC retAD4 opAMaxD4(outAD4 d,inAD4 a,inAD4 b){d[0]=AMaxD1(a[0],b[0]);d[1]=AMaxD1(a[1],b[1]);d[2]=AMaxD1(a[2],b[2]);d[3]=AMaxD1(a[3],b[3]);return d;} +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC retAF2 opAMaxF2(outAF2 d,inAF2 a,inAF2 b){d[0]=AMaxF1(a[0],b[0]);d[1]=AMaxF1(a[1],b[1]);return d;} + A_STATIC retAF3 opAMaxF3(outAF3 d,inAF3 a,inAF3 b){d[0]=AMaxF1(a[0],b[0]);d[1]=AMaxF1(a[1],b[1]);d[2]=AMaxF1(a[2],b[2]);return d;} + A_STATIC retAF4 opAMaxF4(outAF4 d,inAF4 a,inAF4 b){d[0]=AMaxF1(a[0],b[0]);d[1]=AMaxF1(a[1],b[1]);d[2]=AMaxF1(a[2],b[2]);d[3]=AMaxF1(a[3],b[3]);return d;} +//============================================================================================================================== + A_STATIC retAD2 opAMinD2(outAD2 d,inAD2 a,inAD2 b){d[0]=AMinD1(a[0],b[0]);d[1]=AMinD1(a[1],b[1]);return d;} + A_STATIC retAD3 opAMinD3(outAD3 d,inAD3 a,inAD3 b){d[0]=AMinD1(a[0],b[0]);d[1]=AMinD1(a[1],b[1]);d[2]=AMinD1(a[2],b[2]);return d;} + A_STATIC retAD4 opAMinD4(outAD4 d,inAD4 a,inAD4 b){d[0]=AMinD1(a[0],b[0]);d[1]=AMinD1(a[1],b[1]);d[2]=AMinD1(a[2],b[2]);d[3]=AMinD1(a[3],b[3]);return d;} +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC retAF2 opAMinF2(outAF2 d,inAF2 a,inAF2 b){d[0]=AMinF1(a[0],b[0]);d[1]=AMinF1(a[1],b[1]);return d;} + A_STATIC retAF3 opAMinF3(outAF3 d,inAF3 a,inAF3 b){d[0]=AMinF1(a[0],b[0]);d[1]=AMinF1(a[1],b[1]);d[2]=AMinF1(a[2],b[2]);return d;} + A_STATIC retAF4 opAMinF4(outAF4 d,inAF4 a,inAF4 b){d[0]=AMinF1(a[0],b[0]);d[1]=AMinF1(a[1],b[1]);d[2]=AMinF1(a[2],b[2]);d[3]=AMinF1(a[3],b[3]);return d;} +//============================================================================================================================== + A_STATIC retAD2 opAMulD2(outAD2 d,inAD2 a,inAD2 b){d[0]=a[0]*b[0];d[1]=a[1]*b[1];return d;} + A_STATIC retAD3 opAMulD3(outAD3 d,inAD3 a,inAD3 b){d[0]=a[0]*b[0];d[1]=a[1]*b[1];d[2]=a[2]*b[2];return d;} + A_STATIC retAD4 opAMulD4(outAD4 d,inAD4 a,inAD4 b){d[0]=a[0]*b[0];d[1]=a[1]*b[1];d[2]=a[2]*b[2];d[3]=a[3]*b[3];return d;} +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC retAF2 opAMulF2(outAF2 d,inAF2 a,inAF2 b){d[0]=a[0]*b[0];d[1]=a[1]*b[1];return d;} + A_STATIC retAF3 opAMulF3(outAF3 d,inAF3 a,inAF3 b){d[0]=a[0]*b[0];d[1]=a[1]*b[1];d[2]=a[2]*b[2];return d;} + A_STATIC retAF4 opAMulF4(outAF4 d,inAF4 a,inAF4 b){d[0]=a[0]*b[0];d[1]=a[1]*b[1];d[2]=a[2]*b[2];d[3]=a[3]*b[3];return d;} +//============================================================================================================================== + A_STATIC retAD2 opAMulOneD2(outAD2 d,inAD2 a,AD1 b){d[0]=a[0]*b;d[1]=a[1]*b;return d;} + A_STATIC retAD3 opAMulOneD3(outAD3 d,inAD3 a,AD1 b){d[0]=a[0]*b;d[1]=a[1]*b;d[2]=a[2]*b;return d;} + A_STATIC retAD4 opAMulOneD4(outAD4 d,inAD4 a,AD1 b){d[0]=a[0]*b;d[1]=a[1]*b;d[2]=a[2]*b;d[3]=a[3]*b;return d;} +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC retAF2 opAMulOneF2(outAF2 d,inAF2 a,AF1 b){d[0]=a[0]*b;d[1]=a[1]*b;return d;} + A_STATIC retAF3 opAMulOneF3(outAF3 d,inAF3 a,AF1 b){d[0]=a[0]*b;d[1]=a[1]*b;d[2]=a[2]*b;return d;} + A_STATIC retAF4 opAMulOneF4(outAF4 d,inAF4 a,AF1 b){d[0]=a[0]*b;d[1]=a[1]*b;d[2]=a[2]*b;d[3]=a[3]*b;return d;} +//============================================================================================================================== + A_STATIC retAD2 opANegD2(outAD2 d,inAD2 a){d[0]=-a[0];d[1]=-a[1];return d;} + A_STATIC retAD3 opANegD3(outAD3 d,inAD3 a){d[0]=-a[0];d[1]=-a[1];d[2]=-a[2];return d;} + A_STATIC retAD4 opANegD4(outAD4 d,inAD4 a){d[0]=-a[0];d[1]=-a[1];d[2]=-a[2];d[3]=-a[3];return d;} +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC retAF2 opANegF2(outAF2 d,inAF2 a){d[0]=-a[0];d[1]=-a[1];return d;} + A_STATIC retAF3 opANegF3(outAF3 d,inAF3 a){d[0]=-a[0];d[1]=-a[1];d[2]=-a[2];return d;} + A_STATIC retAF4 opANegF4(outAF4 d,inAF4 a){d[0]=-a[0];d[1]=-a[1];d[2]=-a[2];d[3]=-a[3];return d;} +//============================================================================================================================== + A_STATIC retAD2 opARcpD2(outAD2 d,inAD2 a){d[0]=ARcpD1(a[0]);d[1]=ARcpD1(a[1]);return d;} + A_STATIC retAD3 opARcpD3(outAD3 d,inAD3 a){d[0]=ARcpD1(a[0]);d[1]=ARcpD1(a[1]);d[2]=ARcpD1(a[2]);return d;} + A_STATIC retAD4 opARcpD4(outAD4 d,inAD4 a){d[0]=ARcpD1(a[0]);d[1]=ARcpD1(a[1]);d[2]=ARcpD1(a[2]);d[3]=ARcpD1(a[3]);return d;} +//------------------------------------------------------------------------------------------------------------------------------ + A_STATIC retAF2 opARcpF2(outAF2 d,inAF2 a){d[0]=ARcpF1(a[0]);d[1]=ARcpF1(a[1]);return d;} + A_STATIC retAF3 opARcpF3(outAF3 d,inAF3 a){d[0]=ARcpF1(a[0]);d[1]=ARcpF1(a[1]);d[2]=ARcpF1(a[2]);return d;} + A_STATIC retAF4 opARcpF4(outAF4 d,inAF4 a){d[0]=ARcpF1(a[0]);d[1]=ARcpF1(a[1]);d[2]=ARcpF1(a[2]);d[3]=ARcpF1(a[3]);return d;} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// HALF FLOAT PACKING +//============================================================================================================================== + // Convert float to half (in lower 16-bits of output). + // Same fast technique as documented here: ftp://ftp.fox-toolkit.org/pub/fasthalffloatconversion.pdf + // Supports denormals. + // Conversion rules are to make computations possibly "safer" on the GPU, + // -INF & -NaN -> -65504 + // +INF & +NaN -> +65504 + A_STATIC AU1 AU1_AH1_AF1(AF1 f){ + static AW1 base[512]={ + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, + 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0001,0x0002,0x0004,0x0008,0x0010,0x0020,0x0040,0x0080,0x0100, + 0x0200,0x0400,0x0800,0x0c00,0x1000,0x1400,0x1800,0x1c00,0x2000,0x2400,0x2800,0x2c00,0x3000,0x3400,0x3800,0x3c00, + 0x4000,0x4400,0x4800,0x4c00,0x5000,0x5400,0x5800,0x5c00,0x6000,0x6400,0x6800,0x6c00,0x7000,0x7400,0x7800,0x7bff, + 0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff, + 0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff, + 0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff, + 0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff, + 0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff, + 0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff, + 0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff,0x7bff, + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000, + 0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8001,0x8002,0x8004,0x8008,0x8010,0x8020,0x8040,0x8080,0x8100, + 0x8200,0x8400,0x8800,0x8c00,0x9000,0x9400,0x9800,0x9c00,0xa000,0xa400,0xa800,0xac00,0xb000,0xb400,0xb800,0xbc00, + 0xc000,0xc400,0xc800,0xcc00,0xd000,0xd400,0xd800,0xdc00,0xe000,0xe400,0xe800,0xec00,0xf000,0xf400,0xf800,0xfbff, + 0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff, + 0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff, + 0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff, + 0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff, + 0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff, + 0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff, + 0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff,0xfbff}; + static AB1 shift[512]={ + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x16,0x15,0x14,0x13,0x12,0x11,0x10,0x0f, + 0x0e,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d, + 0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x17,0x16,0x15,0x14,0x13,0x12,0x11,0x10,0x0f, + 0x0e,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d, + 0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x0d,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, + 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18}; + union{AF1 f;AU1 u;}bits;bits.f=f;AU1 u=bits.u;AU1 i=u>>23;return (AU1)(base[i])+((u&0x7fffff)>>shift[i]);} +//------------------------------------------------------------------------------------------------------------------------------ + // Used to output packed constant. + A_STATIC AU1 AU1_AH2_AF2(inAF2 a){return AU1_AH1_AF1(a[0])+(AU1_AH1_AF1(a[1])<<16);} +#endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// +// +// GLSL +// +// +//============================================================================================================================== +#if defined(A_GLSL) && defined(A_GPU) + #ifndef A_SKIP_EXT + #ifdef A_HALF + #extension GL_EXT_shader_16bit_storage:require + #extension GL_EXT_shader_explicit_arithmetic_types:require + #endif +//------------------------------------------------------------------------------------------------------------------------------ + #ifdef A_LONG + #extension GL_ARB_gpu_shader_int64:require + #extension GL_NV_shader_atomic_int64:require + #endif +//------------------------------------------------------------------------------------------------------------------------------ + #ifdef A_WAVE + #extension GL_KHR_shader_subgroup_arithmetic:require + #extension GL_KHR_shader_subgroup_ballot:require + #extension GL_KHR_shader_subgroup_quad:require + #extension GL_KHR_shader_subgroup_shuffle:require + #endif + #endif +//============================================================================================================================== + #define AP1 bool + #define AP2 bvec2 + #define AP3 bvec3 + #define AP4 bvec4 +//------------------------------------------------------------------------------------------------------------------------------ + #define AF1 float + #define AF2 vec2 + #define AF3 vec3 + #define AF4 vec4 +//------------------------------------------------------------------------------------------------------------------------------ + #define AU1 uint + #define AU2 uvec2 + #define AU3 uvec3 + #define AU4 uvec4 +//------------------------------------------------------------------------------------------------------------------------------ + #define ASU1 int + #define ASU2 ivec2 + #define ASU3 ivec3 + #define ASU4 ivec4 +//============================================================================================================================== + #define AF1_AU1(x) uintBitsToFloat(AU1(x)) + #define AF2_AU2(x) uintBitsToFloat(AU2(x)) + #define AF3_AU3(x) uintBitsToFloat(AU3(x)) + #define AF4_AU4(x) uintBitsToFloat(AU4(x)) +//------------------------------------------------------------------------------------------------------------------------------ + #define AU1_AF1(x) floatBitsToUint(AF1(x)) + #define AU2_AF2(x) floatBitsToUint(AF2(x)) + #define AU3_AF3(x) floatBitsToUint(AF3(x)) + #define AU4_AF4(x) floatBitsToUint(AF4(x)) +//------------------------------------------------------------------------------------------------------------------------------ + AU1 AU1_AH1_AF1_x(AF1 a){return packHalf2x16(AF2(a,0.0));} + #define AU1_AH1_AF1(a) AU1_AH1_AF1_x(AF1(a)) +//------------------------------------------------------------------------------------------------------------------------------ + #define AU1_AH2_AF2 packHalf2x16 + #define AU1_AW2Unorm_AF2 packUnorm2x16 + #define AU1_AB4Unorm_AF4 packUnorm4x8 +//------------------------------------------------------------------------------------------------------------------------------ + #define AF2_AH2_AU1 unpackHalf2x16 + #define AF2_AW2Unorm_AU1 unpackUnorm2x16 + #define AF4_AB4Unorm_AU1 unpackUnorm4x8 +//============================================================================================================================== + AF1 AF1_x(AF1 a){return AF1(a);} + AF2 AF2_x(AF1 a){return AF2(a,a);} + AF3 AF3_x(AF1 a){return AF3(a,a,a);} + AF4 AF4_x(AF1 a){return AF4(a,a,a,a);} + #define AF1_(a) AF1_x(AF1(a)) + #define AF2_(a) AF2_x(AF1(a)) + #define AF3_(a) AF3_x(AF1(a)) + #define AF4_(a) AF4_x(AF1(a)) +//------------------------------------------------------------------------------------------------------------------------------ + AU1 AU1_x(AU1 a){return AU1(a);} + AU2 AU2_x(AU1 a){return AU2(a,a);} + AU3 AU3_x(AU1 a){return AU3(a,a,a);} + AU4 AU4_x(AU1 a){return AU4(a,a,a,a);} + #define AU1_(a) AU1_x(AU1(a)) + #define AU2_(a) AU2_x(AU1(a)) + #define AU3_(a) AU3_x(AU1(a)) + #define AU4_(a) AU4_x(AU1(a)) +//============================================================================================================================== + AU1 AAbsSU1(AU1 a){return AU1(abs(ASU1(a)));} + AU2 AAbsSU2(AU2 a){return AU2(abs(ASU2(a)));} + AU3 AAbsSU3(AU3 a){return AU3(abs(ASU3(a)));} + AU4 AAbsSU4(AU4 a){return AU4(abs(ASU4(a)));} +//------------------------------------------------------------------------------------------------------------------------------ + AU1 ABfe(AU1 src,AU1 off,AU1 bits){return bitfieldExtract(src,ASU1(off),ASU1(bits));} + AU1 ABfi(AU1 src,AU1 ins,AU1 mask){return (ins&mask)|(src&(~mask));} + // Proxy for V_BFI_B32 where the 'mask' is set as 'bits', 'mask=(1<>ASU1(b));} + AU2 AShrSU2(AU2 a,AU2 b){return AU2(ASU2(a)>>ASU2(b));} + AU3 AShrSU3(AU3 a,AU3 b){return AU3(ASU3(a)>>ASU3(b));} + AU4 AShrSU4(AU4 a,AU4 b){return AU4(ASU4(a)>>ASU4(b));} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// GLSL BYTE +//============================================================================================================================== + #ifdef A_BYTE + #define AB1 uint8_t + #define AB2 u8vec2 + #define AB3 u8vec3 + #define AB4 u8vec4 +//------------------------------------------------------------------------------------------------------------------------------ + #define ASB1 int8_t + #define ASB2 i8vec2 + #define ASB3 i8vec3 + #define ASB4 i8vec4 +//------------------------------------------------------------------------------------------------------------------------------ + AB1 AB1_x(AB1 a){return AB1(a);} + AB2 AB2_x(AB1 a){return AB2(a,a);} + AB3 AB3_x(AB1 a){return AB3(a,a,a);} + AB4 AB4_x(AB1 a){return AB4(a,a,a,a);} + #define AB1_(a) AB1_x(AB1(a)) + #define AB2_(a) AB2_x(AB1(a)) + #define AB3_(a) AB3_x(AB1(a)) + #define AB4_(a) AB4_x(AB1(a)) + #endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// GLSL HALF +//============================================================================================================================== + #ifdef A_HALF + #define AH1 float16_t + #define AH2 f16vec2 + #define AH3 f16vec3 + #define AH4 f16vec4 +//------------------------------------------------------------------------------------------------------------------------------ + #define AW1 uint16_t + #define AW2 u16vec2 + #define AW3 u16vec3 + #define AW4 u16vec4 +//------------------------------------------------------------------------------------------------------------------------------ + #define ASW1 int16_t + #define ASW2 i16vec2 + #define ASW3 i16vec3 + #define ASW4 i16vec4 +//============================================================================================================================== + #define AH2_AU1(x) unpackFloat2x16(AU1(x)) + AH4 AH4_AU2_x(AU2 x){return AH4(unpackFloat2x16(x.x),unpackFloat2x16(x.y));} + #define AH4_AU2(x) AH4_AU2_x(AU2(x)) + #define AW2_AU1(x) unpackUint2x16(AU1(x)) + #define AW4_AU2(x) unpackUint4x16(pack64(AU2(x))) +//------------------------------------------------------------------------------------------------------------------------------ + #define AU1_AH2(x) packFloat2x16(AH2(x)) + AU2 AU2_AH4_x(AH4 x){return AU2(packFloat2x16(x.xy),packFloat2x16(x.zw));} + #define AU2_AH4(x) AU2_AH4_x(AH4(x)) + #define AU1_AW2(x) packUint2x16(AW2(x)) + #define AU2_AW4(x) unpack32(packUint4x16(AW4(x))) +//============================================================================================================================== + #define AW1_AH1(x) halfBitsToUint16(AH1(x)) + #define AW2_AH2(x) halfBitsToUint16(AH2(x)) + #define AW3_AH3(x) halfBitsToUint16(AH3(x)) + #define AW4_AH4(x) halfBitsToUint16(AH4(x)) +//------------------------------------------------------------------------------------------------------------------------------ + #define AH1_AW1(x) uint16BitsToHalf(AW1(x)) + #define AH2_AW2(x) uint16BitsToHalf(AW2(x)) + #define AH3_AW3(x) uint16BitsToHalf(AW3(x)) + #define AH4_AW4(x) uint16BitsToHalf(AW4(x)) +//============================================================================================================================== + AH1 AH1_x(AH1 a){return AH1(a);} + AH2 AH2_x(AH1 a){return AH2(a,a);} + AH3 AH3_x(AH1 a){return AH3(a,a,a);} + AH4 AH4_x(AH1 a){return AH4(a,a,a,a);} + #define AH1_(a) AH1_x(AH1(a)) + #define AH2_(a) AH2_x(AH1(a)) + #define AH3_(a) AH3_x(AH1(a)) + #define AH4_(a) AH4_x(AH1(a)) +//------------------------------------------------------------------------------------------------------------------------------ + AW1 AW1_x(AW1 a){return AW1(a);} + AW2 AW2_x(AW1 a){return AW2(a,a);} + AW3 AW3_x(AW1 a){return AW3(a,a,a);} + AW4 AW4_x(AW1 a){return AW4(a,a,a,a);} + #define AW1_(a) AW1_x(AW1(a)) + #define AW2_(a) AW2_x(AW1(a)) + #define AW3_(a) AW3_x(AW1(a)) + #define AW4_(a) AW4_x(AW1(a)) +//============================================================================================================================== + AW1 AAbsSW1(AW1 a){return AW1(abs(ASW1(a)));} + AW2 AAbsSW2(AW2 a){return AW2(abs(ASW2(a)));} + AW3 AAbsSW3(AW3 a){return AW3(abs(ASW3(a)));} + AW4 AAbsSW4(AW4 a){return AW4(abs(ASW4(a)));} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 AClampH1(AH1 x,AH1 n,AH1 m){return clamp(x,n,m);} + AH2 AClampH2(AH2 x,AH2 n,AH2 m){return clamp(x,n,m);} + AH3 AClampH3(AH3 x,AH3 n,AH3 m){return clamp(x,n,m);} + AH4 AClampH4(AH4 x,AH4 n,AH4 m){return clamp(x,n,m);} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 AFractH1(AH1 x){return fract(x);} + AH2 AFractH2(AH2 x){return fract(x);} + AH3 AFractH3(AH3 x){return fract(x);} + AH4 AFractH4(AH4 x){return fract(x);} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 ALerpH1(AH1 x,AH1 y,AH1 a){return mix(x,y,a);} + AH2 ALerpH2(AH2 x,AH2 y,AH2 a){return mix(x,y,a);} + AH3 ALerpH3(AH3 x,AH3 y,AH3 a){return mix(x,y,a);} + AH4 ALerpH4(AH4 x,AH4 y,AH4 a){return mix(x,y,a);} +//------------------------------------------------------------------------------------------------------------------------------ + // No packed version of max3. + AH1 AMax3H1(AH1 x,AH1 y,AH1 z){return max(x,max(y,z));} + AH2 AMax3H2(AH2 x,AH2 y,AH2 z){return max(x,max(y,z));} + AH3 AMax3H3(AH3 x,AH3 y,AH3 z){return max(x,max(y,z));} + AH4 AMax3H4(AH4 x,AH4 y,AH4 z){return max(x,max(y,z));} +//------------------------------------------------------------------------------------------------------------------------------ + AW1 AMaxSW1(AW1 a,AW1 b){return AW1(max(ASU1(a),ASU1(b)));} + AW2 AMaxSW2(AW2 a,AW2 b){return AW2(max(ASU2(a),ASU2(b)));} + AW3 AMaxSW3(AW3 a,AW3 b){return AW3(max(ASU3(a),ASU3(b)));} + AW4 AMaxSW4(AW4 a,AW4 b){return AW4(max(ASU4(a),ASU4(b)));} +//------------------------------------------------------------------------------------------------------------------------------ + // No packed version of min3. + AH1 AMin3H1(AH1 x,AH1 y,AH1 z){return min(x,min(y,z));} + AH2 AMin3H2(AH2 x,AH2 y,AH2 z){return min(x,min(y,z));} + AH3 AMin3H3(AH3 x,AH3 y,AH3 z){return min(x,min(y,z));} + AH4 AMin3H4(AH4 x,AH4 y,AH4 z){return min(x,min(y,z));} +//------------------------------------------------------------------------------------------------------------------------------ + AW1 AMinSW1(AW1 a,AW1 b){return AW1(min(ASU1(a),ASU1(b)));} + AW2 AMinSW2(AW2 a,AW2 b){return AW2(min(ASU2(a),ASU2(b)));} + AW3 AMinSW3(AW3 a,AW3 b){return AW3(min(ASU3(a),ASU3(b)));} + AW4 AMinSW4(AW4 a,AW4 b){return AW4(min(ASU4(a),ASU4(b)));} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 ARcpH1(AH1 x){return AH1_(1.0)/x;} + AH2 ARcpH2(AH2 x){return AH2_(1.0)/x;} + AH3 ARcpH3(AH3 x){return AH3_(1.0)/x;} + AH4 ARcpH4(AH4 x){return AH4_(1.0)/x;} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 ARsqH1(AH1 x){return AH1_(1.0)/sqrt(x);} + AH2 ARsqH2(AH2 x){return AH2_(1.0)/sqrt(x);} + AH3 ARsqH3(AH3 x){return AH3_(1.0)/sqrt(x);} + AH4 ARsqH4(AH4 x){return AH4_(1.0)/sqrt(x);} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 ASatH1(AH1 x){return clamp(x,AH1_(0.0),AH1_(1.0));} + AH2 ASatH2(AH2 x){return clamp(x,AH2_(0.0),AH2_(1.0));} + AH3 ASatH3(AH3 x){return clamp(x,AH3_(0.0),AH3_(1.0));} + AH4 ASatH4(AH4 x){return clamp(x,AH4_(0.0),AH4_(1.0));} +//------------------------------------------------------------------------------------------------------------------------------ + AW1 AShrSW1(AW1 a,AW1 b){return AW1(ASW1(a)>>ASW1(b));} + AW2 AShrSW2(AW2 a,AW2 b){return AW2(ASW2(a)>>ASW2(b));} + AW3 AShrSW3(AW3 a,AW3 b){return AW3(ASW3(a)>>ASW3(b));} + AW4 AShrSW4(AW4 a,AW4 b){return AW4(ASW4(a)>>ASW4(b));} + #endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// GLSL DOUBLE +//============================================================================================================================== + #ifdef A_DUBL + #define AD1 double + #define AD2 dvec2 + #define AD3 dvec3 + #define AD4 dvec4 +//------------------------------------------------------------------------------------------------------------------------------ + AD1 AD1_x(AD1 a){return AD1(a);} + AD2 AD2_x(AD1 a){return AD2(a,a);} + AD3 AD3_x(AD1 a){return AD3(a,a,a);} + AD4 AD4_x(AD1 a){return AD4(a,a,a,a);} + #define AD1_(a) AD1_x(AD1(a)) + #define AD2_(a) AD2_x(AD1(a)) + #define AD3_(a) AD3_x(AD1(a)) + #define AD4_(a) AD4_x(AD1(a)) +//============================================================================================================================== + AD1 AFractD1(AD1 x){return fract(x);} + AD2 AFractD2(AD2 x){return fract(x);} + AD3 AFractD3(AD3 x){return fract(x);} + AD4 AFractD4(AD4 x){return fract(x);} +//------------------------------------------------------------------------------------------------------------------------------ + AD1 ALerpD1(AD1 x,AD1 y,AD1 a){return mix(x,y,a);} + AD2 ALerpD2(AD2 x,AD2 y,AD2 a){return mix(x,y,a);} + AD3 ALerpD3(AD3 x,AD3 y,AD3 a){return mix(x,y,a);} + AD4 ALerpD4(AD4 x,AD4 y,AD4 a){return mix(x,y,a);} +//------------------------------------------------------------------------------------------------------------------------------ + AD1 ARcpD1(AD1 x){return AD1_(1.0)/x;} + AD2 ARcpD2(AD2 x){return AD2_(1.0)/x;} + AD3 ARcpD3(AD3 x){return AD3_(1.0)/x;} + AD4 ARcpD4(AD4 x){return AD4_(1.0)/x;} +//------------------------------------------------------------------------------------------------------------------------------ + AD1 ARsqD1(AD1 x){return AD1_(1.0)/sqrt(x);} + AD2 ARsqD2(AD2 x){return AD2_(1.0)/sqrt(x);} + AD3 ARsqD3(AD3 x){return AD3_(1.0)/sqrt(x);} + AD4 ARsqD4(AD4 x){return AD4_(1.0)/sqrt(x);} +//------------------------------------------------------------------------------------------------------------------------------ + AD1 ASatD1(AD1 x){return clamp(x,AD1_(0.0),AD1_(1.0));} + AD2 ASatD2(AD2 x){return clamp(x,AD2_(0.0),AD2_(1.0));} + AD3 ASatD3(AD3 x){return clamp(x,AD3_(0.0),AD3_(1.0));} + AD4 ASatD4(AD4 x){return clamp(x,AD4_(0.0),AD4_(1.0));} + #endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// GLSL LONG +//============================================================================================================================== + #ifdef A_LONG + #define AL1 uint64_t + #define AL2 u64vec2 + #define AL3 u64vec3 + #define AL4 u64vec4 +//------------------------------------------------------------------------------------------------------------------------------ + #define ASL1 int64_t + #define ASL2 i64vec2 + #define ASL3 i64vec3 + #define ASL4 i64vec4 +//------------------------------------------------------------------------------------------------------------------------------ + #define AL1_AU2(x) packUint2x32(AU2(x)) + #define AU2_AL1(x) unpackUint2x32(AL1(x)) +//------------------------------------------------------------------------------------------------------------------------------ + AL1 AL1_x(AL1 a){return AL1(a);} + AL2 AL2_x(AL1 a){return AL2(a,a);} + AL3 AL3_x(AL1 a){return AL3(a,a,a);} + AL4 AL4_x(AL1 a){return AL4(a,a,a,a);} + #define AL1_(a) AL1_x(AL1(a)) + #define AL2_(a) AL2_x(AL1(a)) + #define AL3_(a) AL3_x(AL1(a)) + #define AL4_(a) AL4_x(AL1(a)) +//============================================================================================================================== + AL1 AAbsSL1(AL1 a){return AL1(abs(ASL1(a)));} + AL2 AAbsSL2(AL2 a){return AL2(abs(ASL2(a)));} + AL3 AAbsSL3(AL3 a){return AL3(abs(ASL3(a)));} + AL4 AAbsSL4(AL4 a){return AL4(abs(ASL4(a)));} +//------------------------------------------------------------------------------------------------------------------------------ + AL1 AMaxSL1(AL1 a,AL1 b){return AL1(max(ASU1(a),ASU1(b)));} + AL2 AMaxSL2(AL2 a,AL2 b){return AL2(max(ASU2(a),ASU2(b)));} + AL3 AMaxSL3(AL3 a,AL3 b){return AL3(max(ASU3(a),ASU3(b)));} + AL4 AMaxSL4(AL4 a,AL4 b){return AL4(max(ASU4(a),ASU4(b)));} +//------------------------------------------------------------------------------------------------------------------------------ + AL1 AMinSL1(AL1 a,AL1 b){return AL1(min(ASU1(a),ASU1(b)));} + AL2 AMinSL2(AL2 a,AL2 b){return AL2(min(ASU2(a),ASU2(b)));} + AL3 AMinSL3(AL3 a,AL3 b){return AL3(min(ASU3(a),ASU3(b)));} + AL4 AMinSL4(AL4 a,AL4 b){return AL4(min(ASU4(a),ASU4(b)));} + #endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// WAVE OPERATIONS +//============================================================================================================================== + #ifdef A_WAVE + // Where 'x' must be a compile time literal. + AF1 AWaveXorF1(AF1 v,AU1 x){return subgroupShuffleXor(v,x);} + AF2 AWaveXorF2(AF2 v,AU1 x){return subgroupShuffleXor(v,x);} + AF3 AWaveXorF3(AF3 v,AU1 x){return subgroupShuffleXor(v,x);} + AF4 AWaveXorF4(AF4 v,AU1 x){return subgroupShuffleXor(v,x);} + AU1 AWaveXorU1(AU1 v,AU1 x){return subgroupShuffleXor(v,x);} + AU2 AWaveXorU2(AU2 v,AU1 x){return subgroupShuffleXor(v,x);} + AU3 AWaveXorU3(AU3 v,AU1 x){return subgroupShuffleXor(v,x);} + AU4 AWaveXorU4(AU4 v,AU1 x){return subgroupShuffleXor(v,x);} +//------------------------------------------------------------------------------------------------------------------------------ + #ifdef A_HALF + AH2 AWaveXorH2(AH2 v,AU1 x){return AH2_AU1(subgroupShuffleXor(AU1_AH2(v),x));} + AH4 AWaveXorH4(AH4 v,AU1 x){return AH4_AU2(subgroupShuffleXor(AU2_AH4(v),x));} + AW2 AWaveXorW2(AW2 v,AU1 x){return AW2_AU1(subgroupShuffleXor(AU1_AW2(v),x));} + AW4 AWaveXorW4(AW4 v,AU1 x){return AW4_AU2(subgroupShuffleXor(AU2_AW4(v),x));} + #endif + #endif +//============================================================================================================================== +#endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// +// +// HLSL +// +// +//============================================================================================================================== +#if defined(A_HLSL) && defined(A_GPU) + #ifdef A_HLSL_6_2 + #define AP1 bool + #define AP2 bool2 + #define AP3 bool3 + #define AP4 bool4 +//------------------------------------------------------------------------------------------------------------------------------ + #define AF1 float32_t + #define AF2 float32_t2 + #define AF3 float32_t3 + #define AF4 float32_t4 +//------------------------------------------------------------------------------------------------------------------------------ + #define AU1 uint32_t + #define AU2 uint32_t2 + #define AU3 uint32_t3 + #define AU4 uint32_t4 +//------------------------------------------------------------------------------------------------------------------------------ + #define ASU1 int32_t + #define ASU2 int32_t2 + #define ASU3 int32_t3 + #define ASU4 int32_t4 + #else + #define AP1 bool + #define AP2 bool2 + #define AP3 bool3 + #define AP4 bool4 +//------------------------------------------------------------------------------------------------------------------------------ + #define AF1 float + #define AF2 float2 + #define AF3 float3 + #define AF4 float4 +//------------------------------------------------------------------------------------------------------------------------------ + #define AU1 uint + #define AU2 uint2 + #define AU3 uint3 + #define AU4 uint4 +//------------------------------------------------------------------------------------------------------------------------------ + #define ASU1 int + #define ASU2 int2 + #define ASU3 int3 + #define ASU4 int4 + #endif +//============================================================================================================================== + #define AF1_AU1(x) asfloat(AU1(x)) + #define AF2_AU2(x) asfloat(AU2(x)) + #define AF3_AU3(x) asfloat(AU3(x)) + #define AF4_AU4(x) asfloat(AU4(x)) +//------------------------------------------------------------------------------------------------------------------------------ + #define AU1_AF1(x) asuint(AF1(x)) + #define AU2_AF2(x) asuint(AF2(x)) + #define AU3_AF3(x) asuint(AF3(x)) + #define AU4_AF4(x) asuint(AF4(x)) +//------------------------------------------------------------------------------------------------------------------------------ + AU1 AU1_AH1_AF1_x(AF1 a){return f32tof16(a);} + #define AU1_AH1_AF1(a) AU1_AH1_AF1_x(AF1(a)) +//------------------------------------------------------------------------------------------------------------------------------ + AU1 AU1_AH2_AF2_x(AF2 a){return f32tof16(a.x)|(f32tof16(a.y)<<16);} + #define AU1_AH2_AF2(a) AU1_AH2_AF2_x(AF2(a)) + #define AU1_AB4Unorm_AF4(x) D3DCOLORtoUBYTE4(AF4(x)) +//------------------------------------------------------------------------------------------------------------------------------ + AF2 AF2_AH2_AU1_x(AU1 x){return AF2(f16tof32(x&0xFFFF),f16tof32(x>>16));} + #define AF2_AH2_AU1(x) AF2_AH2_AU1_x(AU1(x)) +//============================================================================================================================== + AF1 AF1_x(AF1 a){return AF1(a);} + AF2 AF2_x(AF1 a){return AF2(a,a);} + AF3 AF3_x(AF1 a){return AF3(a,a,a);} + AF4 AF4_x(AF1 a){return AF4(a,a,a,a);} + #define AF1_(a) AF1_x(AF1(a)) + #define AF2_(a) AF2_x(AF1(a)) + #define AF3_(a) AF3_x(AF1(a)) + #define AF4_(a) AF4_x(AF1(a)) +//------------------------------------------------------------------------------------------------------------------------------ + AU1 AU1_x(AU1 a){return AU1(a);} + AU2 AU2_x(AU1 a){return AU2(a,a);} + AU3 AU3_x(AU1 a){return AU3(a,a,a);} + AU4 AU4_x(AU1 a){return AU4(a,a,a,a);} + #define AU1_(a) AU1_x(AU1(a)) + #define AU2_(a) AU2_x(AU1(a)) + #define AU3_(a) AU3_x(AU1(a)) + #define AU4_(a) AU4_x(AU1(a)) +//============================================================================================================================== + AU1 AAbsSU1(AU1 a){return AU1(abs(ASU1(a)));} + AU2 AAbsSU2(AU2 a){return AU2(abs(ASU2(a)));} + AU3 AAbsSU3(AU3 a){return AU3(abs(ASU3(a)));} + AU4 AAbsSU4(AU4 a){return AU4(abs(ASU4(a)));} +//------------------------------------------------------------------------------------------------------------------------------ + AU1 ABfe(AU1 src,AU1 off,AU1 bits){AU1 mask=(1u<>off)&mask;} + AU1 ABfi(AU1 src,AU1 ins,AU1 mask){return (ins&mask)|(src&(~mask));} + AU1 ABfiM(AU1 src,AU1 ins,AU1 bits){AU1 mask=(1u<>ASU1(b));} + AU2 AShrSU2(AU2 a,AU2 b){return AU2(ASU2(a)>>ASU2(b));} + AU3 AShrSU3(AU3 a,AU3 b){return AU3(ASU3(a)>>ASU3(b));} + AU4 AShrSU4(AU4 a,AU4 b){return AU4(ASU4(a)>>ASU4(b));} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// HLSL BYTE +//============================================================================================================================== + #ifdef A_BYTE + #endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// HLSL HALF +//============================================================================================================================== + #ifdef A_HALF + #ifdef A_HLSL_6_2 + #define AH1 float16_t + #define AH2 float16_t2 + #define AH3 float16_t3 + #define AH4 float16_t4 +//------------------------------------------------------------------------------------------------------------------------------ + #define AW1 uint16_t + #define AW2 uint16_t2 + #define AW3 uint16_t3 + #define AW4 uint16_t4 +//------------------------------------------------------------------------------------------------------------------------------ + #define ASW1 int16_t + #define ASW2 int16_t2 + #define ASW3 int16_t3 + #define ASW4 int16_t4 + #else + #define AH1 min16float + #define AH2 min16float2 + #define AH3 min16float3 + #define AH4 min16float4 +//------------------------------------------------------------------------------------------------------------------------------ + #define AW1 min16uint + #define AW2 min16uint2 + #define AW3 min16uint3 + #define AW4 min16uint4 +//------------------------------------------------------------------------------------------------------------------------------ + #define ASW1 min16int + #define ASW2 min16int2 + #define ASW3 min16int3 + #define ASW4 min16int4 + #endif +//============================================================================================================================== + // Need to use manual unpack to get optimal execution (don't use packed types in buffers directly). + // Unpack requires this pattern: https://gpuopen.com/first-steps-implementing-fp16/ + AH2 AH2_AU1_x(AU1 x){AF2 t=f16tof32(AU2(x&0xFFFF,x>>16));return AH2(t);} + AH4 AH4_AU2_x(AU2 x){return AH4(AH2_AU1_x(x.x),AH2_AU1_x(x.y));} + AW2 AW2_AU1_x(AU1 x){AU2 t=AU2(x&0xFFFF,x>>16);return AW2(t);} + AW4 AW4_AU2_x(AU2 x){return AW4(AW2_AU1_x(x.x),AW2_AU1_x(x.y));} + #define AH2_AU1(x) AH2_AU1_x(AU1(x)) + #define AH4_AU2(x) AH4_AU2_x(AU2(x)) + #define AW2_AU1(x) AW2_AU1_x(AU1(x)) + #define AW4_AU2(x) AW4_AU2_x(AU2(x)) +//------------------------------------------------------------------------------------------------------------------------------ + AU1 AU1_AH2_x(AH2 x){return f32tof16(x.x)+(f32tof16(x.y)<<16);} + AU2 AU2_AH4_x(AH4 x){return AU2(AU1_AH2_x(x.xy),AU1_AH2_x(x.zw));} + AU1 AU1_AW2_x(AW2 x){return AU1(x.x)+(AU1(x.y)<<16);} + AU2 AU2_AW4_x(AW4 x){return AU2(AU1_AW2_x(x.xy),AU1_AW2_x(x.zw));} + #define AU1_AH2(x) AU1_AH2_x(AH2(x)) + #define AU2_AH4(x) AU2_AH4_x(AH4(x)) + #define AU1_AW2(x) AU1_AW2_x(AW2(x)) + #define AU2_AW4(x) AU2_AW4_x(AW4(x)) +//============================================================================================================================== + #if defined(A_HLSL_6_2) && !defined(A_NO_16_BIT_CAST) + #define AW1_AH1(x) asuint16(x) + #define AW2_AH2(x) asuint16(x) + #define AW3_AH3(x) asuint16(x) + #define AW4_AH4(x) asuint16(x) + #else + #define AW1_AH1(a) AW1(f32tof16(AF1(a))) + #define AW2_AH2(a) AW2(AW1_AH1((a).x),AW1_AH1((a).y)) + #define AW3_AH3(a) AW3(AW1_AH1((a).x),AW1_AH1((a).y),AW1_AH1((a).z)) + #define AW4_AH4(a) AW4(AW1_AH1((a).x),AW1_AH1((a).y),AW1_AH1((a).z),AW1_AH1((a).w)) + #endif +//------------------------------------------------------------------------------------------------------------------------------ + #if defined(A_HLSL_6_2) && !defined(A_NO_16_BIT_CAST) + #define AH1_AW1(x) asfloat16(x) + #define AH2_AW2(x) asfloat16(x) + #define AH3_AW3(x) asfloat16(x) + #define AH4_AW4(x) asfloat16(x) + #else + #define AH1_AW1(a) AH1(f16tof32(AU1(a))) + #define AH2_AW2(a) AH2(AH1_AW1((a).x),AH1_AW1((a).y)) + #define AH3_AW3(a) AH3(AH1_AW1((a).x),AH1_AW1((a).y),AH1_AW1((a).z)) + #define AH4_AW4(a) AH4(AH1_AW1((a).x),AH1_AW1((a).y),AH1_AW1((a).z),AH1_AW1((a).w)) + #endif +//============================================================================================================================== + AH1 AH1_x(AH1 a){return AH1(a);} + AH2 AH2_x(AH1 a){return AH2(a,a);} + AH3 AH3_x(AH1 a){return AH3(a,a,a);} + AH4 AH4_x(AH1 a){return AH4(a,a,a,a);} + #define AH1_(a) AH1_x(AH1(a)) + #define AH2_(a) AH2_x(AH1(a)) + #define AH3_(a) AH3_x(AH1(a)) + #define AH4_(a) AH4_x(AH1(a)) +//------------------------------------------------------------------------------------------------------------------------------ + AW1 AW1_x(AW1 a){return AW1(a);} + AW2 AW2_x(AW1 a){return AW2(a,a);} + AW3 AW3_x(AW1 a){return AW3(a,a,a);} + AW4 AW4_x(AW1 a){return AW4(a,a,a,a);} + #define AW1_(a) AW1_x(AW1(a)) + #define AW2_(a) AW2_x(AW1(a)) + #define AW3_(a) AW3_x(AW1(a)) + #define AW4_(a) AW4_x(AW1(a)) +//============================================================================================================================== + AW1 AAbsSW1(AW1 a){return AW1(abs(ASW1(a)));} + AW2 AAbsSW2(AW2 a){return AW2(abs(ASW2(a)));} + AW3 AAbsSW3(AW3 a){return AW3(abs(ASW3(a)));} + AW4 AAbsSW4(AW4 a){return AW4(abs(ASW4(a)));} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 AClampH1(AH1 x,AH1 n,AH1 m){return max(n,min(x,m));} + AH2 AClampH2(AH2 x,AH2 n,AH2 m){return max(n,min(x,m));} + AH3 AClampH3(AH3 x,AH3 n,AH3 m){return max(n,min(x,m));} + AH4 AClampH4(AH4 x,AH4 n,AH4 m){return max(n,min(x,m));} +//------------------------------------------------------------------------------------------------------------------------------ + // V_FRACT_F16 (note DX frac() is different). + AH1 AFractH1(AH1 x){return x-floor(x);} + AH2 AFractH2(AH2 x){return x-floor(x);} + AH3 AFractH3(AH3 x){return x-floor(x);} + AH4 AFractH4(AH4 x){return x-floor(x);} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 ALerpH1(AH1 x,AH1 y,AH1 a){return lerp(x,y,a);} + AH2 ALerpH2(AH2 x,AH2 y,AH2 a){return lerp(x,y,a);} + AH3 ALerpH3(AH3 x,AH3 y,AH3 a){return lerp(x,y,a);} + AH4 ALerpH4(AH4 x,AH4 y,AH4 a){return lerp(x,y,a);} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 AMax3H1(AH1 x,AH1 y,AH1 z){return max(x,max(y,z));} + AH2 AMax3H2(AH2 x,AH2 y,AH2 z){return max(x,max(y,z));} + AH3 AMax3H3(AH3 x,AH3 y,AH3 z){return max(x,max(y,z));} + AH4 AMax3H4(AH4 x,AH4 y,AH4 z){return max(x,max(y,z));} +//------------------------------------------------------------------------------------------------------------------------------ + AW1 AMaxSW1(AW1 a,AW1 b){return AW1(max(ASU1(a),ASU1(b)));} + AW2 AMaxSW2(AW2 a,AW2 b){return AW2(max(ASU2(a),ASU2(b)));} + AW3 AMaxSW3(AW3 a,AW3 b){return AW3(max(ASU3(a),ASU3(b)));} + AW4 AMaxSW4(AW4 a,AW4 b){return AW4(max(ASU4(a),ASU4(b)));} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 AMin3H1(AH1 x,AH1 y,AH1 z){return min(x,min(y,z));} + AH2 AMin3H2(AH2 x,AH2 y,AH2 z){return min(x,min(y,z));} + AH3 AMin3H3(AH3 x,AH3 y,AH3 z){return min(x,min(y,z));} + AH4 AMin3H4(AH4 x,AH4 y,AH4 z){return min(x,min(y,z));} +//------------------------------------------------------------------------------------------------------------------------------ + AW1 AMinSW1(AW1 a,AW1 b){return AW1(min(ASU1(a),ASU1(b)));} + AW2 AMinSW2(AW2 a,AW2 b){return AW2(min(ASU2(a),ASU2(b)));} + AW3 AMinSW3(AW3 a,AW3 b){return AW3(min(ASU3(a),ASU3(b)));} + AW4 AMinSW4(AW4 a,AW4 b){return AW4(min(ASU4(a),ASU4(b)));} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 ARcpH1(AH1 x){return rcp(x);} + AH2 ARcpH2(AH2 x){return rcp(x);} + AH3 ARcpH3(AH3 x){return rcp(x);} + AH4 ARcpH4(AH4 x){return rcp(x);} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 ARsqH1(AH1 x){return rsqrt(x);} + AH2 ARsqH2(AH2 x){return rsqrt(x);} + AH3 ARsqH3(AH3 x){return rsqrt(x);} + AH4 ARsqH4(AH4 x){return rsqrt(x);} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 ASatH1(AH1 x){return saturate(x);} + AH2 ASatH2(AH2 x){return saturate(x);} + AH3 ASatH3(AH3 x){return saturate(x);} + AH4 ASatH4(AH4 x){return saturate(x);} +//------------------------------------------------------------------------------------------------------------------------------ + AW1 AShrSW1(AW1 a,AW1 b){return AW1(ASW1(a)>>ASW1(b));} + AW2 AShrSW2(AW2 a,AW2 b){return AW2(ASW2(a)>>ASW2(b));} + AW3 AShrSW3(AW3 a,AW3 b){return AW3(ASW3(a)>>ASW3(b));} + AW4 AShrSW4(AW4 a,AW4 b){return AW4(ASW4(a)>>ASW4(b));} + #endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// HLSL DOUBLE +//============================================================================================================================== + #ifdef A_DUBL + #ifdef A_HLSL_6_2 + #define AD1 float64_t + #define AD2 float64_t2 + #define AD3 float64_t3 + #define AD4 float64_t4 + #else + #define AD1 double + #define AD2 double2 + #define AD3 double3 + #define AD4 double4 + #endif +//------------------------------------------------------------------------------------------------------------------------------ + AD1 AD1_x(AD1 a){return AD1(a);} + AD2 AD2_x(AD1 a){return AD2(a,a);} + AD3 AD3_x(AD1 a){return AD3(a,a,a);} + AD4 AD4_x(AD1 a){return AD4(a,a,a,a);} + #define AD1_(a) AD1_x(AD1(a)) + #define AD2_(a) AD2_x(AD1(a)) + #define AD3_(a) AD3_x(AD1(a)) + #define AD4_(a) AD4_x(AD1(a)) +//============================================================================================================================== + AD1 AFractD1(AD1 a){return a-floor(a);} + AD2 AFractD2(AD2 a){return a-floor(a);} + AD3 AFractD3(AD3 a){return a-floor(a);} + AD4 AFractD4(AD4 a){return a-floor(a);} +//------------------------------------------------------------------------------------------------------------------------------ + AD1 ALerpD1(AD1 x,AD1 y,AD1 a){return lerp(x,y,a);} + AD2 ALerpD2(AD2 x,AD2 y,AD2 a){return lerp(x,y,a);} + AD3 ALerpD3(AD3 x,AD3 y,AD3 a){return lerp(x,y,a);} + AD4 ALerpD4(AD4 x,AD4 y,AD4 a){return lerp(x,y,a);} +//------------------------------------------------------------------------------------------------------------------------------ + AD1 ARcpD1(AD1 x){return rcp(x);} + AD2 ARcpD2(AD2 x){return rcp(x);} + AD3 ARcpD3(AD3 x){return rcp(x);} + AD4 ARcpD4(AD4 x){return rcp(x);} +//------------------------------------------------------------------------------------------------------------------------------ + AD1 ARsqD1(AD1 x){return rsqrt(x);} + AD2 ARsqD2(AD2 x){return rsqrt(x);} + AD3 ARsqD3(AD3 x){return rsqrt(x);} + AD4 ARsqD4(AD4 x){return rsqrt(x);} +//------------------------------------------------------------------------------------------------------------------------------ + AD1 ASatD1(AD1 x){return saturate(x);} + AD2 ASatD2(AD2 x){return saturate(x);} + AD3 ASatD3(AD3 x){return saturate(x);} + AD4 ASatD4(AD4 x){return saturate(x);} + #endif +//============================================================================================================================== +// HLSL WAVE +//============================================================================================================================== + #ifdef A_WAVE + // Where 'x' must be a compile time literal. + AF1 AWaveXorF1(AF1 v,AU1 x){return WaveReadLaneAt(v,WaveGetLaneIndex()^x);} + AF2 AWaveXorF2(AF2 v,AU1 x){return WaveReadLaneAt(v,WaveGetLaneIndex()^x);} + AF3 AWaveXorF3(AF3 v,AU1 x){return WaveReadLaneAt(v,WaveGetLaneIndex()^x);} + AF4 AWaveXorF4(AF4 v,AU1 x){return WaveReadLaneAt(v,WaveGetLaneIndex()^x);} + AU1 AWaveXorU1(AU1 v,AU1 x){return WaveReadLaneAt(v,WaveGetLaneIndex()^x);} + AU2 AWaveXorU1(AU2 v,AU1 x){return WaveReadLaneAt(v,WaveGetLaneIndex()^x);} + AU3 AWaveXorU1(AU3 v,AU1 x){return WaveReadLaneAt(v,WaveGetLaneIndex()^x);} + AU4 AWaveXorU1(AU4 v,AU1 x){return WaveReadLaneAt(v,WaveGetLaneIndex()^x);} +//------------------------------------------------------------------------------------------------------------------------------ + #ifdef A_HALF + AH2 AWaveXorH2(AH2 v,AU1 x){return AH2_AU1(WaveReadLaneAt(AU1_AH2(v),WaveGetLaneIndex()^x));} + AH4 AWaveXorH4(AH4 v,AU1 x){return AH4_AU2(WaveReadLaneAt(AU2_AH4(v),WaveGetLaneIndex()^x));} + AW2 AWaveXorW2(AW2 v,AU1 x){return AW2_AU1(WaveReadLaneAt(AU1_AW2(v),WaveGetLaneIndex()^x));} + AW4 AWaveXorW4(AW4 v,AU1 x){return AW4_AU1(WaveReadLaneAt(AU1_AW4(v),WaveGetLaneIndex()^x));} + #endif + #endif +//============================================================================================================================== +#endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// +// +// GPU COMMON +// +// +//============================================================================================================================== +#ifdef A_GPU + // Negative and positive infinity. + #define A_INFP_F AF1_AU1(0x7f800000u) + #define A_INFN_F AF1_AU1(0xff800000u) +//------------------------------------------------------------------------------------------------------------------------------ + // Copy sign from 's' to positive 'd'. + AF1 ACpySgnF1(AF1 d,AF1 s){return AF1_AU1(AU1_AF1(d)|(AU1_AF1(s)&AU1_(0x80000000u)));} + AF2 ACpySgnF2(AF2 d,AF2 s){return AF2_AU2(AU2_AF2(d)|(AU2_AF2(s)&AU2_(0x80000000u)));} + AF3 ACpySgnF3(AF3 d,AF3 s){return AF3_AU3(AU3_AF3(d)|(AU3_AF3(s)&AU3_(0x80000000u)));} + AF4 ACpySgnF4(AF4 d,AF4 s){return AF4_AU4(AU4_AF4(d)|(AU4_AF4(s)&AU4_(0x80000000u)));} +//------------------------------------------------------------------------------------------------------------------------------ + // Single operation to return (useful to create a mask to use in lerp for branch free logic), + // m=NaN := 0 + // m>=0 := 0 + // m<0 := 1 + // Uses the following useful floating point logic, + // saturate(+a*(-INF)==-INF) := 0 + // saturate( 0*(-INF)== NaN) := 0 + // saturate(-a*(-INF)==+INF) := 1 + AF1 ASignedF1(AF1 m){return ASatF1(m*AF1_(A_INFN_F));} + AF2 ASignedF2(AF2 m){return ASatF2(m*AF2_(A_INFN_F));} + AF3 ASignedF3(AF3 m){return ASatF3(m*AF3_(A_INFN_F));} + AF4 ASignedF4(AF4 m){return ASatF4(m*AF4_(A_INFN_F));} +//------------------------------------------------------------------------------------------------------------------------------ + AF1 AGtZeroF1(AF1 m){return ASatF1(m*AF1_(A_INFP_F));} + AF2 AGtZeroF2(AF2 m){return ASatF2(m*AF2_(A_INFP_F));} + AF3 AGtZeroF3(AF3 m){return ASatF3(m*AF3_(A_INFP_F));} + AF4 AGtZeroF4(AF4 m){return ASatF4(m*AF4_(A_INFP_F));} +//============================================================================================================================== + #ifdef A_HALF + #ifdef A_HLSL_6_2 + #define A_INFP_H AH1_AW1((uint16_t)0x7c00u) + #define A_INFN_H AH1_AW1((uint16_t)0xfc00u) + #else + #define A_INFP_H AH1_AW1(0x7c00u) + #define A_INFN_H AH1_AW1(0xfc00u) + #endif + +//------------------------------------------------------------------------------------------------------------------------------ + AH1 ACpySgnH1(AH1 d,AH1 s){return AH1_AW1(AW1_AH1(d)|(AW1_AH1(s)&AW1_(0x8000u)));} + AH2 ACpySgnH2(AH2 d,AH2 s){return AH2_AW2(AW2_AH2(d)|(AW2_AH2(s)&AW2_(0x8000u)));} + AH3 ACpySgnH3(AH3 d,AH3 s){return AH3_AW3(AW3_AH3(d)|(AW3_AH3(s)&AW3_(0x8000u)));} + AH4 ACpySgnH4(AH4 d,AH4 s){return AH4_AW4(AW4_AH4(d)|(AW4_AH4(s)&AW4_(0x8000u)));} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 ASignedH1(AH1 m){return ASatH1(m*AH1_(A_INFN_H));} + AH2 ASignedH2(AH2 m){return ASatH2(m*AH2_(A_INFN_H));} + AH3 ASignedH3(AH3 m){return ASatH3(m*AH3_(A_INFN_H));} + AH4 ASignedH4(AH4 m){return ASatH4(m*AH4_(A_INFN_H));} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 AGtZeroH1(AH1 m){return ASatH1(m*AH1_(A_INFP_H));} + AH2 AGtZeroH2(AH2 m){return ASatH2(m*AH2_(A_INFP_H));} + AH3 AGtZeroH3(AH3 m){return ASatH3(m*AH3_(A_INFP_H));} + AH4 AGtZeroH4(AH4 m){return ASatH4(m*AH4_(A_INFP_H));} + #endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// [FIS] FLOAT INTEGER SORTABLE +//------------------------------------------------------------------------------------------------------------------------------ +// Float to integer sortable. +// - If sign bit=0, flip the sign bit (positives). +// - If sign bit=1, flip all bits (negatives). +// Integer sortable to float. +// - If sign bit=1, flip the sign bit (positives). +// - If sign bit=0, flip all bits (negatives). +// Has nice side effects. +// - Larger integers are more positive values. +// - Float zero is mapped to center of integers (so clear to integer zero is a nice default for atomic max usage). +// Burns 3 ops for conversion {shift,or,xor}. +//============================================================================================================================== + AU1 AFisToU1(AU1 x){return x^(( AShrSU1(x,AU1_(31)))|AU1_(0x80000000));} + AU1 AFisFromU1(AU1 x){return x^((~AShrSU1(x,AU1_(31)))|AU1_(0x80000000));} +//------------------------------------------------------------------------------------------------------------------------------ + // Just adjust high 16-bit value (useful when upper part of 32-bit word is a 16-bit float value). + AU1 AFisToHiU1(AU1 x){return x^(( AShrSU1(x,AU1_(15)))|AU1_(0x80000000));} + AU1 AFisFromHiU1(AU1 x){return x^((~AShrSU1(x,AU1_(15)))|AU1_(0x80000000));} +//------------------------------------------------------------------------------------------------------------------------------ + #ifdef A_HALF + AW1 AFisToW1(AW1 x){return x^(( AShrSW1(x,AW1_(15)))|AW1_(0x8000));} + AW1 AFisFromW1(AW1 x){return x^((~AShrSW1(x,AW1_(15)))|AW1_(0x8000));} +//------------------------------------------------------------------------------------------------------------------------------ + AW2 AFisToW2(AW2 x){return x^(( AShrSW2(x,AW2_(15)))|AW2_(0x8000));} + AW2 AFisFromW2(AW2 x){return x^((~AShrSW2(x,AW2_(15)))|AW2_(0x8000));} + #endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// [PERM] V_PERM_B32 +//------------------------------------------------------------------------------------------------------------------------------ +// Support for V_PERM_B32 started in the 3rd generation of GCN. +//------------------------------------------------------------------------------------------------------------------------------ +// yyyyxxxx - The 'i' input. +// 76543210 +// ======== +// HGFEDCBA - Naming on permutation. +//------------------------------------------------------------------------------------------------------------------------------ +// TODO +// ==== +// - Make sure compiler optimizes this. +//============================================================================================================================== + #ifdef A_HALF + AU1 APerm0E0A(AU2 i){return((i.x )&0xffu)|((i.y<<16)&0xff0000u);} + AU1 APerm0F0B(AU2 i){return((i.x>> 8)&0xffu)|((i.y<< 8)&0xff0000u);} + AU1 APerm0G0C(AU2 i){return((i.x>>16)&0xffu)|((i.y )&0xff0000u);} + AU1 APerm0H0D(AU2 i){return((i.x>>24)&0xffu)|((i.y>> 8)&0xff0000u);} +//------------------------------------------------------------------------------------------------------------------------------ + AU1 APermHGFA(AU2 i){return((i.x )&0x000000ffu)|(i.y&0xffffff00u);} + AU1 APermHGFC(AU2 i){return((i.x>>16)&0x000000ffu)|(i.y&0xffffff00u);} + AU1 APermHGAE(AU2 i){return((i.x<< 8)&0x0000ff00u)|(i.y&0xffff00ffu);} + AU1 APermHGCE(AU2 i){return((i.x>> 8)&0x0000ff00u)|(i.y&0xffff00ffu);} + AU1 APermHAFE(AU2 i){return((i.x<<16)&0x00ff0000u)|(i.y&0xff00ffffu);} + AU1 APermHCFE(AU2 i){return((i.x )&0x00ff0000u)|(i.y&0xff00ffffu);} + AU1 APermAGFE(AU2 i){return((i.x<<24)&0xff000000u)|(i.y&0x00ffffffu);} + AU1 APermCGFE(AU2 i){return((i.x<< 8)&0xff000000u)|(i.y&0x00ffffffu);} +//------------------------------------------------------------------------------------------------------------------------------ + AU1 APermGCEA(AU2 i){return((i.x)&0x00ff00ffu)|((i.y<<8)&0xff00ff00u);} + AU1 APermGECA(AU2 i){return(((i.x)&0xffu)|((i.x>>8)&0xff00u)|((i.y<<16)&0xff0000u)|((i.y<<8)&0xff000000u));} + #endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// [BUC] BYTE UNSIGNED CONVERSION +//------------------------------------------------------------------------------------------------------------------------------ +// Designed to use the optimal conversion, enables the scaling to possibly be factored into other computation. +// Works on a range of {0 to A_BUC_<32,16>}, for <32-bit, and 16-bit> respectively. +//------------------------------------------------------------------------------------------------------------------------------ +// OPCODE NOTES +// ============ +// GCN does not do UNORM or SNORM for bytes in opcodes. +// - V_CVT_F32_UBYTE{0,1,2,3} - Unsigned byte to float. +// - V_CVT_PKACC_U8_F32 - Float to unsigned byte (does bit-field insert into 32-bit integer). +// V_PERM_B32 does byte packing with ability to zero fill bytes as well. +// - Can pull out byte values from two sources, and zero fill upper 8-bits of packed hi and lo. +//------------------------------------------------------------------------------------------------------------------------------ +// BYTE : FLOAT - ABuc{0,1,2,3}{To,From}U1() - Designed for V_CVT_F32_UBYTE* and V_CVT_PKACCUM_U8_F32 ops. +// ==== ===== +// 0 : 0 +// 1 : 1 +// ... +// 255 : 255 +// : 256 (just outside the encoding range) +//------------------------------------------------------------------------------------------------------------------------------ +// BYTE : FLOAT - ABuc{0,1,2,3}{To,From}U2() - Designed for 16-bit denormal tricks and V_PERM_B32. +// ==== ===== +// 0 : 0 +// 1 : 1/512 +// 2 : 1/256 +// ... +// 64 : 1/8 +// 128 : 1/4 +// 255 : 255/512 +// : 1/2 (just outside the encoding range) +//------------------------------------------------------------------------------------------------------------------------------ +// OPTIMAL IMPLEMENTATIONS ON AMD ARCHITECTURES +// ============================================ +// r=ABuc0FromU1(i) +// V_CVT_F32_UBYTE0 r,i +// -------------------------------------------- +// r=ABuc0ToU1(d,i) +// V_CVT_PKACCUM_U8_F32 r,i,0,d +// -------------------------------------------- +// d=ABuc0FromU2(i) +// Where 'k0' is an SGPR with 0x0E0A +// Where 'k1' is an SGPR with {32768.0} packed into the lower 16-bits +// V_PERM_B32 d,i.x,i.y,k0 +// V_PK_FMA_F16 d,d,k1.x,0 +// -------------------------------------------- +// r=ABuc0ToU2(d,i) +// Where 'k0' is an SGPR with {1.0/32768.0} packed into the lower 16-bits +// Where 'k1' is an SGPR with 0x???? +// Where 'k2' is an SGPR with 0x???? +// V_PK_FMA_F16 i,i,k0.x,0 +// V_PERM_B32 r.x,i,i,k1 +// V_PERM_B32 r.y,i,i,k2 +//============================================================================================================================== + // Peak range for 32-bit and 16-bit operations. + #define A_BUC_32 (255.0) + #define A_BUC_16 (255.0/512.0) +//============================================================================================================================== + #if 1 + // Designed to be one V_CVT_PKACCUM_U8_F32. + // The extra min is required to pattern match to V_CVT_PKACCUM_U8_F32. + AU1 ABuc0ToU1(AU1 d,AF1 i){return (d&0xffffff00u)|((min(AU1(i),255u) )&(0x000000ffu));} + AU1 ABuc1ToU1(AU1 d,AF1 i){return (d&0xffff00ffu)|((min(AU1(i),255u)<< 8)&(0x0000ff00u));} + AU1 ABuc2ToU1(AU1 d,AF1 i){return (d&0xff00ffffu)|((min(AU1(i),255u)<<16)&(0x00ff0000u));} + AU1 ABuc3ToU1(AU1 d,AF1 i){return (d&0x00ffffffu)|((min(AU1(i),255u)<<24)&(0xff000000u));} +//------------------------------------------------------------------------------------------------------------------------------ + // Designed to be one V_CVT_F32_UBYTE*. + AF1 ABuc0FromU1(AU1 i){return AF1((i )&255u);} + AF1 ABuc1FromU1(AU1 i){return AF1((i>> 8)&255u);} + AF1 ABuc2FromU1(AU1 i){return AF1((i>>16)&255u);} + AF1 ABuc3FromU1(AU1 i){return AF1((i>>24)&255u);} + #endif +//============================================================================================================================== + #ifdef A_HALF + // Takes {x0,x1} and {y0,y1} and builds {{x0,y0},{x1,y1}}. + AW2 ABuc01ToW2(AH2 x,AH2 y){x*=AH2_(1.0/32768.0);y*=AH2_(1.0/32768.0); + return AW2_AU1(APermGCEA(AU2(AU1_AW2(AW2_AH2(x)),AU1_AW2(AW2_AH2(y)))));} +//------------------------------------------------------------------------------------------------------------------------------ + // Designed for 3 ops to do SOA to AOS and conversion. + AU2 ABuc0ToU2(AU2 d,AH2 i){AU1 b=AU1_AW2(AW2_AH2(i*AH2_(1.0/32768.0))); + return AU2(APermHGFA(AU2(d.x,b)),APermHGFC(AU2(d.y,b)));} + AU2 ABuc1ToU2(AU2 d,AH2 i){AU1 b=AU1_AW2(AW2_AH2(i*AH2_(1.0/32768.0))); + return AU2(APermHGAE(AU2(d.x,b)),APermHGCE(AU2(d.y,b)));} + AU2 ABuc2ToU2(AU2 d,AH2 i){AU1 b=AU1_AW2(AW2_AH2(i*AH2_(1.0/32768.0))); + return AU2(APermHAFE(AU2(d.x,b)),APermHCFE(AU2(d.y,b)));} + AU2 ABuc3ToU2(AU2 d,AH2 i){AU1 b=AU1_AW2(AW2_AH2(i*AH2_(1.0/32768.0))); + return AU2(APermAGFE(AU2(d.x,b)),APermCGFE(AU2(d.y,b)));} +//------------------------------------------------------------------------------------------------------------------------------ + // Designed for 2 ops to do both AOS to SOA, and conversion. + AH2 ABuc0FromU2(AU2 i){return AH2_AW2(AW2_AU1(APerm0E0A(i)))*AH2_(32768.0);} + AH2 ABuc1FromU2(AU2 i){return AH2_AW2(AW2_AU1(APerm0F0B(i)))*AH2_(32768.0);} + AH2 ABuc2FromU2(AU2 i){return AH2_AW2(AW2_AU1(APerm0G0C(i)))*AH2_(32768.0);} + AH2 ABuc3FromU2(AU2 i){return AH2_AW2(AW2_AU1(APerm0H0D(i)))*AH2_(32768.0);} + #endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// [BSC] BYTE SIGNED CONVERSION +//------------------------------------------------------------------------------------------------------------------------------ +// Similar to [BUC]. +// Works on a range of {-/+ A_BSC_<32,16>}, for <32-bit, and 16-bit> respectively. +//------------------------------------------------------------------------------------------------------------------------------ +// ENCODING (without zero-based encoding) +// ======== +// 0 = unused (can be used to mean something else) +// 1 = lowest value +// 128 = exact zero center (zero based encoding +// 255 = highest value +//------------------------------------------------------------------------------------------------------------------------------ +// Zero-based [Zb] flips the MSB bit of the byte (making 128 "exact zero" actually zero). +// This is useful if there is a desire for cleared values to decode as zero. +//------------------------------------------------------------------------------------------------------------------------------ +// BYTE : FLOAT - ABsc{0,1,2,3}{To,From}U2() - Designed for 16-bit denormal tricks and V_PERM_B32. +// ==== ===== +// 0 : -127/512 (unused) +// 1 : -126/512 +// 2 : -125/512 +// ... +// 128 : 0 +// ... +// 255 : 127/512 +// : 1/4 (just outside the encoding range) +//============================================================================================================================== + // Peak range for 32-bit and 16-bit operations. + #define A_BSC_32 (127.0) + #define A_BSC_16 (127.0/512.0) +//============================================================================================================================== + #if 1 + AU1 ABsc0ToU1(AU1 d,AF1 i){return (d&0xffffff00u)|((min(AU1(i+128.0),255u) )&(0x000000ffu));} + AU1 ABsc1ToU1(AU1 d,AF1 i){return (d&0xffff00ffu)|((min(AU1(i+128.0),255u)<< 8)&(0x0000ff00u));} + AU1 ABsc2ToU1(AU1 d,AF1 i){return (d&0xff00ffffu)|((min(AU1(i+128.0),255u)<<16)&(0x00ff0000u));} + AU1 ABsc3ToU1(AU1 d,AF1 i){return (d&0x00ffffffu)|((min(AU1(i+128.0),255u)<<24)&(0xff000000u));} +//------------------------------------------------------------------------------------------------------------------------------ + AU1 ABsc0ToZbU1(AU1 d,AF1 i){return ((d&0xffffff00u)|((min(AU1(trunc(i)+128.0),255u) )&(0x000000ffu)))^0x00000080u;} + AU1 ABsc1ToZbU1(AU1 d,AF1 i){return ((d&0xffff00ffu)|((min(AU1(trunc(i)+128.0),255u)<< 8)&(0x0000ff00u)))^0x00008000u;} + AU1 ABsc2ToZbU1(AU1 d,AF1 i){return ((d&0xff00ffffu)|((min(AU1(trunc(i)+128.0),255u)<<16)&(0x00ff0000u)))^0x00800000u;} + AU1 ABsc3ToZbU1(AU1 d,AF1 i){return ((d&0x00ffffffu)|((min(AU1(trunc(i)+128.0),255u)<<24)&(0xff000000u)))^0x80000000u;} +//------------------------------------------------------------------------------------------------------------------------------ + AF1 ABsc0FromU1(AU1 i){return AF1((i )&255u)-128.0;} + AF1 ABsc1FromU1(AU1 i){return AF1((i>> 8)&255u)-128.0;} + AF1 ABsc2FromU1(AU1 i){return AF1((i>>16)&255u)-128.0;} + AF1 ABsc3FromU1(AU1 i){return AF1((i>>24)&255u)-128.0;} +//------------------------------------------------------------------------------------------------------------------------------ + AF1 ABsc0FromZbU1(AU1 i){return AF1(((i )&255u)^0x80u)-128.0;} + AF1 ABsc1FromZbU1(AU1 i){return AF1(((i>> 8)&255u)^0x80u)-128.0;} + AF1 ABsc2FromZbU1(AU1 i){return AF1(((i>>16)&255u)^0x80u)-128.0;} + AF1 ABsc3FromZbU1(AU1 i){return AF1(((i>>24)&255u)^0x80u)-128.0;} + #endif +//============================================================================================================================== + #ifdef A_HALF + // Takes {x0,x1} and {y0,y1} and builds {{x0,y0},{x1,y1}}. + AW2 ABsc01ToW2(AH2 x,AH2 y){x=x*AH2_(1.0/32768.0)+AH2_(0.25/32768.0);y=y*AH2_(1.0/32768.0)+AH2_(0.25/32768.0); + return AW2_AU1(APermGCEA(AU2(AU1_AW2(AW2_AH2(x)),AU1_AW2(AW2_AH2(y)))));} +//------------------------------------------------------------------------------------------------------------------------------ + AU2 ABsc0ToU2(AU2 d,AH2 i){AU1 b=AU1_AW2(AW2_AH2(i*AH2_(1.0/32768.0)+AH2_(0.25/32768.0))); + return AU2(APermHGFA(AU2(d.x,b)),APermHGFC(AU2(d.y,b)));} + AU2 ABsc1ToU2(AU2 d,AH2 i){AU1 b=AU1_AW2(AW2_AH2(i*AH2_(1.0/32768.0)+AH2_(0.25/32768.0))); + return AU2(APermHGAE(AU2(d.x,b)),APermHGCE(AU2(d.y,b)));} + AU2 ABsc2ToU2(AU2 d,AH2 i){AU1 b=AU1_AW2(AW2_AH2(i*AH2_(1.0/32768.0)+AH2_(0.25/32768.0))); + return AU2(APermHAFE(AU2(d.x,b)),APermHCFE(AU2(d.y,b)));} + AU2 ABsc3ToU2(AU2 d,AH2 i){AU1 b=AU1_AW2(AW2_AH2(i*AH2_(1.0/32768.0)+AH2_(0.25/32768.0))); + return AU2(APermAGFE(AU2(d.x,b)),APermCGFE(AU2(d.y,b)));} +//------------------------------------------------------------------------------------------------------------------------------ + AU2 ABsc0ToZbU2(AU2 d,AH2 i){AU1 b=AU1_AW2(AW2_AH2(i*AH2_(1.0/32768.0)+AH2_(0.25/32768.0)))^0x00800080u; + return AU2(APermHGFA(AU2(d.x,b)),APermHGFC(AU2(d.y,b)));} + AU2 ABsc1ToZbU2(AU2 d,AH2 i){AU1 b=AU1_AW2(AW2_AH2(i*AH2_(1.0/32768.0)+AH2_(0.25/32768.0)))^0x00800080u; + return AU2(APermHGAE(AU2(d.x,b)),APermHGCE(AU2(d.y,b)));} + AU2 ABsc2ToZbU2(AU2 d,AH2 i){AU1 b=AU1_AW2(AW2_AH2(i*AH2_(1.0/32768.0)+AH2_(0.25/32768.0)))^0x00800080u; + return AU2(APermHAFE(AU2(d.x,b)),APermHCFE(AU2(d.y,b)));} + AU2 ABsc3ToZbU2(AU2 d,AH2 i){AU1 b=AU1_AW2(AW2_AH2(i*AH2_(1.0/32768.0)+AH2_(0.25/32768.0)))^0x00800080u; + return AU2(APermAGFE(AU2(d.x,b)),APermCGFE(AU2(d.y,b)));} +//------------------------------------------------------------------------------------------------------------------------------ + AH2 ABsc0FromU2(AU2 i){return AH2_AW2(AW2_AU1(APerm0E0A(i)))*AH2_(32768.0)-AH2_(0.25);} + AH2 ABsc1FromU2(AU2 i){return AH2_AW2(AW2_AU1(APerm0F0B(i)))*AH2_(32768.0)-AH2_(0.25);} + AH2 ABsc2FromU2(AU2 i){return AH2_AW2(AW2_AU1(APerm0G0C(i)))*AH2_(32768.0)-AH2_(0.25);} + AH2 ABsc3FromU2(AU2 i){return AH2_AW2(AW2_AU1(APerm0H0D(i)))*AH2_(32768.0)-AH2_(0.25);} +//------------------------------------------------------------------------------------------------------------------------------ + AH2 ABsc0FromZbU2(AU2 i){return AH2_AW2(AW2_AU1(APerm0E0A(i)^0x00800080u))*AH2_(32768.0)-AH2_(0.25);} + AH2 ABsc1FromZbU2(AU2 i){return AH2_AW2(AW2_AU1(APerm0F0B(i)^0x00800080u))*AH2_(32768.0)-AH2_(0.25);} + AH2 ABsc2FromZbU2(AU2 i){return AH2_AW2(AW2_AU1(APerm0G0C(i)^0x00800080u))*AH2_(32768.0)-AH2_(0.25);} + AH2 ABsc3FromZbU2(AU2 i){return AH2_AW2(AW2_AU1(APerm0H0D(i)^0x00800080u))*AH2_(32768.0)-AH2_(0.25);} + #endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// HALF APPROXIMATIONS +//------------------------------------------------------------------------------------------------------------------------------ +// These support only positive inputs. +// Did not see value yet in specialization for range. +// Using quick testing, ended up mostly getting the same "best" approximation for various ranges. +// With hardware that can co-execute transcendentals, the value in approximations could be less than expected. +// However from a latency perspective, if execution of a transcendental is 4 clk, with no packed support, -> 8 clk total. +// And co-execution would require a compiler interleaving a lot of independent work for packed usage. +//------------------------------------------------------------------------------------------------------------------------------ +// The one Newton Raphson iteration form of rsq() was skipped (requires 6 ops total). +// Same with sqrt(), as this could be x*rsq() (7 ops). +//============================================================================================================================== + #ifdef A_HALF + // Minimize squared error across full positive range, 2 ops. + // The 0x1de2 based approximation maps {0 to 1} input maps to < 1 output. + AH1 APrxLoSqrtH1(AH1 a){return AH1_AW1((AW1_AH1(a)>>AW1_(1))+AW1_(0x1de2));} + AH2 APrxLoSqrtH2(AH2 a){return AH2_AW2((AW2_AH2(a)>>AW2_(1))+AW2_(0x1de2));} + AH3 APrxLoSqrtH3(AH3 a){return AH3_AW3((AW3_AH3(a)>>AW3_(1))+AW3_(0x1de2));} + AH4 APrxLoSqrtH4(AH4 a){return AH4_AW4((AW4_AH4(a)>>AW4_(1))+AW4_(0x1de2));} +//------------------------------------------------------------------------------------------------------------------------------ + // Lower precision estimation, 1 op. + // Minimize squared error across {smallest normal to 16384.0}. + AH1 APrxLoRcpH1(AH1 a){return AH1_AW1(AW1_(0x7784)-AW1_AH1(a));} + AH2 APrxLoRcpH2(AH2 a){return AH2_AW2(AW2_(0x7784)-AW2_AH2(a));} + AH3 APrxLoRcpH3(AH3 a){return AH3_AW3(AW3_(0x7784)-AW3_AH3(a));} + AH4 APrxLoRcpH4(AH4 a){return AH4_AW4(AW4_(0x7784)-AW4_AH4(a));} +//------------------------------------------------------------------------------------------------------------------------------ + // Medium precision estimation, one Newton Raphson iteration, 3 ops. + AH1 APrxMedRcpH1(AH1 a){AH1 b=AH1_AW1(AW1_(0x778d)-AW1_AH1(a));return b*(-b*a+AH1_(2.0));} + AH2 APrxMedRcpH2(AH2 a){AH2 b=AH2_AW2(AW2_(0x778d)-AW2_AH2(a));return b*(-b*a+AH2_(2.0));} + AH3 APrxMedRcpH3(AH3 a){AH3 b=AH3_AW3(AW3_(0x778d)-AW3_AH3(a));return b*(-b*a+AH3_(2.0));} + AH4 APrxMedRcpH4(AH4 a){AH4 b=AH4_AW4(AW4_(0x778d)-AW4_AH4(a));return b*(-b*a+AH4_(2.0));} +//------------------------------------------------------------------------------------------------------------------------------ + // Minimize squared error across {smallest normal to 16384.0}, 2 ops. + AH1 APrxLoRsqH1(AH1 a){return AH1_AW1(AW1_(0x59a3)-(AW1_AH1(a)>>AW1_(1)));} + AH2 APrxLoRsqH2(AH2 a){return AH2_AW2(AW2_(0x59a3)-(AW2_AH2(a)>>AW2_(1)));} + AH3 APrxLoRsqH3(AH3 a){return AH3_AW3(AW3_(0x59a3)-(AW3_AH3(a)>>AW3_(1)));} + AH4 APrxLoRsqH4(AH4 a){return AH4_AW4(AW4_(0x59a3)-(AW4_AH4(a)>>AW4_(1)));} + #endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// FLOAT APPROXIMATIONS +//------------------------------------------------------------------------------------------------------------------------------ +// Michal Drobot has an excellent presentation on these: "Low Level Optimizations For GCN", +// - Idea dates back to SGI, then to Quake 3, etc. +// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +// - sqrt(x)=rsqrt(x)*x +// - rcp(x)=rsqrt(x)*rsqrt(x) for positive x +// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +//------------------------------------------------------------------------------------------------------------------------------ +// These below are from perhaps less complete searching for optimal. +// Used FP16 normal range for testing with +4096 32-bit step size for sampling error. +// So these match up well with the half approximations. +//============================================================================================================================== + AF1 APrxLoSqrtF1(AF1 a){return AF1_AU1((AU1_AF1(a)>>AU1_(1))+AU1_(0x1fbc4639));} + AF1 APrxLoRcpF1(AF1 a){return AF1_AU1(AU1_(0x7ef07ebb)-AU1_AF1(a));} + AF1 APrxMedRcpF1(AF1 a){AF1 b=AF1_AU1(AU1_(0x7ef19fff)-AU1_AF1(a));return b*(-b*a+AF1_(2.0));} + AF1 APrxLoRsqF1(AF1 a){return AF1_AU1(AU1_(0x5f347d74)-(AU1_AF1(a)>>AU1_(1)));} +//------------------------------------------------------------------------------------------------------------------------------ + AF2 APrxLoSqrtF2(AF2 a){return AF2_AU2((AU2_AF2(a)>>AU2_(1))+AU2_(0x1fbc4639));} + AF2 APrxLoRcpF2(AF2 a){return AF2_AU2(AU2_(0x7ef07ebb)-AU2_AF2(a));} + AF2 APrxMedRcpF2(AF2 a){AF2 b=AF2_AU2(AU2_(0x7ef19fff)-AU2_AF2(a));return b*(-b*a+AF2_(2.0));} + AF2 APrxLoRsqF2(AF2 a){return AF2_AU2(AU2_(0x5f347d74)-(AU2_AF2(a)>>AU2_(1)));} +//------------------------------------------------------------------------------------------------------------------------------ + AF3 APrxLoSqrtF3(AF3 a){return AF3_AU3((AU3_AF3(a)>>AU3_(1))+AU3_(0x1fbc4639));} + AF3 APrxLoRcpF3(AF3 a){return AF3_AU3(AU3_(0x7ef07ebb)-AU3_AF3(a));} + AF3 APrxMedRcpF3(AF3 a){AF3 b=AF3_AU3(AU3_(0x7ef19fff)-AU3_AF3(a));return b*(-b*a+AF3_(2.0));} + AF3 APrxLoRsqF3(AF3 a){return AF3_AU3(AU3_(0x5f347d74)-(AU3_AF3(a)>>AU3_(1)));} +//------------------------------------------------------------------------------------------------------------------------------ + AF4 APrxLoSqrtF4(AF4 a){return AF4_AU4((AU4_AF4(a)>>AU4_(1))+AU4_(0x1fbc4639));} + AF4 APrxLoRcpF4(AF4 a){return AF4_AU4(AU4_(0x7ef07ebb)-AU4_AF4(a));} + AF4 APrxMedRcpF4(AF4 a){AF4 b=AF4_AU4(AU4_(0x7ef19fff)-AU4_AF4(a));return b*(-b*a+AF4_(2.0));} + AF4 APrxLoRsqF4(AF4 a){return AF4_AU4(AU4_(0x5f347d74)-(AU4_AF4(a)>>AU4_(1)));} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// PQ APPROXIMATIONS +//------------------------------------------------------------------------------------------------------------------------------ +// PQ is very close to x^(1/8). The functions below Use the fast float approximation method to do +// PQ<~>Gamma2 (4th power and fast 4th root) and PQ<~>Linear (8th power and fast 8th root). Maximum error is ~0.2%. +//============================================================================================================================== +// Helpers + AF1 Quart(AF1 a) { a = a * a; return a * a;} + AF1 Oct(AF1 a) { a = a * a; a = a * a; return a * a; } + AF2 Quart(AF2 a) { a = a * a; return a * a; } + AF2 Oct(AF2 a) { a = a * a; a = a * a; return a * a; } + AF3 Quart(AF3 a) { a = a * a; return a * a; } + AF3 Oct(AF3 a) { a = a * a; a = a * a; return a * a; } + AF4 Quart(AF4 a) { a = a * a; return a * a; } + AF4 Oct(AF4 a) { a = a * a; a = a * a; return a * a; } + //------------------------------------------------------------------------------------------------------------------------------ + AF1 APrxPQToGamma2(AF1 a) { return Quart(a); } + AF1 APrxPQToLinear(AF1 a) { return Oct(a); } + AF1 APrxLoGamma2ToPQ(AF1 a) { return AF1_AU1((AU1_AF1(a) >> AU1_(2)) + AU1_(0x2F9A4E46)); } + AF1 APrxMedGamma2ToPQ(AF1 a) { AF1 b = AF1_AU1((AU1_AF1(a) >> AU1_(2)) + AU1_(0x2F9A4E46)); AF1 b4 = Quart(b); return b - b * (b4 - a) / (AF1_(4.0) * b4); } + AF1 APrxHighGamma2ToPQ(AF1 a) { return sqrt(sqrt(a)); } + AF1 APrxLoLinearToPQ(AF1 a) { return AF1_AU1((AU1_AF1(a) >> AU1_(3)) + AU1_(0x378D8723)); } + AF1 APrxMedLinearToPQ(AF1 a) { AF1 b = AF1_AU1((AU1_AF1(a) >> AU1_(3)) + AU1_(0x378D8723)); AF1 b8 = Oct(b); return b - b * (b8 - a) / (AF1_(8.0) * b8); } + AF1 APrxHighLinearToPQ(AF1 a) { return sqrt(sqrt(sqrt(a))); } + //------------------------------------------------------------------------------------------------------------------------------ + AF2 APrxPQToGamma2(AF2 a) { return Quart(a); } + AF2 APrxPQToLinear(AF2 a) { return Oct(a); } + AF2 APrxLoGamma2ToPQ(AF2 a) { return AF2_AU2((AU2_AF2(a) >> AU2_(2)) + AU2_(0x2F9A4E46)); } + AF2 APrxMedGamma2ToPQ(AF2 a) { AF2 b = AF2_AU2((AU2_AF2(a) >> AU2_(2)) + AU2_(0x2F9A4E46)); AF2 b4 = Quart(b); return b - b * (b4 - a) / (AF1_(4.0) * b4); } + AF2 APrxHighGamma2ToPQ(AF2 a) { return sqrt(sqrt(a)); } + AF2 APrxLoLinearToPQ(AF2 a) { return AF2_AU2((AU2_AF2(a) >> AU2_(3)) + AU2_(0x378D8723)); } + AF2 APrxMedLinearToPQ(AF2 a) { AF2 b = AF2_AU2((AU2_AF2(a) >> AU2_(3)) + AU2_(0x378D8723)); AF2 b8 = Oct(b); return b - b * (b8 - a) / (AF1_(8.0) * b8); } + AF2 APrxHighLinearToPQ(AF2 a) { return sqrt(sqrt(sqrt(a))); } + //------------------------------------------------------------------------------------------------------------------------------ + AF3 APrxPQToGamma2(AF3 a) { return Quart(a); } + AF3 APrxPQToLinear(AF3 a) { return Oct(a); } + AF3 APrxLoGamma2ToPQ(AF3 a) { return AF3_AU3((AU3_AF3(a) >> AU3_(2)) + AU3_(0x2F9A4E46)); } + AF3 APrxMedGamma2ToPQ(AF3 a) { AF3 b = AF3_AU3((AU3_AF3(a) >> AU3_(2)) + AU3_(0x2F9A4E46)); AF3 b4 = Quart(b); return b - b * (b4 - a) / (AF1_(4.0) * b4); } + AF3 APrxHighGamma2ToPQ(AF3 a) { return sqrt(sqrt(a)); } + AF3 APrxLoLinearToPQ(AF3 a) { return AF3_AU3((AU3_AF3(a) >> AU3_(3)) + AU3_(0x378D8723)); } + AF3 APrxMedLinearToPQ(AF3 a) { AF3 b = AF3_AU3((AU3_AF3(a) >> AU3_(3)) + AU3_(0x378D8723)); AF3 b8 = Oct(b); return b - b * (b8 - a) / (AF1_(8.0) * b8); } + AF3 APrxHighLinearToPQ(AF3 a) { return sqrt(sqrt(sqrt(a))); } + //------------------------------------------------------------------------------------------------------------------------------ + AF4 APrxPQToGamma2(AF4 a) { return Quart(a); } + AF4 APrxPQToLinear(AF4 a) { return Oct(a); } + AF4 APrxLoGamma2ToPQ(AF4 a) { return AF4_AU4((AU4_AF4(a) >> AU4_(2)) + AU4_(0x2F9A4E46)); } + AF4 APrxMedGamma2ToPQ(AF4 a) { AF4 b = AF4_AU4((AU4_AF4(a) >> AU4_(2)) + AU4_(0x2F9A4E46)); AF4 b4 = Quart(b); return b - b * (b4 - a) / (AF1_(4.0) * b4); } + AF4 APrxHighGamma2ToPQ(AF4 a) { return sqrt(sqrt(a)); } + AF4 APrxLoLinearToPQ(AF4 a) { return AF4_AU4((AU4_AF4(a) >> AU4_(3)) + AU4_(0x378D8723)); } + AF4 APrxMedLinearToPQ(AF4 a) { AF4 b = AF4_AU4((AU4_AF4(a) >> AU4_(3)) + AU4_(0x378D8723)); AF4 b8 = Oct(b); return b - b * (b8 - a) / (AF1_(8.0) * b8); } + AF4 APrxHighLinearToPQ(AF4 a) { return sqrt(sqrt(sqrt(a))); } +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// PARABOLIC SIN & COS +//------------------------------------------------------------------------------------------------------------------------------ +// Approximate answers to transcendental questions. +//------------------------------------------------------------------------------------------------------------------------------ +//============================================================================================================================== + #if 1 + // Valid input range is {-1 to 1} representing {0 to 2 pi}. + // Output range is {-1/4 to 1/4} representing {-1 to 1}. + AF1 APSinF1(AF1 x){return x*abs(x)-x;} // MAD. + AF2 APSinF2(AF2 x){return x*abs(x)-x;} + AF1 APCosF1(AF1 x){x=AFractF1(x*AF1_(0.5)+AF1_(0.75));x=x*AF1_(2.0)-AF1_(1.0);return APSinF1(x);} // 3x MAD, FRACT + AF2 APCosF2(AF2 x){x=AFractF2(x*AF2_(0.5)+AF2_(0.75));x=x*AF2_(2.0)-AF2_(1.0);return APSinF2(x);} + AF2 APSinCosF1(AF1 x){AF1 y=AFractF1(x*AF1_(0.5)+AF1_(0.75));y=y*AF1_(2.0)-AF1_(1.0);return APSinF2(AF2(x,y));} + #endif +//------------------------------------------------------------------------------------------------------------------------------ + #ifdef A_HALF + // For a packed {sin,cos} pair, + // - Native takes 16 clocks and 4 issue slots (no packed transcendentals). + // - Parabolic takes 8 clocks and 8 issue slots (only fract is non-packed). + AH1 APSinH1(AH1 x){return x*abs(x)-x;} + AH2 APSinH2(AH2 x){return x*abs(x)-x;} // AND,FMA + AH1 APCosH1(AH1 x){x=AFractH1(x*AH1_(0.5)+AH1_(0.75));x=x*AH1_(2.0)-AH1_(1.0);return APSinH1(x);} + AH2 APCosH2(AH2 x){x=AFractH2(x*AH2_(0.5)+AH2_(0.75));x=x*AH2_(2.0)-AH2_(1.0);return APSinH2(x);} // 3x FMA, 2xFRACT, AND + AH2 APSinCosH1(AH1 x){AH1 y=AFractH1(x*AH1_(0.5)+AH1_(0.75));y=y*AH1_(2.0)-AH1_(1.0);return APSinH2(AH2(x,y));} + #endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// [ZOL] ZERO ONE LOGIC +//------------------------------------------------------------------------------------------------------------------------------ +// Conditional free logic designed for easy 16-bit packing, and backwards porting to 32-bit. +//------------------------------------------------------------------------------------------------------------------------------ +// 0 := false +// 1 := true +//------------------------------------------------------------------------------------------------------------------------------ +// AndNot(x,y) -> !(x&y) .... One op. +// AndOr(x,y,z) -> (x&y)|z ... One op. +// GtZero(x) -> x>0.0 ..... One op. +// Sel(x,y,z) -> x?y:z ..... Two ops, has no precision loss. +// Signed(x) -> x<0.0 ..... One op. +// ZeroPass(x,y) -> x?0:y ..... Two ops, 'y' is a pass through safe for aliasing as integer. +//------------------------------------------------------------------------------------------------------------------------------ +// OPTIMIZATION NOTES +// ================== +// - On Vega to use 2 constants in a packed op, pass in as one AW2 or one AH2 'k.xy' and use as 'k.xx' and 'k.yy'. +// For example 'a.xy*k.xx+k.yy'. +//============================================================================================================================== + #if 1 + AU1 AZolAndU1(AU1 x,AU1 y){return min(x,y);} + AU2 AZolAndU2(AU2 x,AU2 y){return min(x,y);} + AU3 AZolAndU3(AU3 x,AU3 y){return min(x,y);} + AU4 AZolAndU4(AU4 x,AU4 y){return min(x,y);} +//------------------------------------------------------------------------------------------------------------------------------ + AU1 AZolNotU1(AU1 x){return x^AU1_(1);} + AU2 AZolNotU2(AU2 x){return x^AU2_(1);} + AU3 AZolNotU3(AU3 x){return x^AU3_(1);} + AU4 AZolNotU4(AU4 x){return x^AU4_(1);} +//------------------------------------------------------------------------------------------------------------------------------ + AU1 AZolOrU1(AU1 x,AU1 y){return max(x,y);} + AU2 AZolOrU2(AU2 x,AU2 y){return max(x,y);} + AU3 AZolOrU3(AU3 x,AU3 y){return max(x,y);} + AU4 AZolOrU4(AU4 x,AU4 y){return max(x,y);} +//============================================================================================================================== + AU1 AZolF1ToU1(AF1 x){return AU1(x);} + AU2 AZolF2ToU2(AF2 x){return AU2(x);} + AU3 AZolF3ToU3(AF3 x){return AU3(x);} + AU4 AZolF4ToU4(AF4 x){return AU4(x);} +//------------------------------------------------------------------------------------------------------------------------------ + // 2 ops, denormals don't work in 32-bit on PC (and if they are enabled, OMOD is disabled). + AU1 AZolNotF1ToU1(AF1 x){return AU1(AF1_(1.0)-x);} + AU2 AZolNotF2ToU2(AF2 x){return AU2(AF2_(1.0)-x);} + AU3 AZolNotF3ToU3(AF3 x){return AU3(AF3_(1.0)-x);} + AU4 AZolNotF4ToU4(AF4 x){return AU4(AF4_(1.0)-x);} +//------------------------------------------------------------------------------------------------------------------------------ + AF1 AZolU1ToF1(AU1 x){return AF1(x);} + AF2 AZolU2ToF2(AU2 x){return AF2(x);} + AF3 AZolU3ToF3(AU3 x){return AF3(x);} + AF4 AZolU4ToF4(AU4 x){return AF4(x);} +//============================================================================================================================== + AF1 AZolAndF1(AF1 x,AF1 y){return min(x,y);} + AF2 AZolAndF2(AF2 x,AF2 y){return min(x,y);} + AF3 AZolAndF3(AF3 x,AF3 y){return min(x,y);} + AF4 AZolAndF4(AF4 x,AF4 y){return min(x,y);} +//------------------------------------------------------------------------------------------------------------------------------ + AF1 ASolAndNotF1(AF1 x,AF1 y){return (-x)*y+AF1_(1.0);} + AF2 ASolAndNotF2(AF2 x,AF2 y){return (-x)*y+AF2_(1.0);} + AF3 ASolAndNotF3(AF3 x,AF3 y){return (-x)*y+AF3_(1.0);} + AF4 ASolAndNotF4(AF4 x,AF4 y){return (-x)*y+AF4_(1.0);} +//------------------------------------------------------------------------------------------------------------------------------ + AF1 AZolAndOrF1(AF1 x,AF1 y,AF1 z){return ASatF1(x*y+z);} + AF2 AZolAndOrF2(AF2 x,AF2 y,AF2 z){return ASatF2(x*y+z);} + AF3 AZolAndOrF3(AF3 x,AF3 y,AF3 z){return ASatF3(x*y+z);} + AF4 AZolAndOrF4(AF4 x,AF4 y,AF4 z){return ASatF4(x*y+z);} +//------------------------------------------------------------------------------------------------------------------------------ + AF1 AZolGtZeroF1(AF1 x){return ASatF1(x*AF1_(A_INFP_F));} + AF2 AZolGtZeroF2(AF2 x){return ASatF2(x*AF2_(A_INFP_F));} + AF3 AZolGtZeroF3(AF3 x){return ASatF3(x*AF3_(A_INFP_F));} + AF4 AZolGtZeroF4(AF4 x){return ASatF4(x*AF4_(A_INFP_F));} +//------------------------------------------------------------------------------------------------------------------------------ + AF1 AZolNotF1(AF1 x){return AF1_(1.0)-x;} + AF2 AZolNotF2(AF2 x){return AF2_(1.0)-x;} + AF3 AZolNotF3(AF3 x){return AF3_(1.0)-x;} + AF4 AZolNotF4(AF4 x){return AF4_(1.0)-x;} +//------------------------------------------------------------------------------------------------------------------------------ + AF1 AZolOrF1(AF1 x,AF1 y){return max(x,y);} + AF2 AZolOrF2(AF2 x,AF2 y){return max(x,y);} + AF3 AZolOrF3(AF3 x,AF3 y){return max(x,y);} + AF4 AZolOrF4(AF4 x,AF4 y){return max(x,y);} +//------------------------------------------------------------------------------------------------------------------------------ + AF1 AZolSelF1(AF1 x,AF1 y,AF1 z){AF1 r=(-x)*z+z;return x*y+r;} + AF2 AZolSelF2(AF2 x,AF2 y,AF2 z){AF2 r=(-x)*z+z;return x*y+r;} + AF3 AZolSelF3(AF3 x,AF3 y,AF3 z){AF3 r=(-x)*z+z;return x*y+r;} + AF4 AZolSelF4(AF4 x,AF4 y,AF4 z){AF4 r=(-x)*z+z;return x*y+r;} +//------------------------------------------------------------------------------------------------------------------------------ + AF1 AZolSignedF1(AF1 x){return ASatF1(x*AF1_(A_INFN_F));} + AF2 AZolSignedF2(AF2 x){return ASatF2(x*AF2_(A_INFN_F));} + AF3 AZolSignedF3(AF3 x){return ASatF3(x*AF3_(A_INFN_F));} + AF4 AZolSignedF4(AF4 x){return ASatF4(x*AF4_(A_INFN_F));} +//------------------------------------------------------------------------------------------------------------------------------ + AF1 AZolZeroPassF1(AF1 x,AF1 y){return AF1_AU1((AU1_AF1(x)!=AU1_(0))?AU1_(0):AU1_AF1(y));} + AF2 AZolZeroPassF2(AF2 x,AF2 y){return AF2_AU2((AU2_AF2(x)!=AU2_(0))?AU2_(0):AU2_AF2(y));} + AF3 AZolZeroPassF3(AF3 x,AF3 y){return AF3_AU3((AU3_AF3(x)!=AU3_(0))?AU3_(0):AU3_AF3(y));} + AF4 AZolZeroPassF4(AF4 x,AF4 y){return AF4_AU4((AU4_AF4(x)!=AU4_(0))?AU4_(0):AU4_AF4(y));} + #endif +//============================================================================================================================== + #ifdef A_HALF + AW1 AZolAndW1(AW1 x,AW1 y){return min(x,y);} + AW2 AZolAndW2(AW2 x,AW2 y){return min(x,y);} + AW3 AZolAndW3(AW3 x,AW3 y){return min(x,y);} + AW4 AZolAndW4(AW4 x,AW4 y){return min(x,y);} +//------------------------------------------------------------------------------------------------------------------------------ + AW1 AZolNotW1(AW1 x){return x^AW1_(1);} + AW2 AZolNotW2(AW2 x){return x^AW2_(1);} + AW3 AZolNotW3(AW3 x){return x^AW3_(1);} + AW4 AZolNotW4(AW4 x){return x^AW4_(1);} +//------------------------------------------------------------------------------------------------------------------------------ + AW1 AZolOrW1(AW1 x,AW1 y){return max(x,y);} + AW2 AZolOrW2(AW2 x,AW2 y){return max(x,y);} + AW3 AZolOrW3(AW3 x,AW3 y){return max(x,y);} + AW4 AZolOrW4(AW4 x,AW4 y){return max(x,y);} +//============================================================================================================================== + // Uses denormal trick. + AW1 AZolH1ToW1(AH1 x){return AW1_AH1(x*AH1_AW1(AW1_(1)));} + AW2 AZolH2ToW2(AH2 x){return AW2_AH2(x*AH2_AW2(AW2_(1)));} + AW3 AZolH3ToW3(AH3 x){return AW3_AH3(x*AH3_AW3(AW3_(1)));} + AW4 AZolH4ToW4(AH4 x){return AW4_AH4(x*AH4_AW4(AW4_(1)));} +//------------------------------------------------------------------------------------------------------------------------------ + // AMD arch lacks a packed conversion opcode. + AH1 AZolW1ToH1(AW1 x){return AH1_AW1(x*AW1_AH1(AH1_(1.0)));} + AH2 AZolW2ToH2(AW2 x){return AH2_AW2(x*AW2_AH2(AH2_(1.0)));} + AH3 AZolW1ToH3(AW3 x){return AH3_AW3(x*AW3_AH3(AH3_(1.0)));} + AH4 AZolW2ToH4(AW4 x){return AH4_AW4(x*AW4_AH4(AH4_(1.0)));} +//============================================================================================================================== + AH1 AZolAndH1(AH1 x,AH1 y){return min(x,y);} + AH2 AZolAndH2(AH2 x,AH2 y){return min(x,y);} + AH3 AZolAndH3(AH3 x,AH3 y){return min(x,y);} + AH4 AZolAndH4(AH4 x,AH4 y){return min(x,y);} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 ASolAndNotH1(AH1 x,AH1 y){return (-x)*y+AH1_(1.0);} + AH2 ASolAndNotH2(AH2 x,AH2 y){return (-x)*y+AH2_(1.0);} + AH3 ASolAndNotH3(AH3 x,AH3 y){return (-x)*y+AH3_(1.0);} + AH4 ASolAndNotH4(AH4 x,AH4 y){return (-x)*y+AH4_(1.0);} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 AZolAndOrH1(AH1 x,AH1 y,AH1 z){return ASatH1(x*y+z);} + AH2 AZolAndOrH2(AH2 x,AH2 y,AH2 z){return ASatH2(x*y+z);} + AH3 AZolAndOrH3(AH3 x,AH3 y,AH3 z){return ASatH3(x*y+z);} + AH4 AZolAndOrH4(AH4 x,AH4 y,AH4 z){return ASatH4(x*y+z);} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 AZolGtZeroH1(AH1 x){return ASatH1(x*AH1_(A_INFP_H));} + AH2 AZolGtZeroH2(AH2 x){return ASatH2(x*AH2_(A_INFP_H));} + AH3 AZolGtZeroH3(AH3 x){return ASatH3(x*AH3_(A_INFP_H));} + AH4 AZolGtZeroH4(AH4 x){return ASatH4(x*AH4_(A_INFP_H));} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 AZolNotH1(AH1 x){return AH1_(1.0)-x;} + AH2 AZolNotH2(AH2 x){return AH2_(1.0)-x;} + AH3 AZolNotH3(AH3 x){return AH3_(1.0)-x;} + AH4 AZolNotH4(AH4 x){return AH4_(1.0)-x;} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 AZolOrH1(AH1 x,AH1 y){return max(x,y);} + AH2 AZolOrH2(AH2 x,AH2 y){return max(x,y);} + AH3 AZolOrH3(AH3 x,AH3 y){return max(x,y);} + AH4 AZolOrH4(AH4 x,AH4 y){return max(x,y);} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 AZolSelH1(AH1 x,AH1 y,AH1 z){AH1 r=(-x)*z+z;return x*y+r;} + AH2 AZolSelH2(AH2 x,AH2 y,AH2 z){AH2 r=(-x)*z+z;return x*y+r;} + AH3 AZolSelH3(AH3 x,AH3 y,AH3 z){AH3 r=(-x)*z+z;return x*y+r;} + AH4 AZolSelH4(AH4 x,AH4 y,AH4 z){AH4 r=(-x)*z+z;return x*y+r;} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 AZolSignedH1(AH1 x){return ASatH1(x*AH1_(A_INFN_H));} + AH2 AZolSignedH2(AH2 x){return ASatH2(x*AH2_(A_INFN_H));} + AH3 AZolSignedH3(AH3 x){return ASatH3(x*AH3_(A_INFN_H));} + AH4 AZolSignedH4(AH4 x){return ASatH4(x*AH4_(A_INFN_H));} + #endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// COLOR CONVERSIONS +//------------------------------------------------------------------------------------------------------------------------------ +// These are all linear to/from some other space (where 'linear' has been shortened out of the function name). +// So 'ToGamma' is 'LinearToGamma', and 'FromGamma' is 'LinearFromGamma'. +// These are branch free implementations. +// The AToSrgbF1() function is useful for stores for compute shaders for GPUs without hardware linear->sRGB store conversion. +//------------------------------------------------------------------------------------------------------------------------------ +// TRANSFER FUNCTIONS +// ================== +// 709 ..... Rec709 used for some HDTVs +// Gamma ... Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native +// Pq ...... PQ native for HDR10 +// Srgb .... The sRGB output, typical of PC displays, useful for 10-bit output, or storing to 8-bit UNORM without SRGB type +// Two ..... Gamma 2.0, fastest conversion (useful for intermediate pass approximations) +// Three ... Gamma 3.0, less fast, but good for HDR. +//------------------------------------------------------------------------------------------------------------------------------ +// KEEPING TO SPEC +// =============== +// Both Rec.709 and sRGB have a linear segment which as spec'ed would intersect the curved segment 2 times. +// (a.) For 8-bit sRGB, steps {0 to 10.3} are in the linear region (4% of the encoding range). +// (b.) For 8-bit 709, steps {0 to 20.7} are in the linear region (8% of the encoding range). +// Also there is a slight step in the transition regions. +// Precision of the coefficients in the spec being the likely cause. +// Main usage case of the sRGB code is to do the linear->sRGB converstion in a compute shader before store. +// This is to work around lack of hardware (typically only ROP does the conversion for free). +// To "correct" the linear segment, would be to introduce error, because hardware decode of sRGB->linear is fixed (and free). +// So this header keeps with the spec. +// For linear->sRGB transforms, the linear segment in some respects reduces error, because rounding in that region is linear. +// Rounding in the curved region in hardware (and fast software code) introduces error due to rounding in non-linear. +//------------------------------------------------------------------------------------------------------------------------------ +// FOR PQ +// ====== +// Both input and output is {0.0-1.0}, and where output 1.0 represents 10000.0 cd/m^2. +// All constants are only specified to FP32 precision. +// External PQ source reference, +// - https://github.com/ampas/aces-dev/blob/master/transforms/ctl/utilities/ACESlib.Utilities_Color.a1.0.1.ctl +//------------------------------------------------------------------------------------------------------------------------------ +// PACKED VERSIONS +// =============== +// These are the A*H2() functions. +// There is no PQ functions as FP16 seemed to not have enough precision for the conversion. +// The remaining functions are "good enough" for 8-bit, and maybe 10-bit if not concerned about a few 1-bit errors. +// Precision is lowest in the 709 conversion, higher in sRGB, higher still in Two and Gamma (when using 2.2 at least). +//------------------------------------------------------------------------------------------------------------------------------ +// NOTES +// ===== +// Could be faster for PQ conversions to be in ALU or a texture lookup depending on usage case. +//============================================================================================================================== + #if 1 + AF1 ATo709F1(AF1 c){AF3 j=AF3(0.018*4.5,4.5,0.45);AF2 k=AF2(1.099,-0.099); + return clamp(j.x ,c*j.y ,pow(c,j.z )*k.x +k.y );} + AF2 ATo709F2(AF2 c){AF3 j=AF3(0.018*4.5,4.5,0.45);AF2 k=AF2(1.099,-0.099); + return clamp(j.xx ,c*j.yy ,pow(c,j.zz )*k.xx +k.yy );} + AF3 ATo709F3(AF3 c){AF3 j=AF3(0.018*4.5,4.5,0.45);AF2 k=AF2(1.099,-0.099); + return clamp(j.xxx,c*j.yyy,pow(c,j.zzz)*k.xxx+k.yyy);} +//------------------------------------------------------------------------------------------------------------------------------ + // Note 'rcpX' is '1/x', where the 'x' is what would be used in AFromGamma(). + AF1 AToGammaF1(AF1 c,AF1 rcpX){return pow(c,AF1_(rcpX));} + AF2 AToGammaF2(AF2 c,AF1 rcpX){return pow(c,AF2_(rcpX));} + AF3 AToGammaF3(AF3 c,AF1 rcpX){return pow(c,AF3_(rcpX));} +//------------------------------------------------------------------------------------------------------------------------------ + AF1 AToPqF1(AF1 x){AF1 p=pow(x,AF1_(0.159302)); + return pow((AF1_(0.835938)+AF1_(18.8516)*p)/(AF1_(1.0)+AF1_(18.6875)*p),AF1_(78.8438));} + AF2 AToPqF1(AF2 x){AF2 p=pow(x,AF2_(0.159302)); + return pow((AF2_(0.835938)+AF2_(18.8516)*p)/(AF2_(1.0)+AF2_(18.6875)*p),AF2_(78.8438));} + AF3 AToPqF1(AF3 x){AF3 p=pow(x,AF3_(0.159302)); + return pow((AF3_(0.835938)+AF3_(18.8516)*p)/(AF3_(1.0)+AF3_(18.6875)*p),AF3_(78.8438));} +//------------------------------------------------------------------------------------------------------------------------------ + AF1 AToSrgbF1(AF1 c){AF3 j=AF3(0.0031308*12.92,12.92,1.0/2.4);AF2 k=AF2(1.055,-0.055); + return clamp(j.x ,c*j.y ,pow(c,j.z )*k.x +k.y );} + AF2 AToSrgbF2(AF2 c){AF3 j=AF3(0.0031308*12.92,12.92,1.0/2.4);AF2 k=AF2(1.055,-0.055); + return clamp(j.xx ,c*j.yy ,pow(c,j.zz )*k.xx +k.yy );} + AF3 AToSrgbF3(AF3 c){AF3 j=AF3(0.0031308*12.92,12.92,1.0/2.4);AF2 k=AF2(1.055,-0.055); + return clamp(j.xxx,c*j.yyy,pow(c,j.zzz)*k.xxx+k.yyy);} +//------------------------------------------------------------------------------------------------------------------------------ + AF1 AToTwoF1(AF1 c){return sqrt(c);} + AF2 AToTwoF2(AF2 c){return sqrt(c);} + AF3 AToTwoF3(AF3 c){return sqrt(c);} +//------------------------------------------------------------------------------------------------------------------------------ + AF1 AToThreeF1(AF1 c){return pow(c,AF1_(1.0/3.0));} + AF2 AToThreeF2(AF2 c){return pow(c,AF2_(1.0/3.0));} + AF3 AToThreeF3(AF3 c){return pow(c,AF3_(1.0/3.0));} + #endif +//============================================================================================================================== + #if 1 + // Unfortunately median won't work here. + AF1 AFrom709F1(AF1 c){AF3 j=AF3(0.081/4.5,1.0/4.5,1.0/0.45);AF2 k=AF2(1.0/1.099,0.099/1.099); + return AZolSelF1(AZolSignedF1(c-j.x ),c*j.y ,pow(c*k.x +k.y ,j.z ));} + AF2 AFrom709F2(AF2 c){AF3 j=AF3(0.081/4.5,1.0/4.5,1.0/0.45);AF2 k=AF2(1.0/1.099,0.099/1.099); + return AZolSelF2(AZolSignedF2(c-j.xx ),c*j.yy ,pow(c*k.xx +k.yy ,j.zz ));} + AF3 AFrom709F3(AF3 c){AF3 j=AF3(0.081/4.5,1.0/4.5,1.0/0.45);AF2 k=AF2(1.0/1.099,0.099/1.099); + return AZolSelF3(AZolSignedF3(c-j.xxx),c*j.yyy,pow(c*k.xxx+k.yyy,j.zzz));} +//------------------------------------------------------------------------------------------------------------------------------ + AF1 AFromGammaF1(AF1 c,AF1 x){return pow(c,AF1_(x));} + AF2 AFromGammaF2(AF2 c,AF1 x){return pow(c,AF2_(x));} + AF3 AFromGammaF3(AF3 c,AF1 x){return pow(c,AF3_(x));} +//------------------------------------------------------------------------------------------------------------------------------ + AF1 AFromPqF1(AF1 x){AF1 p=pow(x,AF1_(0.0126833)); + return pow(ASatF1(p-AF1_(0.835938))/(AF1_(18.8516)-AF1_(18.6875)*p),AF1_(6.27739));} + AF2 AFromPqF1(AF2 x){AF2 p=pow(x,AF2_(0.0126833)); + return pow(ASatF2(p-AF2_(0.835938))/(AF2_(18.8516)-AF2_(18.6875)*p),AF2_(6.27739));} + AF3 AFromPqF1(AF3 x){AF3 p=pow(x,AF3_(0.0126833)); + return pow(ASatF3(p-AF3_(0.835938))/(AF3_(18.8516)-AF3_(18.6875)*p),AF3_(6.27739));} +//------------------------------------------------------------------------------------------------------------------------------ + // Unfortunately median won't work here. + AF1 AFromSrgbF1(AF1 c){AF3 j=AF3(0.04045/12.92,1.0/12.92,2.4);AF2 k=AF2(1.0/1.055,0.055/1.055); + return AZolSelF1(AZolSignedF1(c-j.x ),c*j.y ,pow(c*k.x +k.y ,j.z ));} + AF2 AFromSrgbF2(AF2 c){AF3 j=AF3(0.04045/12.92,1.0/12.92,2.4);AF2 k=AF2(1.0/1.055,0.055/1.055); + return AZolSelF2(AZolSignedF2(c-j.xx ),c*j.yy ,pow(c*k.xx +k.yy ,j.zz ));} + AF3 AFromSrgbF3(AF3 c){AF3 j=AF3(0.04045/12.92,1.0/12.92,2.4);AF2 k=AF2(1.0/1.055,0.055/1.055); + return AZolSelF3(AZolSignedF3(c-j.xxx),c*j.yyy,pow(c*k.xxx+k.yyy,j.zzz));} +//------------------------------------------------------------------------------------------------------------------------------ + AF1 AFromTwoF1(AF1 c){return c*c;} + AF2 AFromTwoF2(AF2 c){return c*c;} + AF3 AFromTwoF3(AF3 c){return c*c;} +//------------------------------------------------------------------------------------------------------------------------------ + AF1 AFromThreeF1(AF1 c){return c*c*c;} + AF2 AFromThreeF2(AF2 c){return c*c*c;} + AF3 AFromThreeF3(AF3 c){return c*c*c;} + #endif +//============================================================================================================================== + #ifdef A_HALF + AH1 ATo709H1(AH1 c){AH3 j=AH3(0.018*4.5,4.5,0.45);AH2 k=AH2(1.099,-0.099); + return clamp(j.x ,c*j.y ,pow(c,j.z )*k.x +k.y );} + AH2 ATo709H2(AH2 c){AH3 j=AH3(0.018*4.5,4.5,0.45);AH2 k=AH2(1.099,-0.099); + return clamp(j.xx ,c*j.yy ,pow(c,j.zz )*k.xx +k.yy );} + AH3 ATo709H3(AH3 c){AH3 j=AH3(0.018*4.5,4.5,0.45);AH2 k=AH2(1.099,-0.099); + return clamp(j.xxx,c*j.yyy,pow(c,j.zzz)*k.xxx+k.yyy);} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 AToGammaH1(AH1 c,AH1 rcpX){return pow(c,AH1_(rcpX));} + AH2 AToGammaH2(AH2 c,AH1 rcpX){return pow(c,AH2_(rcpX));} + AH3 AToGammaH3(AH3 c,AH1 rcpX){return pow(c,AH3_(rcpX));} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 AToSrgbH1(AH1 c){AH3 j=AH3(0.0031308*12.92,12.92,1.0/2.4);AH2 k=AH2(1.055,-0.055); + return clamp(j.x ,c*j.y ,pow(c,j.z )*k.x +k.y );} + AH2 AToSrgbH2(AH2 c){AH3 j=AH3(0.0031308*12.92,12.92,1.0/2.4);AH2 k=AH2(1.055,-0.055); + return clamp(j.xx ,c*j.yy ,pow(c,j.zz )*k.xx +k.yy );} + AH3 AToSrgbH3(AH3 c){AH3 j=AH3(0.0031308*12.92,12.92,1.0/2.4);AH2 k=AH2(1.055,-0.055); + return clamp(j.xxx,c*j.yyy,pow(c,j.zzz)*k.xxx+k.yyy);} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 AToTwoH1(AH1 c){return sqrt(c);} + AH2 AToTwoH2(AH2 c){return sqrt(c);} + AH3 AToTwoH3(AH3 c){return sqrt(c);} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 AToThreeF1(AH1 c){return pow(c,AH1_(1.0/3.0));} + AH2 AToThreeF2(AH2 c){return pow(c,AH2_(1.0/3.0));} + AH3 AToThreeF3(AH3 c){return pow(c,AH3_(1.0/3.0));} + #endif +//============================================================================================================================== + #ifdef A_HALF + AH1 AFrom709H1(AH1 c){AH3 j=AH3(0.081/4.5,1.0/4.5,1.0/0.45);AH2 k=AH2(1.0/1.099,0.099/1.099); + return AZolSelH1(AZolSignedH1(c-j.x ),c*j.y ,pow(c*k.x +k.y ,j.z ));} + AH2 AFrom709H2(AH2 c){AH3 j=AH3(0.081/4.5,1.0/4.5,1.0/0.45);AH2 k=AH2(1.0/1.099,0.099/1.099); + return AZolSelH2(AZolSignedH2(c-j.xx ),c*j.yy ,pow(c*k.xx +k.yy ,j.zz ));} + AH3 AFrom709H3(AH3 c){AH3 j=AH3(0.081/4.5,1.0/4.5,1.0/0.45);AH2 k=AH2(1.0/1.099,0.099/1.099); + return AZolSelH3(AZolSignedH3(c-j.xxx),c*j.yyy,pow(c*k.xxx+k.yyy,j.zzz));} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 AFromGammaH1(AH1 c,AH1 x){return pow(c,AH1_(x));} + AH2 AFromGammaH2(AH2 c,AH1 x){return pow(c,AH2_(x));} + AH3 AFromGammaH3(AH3 c,AH1 x){return pow(c,AH3_(x));} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 AHromSrgbF1(AH1 c){AH3 j=AH3(0.04045/12.92,1.0/12.92,2.4);AH2 k=AH2(1.0/1.055,0.055/1.055); + return AZolSelH1(AZolSignedH1(c-j.x ),c*j.y ,pow(c*k.x +k.y ,j.z ));} + AH2 AHromSrgbF2(AH2 c){AH3 j=AH3(0.04045/12.92,1.0/12.92,2.4);AH2 k=AH2(1.0/1.055,0.055/1.055); + return AZolSelH2(AZolSignedH2(c-j.xx ),c*j.yy ,pow(c*k.xx +k.yy ,j.zz ));} + AH3 AHromSrgbF3(AH3 c){AH3 j=AH3(0.04045/12.92,1.0/12.92,2.4);AH2 k=AH2(1.0/1.055,0.055/1.055); + return AZolSelH3(AZolSignedH3(c-j.xxx),c*j.yyy,pow(c*k.xxx+k.yyy,j.zzz));} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 AFromTwoH1(AH1 c){return c*c;} + AH2 AFromTwoH2(AH2 c){return c*c;} + AH3 AFromTwoH3(AH3 c){return c*c;} +//------------------------------------------------------------------------------------------------------------------------------ + AH1 AFromThreeH1(AH1 c){return c*c*c;} + AH2 AFromThreeH2(AH2 c){return c*c*c;} + AH3 AFromThreeH3(AH3 c){return c*c*c;} + #endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// CS REMAP +//============================================================================================================================== + // Simple remap 64x1 to 8x8 with rotated 2x2 pixel quads in quad linear. + // 543210 + // ====== + // ..xxx. + // yy...y + AU2 ARmp8x8(AU1 a){return AU2(ABfe(a,1u,3u),ABfiM(ABfe(a,3u,3u),a,1u));} +//============================================================================================================================== + // More complex remap 64x1 to 8x8 which is necessary for 2D wave reductions. + // 543210 + // ====== + // .xx..x + // y..yy. + // Details, + // LANE TO 8x8 MAPPING + // =================== + // 00 01 08 09 10 11 18 19 + // 02 03 0a 0b 12 13 1a 1b + // 04 05 0c 0d 14 15 1c 1d + // 06 07 0e 0f 16 17 1e 1f + // 20 21 28 29 30 31 38 39 + // 22 23 2a 2b 32 33 3a 3b + // 24 25 2c 2d 34 35 3c 3d + // 26 27 2e 2f 36 37 3e 3f + AU2 ARmpRed8x8(AU1 a){return AU2(ABfiM(ABfe(a,2u,3u),a,1u),ABfiM(ABfe(a,3u,3u),ABfe(a,1u,2u),2u));} +//============================================================================================================================== + #ifdef A_HALF + AW2 ARmp8x8H(AU1 a){return AW2(ABfe(a,1u,3u),ABfiM(ABfe(a,3u,3u),a,1u));} + AW2 ARmpRed8x8H(AU1 a){return AW2(ABfiM(ABfe(a,2u,3u),a,1u),ABfiM(ABfe(a,3u,3u),ABfe(a,1u,2u),2u));} + #endif +#endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// +// REFERENCE +// +//------------------------------------------------------------------------------------------------------------------------------ +// IEEE FLOAT RULES +// ================ +// - saturate(NaN)=0, saturate(-INF)=0, saturate(+INF)=1 +// - {+/-}0 * {+/-}INF = NaN +// - -INF + (+INF) = NaN +// - {+/-}0 / {+/-}0 = NaN +// - {+/-}INF / {+/-}INF = NaN +// - a<(-0) := sqrt(a) = NaN (a=-0.0 won't NaN) +// - 0 == -0 +// - 4/0 = +INF +// - 4/-0 = -INF +// - 4+INF = +INF +// - 4-INF = -INF +// - 4*(+INF) = +INF +// - 4*(-INF) = -INF +// - -4*(+INF) = -INF +// - sqrt(+INF) = +INF +//------------------------------------------------------------------------------------------------------------------------------ +// FP16 ENCODING +// ============= +// fedcba9876543210 +// ---------------- +// ......mmmmmmmmmm 10-bit mantissa (encodes 11-bit 0.5 to 1.0 except for denormals) +// .eeeee.......... 5-bit exponent +// .00000.......... denormals +// .00001.......... -14 exponent +// .11110.......... 15 exponent +// .111110000000000 infinity +// .11111nnnnnnnnnn NaN with n!=0 +// s............... sign +//------------------------------------------------------------------------------------------------------------------------------ +// FP16/INT16 ALIASING DENORMAL +// ============================ +// 11-bit unsigned integers alias with half float denormal/normal values, +// 1 = 2^(-24) = 1/16777216 ....................... first denormal value +// 2 = 2^(-23) +// ... +// 1023 = 2^(-14)*(1-2^(-10)) = 2^(-14)*(1-1/1024) ... last denormal value +// 1024 = 2^(-14) = 1/16384 .......................... first normal value that still maps to integers +// 2047 .............................................. last normal value that still maps to integers +// Scaling limits, +// 2^15 = 32768 ...................................... largest power of 2 scaling +// Largest pow2 conversion mapping is at *32768, +// 1 : 2^(-9) = 1/512 +// 2 : 1/256 +// 4 : 1/128 +// 8 : 1/64 +// 16 : 1/32 +// 32 : 1/16 +// 64 : 1/8 +// 128 : 1/4 +// 256 : 1/2 +// 512 : 1 +// 1024 : 2 +// 2047 : a little less than 4 +//============================================================================================================================== +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// +// +// GPU/CPU PORTABILITY +// +// +//------------------------------------------------------------------------------------------------------------------------------ +// This is the GPU implementation. +// See the CPU implementation for docs. +//============================================================================================================================== +#ifdef A_GPU + #define A_TRUE true + #define A_FALSE false + #define A_STATIC +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// VECTOR ARGUMENT/RETURN/INITIALIZATION PORTABILITY +//============================================================================================================================== + #define retAD2 AD2 + #define retAD3 AD3 + #define retAD4 AD4 + #define retAF2 AF2 + #define retAF3 AF3 + #define retAF4 AF4 + #define retAL2 AL2 + #define retAL3 AL3 + #define retAL4 AL4 + #define retAU2 AU2 + #define retAU3 AU3 + #define retAU4 AU4 +//------------------------------------------------------------------------------------------------------------------------------ + #define inAD2 in AD2 + #define inAD3 in AD3 + #define inAD4 in AD4 + #define inAF2 in AF2 + #define inAF3 in AF3 + #define inAF4 in AF4 + #define inAL2 in AL2 + #define inAL3 in AL3 + #define inAL4 in AL4 + #define inAU2 in AU2 + #define inAU3 in AU3 + #define inAU4 in AU4 +//------------------------------------------------------------------------------------------------------------------------------ + #define inoutAD2 inout AD2 + #define inoutAD3 inout AD3 + #define inoutAD4 inout AD4 + #define inoutAF2 inout AF2 + #define inoutAF3 inout AF3 + #define inoutAF4 inout AF4 + #define inoutAL2 inout AL2 + #define inoutAL3 inout AL3 + #define inoutAL4 inout AL4 + #define inoutAU2 inout AU2 + #define inoutAU3 inout AU3 + #define inoutAU4 inout AU4 +//------------------------------------------------------------------------------------------------------------------------------ + #define outAD2 out AD2 + #define outAD3 out AD3 + #define outAD4 out AD4 + #define outAF2 out AF2 + #define outAF3 out AF3 + #define outAF4 out AF4 + #define outAL2 out AL2 + #define outAL3 out AL3 + #define outAL4 out AL4 + #define outAU2 out AU2 + #define outAU3 out AU3 + #define outAU4 out AU4 +//------------------------------------------------------------------------------------------------------------------------------ + #define varAD2(x) AD2 x + #define varAD3(x) AD3 x + #define varAD4(x) AD4 x + #define varAF2(x) AF2 x + #define varAF3(x) AF3 x + #define varAF4(x) AF4 x + #define varAL2(x) AL2 x + #define varAL3(x) AL3 x + #define varAL4(x) AL4 x + #define varAU2(x) AU2 x + #define varAU3(x) AU3 x + #define varAU4(x) AU4 x +//------------------------------------------------------------------------------------------------------------------------------ + #define initAD2(x,y) AD2(x,y) + #define initAD3(x,y,z) AD3(x,y,z) + #define initAD4(x,y,z,w) AD4(x,y,z,w) + #define initAF2(x,y) AF2(x,y) + #define initAF3(x,y,z) AF3(x,y,z) + #define initAF4(x,y,z,w) AF4(x,y,z,w) + #define initAL2(x,y) AL2(x,y) + #define initAL3(x,y,z) AL3(x,y,z) + #define initAL4(x,y,z,w) AL4(x,y,z,w) + #define initAU2(x,y) AU2(x,y) + #define initAU3(x,y,z) AU3(x,y,z) + #define initAU4(x,y,z,w) AU4(x,y,z,w) +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// SCALAR RETURN OPS +//============================================================================================================================== + #define AAbsD1(a) abs(AD1(a)) + #define AAbsF1(a) abs(AF1(a)) +//------------------------------------------------------------------------------------------------------------------------------ + #define ACosD1(a) cos(AD1(a)) + #define ACosF1(a) cos(AF1(a)) +//------------------------------------------------------------------------------------------------------------------------------ + #define ADotD2(a,b) dot(AD2(a),AD2(b)) + #define ADotD3(a,b) dot(AD3(a),AD3(b)) + #define ADotD4(a,b) dot(AD4(a),AD4(b)) + #define ADotF2(a,b) dot(AF2(a),AF2(b)) + #define ADotF3(a,b) dot(AF3(a),AF3(b)) + #define ADotF4(a,b) dot(AF4(a),AF4(b)) +//------------------------------------------------------------------------------------------------------------------------------ + #define AExp2D1(a) exp2(AD1(a)) + #define AExp2F1(a) exp2(AF1(a)) +//------------------------------------------------------------------------------------------------------------------------------ + #define AFloorD1(a) floor(AD1(a)) + #define AFloorF1(a) floor(AF1(a)) +//------------------------------------------------------------------------------------------------------------------------------ + #define ALog2D1(a) log2(AD1(a)) + #define ALog2F1(a) log2(AF1(a)) +//------------------------------------------------------------------------------------------------------------------------------ + #define AMaxD1(a,b) max(a,b) + #define AMaxF1(a,b) max(a,b) + #define AMaxL1(a,b) max(a,b) + #define AMaxU1(a,b) max(a,b) +//------------------------------------------------------------------------------------------------------------------------------ + #define AMinD1(a,b) min(a,b) + #define AMinF1(a,b) min(a,b) + #define AMinL1(a,b) min(a,b) + #define AMinU1(a,b) min(a,b) +//------------------------------------------------------------------------------------------------------------------------------ + #define ASinD1(a) sin(AD1(a)) + #define ASinF1(a) sin(AF1(a)) +//------------------------------------------------------------------------------------------------------------------------------ + #define ASqrtD1(a) sqrt(AD1(a)) + #define ASqrtF1(a) sqrt(AF1(a)) +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// SCALAR RETURN OPS - DEPENDENT +//============================================================================================================================== + #define APowD1(a,b) pow(AD1(a),AF1(b)) + #define APowF1(a,b) pow(AF1(a),AF1(b)) +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// VECTOR OPS +//------------------------------------------------------------------------------------------------------------------------------ +// These are added as needed for production or prototyping, so not necessarily a complete set. +// They follow a convention of taking in a destination and also returning the destination value to increase utility. +//============================================================================================================================== + #ifdef A_DUBL + AD2 opAAbsD2(outAD2 d,inAD2 a){d=abs(a);return d;} + AD3 opAAbsD3(outAD3 d,inAD3 a){d=abs(a);return d;} + AD4 opAAbsD4(outAD4 d,inAD4 a){d=abs(a);return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AD2 opAAddD2(outAD2 d,inAD2 a,inAD2 b){d=a+b;return d;} + AD3 opAAddD3(outAD3 d,inAD3 a,inAD3 b){d=a+b;return d;} + AD4 opAAddD4(outAD4 d,inAD4 a,inAD4 b){d=a+b;return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AD2 opAAddOneD2(outAD2 d,inAD2 a,AD1 b){d=a+AD2_(b);return d;} + AD3 opAAddOneD3(outAD3 d,inAD3 a,AD1 b){d=a+AD3_(b);return d;} + AD4 opAAddOneD4(outAD4 d,inAD4 a,AD1 b){d=a+AD4_(b);return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AD2 opACpyD2(outAD2 d,inAD2 a){d=a;return d;} + AD3 opACpyD3(outAD3 d,inAD3 a){d=a;return d;} + AD4 opACpyD4(outAD4 d,inAD4 a){d=a;return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AD2 opALerpD2(outAD2 d,inAD2 a,inAD2 b,inAD2 c){d=ALerpD2(a,b,c);return d;} + AD3 opALerpD3(outAD3 d,inAD3 a,inAD3 b,inAD3 c){d=ALerpD3(a,b,c);return d;} + AD4 opALerpD4(outAD4 d,inAD4 a,inAD4 b,inAD4 c){d=ALerpD4(a,b,c);return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AD2 opALerpOneD2(outAD2 d,inAD2 a,inAD2 b,AD1 c){d=ALerpD2(a,b,AD2_(c));return d;} + AD3 opALerpOneD3(outAD3 d,inAD3 a,inAD3 b,AD1 c){d=ALerpD3(a,b,AD3_(c));return d;} + AD4 opALerpOneD4(outAD4 d,inAD4 a,inAD4 b,AD1 c){d=ALerpD4(a,b,AD4_(c));return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AD2 opAMaxD2(outAD2 d,inAD2 a,inAD2 b){d=max(a,b);return d;} + AD3 opAMaxD3(outAD3 d,inAD3 a,inAD3 b){d=max(a,b);return d;} + AD4 opAMaxD4(outAD4 d,inAD4 a,inAD4 b){d=max(a,b);return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AD2 opAMinD2(outAD2 d,inAD2 a,inAD2 b){d=min(a,b);return d;} + AD3 opAMinD3(outAD3 d,inAD3 a,inAD3 b){d=min(a,b);return d;} + AD4 opAMinD4(outAD4 d,inAD4 a,inAD4 b){d=min(a,b);return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AD2 opAMulD2(outAD2 d,inAD2 a,inAD2 b){d=a*b;return d;} + AD3 opAMulD3(outAD3 d,inAD3 a,inAD3 b){d=a*b;return d;} + AD4 opAMulD4(outAD4 d,inAD4 a,inAD4 b){d=a*b;return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AD2 opAMulOneD2(outAD2 d,inAD2 a,AD1 b){d=a*AD2_(b);return d;} + AD3 opAMulOneD3(outAD3 d,inAD3 a,AD1 b){d=a*AD3_(b);return d;} + AD4 opAMulOneD4(outAD4 d,inAD4 a,AD1 b){d=a*AD4_(b);return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AD2 opANegD2(outAD2 d,inAD2 a){d=-a;return d;} + AD3 opANegD3(outAD3 d,inAD3 a){d=-a;return d;} + AD4 opANegD4(outAD4 d,inAD4 a){d=-a;return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AD2 opARcpD2(outAD2 d,inAD2 a){d=ARcpD2(a);return d;} + AD3 opARcpD3(outAD3 d,inAD3 a){d=ARcpD3(a);return d;} + AD4 opARcpD4(outAD4 d,inAD4 a){d=ARcpD4(a);return d;} + #endif +//============================================================================================================================== + AF2 opAAbsF2(outAF2 d,inAF2 a){d=abs(a);return d;} + AF3 opAAbsF3(outAF3 d,inAF3 a){d=abs(a);return d;} + AF4 opAAbsF4(outAF4 d,inAF4 a){d=abs(a);return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AF2 opAAddF2(outAF2 d,inAF2 a,inAF2 b){d=a+b;return d;} + AF3 opAAddF3(outAF3 d,inAF3 a,inAF3 b){d=a+b;return d;} + AF4 opAAddF4(outAF4 d,inAF4 a,inAF4 b){d=a+b;return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AF2 opAAddOneF2(outAF2 d,inAF2 a,AF1 b){d=a+AF2_(b);return d;} + AF3 opAAddOneF3(outAF3 d,inAF3 a,AF1 b){d=a+AF3_(b);return d;} + AF4 opAAddOneF4(outAF4 d,inAF4 a,AF1 b){d=a+AF4_(b);return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AF2 opACpyF2(outAF2 d,inAF2 a){d=a;return d;} + AF3 opACpyF3(outAF3 d,inAF3 a){d=a;return d;} + AF4 opACpyF4(outAF4 d,inAF4 a){d=a;return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AF2 opALerpF2(outAF2 d,inAF2 a,inAF2 b,inAF2 c){d=ALerpF2(a,b,c);return d;} + AF3 opALerpF3(outAF3 d,inAF3 a,inAF3 b,inAF3 c){d=ALerpF3(a,b,c);return d;} + AF4 opALerpF4(outAF4 d,inAF4 a,inAF4 b,inAF4 c){d=ALerpF4(a,b,c);return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AF2 opALerpOneF2(outAF2 d,inAF2 a,inAF2 b,AF1 c){d=ALerpF2(a,b,AF2_(c));return d;} + AF3 opALerpOneF3(outAF3 d,inAF3 a,inAF3 b,AF1 c){d=ALerpF3(a,b,AF3_(c));return d;} + AF4 opALerpOneF4(outAF4 d,inAF4 a,inAF4 b,AF1 c){d=ALerpF4(a,b,AF4_(c));return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AF2 opAMaxF2(outAF2 d,inAF2 a,inAF2 b){d=max(a,b);return d;} + AF3 opAMaxF3(outAF3 d,inAF3 a,inAF3 b){d=max(a,b);return d;} + AF4 opAMaxF4(outAF4 d,inAF4 a,inAF4 b){d=max(a,b);return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AF2 opAMinF2(outAF2 d,inAF2 a,inAF2 b){d=min(a,b);return d;} + AF3 opAMinF3(outAF3 d,inAF3 a,inAF3 b){d=min(a,b);return d;} + AF4 opAMinF4(outAF4 d,inAF4 a,inAF4 b){d=min(a,b);return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AF2 opAMulF2(outAF2 d,inAF2 a,inAF2 b){d=a*b;return d;} + AF3 opAMulF3(outAF3 d,inAF3 a,inAF3 b){d=a*b;return d;} + AF4 opAMulF4(outAF4 d,inAF4 a,inAF4 b){d=a*b;return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AF2 opAMulOneF2(outAF2 d,inAF2 a,AF1 b){d=a*AF2_(b);return d;} + AF3 opAMulOneF3(outAF3 d,inAF3 a,AF1 b){d=a*AF3_(b);return d;} + AF4 opAMulOneF4(outAF4 d,inAF4 a,AF1 b){d=a*AF4_(b);return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AF2 opANegF2(outAF2 d,inAF2 a){d=-a;return d;} + AF3 opANegF3(outAF3 d,inAF3 a){d=-a;return d;} + AF4 opANegF4(outAF4 d,inAF4 a){d=-a;return d;} +//------------------------------------------------------------------------------------------------------------------------------ + AF2 opARcpF2(outAF2 d,inAF2 a){d=ARcpF2(a);return d;} + AF3 opARcpF3(outAF3 d,inAF3 a){d=ARcpF3(a);return d;} + AF4 opARcpF4(outAF4 d,inAF4 a){d=ARcpF4(a);return d;} +#endif diff --git a/src/refresh/vkpt/fsr/ffx_fsr1.h b/src/refresh/vkpt/fsr/ffx_fsr1.h new file mode 100644 index 000000000..15ecfde5c --- /dev/null +++ b/src/refresh/vkpt/fsr/ffx_fsr1.h @@ -0,0 +1,1199 @@ +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// +// +// AMD FidelityFX SUPER RESOLUTION [FSR 1] ::: SPATIAL SCALING & EXTRAS - v1.20210629 +// +// +//------------------------------------------------------------------------------------------------------------------------------ +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//------------------------------------------------------------------------------------------------------------------------------ +// FidelityFX Super Resolution Sample +// +// Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +//------------------------------------------------------------------------------------------------------------------------------ +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//------------------------------------------------------------------------------------------------------------------------------ +// ABOUT +// ===== +// FSR is a collection of algorithms relating to generating a higher resolution image. +// This specific header focuses on single-image non-temporal image scaling, and related tools. +// +// The core functions are EASU and RCAS: +// [EASU] Edge Adaptive Spatial Upsampling ....... 1x to 4x area range spatial scaling, clamped adaptive elliptical filter. +// [RCAS] Robust Contrast Adaptive Sharpening .... A non-scaling variation on CAS. +// RCAS needs to be applied after EASU as a separate pass. +// +// Optional utility functions are: +// [LFGA] Linear Film Grain Applicator ........... Tool to apply film grain after scaling. +// [SRTM] Simple Reversible Tone-Mapper .......... Linear HDR {0 to FP16_MAX} to {0 to 1} and back. +// [TEPD] Temporal Energy Preserving Dither ...... Temporally energy preserving dithered {0 to 1} linear to gamma 2.0 conversion. +// See each individual sub-section for inline documentation. +//------------------------------------------------------------------------------------------------------------------------------ +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//------------------------------------------------------------------------------------------------------------------------------ +// FUNCTION PERMUTATIONS +// ===================== +// *F() ..... Single item computation with 32-bit. +// *H() ..... Single item computation with 16-bit, with packing (aka two 16-bit ops in parallel) when possible. +// *Hx2() ... Processing two items in parallel with 16-bit, easier packing. +// Not all interfaces in this file have a *Hx2() form. +//============================================================================================================================== +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// +// FSR - [EASU] EDGE ADAPTIVE SPATIAL UPSAMPLING +// +//------------------------------------------------------------------------------------------------------------------------------ +// EASU provides a high quality spatial-only scaling at relatively low cost. +// Meaning EASU is appropiate for laptops and other low-end GPUs. +// Quality from 1x to 4x area scaling is good. +//------------------------------------------------------------------------------------------------------------------------------ +// The scalar uses a modified fast approximation to the standard lanczos(size=2) kernel. +// EASU runs in a single pass, so it applies a directionally and anisotropically adaptive radial lanczos. +// This is also kept as simple as possible to have minimum runtime. +//------------------------------------------------------------------------------------------------------------------------------ +// The lanzcos filter has negative lobes, so by itself it will introduce ringing. +// To remove all ringing, the algorithm uses the nearest 2x2 input texels as a neighborhood, +// and limits output to the minimum and maximum of that neighborhood. +//------------------------------------------------------------------------------------------------------------------------------ +// Input image requirements: +// +// Color needs to be encoded as 3 channel[red, green, blue](e.g.XYZ not supported) +// Each channel needs to be in the range[0, 1] +// Any color primaries are supported +// Display / tonemapping curve needs to be as if presenting to sRGB display or similar(e.g.Gamma 2.0) +// There should be no banding in the input +// There should be no high amplitude noise in the input +// There should be no noise in the input that is not at input pixel granularity +// For performance purposes, use 32bpp formats +//------------------------------------------------------------------------------------------------------------------------------ +// Best to apply EASU at the end of the frame after tonemapping +// but before film grain or composite of the UI. +//------------------------------------------------------------------------------------------------------------------------------ +// Example of including this header for D3D HLSL : +// +// #define A_GPU 1 +// #define A_HLSL 1 +// #define A_HALF 1 +// #include "ffx_a.h" +// #define FSR_EASU_H 1 +// #define FSR_RCAS_H 1 +// //declare input callbacks +// #include "ffx_fsr1.h" +// +// Example of including this header for Vulkan GLSL : +// +// #define A_GPU 1 +// #define A_GLSL 1 +// #define A_HALF 1 +// #include "ffx_a.h" +// #define FSR_EASU_H 1 +// #define FSR_RCAS_H 1 +// //declare input callbacks +// #include "ffx_fsr1.h" +// +// Example of including this header for Vulkan HLSL : +// +// #define A_GPU 1 +// #define A_HLSL 1 +// #define A_HLSL_6_2 1 +// #define A_NO_16_BIT_CAST 1 +// #define A_HALF 1 +// #include "ffx_a.h" +// #define FSR_EASU_H 1 +// #define FSR_RCAS_H 1 +// //declare input callbacks +// #include "ffx_fsr1.h" +// +// Example of declaring the required input callbacks for GLSL : +// The callbacks need to gather4 for each color channel using the specified texture coordinate 'p'. +// EASU uses gather4 to reduce position computation logic and for free Arrays of Structures to Structures of Arrays conversion. +// +// AH4 FsrEasuRH(AF2 p){return AH4(textureGather(sampler2D(tex,sam),p,0));} +// AH4 FsrEasuGH(AF2 p){return AH4(textureGather(sampler2D(tex,sam),p,1));} +// AH4 FsrEasuBH(AF2 p){return AH4(textureGather(sampler2D(tex,sam),p,2));} +// ... +// The FsrEasuCon function needs to be called from the CPU or GPU to set up constants. +// The difference in viewport and input image size is there to support Dynamic Resolution Scaling. +// To use FsrEasuCon() on the CPU, define A_CPU before including ffx_a and ffx_fsr1. +// Including a GPU example here, the 'con0' through 'con3' values would be stored out to a constant buffer. +// AU4 con0,con1,con2,con3; +// FsrEasuCon(con0,con1,con2,con3, +// 1920.0,1080.0, // Viewport size (top left aligned) in the input image which is to be scaled. +// 3840.0,2160.0, // The size of the input image. +// 2560.0,1440.0); // The output resolution. +//============================================================================================================================== +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// CONSTANT SETUP +//============================================================================================================================== +// Call to setup required constant values (works on CPU or GPU). +A_STATIC void FsrEasuCon( +outAU4 con0, +outAU4 con1, +outAU4 con2, +outAU4 con3, +// This the rendered image resolution being upscaled +AF1 inputViewportInPixelsX, +AF1 inputViewportInPixelsY, +// This is the resolution of the resource containing the input image (useful for dynamic resolution) +AF1 inputSizeInPixelsX, +AF1 inputSizeInPixelsY, +// This is the display resolution which the input image gets upscaled to +AF1 outputSizeInPixelsX, +AF1 outputSizeInPixelsY){ + // Output integer position to a pixel position in viewport. + con0[0]=AU1_AF1(inputViewportInPixelsX*ARcpF1(outputSizeInPixelsX)); + con0[1]=AU1_AF1(inputViewportInPixelsY*ARcpF1(outputSizeInPixelsY)); + con0[2]=AU1_AF1(AF1_(0.5)*inputViewportInPixelsX*ARcpF1(outputSizeInPixelsX)-AF1_(0.5)); + con0[3]=AU1_AF1(AF1_(0.5)*inputViewportInPixelsY*ARcpF1(outputSizeInPixelsY)-AF1_(0.5)); + // Viewport pixel position to normalized image space. + // This is used to get upper-left of 'F' tap. + con1[0]=AU1_AF1(ARcpF1(inputSizeInPixelsX)); + con1[1]=AU1_AF1(ARcpF1(inputSizeInPixelsY)); + // Centers of gather4, first offset from upper-left of 'F'. + // +---+---+ + // | | | + // +--(0)--+ + // | b | c | + // +---F---+---+---+ + // | e | f | g | h | + // +--(1)--+--(2)--+ + // | i | j | k | l | + // +---+---+---+---+ + // | n | o | + // +--(3)--+ + // | | | + // +---+---+ + con1[2]=AU1_AF1(AF1_( 1.0)*ARcpF1(inputSizeInPixelsX)); + con1[3]=AU1_AF1(AF1_(-1.0)*ARcpF1(inputSizeInPixelsY)); + // These are from (0) instead of 'F'. + con2[0]=AU1_AF1(AF1_(-1.0)*ARcpF1(inputSizeInPixelsX)); + con2[1]=AU1_AF1(AF1_( 2.0)*ARcpF1(inputSizeInPixelsY)); + con2[2]=AU1_AF1(AF1_( 1.0)*ARcpF1(inputSizeInPixelsX)); + con2[3]=AU1_AF1(AF1_( 2.0)*ARcpF1(inputSizeInPixelsY)); + con3[0]=AU1_AF1(AF1_( 0.0)*ARcpF1(inputSizeInPixelsX)); + con3[1]=AU1_AF1(AF1_( 4.0)*ARcpF1(inputSizeInPixelsY)); + con3[2]=con3[3]=0;} + +//If the an offset into the input image resource +A_STATIC void FsrEasuConOffset( + outAU4 con0, + outAU4 con1, + outAU4 con2, + outAU4 con3, + // This the rendered image resolution being upscaled + AF1 inputViewportInPixelsX, + AF1 inputViewportInPixelsY, + // This is the resolution of the resource containing the input image (useful for dynamic resolution) + AF1 inputSizeInPixelsX, + AF1 inputSizeInPixelsY, + // This is the display resolution which the input image gets upscaled to + AF1 outputSizeInPixelsX, + AF1 outputSizeInPixelsY, + // This is the input image offset into the resource containing it (useful for dynamic resolution) + AF1 inputOffsetInPixelsX, + AF1 inputOffsetInPixelsY) { + FsrEasuCon(con0, con1, con2, con3, inputViewportInPixelsX, inputViewportInPixelsY, inputSizeInPixelsX, inputSizeInPixelsY, outputSizeInPixelsX, outputSizeInPixelsY); + con0[2] = AU1_AF1(AF1_(0.5) * inputViewportInPixelsX * ARcpF1(outputSizeInPixelsX) - AF1_(0.5) + inputOffsetInPixelsX); + con0[3] = AU1_AF1(AF1_(0.5) * inputViewportInPixelsY * ARcpF1(outputSizeInPixelsY) - AF1_(0.5) + inputOffsetInPixelsY); +} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// NON-PACKED 32-BIT VERSION +//============================================================================================================================== +#if defined(A_GPU)&&defined(FSR_EASU_F) + // Input callback prototypes, need to be implemented by calling shader + AF4 FsrEasuRF(AF2 p); + AF4 FsrEasuGF(AF2 p); + AF4 FsrEasuBF(AF2 p); +//------------------------------------------------------------------------------------------------------------------------------ + // Filtering for a given tap for the scalar. + void FsrEasuTapF( + inout AF3 aC, // Accumulated color, with negative lobe. + inout AF1 aW, // Accumulated weight. + AF2 off, // Pixel offset from resolve position to tap. + AF2 dir, // Gradient direction. + AF2 len, // Length. + AF1 lob, // Negative lobe strength. + AF1 clp, // Clipping point. + AF3 c){ // Tap color. + // Rotate offset by direction. + AF2 v; + v.x=(off.x*( dir.x))+(off.y*dir.y); + v.y=(off.x*(-dir.y))+(off.y*dir.x); + // Anisotropy. + v*=len; + // Compute distance^2. + AF1 d2=v.x*v.x+v.y*v.y; + // Limit to the window as at corner, 2 taps can easily be outside. + d2=min(d2,clp); + // Approximation of lancos2 without sin() or rcp(), or sqrt() to get x. + // (25/16 * (2/5 * x^2 - 1)^2 - (25/16 - 1)) * (1/4 * x^2 - 1)^2 + // |_______________________________________| |_______________| + // base window + // The general form of the 'base' is, + // (a*(b*x^2-1)^2-(a-1)) + // Where 'a=1/(2*b-b^2)' and 'b' moves around the negative lobe. + AF1 wB=AF1_(2.0/5.0)*d2+AF1_(-1.0); + AF1 wA=lob*d2+AF1_(-1.0); + wB*=wB; + wA*=wA; + wB=AF1_(25.0/16.0)*wB+AF1_(-(25.0/16.0-1.0)); + AF1 w=wB*wA; + // Do weighted average. + aC+=c*w;aW+=w;} +//------------------------------------------------------------------------------------------------------------------------------ + // Accumulate direction and length. + void FsrEasuSetF( + inout AF2 dir, + inout AF1 len, + AF2 pp, + AP1 biS,AP1 biT,AP1 biU,AP1 biV, + AF1 lA,AF1 lB,AF1 lC,AF1 lD,AF1 lE){ + // Compute bilinear weight, branches factor out as predicates are compiler time immediates. + // s t + // u v + AF1 w = AF1_(0.0); + if(biS)w=(AF1_(1.0)-pp.x)*(AF1_(1.0)-pp.y); + if(biT)w= pp.x *(AF1_(1.0)-pp.y); + if(biU)w=(AF1_(1.0)-pp.x)* pp.y ; + if(biV)w= pp.x * pp.y ; + // Direction is the '+' diff. + // a + // b c d + // e + // Then takes magnitude from abs average of both sides of 'c'. + // Length converts gradient reversal to 0, smoothly to non-reversal at 1, shaped, then adding horz and vert terms. + AF1 dc=lD-lC; + AF1 cb=lC-lB; + AF1 lenX=max(abs(dc),abs(cb)); + lenX=APrxLoRcpF1(lenX); + AF1 dirX=lD-lB; + dir.x+=dirX*w; + lenX=ASatF1(abs(dirX)*lenX); + lenX*=lenX; + len+=lenX*w; + // Repeat for the y axis. + AF1 ec=lE-lC; + AF1 ca=lC-lA; + AF1 lenY=max(abs(ec),abs(ca)); + lenY=APrxLoRcpF1(lenY); + AF1 dirY=lE-lA; + dir.y+=dirY*w; + lenY=ASatF1(abs(dirY)*lenY); + lenY*=lenY; + len+=lenY*w;} +//------------------------------------------------------------------------------------------------------------------------------ + void FsrEasuF( + out AF3 pix, + AU2 ip, // Integer pixel position in output. + AU4 con0, // Constants generated by FsrEasuCon(). + AU4 con1, + AU4 con2, + AU4 con3){ +//------------------------------------------------------------------------------------------------------------------------------ + // Get position of 'f'. + AF2 pp=AF2(ip)*AF2_AU2(con0.xy)+AF2_AU2(con0.zw); + AF2 fp=floor(pp); + pp-=fp; +//------------------------------------------------------------------------------------------------------------------------------ + // 12-tap kernel. + // b c + // e f g h + // i j k l + // n o + // Gather 4 ordering. + // a b + // r g + // For packed FP16, need either {rg} or {ab} so using the following setup for gather in all versions, + // a b <- unused (z) + // r g + // a b a b + // r g r g + // a b + // r g <- unused (z) + // Allowing dead-code removal to remove the 'z's. + AF2 p0=fp*AF2_AU2(con1.xy)+AF2_AU2(con1.zw); + // These are from p0 to avoid pulling two constants on pre-Navi hardware. + AF2 p1=p0+AF2_AU2(con2.xy); + AF2 p2=p0+AF2_AU2(con2.zw); + AF2 p3=p0+AF2_AU2(con3.xy); + AF4 bczzR=FsrEasuRF(p0); + AF4 bczzG=FsrEasuGF(p0); + AF4 bczzB=FsrEasuBF(p0); + AF4 ijfeR=FsrEasuRF(p1); + AF4 ijfeG=FsrEasuGF(p1); + AF4 ijfeB=FsrEasuBF(p1); + AF4 klhgR=FsrEasuRF(p2); + AF4 klhgG=FsrEasuGF(p2); + AF4 klhgB=FsrEasuBF(p2); + AF4 zzonR=FsrEasuRF(p3); + AF4 zzonG=FsrEasuGF(p3); + AF4 zzonB=FsrEasuBF(p3); +//------------------------------------------------------------------------------------------------------------------------------ + // Simplest multi-channel approximate luma possible (luma times 2, in 2 FMA/MAD). + AF4 bczzL=bczzB*AF4_(0.5)+(bczzR*AF4_(0.5)+bczzG); + AF4 ijfeL=ijfeB*AF4_(0.5)+(ijfeR*AF4_(0.5)+ijfeG); + AF4 klhgL=klhgB*AF4_(0.5)+(klhgR*AF4_(0.5)+klhgG); + AF4 zzonL=zzonB*AF4_(0.5)+(zzonR*AF4_(0.5)+zzonG); + // Rename. + AF1 bL=bczzL.x; + AF1 cL=bczzL.y; + AF1 iL=ijfeL.x; + AF1 jL=ijfeL.y; + AF1 fL=ijfeL.z; + AF1 eL=ijfeL.w; + AF1 kL=klhgL.x; + AF1 lL=klhgL.y; + AF1 hL=klhgL.z; + AF1 gL=klhgL.w; + AF1 oL=zzonL.z; + AF1 nL=zzonL.w; + // Accumulate for bilinear interpolation. + AF2 dir=AF2_(0.0); + AF1 len=AF1_(0.0); + FsrEasuSetF(dir,len,pp,true, false,false,false,bL,eL,fL,gL,jL); + FsrEasuSetF(dir,len,pp,false,true ,false,false,cL,fL,gL,hL,kL); + FsrEasuSetF(dir,len,pp,false,false,true ,false,fL,iL,jL,kL,nL); + FsrEasuSetF(dir,len,pp,false,false,false,true ,gL,jL,kL,lL,oL); +//------------------------------------------------------------------------------------------------------------------------------ + // Normalize with approximation, and cleanup close to zero. + AF2 dir2=dir*dir; + AF1 dirR=dir2.x+dir2.y; + AP1 zro=dirR w = -m/(n+e+w+s) +// 1 == (w*(n+e+w+s)+m)/(4*w+1) -> w = (1-m)/(n+e+w+s-4*1) +// Then chooses the 'w' which results in no clipping, limits 'w', and multiplies by the 'sharp' amount. +// This solution above has issues with MSAA input as the steps along the gradient cause edge detection issues. +// So RCAS uses 4x the maximum and 4x the minimum (depending on equation)in place of the individual taps. +// As well as switching from 'm' to either the minimum or maximum (depending on side), to help in energy conservation. +// This stabilizes RCAS. +// RCAS does a simple highpass which is normalized against the local contrast then shaped, +// 0.25 +// 0.25 -1 0.25 +// 0.25 +// This is used as a noise detection filter, to reduce the effect of RCAS on grain, and focus on real edges. +// +// GLSL example for the required callbacks : +// +// AH4 FsrRcasLoadH(ASW2 p){return AH4(imageLoad(imgSrc,ASU2(p)));} +// void FsrRcasInputH(inout AH1 r,inout AH1 g,inout AH1 b) +// { +// //do any simple input color conversions here or leave empty if none needed +// } +// +// FsrRcasCon need to be called from the CPU or GPU to set up constants. +// Including a GPU example here, the 'con' value would be stored out to a constant buffer. +// +// AU4 con; +// FsrRcasCon(con, +// 0.0); // The scale is {0.0 := maximum sharpness, to N>0, where N is the number of stops (halving) of the reduction of sharpness}. +// --------------- +// RCAS sharpening supports a CAS-like pass-through alpha via, +// #define FSR_RCAS_PASSTHROUGH_ALPHA 1 +// RCAS also supports a define to enable a more expensive path to avoid some sharpening of noise. +// Would suggest it is better to apply film grain after RCAS sharpening (and after scaling) instead of using this define, +// #define FSR_RCAS_DENOISE 1 +//============================================================================================================================== +// This is set at the limit of providing unnatural results for sharpening. +#define FSR_RCAS_LIMIT (0.25-(1.0/16.0)) +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// CONSTANT SETUP +//============================================================================================================================== +// Call to setup required constant values (works on CPU or GPU). +A_STATIC void FsrRcasCon( +outAU4 con, +// The scale is {0.0 := maximum, to N>0, where N is the number of stops (halving) of the reduction of sharpness}. +AF1 sharpness){ + // Transform from stops to linear value. + sharpness=AExp2F1(-sharpness); + varAF2(hSharp)=initAF2(sharpness,sharpness); + con[0]=AU1_AF1(sharpness); + con[1]=AU1_AH2_AF2(hSharp); + con[2]=0; + con[3]=0;} +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// NON-PACKED 32-BIT VERSION +//============================================================================================================================== +#if defined(A_GPU)&&defined(FSR_RCAS_F) + // Input callback prototypes that need to be implemented by calling shader + AF4 FsrRcasLoadF(ASU2 p); + void FsrRcasInputF(inout AF1 r,inout AF1 g,inout AF1 b); +//------------------------------------------------------------------------------------------------------------------------------ + void FsrRcasF( + out AF1 pixR, // Output values, non-vector so port between RcasFilter() and RcasFilterH() is easy. + out AF1 pixG, + out AF1 pixB, + #ifdef FSR_RCAS_PASSTHROUGH_ALPHA + out AF1 pixA, + #endif + AU2 ip, // Integer pixel position in output. + AU4 con){ // Constant generated by RcasSetup(). + // Algorithm uses minimal 3x3 pixel neighborhood. + // b + // d e f + // h + ASU2 sp=ASU2(ip); + AF3 b=FsrRcasLoadF(sp+ASU2( 0,-1)).rgb; + AF3 d=FsrRcasLoadF(sp+ASU2(-1, 0)).rgb; + #ifdef FSR_RCAS_PASSTHROUGH_ALPHA + AF4 ee=FsrRcasLoadF(sp); + AF3 e=ee.rgb;pixA=ee.a; + #else + AF3 e=FsrRcasLoadF(sp).rgb; + #endif + AF3 f=FsrRcasLoadF(sp+ASU2( 1, 0)).rgb; + AF3 h=FsrRcasLoadF(sp+ASU2( 0, 1)).rgb; + // Rename (32-bit) or regroup (16-bit). + AF1 bR=b.r; + AF1 bG=b.g; + AF1 bB=b.b; + AF1 dR=d.r; + AF1 dG=d.g; + AF1 dB=d.b; + AF1 eR=e.r; + AF1 eG=e.g; + AF1 eB=e.b; + AF1 fR=f.r; + AF1 fG=f.g; + AF1 fB=f.b; + AF1 hR=h.r; + AF1 hG=h.g; + AF1 hB=h.b; + // Run optional input transform. + FsrRcasInputF(bR,bG,bB); + FsrRcasInputF(dR,dG,dB); + FsrRcasInputF(eR,eG,eB); + FsrRcasInputF(fR,fG,fB); + FsrRcasInputF(hR,hG,hB); + // Luma times 2. + AF1 bL=bB*AF1_(0.5)+(bR*AF1_(0.5)+bG); + AF1 dL=dB*AF1_(0.5)+(dR*AF1_(0.5)+dG); + AF1 eL=eB*AF1_(0.5)+(eR*AF1_(0.5)+eG); + AF1 fL=fB*AF1_(0.5)+(fR*AF1_(0.5)+fG); + AF1 hL=hB*AF1_(0.5)+(hR*AF1_(0.5)+hG); + // Noise detection. + AF1 nz=AF1_(0.25)*bL+AF1_(0.25)*dL+AF1_(0.25)*fL+AF1_(0.25)*hL-eL; + nz=ASatF1(abs(nz)*APrxMedRcpF1(AMax3F1(AMax3F1(bL,dL,eL),fL,hL)-AMin3F1(AMin3F1(bL,dL,eL),fL,hL))); + nz=AF1_(-0.5)*nz+AF1_(1.0); + // Min and max of ring. + AF1 mn4R=min(AMin3F1(bR,dR,fR),hR); + AF1 mn4G=min(AMin3F1(bG,dG,fG),hG); + AF1 mn4B=min(AMin3F1(bB,dB,fB),hB); + AF1 mx4R=max(AMax3F1(bR,dR,fR),hR); + AF1 mx4G=max(AMax3F1(bG,dG,fG),hG); + AF1 mx4B=max(AMax3F1(bB,dB,fB),hB); + // Immediate constants for peak range. + AF2 peakC=AF2(1.0,-1.0*4.0); + // Limiters, these need to be high precision RCPs. + AF1 hitMinR=mn4R*ARcpF1(AF1_(4.0)*mx4R); + AF1 hitMinG=mn4G*ARcpF1(AF1_(4.0)*mx4G); + AF1 hitMinB=mn4B*ARcpF1(AF1_(4.0)*mx4B); + AF1 hitMaxR=(peakC.x-mx4R)*ARcpF1(AF1_(4.0)*mn4R+peakC.y); + AF1 hitMaxG=(peakC.x-mx4G)*ARcpF1(AF1_(4.0)*mn4G+peakC.y); + AF1 hitMaxB=(peakC.x-mx4B)*ARcpF1(AF1_(4.0)*mn4B+peakC.y); + AF1 lobeR=max(-hitMinR,hitMaxR); + AF1 lobeG=max(-hitMinG,hitMaxG); + AF1 lobeB=max(-hitMinB,hitMaxB); + AF1 lobe=max(AF1_(-FSR_RCAS_LIMIT),min(AMax3F1(lobeR,lobeG,lobeB),AF1_(0.0)))*AF1_AU1(con.x); + // Apply noise removal. + #ifdef FSR_RCAS_DENOISE + lobe*=nz; + #endif + // Resolve, which needs the medium precision rcp approximation to avoid visible tonality changes. + AF1 rcpL=APrxMedRcpF1(AF1_(4.0)*lobe+AF1_(1.0)); + pixR=(lobe*bR+lobe*dR+lobe*hR+lobe*fR+eR)*rcpL; + pixG=(lobe*bG+lobe*dG+lobe*hG+lobe*fG+eG)*rcpL; + pixB=(lobe*bB+lobe*dB+lobe*hB+lobe*fB+eB)*rcpL; + return;} +#endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// NON-PACKED 16-BIT VERSION +//============================================================================================================================== +#if defined(A_GPU)&&defined(A_HALF)&&defined(FSR_RCAS_H) + // Input callback prototypes that need to be implemented by calling shader + AH4 FsrRcasLoadH(ASW2 p); + void FsrRcasInputH(inout AH1 r,inout AH1 g,inout AH1 b); +//------------------------------------------------------------------------------------------------------------------------------ + void FsrRcasH( + out AH1 pixR, // Output values, non-vector so port between RcasFilter() and RcasFilterH() is easy. + out AH1 pixG, + out AH1 pixB, + #ifdef FSR_RCAS_PASSTHROUGH_ALPHA + out AH1 pixA, + #endif + AU2 ip, // Integer pixel position in output. + AU4 con){ // Constant generated by RcasSetup(). + // Sharpening algorithm uses minimal 3x3 pixel neighborhood. + // b + // d e f + // h + ASW2 sp=ASW2(ip); + AH3 b=FsrRcasLoadH(sp+ASW2( 0,-1)).rgb; + AH3 d=FsrRcasLoadH(sp+ASW2(-1, 0)).rgb; + #ifdef FSR_RCAS_PASSTHROUGH_ALPHA + AH4 ee=FsrRcasLoadH(sp); + AH3 e=ee.rgb;pixA=ee.a; + #else + AH3 e=FsrRcasLoadH(sp).rgb; + #endif + AH3 f=FsrRcasLoadH(sp+ASW2( 1, 0)).rgb; + AH3 h=FsrRcasLoadH(sp+ASW2( 0, 1)).rgb; + // Rename (32-bit) or regroup (16-bit). + AH1 bR=b.r; + AH1 bG=b.g; + AH1 bB=b.b; + AH1 dR=d.r; + AH1 dG=d.g; + AH1 dB=d.b; + AH1 eR=e.r; + AH1 eG=e.g; + AH1 eB=e.b; + AH1 fR=f.r; + AH1 fG=f.g; + AH1 fB=f.b; + AH1 hR=h.r; + AH1 hG=h.g; + AH1 hB=h.b; + // Run optional input transform. + FsrRcasInputH(bR,bG,bB); + FsrRcasInputH(dR,dG,dB); + FsrRcasInputH(eR,eG,eB); + FsrRcasInputH(fR,fG,fB); + FsrRcasInputH(hR,hG,hB); + // Luma times 2. + AH1 bL=bB*AH1_(0.5)+(bR*AH1_(0.5)+bG); + AH1 dL=dB*AH1_(0.5)+(dR*AH1_(0.5)+dG); + AH1 eL=eB*AH1_(0.5)+(eR*AH1_(0.5)+eG); + AH1 fL=fB*AH1_(0.5)+(fR*AH1_(0.5)+fG); + AH1 hL=hB*AH1_(0.5)+(hR*AH1_(0.5)+hG); + // Noise detection. + AH1 nz=AH1_(0.25)*bL+AH1_(0.25)*dL+AH1_(0.25)*fL+AH1_(0.25)*hL-eL; + nz=ASatH1(abs(nz)*APrxMedRcpH1(AMax3H1(AMax3H1(bL,dL,eL),fL,hL)-AMin3H1(AMin3H1(bL,dL,eL),fL,hL))); + nz=AH1_(-0.5)*nz+AH1_(1.0); + // Min and max of ring. + AH1 mn4R=min(AMin3H1(bR,dR,fR),hR); + AH1 mn4G=min(AMin3H1(bG,dG,fG),hG); + AH1 mn4B=min(AMin3H1(bB,dB,fB),hB); + AH1 mx4R=max(AMax3H1(bR,dR,fR),hR); + AH1 mx4G=max(AMax3H1(bG,dG,fG),hG); + AH1 mx4B=max(AMax3H1(bB,dB,fB),hB); + // Immediate constants for peak range. + AH2 peakC=AH2(1.0,-1.0*4.0); + // Limiters, these need to be high precision RCPs. + AH1 hitMinR=mn4R*ARcpH1(AH1_(4.0)*mx4R); + AH1 hitMinG=mn4G*ARcpH1(AH1_(4.0)*mx4G); + AH1 hitMinB=mn4B*ARcpH1(AH1_(4.0)*mx4B); + AH1 hitMaxR=(peakC.x-mx4R)*ARcpH1(AH1_(4.0)*mn4R+peakC.y); + AH1 hitMaxG=(peakC.x-mx4G)*ARcpH1(AH1_(4.0)*mn4G+peakC.y); + AH1 hitMaxB=(peakC.x-mx4B)*ARcpH1(AH1_(4.0)*mn4B+peakC.y); + AH1 lobeR=max(-hitMinR,hitMaxR); + AH1 lobeG=max(-hitMinG,hitMaxG); + AH1 lobeB=max(-hitMinB,hitMaxB); + AH1 lobe=max(AH1_(-FSR_RCAS_LIMIT),min(AMax3H1(lobeR,lobeG,lobeB),AH1_(0.0)))*AH2_AU1(con.y).x; + // Apply noise removal. + #ifdef FSR_RCAS_DENOISE + lobe*=nz; + #endif + // Resolve, which needs the medium precision rcp approximation to avoid visible tonality changes. + AH1 rcpL=APrxMedRcpH1(AH1_(4.0)*lobe+AH1_(1.0)); + pixR=(lobe*bR+lobe*dR+lobe*hR+lobe*fR+eR)*rcpL; + pixG=(lobe*bG+lobe*dG+lobe*hG+lobe*fG+eG)*rcpL; + pixB=(lobe*bB+lobe*dB+lobe*hB+lobe*fB+eB)*rcpL;} +#endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// PACKED 16-BIT VERSION +//============================================================================================================================== +#if defined(A_GPU)&&defined(A_HALF)&&defined(FSR_RCAS_HX2) + // Input callback prototypes that need to be implemented by the calling shader + AH4 FsrRcasLoadHx2(ASW2 p); + void FsrRcasInputHx2(inout AH2 r,inout AH2 g,inout AH2 b); +//------------------------------------------------------------------------------------------------------------------------------ + // Can be used to convert from packed Structures of Arrays to Arrays of Structures for store. + void FsrRcasDepackHx2(out AH4 pix0,out AH4 pix1,AH2 pixR,AH2 pixG,AH2 pixB){ + #ifdef A_HLSL + // Invoke a slower path for DX only, since it won't allow uninitialized values. + pix0.a=pix1.a=0.0; + #endif + pix0.rgb=AH3(pixR.x,pixG.x,pixB.x); + pix1.rgb=AH3(pixR.y,pixG.y,pixB.y);} +//------------------------------------------------------------------------------------------------------------------------------ + void FsrRcasHx2( + // Output values are for 2 8x8 tiles in a 16x8 region. + // pix.x = left 8x8 tile + // pix.y = right 8x8 tile + // This enables later processing to easily be packed as well. + out AH2 pixR, + out AH2 pixG, + out AH2 pixB, + #ifdef FSR_RCAS_PASSTHROUGH_ALPHA + out AH2 pixA, + #endif + AU2 ip, // Integer pixel position in output. + AU4 con){ // Constant generated by RcasSetup(). + // No scaling algorithm uses minimal 3x3 pixel neighborhood. + ASW2 sp0=ASW2(ip); + AH3 b0=FsrRcasLoadHx2(sp0+ASW2( 0,-1)).rgb; + AH3 d0=FsrRcasLoadHx2(sp0+ASW2(-1, 0)).rgb; + #ifdef FSR_RCAS_PASSTHROUGH_ALPHA + AH4 ee0=FsrRcasLoadHx2(sp0); + AH3 e0=ee0.rgb;pixA.r=ee0.a; + #else + AH3 e0=FsrRcasLoadHx2(sp0).rgb; + #endif + AH3 f0=FsrRcasLoadHx2(sp0+ASW2( 1, 0)).rgb; + AH3 h0=FsrRcasLoadHx2(sp0+ASW2( 0, 1)).rgb; + ASW2 sp1=sp0+ASW2(8,0); + AH3 b1=FsrRcasLoadHx2(sp1+ASW2( 0,-1)).rgb; + AH3 d1=FsrRcasLoadHx2(sp1+ASW2(-1, 0)).rgb; + #ifdef FSR_RCAS_PASSTHROUGH_ALPHA + AH4 ee1=FsrRcasLoadHx2(sp1); + AH3 e1=ee1.rgb;pixA.g=ee1.a; + #else + AH3 e1=FsrRcasLoadHx2(sp1).rgb; + #endif + AH3 f1=FsrRcasLoadHx2(sp1+ASW2( 1, 0)).rgb; + AH3 h1=FsrRcasLoadHx2(sp1+ASW2( 0, 1)).rgb; + // Arrays of Structures to Structures of Arrays conversion. + AH2 bR=AH2(b0.r,b1.r); + AH2 bG=AH2(b0.g,b1.g); + AH2 bB=AH2(b0.b,b1.b); + AH2 dR=AH2(d0.r,d1.r); + AH2 dG=AH2(d0.g,d1.g); + AH2 dB=AH2(d0.b,d1.b); + AH2 eR=AH2(e0.r,e1.r); + AH2 eG=AH2(e0.g,e1.g); + AH2 eB=AH2(e0.b,e1.b); + AH2 fR=AH2(f0.r,f1.r); + AH2 fG=AH2(f0.g,f1.g); + AH2 fB=AH2(f0.b,f1.b); + AH2 hR=AH2(h0.r,h1.r); + AH2 hG=AH2(h0.g,h1.g); + AH2 hB=AH2(h0.b,h1.b); + // Run optional input transform. + FsrRcasInputHx2(bR,bG,bB); + FsrRcasInputHx2(dR,dG,dB); + FsrRcasInputHx2(eR,eG,eB); + FsrRcasInputHx2(fR,fG,fB); + FsrRcasInputHx2(hR,hG,hB); + // Luma times 2. + AH2 bL=bB*AH2_(0.5)+(bR*AH2_(0.5)+bG); + AH2 dL=dB*AH2_(0.5)+(dR*AH2_(0.5)+dG); + AH2 eL=eB*AH2_(0.5)+(eR*AH2_(0.5)+eG); + AH2 fL=fB*AH2_(0.5)+(fR*AH2_(0.5)+fG); + AH2 hL=hB*AH2_(0.5)+(hR*AH2_(0.5)+hG); + // Noise detection. + AH2 nz=AH2_(0.25)*bL+AH2_(0.25)*dL+AH2_(0.25)*fL+AH2_(0.25)*hL-eL; + nz=ASatH2(abs(nz)*APrxMedRcpH2(AMax3H2(AMax3H2(bL,dL,eL),fL,hL)-AMin3H2(AMin3H2(bL,dL,eL),fL,hL))); + nz=AH2_(-0.5)*nz+AH2_(1.0); + // Min and max of ring. + AH2 mn4R=min(AMin3H2(bR,dR,fR),hR); + AH2 mn4G=min(AMin3H2(bG,dG,fG),hG); + AH2 mn4B=min(AMin3H2(bB,dB,fB),hB); + AH2 mx4R=max(AMax3H2(bR,dR,fR),hR); + AH2 mx4G=max(AMax3H2(bG,dG,fG),hG); + AH2 mx4B=max(AMax3H2(bB,dB,fB),hB); + // Immediate constants for peak range. + AH2 peakC=AH2(1.0,-1.0*4.0); + // Limiters, these need to be high precision RCPs. + AH2 hitMinR=mn4R*ARcpH2(AH2_(4.0)*mx4R); + AH2 hitMinG=mn4G*ARcpH2(AH2_(4.0)*mx4G); + AH2 hitMinB=mn4B*ARcpH2(AH2_(4.0)*mx4B); + AH2 hitMaxR=(peakC.x-mx4R)*ARcpH2(AH2_(4.0)*mn4R+peakC.y); + AH2 hitMaxG=(peakC.x-mx4G)*ARcpH2(AH2_(4.0)*mn4G+peakC.y); + AH2 hitMaxB=(peakC.x-mx4B)*ARcpH2(AH2_(4.0)*mn4B+peakC.y); + AH2 lobeR=max(-hitMinR,hitMaxR); + AH2 lobeG=max(-hitMinG,hitMaxG); + AH2 lobeB=max(-hitMinB,hitMaxB); + AH2 lobe=max(AH2_(-FSR_RCAS_LIMIT),min(AMax3H2(lobeR,lobeG,lobeB),AH2_(0.0)))*AH2_(AH2_AU1(con.y).x); + // Apply noise removal. + #ifdef FSR_RCAS_DENOISE + lobe*=nz; + #endif + // Resolve, which needs the medium precision rcp approximation to avoid visible tonality changes. + AH2 rcpL=APrxMedRcpH2(AH2_(4.0)*lobe+AH2_(1.0)); + pixR=(lobe*bR+lobe*dR+lobe*hR+lobe*fR+eR)*rcpL; + pixG=(lobe*bG+lobe*dG+lobe*hG+lobe*fG+eG)*rcpL; + pixB=(lobe*bB+lobe*dB+lobe*hB+lobe*fB+eB)*rcpL;} +#endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// +// FSR - [LFGA] LINEAR FILM GRAIN APPLICATOR +// +//------------------------------------------------------------------------------------------------------------------------------ +// Adding output-resolution film grain after scaling is a good way to mask both rendering and scaling artifacts. +// Suggest using tiled blue noise as film grain input, with peak noise frequency set for a specific look and feel. +// The 'Lfga*()' functions provide a convenient way to introduce grain. +// These functions limit grain based on distance to signal limits. +// This is done so that the grain is temporally energy preserving, and thus won't modify image tonality. +// Grain application should be done in a linear colorspace. +// The grain should be temporally changing, but have a temporal sum per pixel that adds to zero (non-biased). +//------------------------------------------------------------------------------------------------------------------------------ +// Usage, +// FsrLfga*( +// color, // In/out linear colorspace color {0 to 1} ranged. +// grain, // Per pixel grain texture value {-0.5 to 0.5} ranged, input is 3-channel to support colored grain. +// amount); // Amount of grain (0 to 1} ranged. +//------------------------------------------------------------------------------------------------------------------------------ +// Example if grain texture is monochrome: 'FsrLfgaF(color,AF3_(grain),amount)' +//============================================================================================================================== +#if defined(A_GPU) + // Maximum grain is the minimum distance to the signal limit. + void FsrLfgaF(inout AF3 c,AF3 t,AF1 a){c+=(t*AF3_(a))*min(AF3_(1.0)-c,c);} +#endif +//============================================================================================================================== +#if defined(A_GPU)&&defined(A_HALF) + // Half precision version (slower). + void FsrLfgaH(inout AH3 c,AH3 t,AH1 a){c+=(t*AH3_(a))*min(AH3_(1.0)-c,c);} +//------------------------------------------------------------------------------------------------------------------------------ + // Packed half precision version (faster). + void FsrLfgaHx2(inout AH2 cR,inout AH2 cG,inout AH2 cB,AH2 tR,AH2 tG,AH2 tB,AH1 a){ + cR+=(tR*AH2_(a))*min(AH2_(1.0)-cR,cR);cG+=(tG*AH2_(a))*min(AH2_(1.0)-cG,cG);cB+=(tB*AH2_(a))*min(AH2_(1.0)-cB,cB);} +#endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// +// FSR - [SRTM] SIMPLE REVERSIBLE TONE-MAPPER +// +//------------------------------------------------------------------------------------------------------------------------------ +// This provides a way to take linear HDR color {0 to FP16_MAX} and convert it into a temporary {0 to 1} ranged post-tonemapped linear. +// The tonemapper preserves RGB ratio, which helps maintain HDR color bleed during filtering. +//------------------------------------------------------------------------------------------------------------------------------ +// Reversible tonemapper usage, +// FsrSrtm*(color); // {0 to FP16_MAX} converted to {0 to 1}. +// FsrSrtmInv*(color); // {0 to 1} converted into {0 to 32768, output peak safe for FP16}. +//============================================================================================================================== +#if defined(A_GPU) + void FsrSrtmF(inout AF3 c){c*=AF3_(ARcpF1(AMax3F1(c.r,c.g,c.b)+AF1_(1.0)));} + // The extra max solves the c=1.0 case (which is a /0). + void FsrSrtmInvF(inout AF3 c){c*=AF3_(ARcpF1(max(AF1_(1.0/32768.0),AF1_(1.0)-AMax3F1(c.r,c.g,c.b))));} +#endif +//============================================================================================================================== +#if defined(A_GPU)&&defined(A_HALF) + void FsrSrtmH(inout AH3 c){c*=AH3_(ARcpH1(AMax3H1(c.r,c.g,c.b)+AH1_(1.0)));} + void FsrSrtmInvH(inout AH3 c){c*=AH3_(ARcpH1(max(AH1_(1.0/32768.0),AH1_(1.0)-AMax3H1(c.r,c.g,c.b))));} +//------------------------------------------------------------------------------------------------------------------------------ + void FsrSrtmHx2(inout AH2 cR,inout AH2 cG,inout AH2 cB){ + AH2 rcp=ARcpH2(AMax3H2(cR,cG,cB)+AH2_(1.0));cR*=rcp;cG*=rcp;cB*=rcp;} + void FsrSrtmInvHx2(inout AH2 cR,inout AH2 cG,inout AH2 cB){ + AH2 rcp=ARcpH2(max(AH2_(1.0/32768.0),AH2_(1.0)-AMax3H2(cR,cG,cB)));cR*=rcp;cG*=rcp;cB*=rcp;} +#endif +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//_____________________________________________________________/\_______________________________________________________________ +//============================================================================================================================== +// +// FSR - [TEPD] TEMPORAL ENERGY PRESERVING DITHER +// +//------------------------------------------------------------------------------------------------------------------------------ +// Temporally energy preserving dithered {0 to 1} linear to gamma 2.0 conversion. +// Gamma 2.0 is used so that the conversion back to linear is just to square the color. +// The conversion comes in 8-bit and 10-bit modes, designed for output to 8-bit UNORM or 10:10:10:2 respectively. +// Given good non-biased temporal blue noise as dither input, +// the output dither will temporally conserve energy. +// This is done by choosing the linear nearest step point instead of perceptual nearest. +// See code below for details. +//------------------------------------------------------------------------------------------------------------------------------ +// DX SPEC RULES FOR FLOAT->UNORM 8-BIT CONVERSION +// =============================================== +// - Output is 'uint(floor(saturate(n)*255.0+0.5))'. +// - Thus rounding is to nearest. +// - NaN gets converted to zero. +// - INF is clamped to {0.0 to 1.0}. +//============================================================================================================================== +#if defined(A_GPU) + // Hand tuned integer position to dither value, with more values than simple checkerboard. + // Only 32-bit has enough precision for this compddation. + // Output is {0 to <1}. + AF1 FsrTepdDitF(AU2 p,AU1 f){ + AF1 x=AF1_(p.x+f); + AF1 y=AF1_(p.y); + // The 1.61803 golden ratio. + AF1 a=AF1_((1.0+sqrt(5.0))/2.0); + // Number designed to provide a good visual pattern. + AF1 b=AF1_(1.0/3.69); + x=x*a+(y*b); + return AFractF1(x);} +//------------------------------------------------------------------------------------------------------------------------------ + // This version is 8-bit gamma 2.0. + // The 'c' input is {0 to 1}. + // Output is {0 to 1} ready for image store. + void FsrTepdC8F(inout AF3 c,AF1 dit){ + AF3 n=sqrt(c); + n=floor(n*AF3_(255.0))*AF3_(1.0/255.0); + AF3 a=n*n; + AF3 b=n+AF3_(1.0/255.0);b=b*b; + // Ratio of 'a' to 'b' required to produce 'c'. + // APrxLoRcpF1() won't work here (at least for very high dynamic ranges). + // APrxMedRcpF1() is an IADD,FMA,MUL. + AF3 r=(c-b)*APrxMedRcpF3(a-b); + // Use the ratio as a cutoff to choose 'a' or 'b'. + // AGtZeroF1() is a MUL. + c=ASatF3(n+AGtZeroF3(AF3_(dit)-r)*AF3_(1.0/255.0));} +//------------------------------------------------------------------------------------------------------------------------------ + // This version is 10-bit gamma 2.0. + // The 'c' input is {0 to 1}. + // Output is {0 to 1} ready for image store. + void FsrTepdC10F(inout AF3 c,AF1 dit){ + AF3 n=sqrt(c); + n=floor(n*AF3_(1023.0))*AF3_(1.0/1023.0); + AF3 a=n*n; + AF3 b=n+AF3_(1.0/1023.0);b=b*b; + AF3 r=(c-b)*APrxMedRcpF3(a-b); + c=ASatF3(n+AGtZeroF3(AF3_(dit)-r)*AF3_(1.0/1023.0));} +#endif +//============================================================================================================================== +#if defined(A_GPU)&&defined(A_HALF) + AH1 FsrTepdDitH(AU2 p,AU1 f){ + AF1 x=AF1_(p.x+f); + AF1 y=AF1_(p.y); + AF1 a=AF1_((1.0+sqrt(5.0))/2.0); + AF1 b=AF1_(1.0/3.69); + x=x*a+(y*b); + return AH1(AFractF1(x));} +//------------------------------------------------------------------------------------------------------------------------------ + void FsrTepdC8H(inout AH3 c,AH1 dit){ + AH3 n=sqrt(c); + n=floor(n*AH3_(255.0))*AH3_(1.0/255.0); + AH3 a=n*n; + AH3 b=n+AH3_(1.0/255.0);b=b*b; + AH3 r=(c-b)*APrxMedRcpH3(a-b); + c=ASatH3(n+AGtZeroH3(AH3_(dit)-r)*AH3_(1.0/255.0));} +//------------------------------------------------------------------------------------------------------------------------------ + void FsrTepdC10H(inout AH3 c,AH1 dit){ + AH3 n=sqrt(c); + n=floor(n*AH3_(1023.0))*AH3_(1.0/1023.0); + AH3 a=n*n; + AH3 b=n+AH3_(1.0/1023.0);b=b*b; + AH3 r=(c-b)*APrxMedRcpH3(a-b); + c=ASatH3(n+AGtZeroH3(AH3_(dit)-r)*AH3_(1.0/1023.0));} +//============================================================================================================================== + // This computes dither for positions 'p' and 'p+{8,0}'. + AH2 FsrTepdDitHx2(AU2 p,AU1 f){ + AF2 x; + x.x=AF1_(p.x+f); + x.y=x.x+AF1_(8.0); + AF1 y=AF1_(p.y); + AF1 a=AF1_((1.0+sqrt(5.0))/2.0); + AF1 b=AF1_(1.0/3.69); + x=x*AF2_(a)+AF2_(y*b); + return AH2(AFractF2(x));} +//------------------------------------------------------------------------------------------------------------------------------ + void FsrTepdC8Hx2(inout AH2 cR,inout AH2 cG,inout AH2 cB,AH2 dit){ + AH2 nR=sqrt(cR); + AH2 nG=sqrt(cG); + AH2 nB=sqrt(cB); + nR=floor(nR*AH2_(255.0))*AH2_(1.0/255.0); + nG=floor(nG*AH2_(255.0))*AH2_(1.0/255.0); + nB=floor(nB*AH2_(255.0))*AH2_(1.0/255.0); + AH2 aR=nR*nR; + AH2 aG=nG*nG; + AH2 aB=nB*nB; + AH2 bR=nR+AH2_(1.0/255.0);bR=bR*bR; + AH2 bG=nG+AH2_(1.0/255.0);bG=bG*bG; + AH2 bB=nB+AH2_(1.0/255.0);bB=bB*bB; + AH2 rR=(cR-bR)*APrxMedRcpH2(aR-bR); + AH2 rG=(cG-bG)*APrxMedRcpH2(aG-bG); + AH2 rB=(cB-bB)*APrxMedRcpH2(aB-bB); + cR=ASatH2(nR+AGtZeroH2(dit-rR)*AH2_(1.0/255.0)); + cG=ASatH2(nG+AGtZeroH2(dit-rG)*AH2_(1.0/255.0)); + cB=ASatH2(nB+AGtZeroH2(dit-rB)*AH2_(1.0/255.0));} +//------------------------------------------------------------------------------------------------------------------------------ + void FsrTepdC10Hx2(inout AH2 cR,inout AH2 cG,inout AH2 cB,AH2 dit){ + AH2 nR=sqrt(cR); + AH2 nG=sqrt(cG); + AH2 nB=sqrt(cB); + nR=floor(nR*AH2_(1023.0))*AH2_(1.0/1023.0); + nG=floor(nG*AH2_(1023.0))*AH2_(1.0/1023.0); + nB=floor(nB*AH2_(1023.0))*AH2_(1.0/1023.0); + AH2 aR=nR*nR; + AH2 aG=nG*nG; + AH2 aB=nB*nB; + AH2 bR=nR+AH2_(1.0/1023.0);bR=bR*bR; + AH2 bG=nG+AH2_(1.0/1023.0);bG=bG*bG; + AH2 bB=nB+AH2_(1.0/1023.0);bB=bB*bB; + AH2 rR=(cR-bR)*APrxMedRcpH2(aR-bR); + AH2 rG=(cG-bG)*APrxMedRcpH2(aG-bG); + AH2 rB=(cB-bB)*APrxMedRcpH2(aB-bB); + cR=ASatH2(nR+AGtZeroH2(dit-rR)*AH2_(1.0/1023.0)); + cG=ASatH2(nG+AGtZeroH2(dit-rG)*AH2_(1.0/1023.0)); + cB=ASatH2(nB+AGtZeroH2(dit-rB)*AH2_(1.0/1023.0));} +#endif diff --git a/src/refresh/vkpt/main.c b/src/refresh/vkpt/main.c index 22d48b6c5..447561654 100644 --- a/src/refresh/vkpt/main.c +++ b/src/refresh/vkpt/main.c @@ -76,6 +76,7 @@ extern cvar_t *cvar_bloom_enable; extern cvar_t* cvar_flt_taa; static int drs_current_scale = 0; static int drs_effective_scale = 0; +extern cvar_t *cvar_flt_fsr_enable; cvar_t* cvar_min_driver_version_nvidia = NULL; cvar_t* cvar_min_driver_version_amd = NULL; @@ -152,6 +153,8 @@ VkptInit_t vkpt_initialization[] = { { "bloom|", vkpt_bloom_create_pipelines, vkpt_bloom_destroy_pipelines, VKPT_INIT_RELOAD_SHADER, 0 }, { "tonemap", vkpt_tone_mapping_initialize, vkpt_tone_mapping_destroy, VKPT_INIT_DEFAULT, 0 }, { "tonemap|", vkpt_tone_mapping_create_pipelines, vkpt_tone_mapping_destroy_pipelines, VKPT_INIT_RELOAD_SHADER, 0 }, + { "fsr", vkpt_fsr_initialize, vkpt_fsr_destroy, VKPT_INIT_DEFAULT, 0 }, + { "fsr|", vkpt_fsr_create_pipelines, vkpt_fsr_destroy_pipelines, VKPT_INIT_RELOAD_SHADER, 0 }, { "physicalSky", vkpt_physical_sky_initialize, vkpt_physical_sky_destroy, VKPT_INIT_DEFAULT, 0 }, { "physicalSky|", vkpt_physical_sky_create_pipelines, vkpt_physical_sky_destroy_pipelines, VKPT_INIT_RELOAD_SHADER, 0 }, @@ -2360,7 +2363,7 @@ evaluate_taa_settings(const reference_mode_t* ref_mode) { qvk.effective_aa_mode = AA_MODE_TAA; } - else if (cvar_flt_taa->integer == AA_MODE_UPSCALE) + else if (cvar_flt_taa->integer == AA_MODE_UPSCALE) // TAAU or TAA+FSR { if (qvk.extent_render.width > qvk.extent_unscaled.width || qvk.extent_render.height > qvk.extent_unscaled.height) { @@ -2369,7 +2372,8 @@ evaluate_taa_settings(const reference_mode_t* ref_mode) else { qvk.effective_aa_mode = AA_MODE_UPSCALE; - qvk.extent_taa_output = qvk.extent_unscaled; + if (cvar_flt_fsr_enable->integer == 0) + qvk.extent_taa_output = qvk.extent_unscaled; } } } @@ -2527,7 +2531,7 @@ prepare_ubo(refdef_t *fd, mleaf_t* viewleaf, const reference_mode_t* ref_mode, c ubo->pt_ndf_trim = 1.f; } } - else if(qvk.effective_aa_mode == AA_MODE_UPSCALE) + else if((cvar_flt_fsr_enable->integer != 0) || (qvk.effective_aa_mode == AA_MODE_UPSCALE)) { // adjust texture LOD bias to the resolution scale, i.e. use negative bias if scale is < 100 float resolution_scale = (drs_effective_scale != 0) ? (float)drs_effective_scale : (float)scr_viewsize->integer; @@ -2600,6 +2604,12 @@ prepare_ubo(refdef_t *fd, mleaf_t* viewleaf, const reference_mode_t* ref_mode, c ubo->sub_pixel_jitter[1] = 0.f; } + // Set up constants for FSR + if (cvar_flt_fsr_enable->integer != 0) + { + vkpt_fsr_update_ubo(ubo); + } + ubo->first_person_model = cl_player_model->integer == CL_PLAYER_MODEL_FIRST_PERSON; memset(ubo->environment_rotation_matrix, 0, sizeof(ubo->environment_rotation_matrix)); @@ -2931,6 +2941,11 @@ R_RenderFrame_RTX(refdef_t *fd) } END_PERF_MARKER(post_cmd_buf, PROFILER_TONE_MAPPING); + if(cvar_flt_fsr_enable->integer != 0) + { + vkpt_fsr_do(post_cmd_buf); + } + { VkBufferCopy copyRegion = { 0, 0, sizeof(ReadbackBuffer) }; vkCmdCopyBuffer(post_cmd_buf, qvk.buf_readback.buffer, qvk.buf_readback_staging[qvk.current_frame_index].buffer, 1, ©Region); @@ -3186,7 +3201,11 @@ R_EndFrame_RTX(void) if (frame_ready) { - if (qvk.effective_aa_mode == AA_MODE_UPSCALE) + if (cvar_flt_fsr_enable->integer != 0) + { + vkpt_fsr_final_blit(cmd_buf); + } + else if (qvk.effective_aa_mode == AA_MODE_UPSCALE) { vkpt_final_blit_simple(cmd_buf, qvk.images[VKPT_IMG_TAA_OUTPUT], qvk.extent_taa_output); } @@ -3422,7 +3441,8 @@ R_Init_RTX(qboolean total) cvar_tm_blend_enable = Cvar_Get("tm_blend_enable", "1", CVAR_ARCHIVE); drs_init(); - + vkpt_fsr_init_cvars(); + // Minimum NVIDIA driver version - this is a cvar in case something changes in the future, // and the current test no longer works. cvar_min_driver_version_nvidia = Cvar_Get("min_driver_version_nvidia", "460.82", 0); diff --git a/src/refresh/vkpt/profiler.c b/src/refresh/vkpt/profiler.c index e8a18d184..a6898ecce 100644 --- a/src/refresh/vkpt/profiler.c +++ b/src/refresh/vkpt/profiler.c @@ -28,6 +28,7 @@ static uint64_t query_pool_results[NUM_PROFILER_QUERIES_PER_FRAME * 2]; // the buffer if it's properly sized. extern cvar_t *cvar_pt_reflect_refract; +extern cvar_t *cvar_flt_fsr_enable; static qboolean profiler_queries_used[NUM_PROFILER_QUERIES_PER_FRAME * MAX_FRAMES_IN_FLIGHT] = { 0 }; @@ -192,6 +193,12 @@ draw_profiler(int enable_asvgf) PROFILER_DO(PROFILER_INTERLEAVE, 1); PROFILER_DO(PROFILER_BLOOM, 1); PROFILER_DO(PROFILER_TONE_MAPPING, 2); + if(cvar_flt_fsr_enable->integer != 0) + { + PROFILER_DO(PROFILER_FSR, 1); + PROFILER_DO(PROFILER_FSR_EASU, 2); + PROFILER_DO(PROFILER_FSR_RCAS, 2); + } #undef PROFILER_DO } diff --git a/src/refresh/vkpt/shader/fsr_easu.comp b/src/refresh/vkpt/shader/fsr_easu.comp new file mode 100644 index 000000000..b8ce9e95e --- /dev/null +++ b/src/refresh/vkpt/shader/fsr_easu.comp @@ -0,0 +1,81 @@ +/* +Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#version 450 +#extension GL_GOOGLE_include_directive : enable +#extension GL_ARB_separate_shader_objects : enable +#extension GL_EXT_nonuniform_qualifier : enable + +#include "utils.glsl" + +#define GLOBAL_UBO_DESC_SET_IDX 0 +#include "global_ubo.h" + +#define GLOBAL_TEXTURES_DESC_SET_IDX 1 +#include "global_textures.h" + +#define A_GPU 1 +#define A_GLSL 1 +//#define A_HALF // TODO + +#define FSR_EASU_F 1 + +#include "ffx_a.h" +#include "ffx_fsr1.h" + +layout(local_size_x=64) in; + +// Input: TEX_TAA_OUTPUT +AF4 FsrEasuRF(AF2 p) +{ + return textureGather(TEX_TAA_OUTPUT, p, 0); +} +AF4 FsrEasuGF(AF2 p) +{ + return textureGather(TEX_TAA_OUTPUT, p, 1); +} +AF4 FsrEasuBF(AF2 p) +{ + return textureGather(TEX_TAA_OUTPUT, p, 2); +} + + +void main() +{ + /* Code from EASU application has been lifted from: + https://raw.githubusercontent.com/GPUOpen-Effects/FidelityFX-FSR/master/docs/FidelityFX-FSR-Overview-Integration.pdf */ + + // Do remapping of local xy in workgroup for a more PS-like swizzle pattern. + AU2 gxy = ARmp8x8(gl_LocalInvocationID.x) + AU2(gl_WorkGroupID.x << 4u, gl_WorkGroupID.y << 4u); + + AF3 color; + FsrEasuF(color, gxy, global_ubo.easu_const0, global_ubo.easu_const1, global_ubo.easu_const2, global_ubo.easu_const3); + imageStore(IMG_FSR_EASU_OUTPUT, ivec2(gxy), vec4(color, 1)); + gxy.x += 8; + + FsrEasuF(color, gxy, global_ubo.easu_const0, global_ubo.easu_const1, global_ubo.easu_const2, global_ubo.easu_const3); + imageStore(IMG_FSR_EASU_OUTPUT, ivec2(gxy), vec4(color, 1)); + gxy.y += 8; + + FsrEasuF(color, gxy, global_ubo.easu_const0, global_ubo.easu_const1, global_ubo.easu_const2, global_ubo.easu_const3); + imageStore(IMG_FSR_EASU_OUTPUT, ivec2(gxy), vec4(color, 1)); + gxy.x -= 8; + + FsrEasuF(color, gxy, global_ubo.easu_const0, global_ubo.easu_const1, global_ubo.easu_const2, global_ubo.easu_const3); + imageStore(IMG_FSR_EASU_OUTPUT, ivec2(gxy), vec4(color, 1)); +} diff --git a/src/refresh/vkpt/shader/fsr_rcas.comp b/src/refresh/vkpt/shader/fsr_rcas.comp new file mode 100644 index 000000000..ec71b3ac4 --- /dev/null +++ b/src/refresh/vkpt/shader/fsr_rcas.comp @@ -0,0 +1,74 @@ +/* +Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#version 450 +#extension GL_GOOGLE_include_directive : enable +#extension GL_ARB_separate_shader_objects : enable +#extension GL_EXT_nonuniform_qualifier : enable + +#include "utils.glsl" + +#define GLOBAL_UBO_DESC_SET_IDX 0 +#include "global_ubo.h" + +#define GLOBAL_TEXTURES_DESC_SET_IDX 1 +#include "global_textures.h" + +#define A_GPU 1 +#define A_GLSL 1 +//#define A_HALF // TODO + +#define FSR_RCAS_F 1 + +#include "ffx_a.h" +#include "ffx_fsr1.h" + +layout(local_size_x=64) in; + +// Input: TEX_FSR_EASU_OUTPUT +AF4 FsrRcasLoadF(ASU2 p) +{ + return texelFetch(TEX_FSR_EASU_OUTPUT, ivec2(p), 0); +} +void FsrRcasInputF(inout AF1 r, inout AF1 g, inout AF1 b) {} + + +void main() +{ + /* Code from EASU application has been lifted from: + https://raw.githubusercontent.com/GPUOpen-Effects/FidelityFX-FSR/master/docs/FidelityFX-FSR-Overview-Integration.pdf */ + + // Do remapping of local xy in workgroup for a more PS-like swizzle pattern. + AU2 gxy = ARmp8x8(gl_LocalInvocationID.x) + AU2(gl_WorkGroupID.x << 4u, gl_WorkGroupID.y << 4u); + + AF3 color; + FsrRcasF(color.r, color.g, color.b, gxy, global_ubo.rcas_const0); + imageStore(IMG_FSR_RCAS_OUTPUT, ivec2(gxy), vec4(color, 1)); + gxy.x += 8; + + FsrRcasF(color.r, color.g, color.b, gxy, global_ubo.rcas_const0); + imageStore(IMG_FSR_RCAS_OUTPUT, ivec2(gxy), vec4(color, 1)); + gxy.y += 8; + + FsrRcasF(color.r, color.g, color.b, gxy, global_ubo.rcas_const0); + imageStore(IMG_FSR_RCAS_OUTPUT, ivec2(gxy), vec4(color, 1)); + gxy.x -= 8; + + FsrRcasF(color.r, color.g, color.b, gxy, global_ubo.rcas_const0); + imageStore(IMG_FSR_RCAS_OUTPUT, ivec2(gxy), vec4(color, 1)); +} diff --git a/src/refresh/vkpt/shader/global_textures.h b/src/refresh/vkpt/shader/global_textures.h index 97b0a6793..08e131f37 100644 --- a/src/refresh/vkpt/shader/global_textures.h +++ b/src/refresh/vkpt/shader/global_textures.h @@ -73,8 +73,10 @@ with this program; if not, write to the Free Software Foundation, Inc., IMG_DO(PT_COLOR_HF, 33, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ IMG_DO(PT_COLOR_SPEC, 34, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ IMG_DO(PT_GEO_NORMAL2, 35, R32_UINT, r32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ + IMG_DO(FSR_EASU_OUTPUT, 36, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH, IMG_HEIGHT ) \ + IMG_DO(FSR_RCAS_OUTPUT, 37, R16G16B16A16_SFLOAT, rgba16f, IMG_WIDTH, IMG_HEIGHT ) \ -#define NUM_IMAGES_BASE 36 +#define NUM_IMAGES_BASE 38 #define LIST_IMAGES_A_B \ IMG_DO(PT_VISBUF_A, NUM_IMAGES_BASE + 0, R32G32_UINT, rg32ui, IMG_WIDTH_MGPU, IMG_HEIGHT ) \ diff --git a/src/refresh/vkpt/shader/global_ubo.h b/src/refresh/vkpt/shader/global_ubo.h index 32a15c577..577846804 100644 --- a/src/refresh/vkpt/shader/global_ubo.h +++ b/src/refresh/vkpt/shader/global_ubo.h @@ -190,6 +190,12 @@ with this program; if not, write to the Free Software Foundation, Inc., GLOBAL_UBO_VAR_LIST_DO(int, prev_taa_output_width) \ GLOBAL_UBO_VAR_LIST_DO(int, prev_taa_output_height) \ \ + GLOBAL_UBO_VAR_LIST_DO(uvec4, easu_const0) \ + GLOBAL_UBO_VAR_LIST_DO(uvec4, easu_const1) \ + GLOBAL_UBO_VAR_LIST_DO(uvec4, easu_const2) \ + GLOBAL_UBO_VAR_LIST_DO(uvec4, easu_const3) \ + GLOBAL_UBO_VAR_LIST_DO(uvec4, rcas_const0) \ + \ GLOBAL_UBO_VAR_LIST_DO(vec2, sub_pixel_jitter) \ GLOBAL_UBO_VAR_LIST_DO(float, prev_adapted_luminance) \ GLOBAL_UBO_VAR_LIST_DO(float, padding1) \ diff --git a/src/refresh/vkpt/vkpt.h b/src/refresh/vkpt/vkpt.h index 5774b0429..774118537 100644 --- a/src/refresh/vkpt/vkpt.h +++ b/src/refresh/vkpt/vkpt.h @@ -95,6 +95,8 @@ with this program; if not, write to the Free Software Foundation, Inc., SHADER_MODULE_DO(QVK_MOD_GOD_RAYS_FILTER_COMP) \ SHADER_MODULE_DO(QVK_MOD_SHADOW_MAP_VERT) \ SHADER_MODULE_DO(QVK_MOD_COMPOSITING_COMP) \ + SHADER_MODULE_DO(QVK_MOD_FSR_EASU_COMP) \ + SHADER_MODULE_DO(QVK_MOD_FSR_RCAS_COMP) \ #define LIST_RT_RGEN_SHADER_MODULES \ SHADER_MODULE_DO(QVK_MOD_PRIMARY_RAYS_RGEN) \ @@ -455,6 +457,9 @@ void create_orthographic_matrix(mat4_t matrix, float xmin, float xmax, PROFILER_DO(PROFILER_ASVGF_TAA, 2) \ PROFILER_DO(PROFILER_BLOOM, 1) \ PROFILER_DO(PROFILER_TONE_MAPPING, 1) \ + PROFILER_DO(PROFILER_FSR, 1) \ + PROFILER_DO(PROFILER_FSR_EASU, 2) \ + PROFILER_DO(PROFILER_FSR_RCAS, 2) \ PROFILER_DO(PROFILER_UPDATE_ENVIRONMENT, 1) \ PROFILER_DO(PROFILER_GOD_RAYS, 1) \ PROFILER_DO(PROFILER_GOD_RAYS_REFLECT_REFRACT, 1) \ @@ -627,6 +632,15 @@ VkResult vkpt_interleave(VkCommandBuffer cmd_buf); VkResult vkpt_taa(VkCommandBuffer cmd_buf); VkResult vkpt_asvgf_gradient_reproject(VkCommandBuffer cmd_buf); +void vkpt_fsr_init_cvars(); +VkResult vkpt_fsr_initialize(); +VkResult vkpt_fsr_destroy(); +VkResult vkpt_fsr_create_pipelines(); +VkResult vkpt_fsr_destroy_pipelines(); +void vkpt_fsr_update_ubo(QVKUniformBuffer_t *ubo); +VkResult vkpt_fsr_do(VkCommandBuffer cmd_buf); +VkResult vkpt_fsr_final_blit(VkCommandBuffer cmd_buf); + VkResult vkpt_bloom_initialize(); VkResult vkpt_bloom_destroy(); VkResult vkpt_bloom_create_pipelines(); From cd3337072eb140c8f8e9cf27560d3f14476633a5 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Wed, 1 Sep 2021 22:31:31 +0200 Subject: [PATCH 25/55] FSR sharpness menu setting --- baseq2/q2rtx.menu | 1 + 1 file changed, 1 insertion(+) diff --git a/baseq2/q2rtx.menu b/baseq2/q2rtx.menu index 9d6f3ca1a..f27f37c72 100644 --- a/baseq2/q2rtx.menu +++ b/baseq2/q2rtx.menu @@ -126,6 +126,7 @@ begin video range "texture LOD bias" pt_texture_lod_bias -2 2 0.5 pairs "anti-aliasing" flt_taa "none" 0 "temporal AA" 1 "temporal upscaling" 2 toggle "FSR" flt_fsr_enable + range --status "lower is sharper" "FSR sharpness" flt_fsr_sharpness 0 2 0.01 pairs "global illumination" pt_num_bounce_rays low 0.5 medium 1 high 2 pairs "reflection/refraction depth" pt_reflect_refract off 0 1 1 2 2 4 4 8 8 toggle --status "turn some monitors in the game into security camera views" \ From d75dfc16582ed58e166d34a2a5f46211e41965b1 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Wed, 1 Sep 2021 22:45:18 +0200 Subject: [PATCH 26/55] Add ability to disable FSR EASU --- src/refresh/vkpt/fsr.c | 44 ++++++++++++++++++++++++--- src/refresh/vkpt/main.c | 23 +++++++++----- src/refresh/vkpt/shader/fsr_rcas.comp | 10 ++++-- src/refresh/vkpt/vkpt.h | 2 ++ 4 files changed, 64 insertions(+), 15 deletions(-) diff --git a/src/refresh/vkpt/fsr.c b/src/refresh/vkpt/fsr.c index 788c873e5..9a44afba3 100644 --- a/src/refresh/vkpt/fsr.c +++ b/src/refresh/vkpt/fsr.c @@ -25,7 +25,8 @@ with this program; if not, write to the Free Software Foundation, Inc., enum { FSR_EASU, - FSR_RCAS, + FSR_RCAS_AFTER_EASU, + FSR_RCAS_AFTER_TAAU, FSR_NUM_PIPELINES }; @@ -33,6 +34,7 @@ static VkPipeline pipeline_fsr[FSR_NUM_PIPELINES]; static VkPipelineLayout pipeline_layout_fsr; cvar_t *cvar_flt_fsr_enable = NULL; +cvar_t *cvar_flt_fsr_easu = NULL; cvar_t *cvar_flt_fsr_rcas = NULL; cvar_t *cvar_flt_fsr_sharpness = NULL; @@ -40,6 +42,8 @@ void vkpt_fsr_init_cvars() { // FSR enable toggle cvar_flt_fsr_enable = Cvar_Get("flt_fsr_enable", "0", CVAR_ARCHIVE); + // FSR EASU (upscaling) toggle + cvar_flt_fsr_easu = Cvar_Get("flt_fsr_easu", "1", CVAR_ARCHIVE); // FSR RCAS (sharpening) toggle cvar_flt_fsr_rcas = Cvar_Get("flt_fsr_rcas", "1", CVAR_ARCHIVE); // FSR sharpness setting (float, 0..2) @@ -73,15 +77,34 @@ vkpt_fsr_destroy() VkResult vkpt_fsr_create_pipelines() { + VkSpecializationMapEntry specEntries[] = { + { .constantID = 0, .offset = 0, .size = sizeof(uint32_t) } + }; + + uint32_t spec_data[] = { + 0, + 1 + }; + + VkSpecializationInfo specInfo[] = { + { .mapEntryCount = 1, .pMapEntries = specEntries, .dataSize = sizeof(uint32_t), .pData = &spec_data[0] }, + { .mapEntryCount = 1, .pMapEntries = specEntries, .dataSize = sizeof(uint32_t), .pData = &spec_data[1] }, + }; + VkComputePipelineCreateInfo pipeline_info[FSR_NUM_PIPELINES] = { [FSR_EASU] = { .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, .stage = SHADER_STAGE(QVK_MOD_FSR_EASU_COMP, VK_SHADER_STAGE_COMPUTE_BIT), .layout = pipeline_layout_fsr, }, - [FSR_RCAS] = { + [FSR_RCAS_AFTER_EASU] = { .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = SHADER_STAGE(QVK_MOD_FSR_RCAS_COMP, VK_SHADER_STAGE_COMPUTE_BIT), + .stage = SHADER_STAGE_SPEC(QVK_MOD_FSR_RCAS_COMP, VK_SHADER_STAGE_COMPUTE_BIT, &specInfo[0]), + .layout = pipeline_layout_fsr, + }, + [FSR_RCAS_AFTER_TAAU] = { + .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, + .stage = SHADER_STAGE_SPEC(QVK_MOD_FSR_RCAS_COMP, VK_SHADER_STAGE_COMPUTE_BIT, &specInfo[1]), .layout = pipeline_layout_fsr, }, }; @@ -99,6 +122,16 @@ vkpt_fsr_destroy_pipelines() return VK_SUCCESS; } +qboolean vkpt_fsr_is_enabled() +{ + return (cvar_flt_fsr_enable->integer != 0) && ((cvar_flt_fsr_easu->integer != 0) || (cvar_flt_fsr_rcas->integer != 0)); +} + +qboolean vkpt_fsr_needs_upscale() +{ + return cvar_flt_fsr_easu->integer == 0; +} + void vkpt_fsr_update_ubo(QVKUniformBuffer_t *ubo) { FsrEasuCon(&ubo->easu_const0[0], &ubo->easu_const1[0], &ubo->easu_const2[0], &ubo->easu_const3[0], @@ -161,7 +194,7 @@ static void vkpt_fsr_rcas(VkCommandBuffer cmd_buf) BEGIN_PERF_MARKER(cmd_buf, PROFILER_FSR_RCAS); - vkCmdBindPipeline(cmd_buf, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline_fsr[FSR_RCAS]); + vkCmdBindPipeline(cmd_buf, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline_fsr[cvar_flt_fsr_easu->integer != 0 ? FSR_RCAS_AFTER_EASU : FSR_RCAS_AFTER_TAAU]); vkCmdBindDescriptorSets(cmd_buf, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline_layout_fsr, 0, LENGTH(desc_sets), desc_sets, 0, 0); @@ -181,7 +214,8 @@ VkResult vkpt_fsr_do(VkCommandBuffer cmd_buf) { BEGIN_PERF_MARKER(cmd_buf, PROFILER_FSR); - vkpt_fsr_easu(cmd_buf); + if(cvar_flt_fsr_easu->integer != 0) + vkpt_fsr_easu(cmd_buf); if(cvar_flt_fsr_rcas->integer != 0) vkpt_fsr_rcas(cmd_buf); diff --git a/src/refresh/vkpt/main.c b/src/refresh/vkpt/main.c index 447561654..b8f155c66 100644 --- a/src/refresh/vkpt/main.c +++ b/src/refresh/vkpt/main.c @@ -76,7 +76,6 @@ extern cvar_t *cvar_bloom_enable; extern cvar_t* cvar_flt_taa; static int drs_current_scale = 0; static int drs_effective_scale = 0; -extern cvar_t *cvar_flt_fsr_enable; cvar_t* cvar_min_driver_version_nvidia = NULL; cvar_t* cvar_min_driver_version_amd = NULL; @@ -2359,11 +2358,19 @@ evaluate_taa_settings(const reference_mode_t* ref_mode) if (!ref_mode->enable_denoiser) return; - if (cvar_flt_taa->integer == AA_MODE_TAA) + int flt_taa = cvar_flt_taa->integer; + // FSR RCAS needs upscaled input; if EASU was disabled, force to TAAU + qboolean force_upscaling = vkpt_fsr_is_enabled() && vkpt_fsr_needs_upscale(); + if(force_upscaling) + { + flt_taa = AA_MODE_UPSCALE; + } + + if (flt_taa == AA_MODE_TAA) { qvk.effective_aa_mode = AA_MODE_TAA; } - else if (cvar_flt_taa->integer == AA_MODE_UPSCALE) // TAAU or TAA+FSR + else if (flt_taa == AA_MODE_UPSCALE) // TAAU or TAA+FSR { if (qvk.extent_render.width > qvk.extent_unscaled.width || qvk.extent_render.height > qvk.extent_unscaled.height) { @@ -2372,7 +2379,7 @@ evaluate_taa_settings(const reference_mode_t* ref_mode) else { qvk.effective_aa_mode = AA_MODE_UPSCALE; - if (cvar_flt_fsr_enable->integer == 0) + if (!vkpt_fsr_is_enabled() || force_upscaling) qvk.extent_taa_output = qvk.extent_unscaled; } } @@ -2531,7 +2538,7 @@ prepare_ubo(refdef_t *fd, mleaf_t* viewleaf, const reference_mode_t* ref_mode, c ubo->pt_ndf_trim = 1.f; } } - else if((cvar_flt_fsr_enable->integer != 0) || (qvk.effective_aa_mode == AA_MODE_UPSCALE)) + else if(vkpt_fsr_is_enabled() || (qvk.effective_aa_mode == AA_MODE_UPSCALE)) { // adjust texture LOD bias to the resolution scale, i.e. use negative bias if scale is < 100 float resolution_scale = (drs_effective_scale != 0) ? (float)drs_effective_scale : (float)scr_viewsize->integer; @@ -2605,7 +2612,7 @@ prepare_ubo(refdef_t *fd, mleaf_t* viewleaf, const reference_mode_t* ref_mode, c } // Set up constants for FSR - if (cvar_flt_fsr_enable->integer != 0) + if (vkpt_fsr_is_enabled()) { vkpt_fsr_update_ubo(ubo); } @@ -2941,7 +2948,7 @@ R_RenderFrame_RTX(refdef_t *fd) } END_PERF_MARKER(post_cmd_buf, PROFILER_TONE_MAPPING); - if(cvar_flt_fsr_enable->integer != 0) + if(vkpt_fsr_is_enabled()) { vkpt_fsr_do(post_cmd_buf); } @@ -3201,7 +3208,7 @@ R_EndFrame_RTX(void) if (frame_ready) { - if (cvar_flt_fsr_enable->integer != 0) + if (vkpt_fsr_is_enabled()) { vkpt_fsr_final_blit(cmd_buf); } diff --git a/src/refresh/vkpt/shader/fsr_rcas.comp b/src/refresh/vkpt/shader/fsr_rcas.comp index ec71b3ac4..ffa235137 100644 --- a/src/refresh/vkpt/shader/fsr_rcas.comp +++ b/src/refresh/vkpt/shader/fsr_rcas.comp @@ -21,6 +21,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #extension GL_ARB_separate_shader_objects : enable #extension GL_EXT_nonuniform_qualifier : enable +layout(constant_id = 0) const uint spec_input_tex = 0; + #include "utils.glsl" #define GLOBAL_UBO_DESC_SET_IDX 0 @@ -40,10 +42,14 @@ with this program; if not, write to the Free Software Foundation, Inc., layout(local_size_x=64) in; -// Input: TEX_FSR_EASU_OUTPUT AF4 FsrRcasLoadF(ASU2 p) { - return texelFetch(TEX_FSR_EASU_OUTPUT, ivec2(p), 0); + if(spec_input_tex == 0) + // RCAS after EASU + return texelFetch(TEX_FSR_EASU_OUTPUT, ivec2(p), 0); + else + // RCAS after TAAU + return texelFetch(TEX_TAA_OUTPUT, ivec2(p), 0); } void FsrRcasInputF(inout AF1 r, inout AF1 g, inout AF1 b) {} diff --git a/src/refresh/vkpt/vkpt.h b/src/refresh/vkpt/vkpt.h index 774118537..4b3f737eb 100644 --- a/src/refresh/vkpt/vkpt.h +++ b/src/refresh/vkpt/vkpt.h @@ -637,6 +637,8 @@ VkResult vkpt_fsr_initialize(); VkResult vkpt_fsr_destroy(); VkResult vkpt_fsr_create_pipelines(); VkResult vkpt_fsr_destroy_pipelines(); +qboolean vkpt_fsr_is_enabled(); +qboolean vkpt_fsr_needs_upscale(); void vkpt_fsr_update_ubo(QVKUniformBuffer_t *ubo); VkResult vkpt_fsr_do(VkCommandBuffer cmd_buf); VkResult vkpt_fsr_final_blit(VkCommandBuffer cmd_buf); From faa05e74f41b91029ca6b3f43e587178500a330d Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Wed, 1 Sep 2021 23:08:23 +0200 Subject: [PATCH 27/55] Default FSR to an 'upscale only' option --- baseq2/q2rtx.menu | 2 +- src/refresh/vkpt/fsr.c | 13 ++++++++++++- src/refresh/vkpt/main.c | 6 ++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/baseq2/q2rtx.menu b/baseq2/q2rtx.menu index f27f37c72..379a2f93e 100644 --- a/baseq2/q2rtx.menu +++ b/baseq2/q2rtx.menu @@ -125,7 +125,7 @@ begin video range -p -f "%.0f%%" "contrast" tm_reinhard 0 1 0.1 range "texture LOD bias" pt_texture_lod_bias -2 2 0.5 pairs "anti-aliasing" flt_taa "none" 0 "temporal AA" 1 "temporal upscaling" 2 - toggle "FSR" flt_fsr_enable + pairs "FSR" flt_fsr_enable "off" 0 "for upscaling" 1 "always" 2 range --status "lower is sharper" "FSR sharpness" flt_fsr_sharpness 0 2 0.01 pairs "global illumination" pt_num_bounce_rays low 0.5 medium 1 high 2 pairs "reflection/refraction depth" pt_reflect_refract off 0 1 1 2 2 4 4 8 8 diff --git a/src/refresh/vkpt/fsr.c b/src/refresh/vkpt/fsr.c index 9a44afba3..82bb50fd5 100644 --- a/src/refresh/vkpt/fsr.c +++ b/src/refresh/vkpt/fsr.c @@ -124,7 +124,18 @@ vkpt_fsr_destroy_pipelines() qboolean vkpt_fsr_is_enabled() { - return (cvar_flt_fsr_enable->integer != 0) && ((cvar_flt_fsr_easu->integer != 0) || (cvar_flt_fsr_rcas->integer != 0)); + if (cvar_flt_fsr_enable->integer == 0) + return qfalse; + + if ((cvar_flt_fsr_enable->integer == 1) + && (qvk.extent_render.width > qvk.extent_unscaled.width || qvk.extent_render.height > qvk.extent_unscaled.height)) + { + // "upscale only" option + return qfalse; + } + + // Need one of EASU or RCAS enabled + return (cvar_flt_fsr_easu->integer != 0) || (cvar_flt_fsr_rcas->integer != 0); } qboolean vkpt_fsr_needs_upscale() diff --git a/src/refresh/vkpt/main.c b/src/refresh/vkpt/main.c index b8f155c66..25202cf3d 100644 --- a/src/refresh/vkpt/main.c +++ b/src/refresh/vkpt/main.c @@ -2518,6 +2518,8 @@ prepare_ubo(refdef_t *fd, mleaf_t* viewleaf, const reference_mode_t* ref_mode, c UBO_CVAR_LIST #undef UBO_CVAR_DO + qboolean fsr_enabled = vkpt_fsr_is_enabled(); + if (!ref_mode->enable_denoiser) { // disable fake specular because it is not supported without denoiser, and the result @@ -2538,7 +2540,7 @@ prepare_ubo(refdef_t *fd, mleaf_t* viewleaf, const reference_mode_t* ref_mode, c ubo->pt_ndf_trim = 1.f; } } - else if(vkpt_fsr_is_enabled() || (qvk.effective_aa_mode == AA_MODE_UPSCALE)) + else if(fsr_enabled || (qvk.effective_aa_mode == AA_MODE_UPSCALE)) { // adjust texture LOD bias to the resolution scale, i.e. use negative bias if scale is < 100 float resolution_scale = (drs_effective_scale != 0) ? (float)drs_effective_scale : (float)scr_viewsize->integer; @@ -2612,7 +2614,7 @@ prepare_ubo(refdef_t *fd, mleaf_t* viewleaf, const reference_mode_t* ref_mode, c } // Set up constants for FSR - if (vkpt_fsr_is_enabled()) + if (fsr_enabled) { vkpt_fsr_update_ubo(ubo); } From bef2c7b186266eff1ac0d0c06a694c3955034ff4 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Wed, 1 Sep 2021 23:18:46 +0200 Subject: [PATCH 28/55] Adjust menu entries according to recommendation --- baseq2/q2rtx.menu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/baseq2/q2rtx.menu b/baseq2/q2rtx.menu index 379a2f93e..05c6c5cc6 100644 --- a/baseq2/q2rtx.menu +++ b/baseq2/q2rtx.menu @@ -125,8 +125,8 @@ begin video range -p -f "%.0f%%" "contrast" tm_reinhard 0 1 0.1 range "texture LOD bias" pt_texture_lod_bias -2 2 0.5 pairs "anti-aliasing" flt_taa "none" 0 "temporal AA" 1 "temporal upscaling" 2 - pairs "FSR" flt_fsr_enable "off" 0 "for upscaling" 1 "always" 2 - range --status "lower is sharper" "FSR sharpness" flt_fsr_sharpness 0 2 0.01 + pairs "AMD FSR 1.0" flt_fsr_enable "off" 0 "for upscaling" 1 "always" 2 + range --status "lower is sharper" "AMD FSR 1.0 sharpness" flt_fsr_sharpness 0 2 0.01 pairs "global illumination" pt_num_bounce_rays low 0.5 medium 1 high 2 pairs "reflection/refraction depth" pt_reflect_refract off 0 1 1 2 2 4 4 8 8 toggle --status "turn some monitors in the game into security camera views" \ From 227495cde026a66d3e581adf2d852e37dcb56434 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Thu, 9 Sep 2021 12:52:51 +0200 Subject: [PATCH 29/55] Prefer VK_TRUE/VK_FALSE in VkPhysicalDeviceFeatures2 definition --- src/refresh/vkpt/main.c | 110 ++++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/src/refresh/vkpt/main.c b/src/refresh/vkpt/main.c index 25202cf3d..d98d7a037 100644 --- a/src/refresh/vkpt/main.c +++ b/src/refresh/vkpt/main.c @@ -1169,61 +1169,61 @@ init_vulkan() VkPhysicalDeviceFeatures2 device_features = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR, .features = { - .robustBufferAccess = 1, - .fullDrawIndexUint32 = 1, - .imageCubeArray = 1, - .independentBlend = 1, - .geometryShader = 0, - .tessellationShader = 0, - .sampleRateShading = 0, - .dualSrcBlend = 0, - .logicOp = 0, - .multiDrawIndirect = 0, - .drawIndirectFirstInstance = 0, - .depthClamp = 0, - .depthBiasClamp = 0, - .fillModeNonSolid = 0, - .depthBounds = 0, - .wideLines = 0, - .largePoints = 0, - .alphaToOne = 0, - .multiViewport = 0, - .samplerAnisotropy = 1, - .textureCompressionETC2 = 0, - .textureCompressionASTC_LDR = 0, - .textureCompressionBC = 0, - .occlusionQueryPrecise = 0, - .pipelineStatisticsQuery = 1, - .vertexPipelineStoresAndAtomics = 0, - .fragmentStoresAndAtomics = 0, - .shaderTessellationAndGeometryPointSize = 0, - .shaderImageGatherExtended = 0, - .shaderStorageImageExtendedFormats = 1, - .shaderStorageImageMultisample = 0, - .shaderStorageImageReadWithoutFormat = 0, - .shaderStorageImageWriteWithoutFormat = 0, - .shaderUniformBufferArrayDynamicIndexing = 1, - .shaderSampledImageArrayDynamicIndexing = 1, - .shaderStorageBufferArrayDynamicIndexing = 1, - .shaderStorageImageArrayDynamicIndexing = 1, - .shaderClipDistance = 0, - .shaderCullDistance = 0, - .shaderFloat64 = 0, - .shaderInt64 = 0, - .shaderInt16 = 0, - .shaderResourceResidency = 0, - .shaderResourceMinLod = 0, - .sparseBinding = 1, - .sparseResidencyBuffer = 0, - .sparseResidencyImage2D = 0, - .sparseResidencyImage3D = 0, - .sparseResidency2Samples = 0, - .sparseResidency4Samples = 0, - .sparseResidency8Samples = 0, - .sparseResidency16Samples = 0, - .sparseResidencyAliased = 0, - .variableMultisampleRate = 0, - .inheritedQueries = 0, + .robustBufferAccess = VK_TRUE, + .fullDrawIndexUint32 = VK_TRUE, + .imageCubeArray = VK_TRUE, + .independentBlend = VK_TRUE, + .geometryShader = VK_FALSE, + .tessellationShader = VK_FALSE, + .sampleRateShading = VK_FALSE, + .dualSrcBlend = VK_FALSE, + .logicOp = VK_FALSE, + .multiDrawIndirect = VK_FALSE, + .drawIndirectFirstInstance = VK_FALSE, + .depthClamp = VK_FALSE, + .depthBiasClamp = VK_FALSE, + .fillModeNonSolid = VK_FALSE, + .depthBounds = VK_FALSE, + .wideLines = VK_FALSE, + .largePoints = VK_FALSE, + .alphaToOne = VK_FALSE, + .multiViewport = VK_FALSE, + .samplerAnisotropy = VK_TRUE, + .textureCompressionETC2 = VK_FALSE, + .textureCompressionASTC_LDR = VK_FALSE, + .textureCompressionBC = VK_FALSE, + .occlusionQueryPrecise = VK_FALSE, + .pipelineStatisticsQuery = VK_TRUE, + .vertexPipelineStoresAndAtomics = VK_FALSE, + .fragmentStoresAndAtomics = VK_FALSE, + .shaderTessellationAndGeometryPointSize = VK_FALSE, + .shaderImageGatherExtended = VK_FALSE, + .shaderStorageImageExtendedFormats = VK_TRUE, + .shaderStorageImageMultisample = VK_FALSE, + .shaderStorageImageReadWithoutFormat = VK_FALSE, + .shaderStorageImageWriteWithoutFormat = VK_FALSE, + .shaderUniformBufferArrayDynamicIndexing = VK_TRUE, + .shaderSampledImageArrayDynamicIndexing = VK_TRUE, + .shaderStorageBufferArrayDynamicIndexing = VK_TRUE, + .shaderStorageImageArrayDynamicIndexing = VK_TRUE, + .shaderClipDistance = VK_FALSE, + .shaderCullDistance = VK_FALSE, + .shaderFloat64 = VK_FALSE, + .shaderInt64 = VK_FALSE, + .shaderInt16 = VK_FALSE, + .shaderResourceResidency = VK_FALSE, + .shaderResourceMinLod = VK_FALSE, + .sparseBinding = VK_TRUE, + .sparseResidencyBuffer = VK_FALSE, + .sparseResidencyImage2D = VK_FALSE, + .sparseResidencyImage3D = VK_FALSE, + .sparseResidency2Samples = VK_FALSE, + .sparseResidency4Samples = VK_FALSE, + .sparseResidency8Samples = VK_FALSE, + .sparseResidency16Samples = VK_FALSE, + .sparseResidencyAliased = VK_FALSE, + .variableMultisampleRate = VK_FALSE, + .inheritedQueries = VK_FALSE, } }; VkDeviceCreateInfo dev_create_info = { From 63713ab7fe2bb5cedc7c57dbafadf761e8234172 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Thu, 9 Sep 2021 12:55:11 +0200 Subject: [PATCH 30/55] Make use of VkPhysicalDeviceVulkan12Features --- src/refresh/vkpt/main.c | 47 ++++++++++++++--------------------------- 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/src/refresh/vkpt/main.c b/src/refresh/vkpt/main.c index d98d7a037..991ae5b10 100644 --- a/src/refresh/vkpt/main.c +++ b/src/refresh/vkpt/main.c @@ -381,8 +381,6 @@ const char *vk_requested_instance_extensions[] = { const char *vk_requested_device_extensions_common[] = { VK_KHR_SWAPCHAIN_EXTENSION_NAME, - VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME, - VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME, #ifdef VKPT_DEVICE_GROUPS VK_KHR_DEVICE_GROUP_EXTENSION_NAME, VK_KHR_BIND_MEMORY_2_EXTENSION_NAME, @@ -1124,50 +1122,37 @@ init_vulkan() queue_create_info[num_create_queues++] = q; }; - VkPhysicalDeviceDescriptorIndexingFeatures idx_features = { - .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES, - .runtimeDescriptorArray = 1, - .shaderSampledImageArrayNonUniformIndexing = 1, - .shaderStorageBufferArrayNonUniformIndexing = 1 - }; - -#ifdef VKPT_DEVICE_GROUPS - if (qvk.device_count > 1) { - idx_features.pNext = &device_group_create_info; - } -#endif VkPhysicalDeviceAccelerationStructureFeaturesKHR physical_device_as_features = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR, - .pNext = &idx_features, + .pNext = (qvk.device_count > 1) ? &device_group_create_info : NULL, .accelerationStructure = VK_TRUE, }; - VkPhysicalDeviceBufferDeviceAddressFeatures physical_device_address_features = { - .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES, - .pNext = &physical_device_as_features, - .bufferDeviceAddress = VK_TRUE - }; - -#ifdef VKPT_DEVICE_GROUPS - if (qvk.device_count > 1) { - physical_device_address_features.bufferDeviceAddressMultiDevice = VK_TRUE; - } -#endif - VkPhysicalDeviceRayTracingPipelineFeaturesKHR physical_device_rt_pipeline_features = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR, - .pNext = &physical_device_address_features, + .pNext = &physical_device_as_features, .rayTracingPipeline = VK_TRUE }; VkPhysicalDeviceRayQueryFeaturesKHR physical_device_ray_query_features = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR, - .pNext = &physical_device_address_features, + .pNext = &physical_device_as_features, .rayQuery = VK_TRUE }; + VkPhysicalDeviceVulkan12Features device_features_vk12 = { + .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, + .descriptorIndexing = VK_TRUE, + .shaderSampledImageArrayNonUniformIndexing = VK_TRUE, + .shaderStorageBufferArrayNonUniformIndexing = VK_TRUE, + .runtimeDescriptorArray = VK_TRUE, + .samplerFilterMinmax = VK_TRUE, + .bufferDeviceAddress = VK_TRUE, + .bufferDeviceAddressMultiDevice = qvk.device_count > 1 ? VK_TRUE : VK_FALSE, + }; VkPhysicalDeviceFeatures2 device_features = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR, + .pNext = &device_features_vk12, .features = { .robustBufferAccess = VK_TRUE, .fullDrawIndexUint32 = VK_TRUE, @@ -1248,14 +1233,14 @@ init_vulkan() append_string_list(device_extensions, &device_extension_count, max_extension_count, vk_requested_device_extensions_ray_query, LENGTH(vk_requested_device_extensions_ray_query)); - device_features.pNext = &physical_device_ray_query_features; + device_features_vk12.pNext = &physical_device_ray_query_features; } else { append_string_list(device_extensions, &device_extension_count, max_extension_count, vk_requested_device_extensions_ray_pipeline, LENGTH(vk_requested_device_extensions_ray_pipeline)); - device_features.pNext = &physical_device_rt_pipeline_features; + device_features_vk12.pNext = &physical_device_rt_pipeline_features; } if (qvk.enable_validation) From 70cafd508e262d9e869e0320d6b1c5f094c1242c Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Thu, 9 Sep 2021 13:04:25 +0200 Subject: [PATCH 31/55] Use FP16 variants of FSR shader programs, if supported --- src/CMakeLists.txt | 6 ++-- src/refresh/vkpt/fsr.c | 8 +++-- src/refresh/vkpt/main.c | 29 +++++++++++++-- .../shader/{fsr_easu.comp => fsr_easu.glsl} | 30 ++++++---------- src/refresh/vkpt/shader/fsr_easu_fp16.comp | 34 ++++++++++++++++++ src/refresh/vkpt/shader/fsr_easu_fp32.comp | 33 +++++++++++++++++ .../shader/{fsr_rcas.comp => fsr_rcas.glsl} | 26 +++++--------- src/refresh/vkpt/shader/fsr_rcas_fp16.comp | 35 +++++++++++++++++++ src/refresh/vkpt/shader/fsr_rcas_fp32.comp | 34 ++++++++++++++++++ src/refresh/vkpt/vkpt.h | 7 ++-- 10 files changed, 197 insertions(+), 45 deletions(-) rename src/refresh/vkpt/shader/{fsr_easu.comp => fsr_easu.glsl} (65%) create mode 100644 src/refresh/vkpt/shader/fsr_easu_fp16.comp create mode 100644 src/refresh/vkpt/shader/fsr_easu_fp32.comp rename src/refresh/vkpt/shader/{fsr_rcas.comp => fsr_rcas.glsl} (72%) create mode 100644 src/refresh/vkpt/shader/fsr_rcas_fp16.comp create mode 100644 src/refresh/vkpt/shader/fsr_rcas_fp32.comp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3af21e00a..1216bf40a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -330,8 +330,10 @@ set(SRC_SHADERS refresh/vkpt/shader/stretch_pic.vert refresh/vkpt/shader/final_blit_lanczos.frag refresh/vkpt/shader/final_blit.vert - refresh/vkpt/shader/fsr_easu.comp - refresh/vkpt/shader/fsr_rcas.comp + refresh/vkpt/shader/fsr_easu_fp16.comp + refresh/vkpt/shader/fsr_easu_fp32.comp + refresh/vkpt/shader/fsr_rcas_fp16.comp + refresh/vkpt/shader/fsr_rcas_fp32.comp ) set(SRC_RT_SHADERS diff --git a/src/refresh/vkpt/fsr.c b/src/refresh/vkpt/fsr.c index 82bb50fd5..5a165586e 100644 --- a/src/refresh/vkpt/fsr.c +++ b/src/refresh/vkpt/fsr.c @@ -91,20 +91,22 @@ vkpt_fsr_create_pipelines() { .mapEntryCount = 1, .pMapEntries = specEntries, .dataSize = sizeof(uint32_t), .pData = &spec_data[1] }, }; + enum QVK_SHADER_MODULES qvk_mod_easu = qvk.supports_fp16 ? QVK_MOD_FSR_EASU_FP16_COMP : QVK_MOD_FSR_EASU_FP32_COMP; + enum QVK_SHADER_MODULES qvk_mod_rcas = qvk.supports_fp16 ? QVK_MOD_FSR_RCAS_FP16_COMP : QVK_MOD_FSR_RCAS_FP32_COMP; VkComputePipelineCreateInfo pipeline_info[FSR_NUM_PIPELINES] = { [FSR_EASU] = { .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = SHADER_STAGE(QVK_MOD_FSR_EASU_COMP, VK_SHADER_STAGE_COMPUTE_BIT), + .stage = SHADER_STAGE(qvk_mod_easu, VK_SHADER_STAGE_COMPUTE_BIT), .layout = pipeline_layout_fsr, }, [FSR_RCAS_AFTER_EASU] = { .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = SHADER_STAGE_SPEC(QVK_MOD_FSR_RCAS_COMP, VK_SHADER_STAGE_COMPUTE_BIT, &specInfo[0]), + .stage = SHADER_STAGE_SPEC(qvk_mod_rcas, VK_SHADER_STAGE_COMPUTE_BIT, &specInfo[0]), .layout = pipeline_layout_fsr, }, [FSR_RCAS_AFTER_TAAU] = { .sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO, - .stage = SHADER_STAGE_SPEC(QVK_MOD_FSR_RCAS_COMP, VK_SHADER_STAGE_COMPUTE_BIT, &specInfo[1]), + .stage = SHADER_STAGE_SPEC(qvk_mod_rcas, VK_SHADER_STAGE_COMPUTE_BIT, &specInfo[1]), .layout = pipeline_layout_fsr, }, }; diff --git a/src/refresh/vkpt/main.c b/src/refresh/vkpt/main.c index 991ae5b10..b51fa12e3 100644 --- a/src/refresh/vkpt/main.c +++ b/src/refresh/vkpt/main.c @@ -1060,6 +1060,24 @@ init_vulkan() #endif } + // Query device 16-bit float capabilities + VkPhysicalDevice16BitStorageFeatures features_16bit_storage = { + .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES, + }; + { + VkPhysicalDeviceVulkan12Features device_features_1_2 = { + .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, + .pNext = &features_16bit_storage + }; + VkPhysicalDeviceFeatures2 device_features = { + .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR, + .pNext = &device_features_1_2 + }; + vkGetPhysicalDeviceFeatures2(qvk.physical_device, &device_features); + qvk.supports_fp16 = device_features_1_2.shaderFloat16 && features_16bit_storage.storageBuffer16BitAccess; + } + Com_Printf("FP16 support: %s\n", qvk.supports_fp16 ? "yes" : "no"); + vkGetPhysicalDeviceMemoryProperties(qvk.physical_device, &qvk.mem_properties); /* queue family and create physical device */ @@ -1122,9 +1140,15 @@ init_vulkan() queue_create_info[num_create_queues++] = q; }; +#ifdef VKPT_DEVICE_GROUPS + if (qvk.device_count > 1) { + features_16bit_storage.pNext = &device_group_create_info; + } +#endif + VkPhysicalDeviceAccelerationStructureFeaturesKHR physical_device_as_features = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR, - .pNext = (qvk.device_count > 1) ? &device_group_create_info : NULL, + .pNext = &features_16bit_storage, .accelerationStructure = VK_TRUE, }; @@ -1143,6 +1167,7 @@ init_vulkan() VkPhysicalDeviceVulkan12Features device_features_vk12 = { .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES, .descriptorIndexing = VK_TRUE, + .shaderFloat16 = qvk.supports_fp16, .shaderSampledImageArrayNonUniformIndexing = VK_TRUE, .shaderStorageBufferArrayNonUniformIndexing = VK_TRUE, .runtimeDescriptorArray = VK_TRUE, @@ -1195,7 +1220,7 @@ init_vulkan() .shaderCullDistance = VK_FALSE, .shaderFloat64 = VK_FALSE, .shaderInt64 = VK_FALSE, - .shaderInt16 = VK_FALSE, + .shaderInt16 = qvk.supports_fp16, .shaderResourceResidency = VK_FALSE, .shaderResourceMinLod = VK_FALSE, .sparseBinding = VK_TRUE, diff --git a/src/refresh/vkpt/shader/fsr_easu.comp b/src/refresh/vkpt/shader/fsr_easu.glsl similarity index 65% rename from src/refresh/vkpt/shader/fsr_easu.comp rename to src/refresh/vkpt/shader/fsr_easu.glsl index b8ce9e95e..7eb234cb6 100644 --- a/src/refresh/vkpt/shader/fsr_easu.comp +++ b/src/refresh/vkpt/shader/fsr_easu.glsl @@ -16,11 +16,6 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#version 450 -#extension GL_GOOGLE_include_directive : enable -#extension GL_ARB_separate_shader_objects : enable -#extension GL_EXT_nonuniform_qualifier : enable - #include "utils.glsl" #define GLOBAL_UBO_DESC_SET_IDX 0 @@ -31,9 +26,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #define A_GPU 1 #define A_GLSL 1 -//#define A_HALF // TODO - -#define FSR_EASU_F 1 #include "ffx_a.h" #include "ffx_fsr1.h" @@ -41,17 +33,17 @@ with this program; if not, write to the Free Software Foundation, Inc., layout(local_size_x=64) in; // Input: TEX_TAA_OUTPUT -AF4 FsrEasuRF(AF2 p) +fsr_vec4 FsrEasuR(AF2 p) { - return textureGather(TEX_TAA_OUTPUT, p, 0); + return fsr_vec4(textureGather(TEX_TAA_OUTPUT, p, 0)); } -AF4 FsrEasuGF(AF2 p) +fsr_vec4 FsrEasuG(AF2 p) { - return textureGather(TEX_TAA_OUTPUT, p, 1); + return fsr_vec4(textureGather(TEX_TAA_OUTPUT, p, 1)); } -AF4 FsrEasuBF(AF2 p) +fsr_vec4 FsrEasuB(AF2 p) { - return textureGather(TEX_TAA_OUTPUT, p, 2); + return fsr_vec4(textureGather(TEX_TAA_OUTPUT, p, 2)); } @@ -63,19 +55,19 @@ void main() // Do remapping of local xy in workgroup for a more PS-like swizzle pattern. AU2 gxy = ARmp8x8(gl_LocalInvocationID.x) + AU2(gl_WorkGroupID.x << 4u, gl_WorkGroupID.y << 4u); - AF3 color; - FsrEasuF(color, gxy, global_ubo.easu_const0, global_ubo.easu_const1, global_ubo.easu_const2, global_ubo.easu_const3); + fsr_vec3 color; + FsrEasu(color, gxy, global_ubo.easu_const0, global_ubo.easu_const1, global_ubo.easu_const2, global_ubo.easu_const3); imageStore(IMG_FSR_EASU_OUTPUT, ivec2(gxy), vec4(color, 1)); gxy.x += 8; - FsrEasuF(color, gxy, global_ubo.easu_const0, global_ubo.easu_const1, global_ubo.easu_const2, global_ubo.easu_const3); + FsrEasu(color, gxy, global_ubo.easu_const0, global_ubo.easu_const1, global_ubo.easu_const2, global_ubo.easu_const3); imageStore(IMG_FSR_EASU_OUTPUT, ivec2(gxy), vec4(color, 1)); gxy.y += 8; - FsrEasuF(color, gxy, global_ubo.easu_const0, global_ubo.easu_const1, global_ubo.easu_const2, global_ubo.easu_const3); + FsrEasu(color, gxy, global_ubo.easu_const0, global_ubo.easu_const1, global_ubo.easu_const2, global_ubo.easu_const3); imageStore(IMG_FSR_EASU_OUTPUT, ivec2(gxy), vec4(color, 1)); gxy.x -= 8; - FsrEasuF(color, gxy, global_ubo.easu_const0, global_ubo.easu_const1, global_ubo.easu_const2, global_ubo.easu_const3); + FsrEasu(color, gxy, global_ubo.easu_const0, global_ubo.easu_const1, global_ubo.easu_const2, global_ubo.easu_const3); imageStore(IMG_FSR_EASU_OUTPUT, ivec2(gxy), vec4(color, 1)); } diff --git a/src/refresh/vkpt/shader/fsr_easu_fp16.comp b/src/refresh/vkpt/shader/fsr_easu_fp16.comp new file mode 100644 index 000000000..994e6a2ac --- /dev/null +++ b/src/refresh/vkpt/shader/fsr_easu_fp16.comp @@ -0,0 +1,34 @@ +/* +Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#version 450 +#extension GL_GOOGLE_include_directive : enable +#extension GL_ARB_separate_shader_objects : enable +#extension GL_EXT_nonuniform_qualifier : enable + +#define A_HALF +#define FSR_EASU_H 1 + +#define fsr_vec3 AH3 +#define fsr_vec4 AH4 +#define FsrEasu FsrEasuH +#define FsrEasuR FsrEasuRH +#define FsrEasuG FsrEasuGH +#define FsrEasuB FsrEasuBH + +#include "fsr_easu.glsl" diff --git a/src/refresh/vkpt/shader/fsr_easu_fp32.comp b/src/refresh/vkpt/shader/fsr_easu_fp32.comp new file mode 100644 index 000000000..2c755b0c8 --- /dev/null +++ b/src/refresh/vkpt/shader/fsr_easu_fp32.comp @@ -0,0 +1,33 @@ +/* +Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#version 450 +#extension GL_GOOGLE_include_directive : enable +#extension GL_ARB_separate_shader_objects : enable +#extension GL_EXT_nonuniform_qualifier : enable + +#define FSR_EASU_F 1 + +#define fsr_vec3 AF3 +#define fsr_vec4 AF4 +#define FsrEasu FsrEasuF +#define FsrEasuR FsrEasuRF +#define FsrEasuG FsrEasuGF +#define FsrEasuB FsrEasuBF + +#include "fsr_easu.glsl" diff --git a/src/refresh/vkpt/shader/fsr_rcas.comp b/src/refresh/vkpt/shader/fsr_rcas.glsl similarity index 72% rename from src/refresh/vkpt/shader/fsr_rcas.comp rename to src/refresh/vkpt/shader/fsr_rcas.glsl index ffa235137..e4628b261 100644 --- a/src/refresh/vkpt/shader/fsr_rcas.comp +++ b/src/refresh/vkpt/shader/fsr_rcas.glsl @@ -16,11 +16,6 @@ with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#version 450 -#extension GL_GOOGLE_include_directive : enable -#extension GL_ARB_separate_shader_objects : enable -#extension GL_EXT_nonuniform_qualifier : enable - layout(constant_id = 0) const uint spec_input_tex = 0; #include "utils.glsl" @@ -33,25 +28,22 @@ layout(constant_id = 0) const uint spec_input_tex = 0; #define A_GPU 1 #define A_GLSL 1 -//#define A_HALF // TODO - -#define FSR_RCAS_F 1 #include "ffx_a.h" #include "ffx_fsr1.h" layout(local_size_x=64) in; -AF4 FsrRcasLoadF(ASU2 p) +fsr_vec4 FsrRcasLoad(load_coord p) { if(spec_input_tex == 0) // RCAS after EASU - return texelFetch(TEX_FSR_EASU_OUTPUT, ivec2(p), 0); + return fsr_vec4(texelFetch(TEX_FSR_EASU_OUTPUT, ivec2(p), 0)); else // RCAS after TAAU - return texelFetch(TEX_TAA_OUTPUT, ivec2(p), 0); + return fsr_vec4(texelFetch(TEX_TAA_OUTPUT, ivec2(p), 0)); } -void FsrRcasInputF(inout AF1 r, inout AF1 g, inout AF1 b) {} +void FsrRcasInput(inout fsr_val r, inout fsr_val g, inout fsr_val b) {} void main() @@ -62,19 +54,19 @@ void main() // Do remapping of local xy in workgroup for a more PS-like swizzle pattern. AU2 gxy = ARmp8x8(gl_LocalInvocationID.x) + AU2(gl_WorkGroupID.x << 4u, gl_WorkGroupID.y << 4u); - AF3 color; - FsrRcasF(color.r, color.g, color.b, gxy, global_ubo.rcas_const0); + fsr_vec3 color; + FsrRcas(color.r, color.g, color.b, gxy, global_ubo.rcas_const0); imageStore(IMG_FSR_RCAS_OUTPUT, ivec2(gxy), vec4(color, 1)); gxy.x += 8; - FsrRcasF(color.r, color.g, color.b, gxy, global_ubo.rcas_const0); + FsrRcas(color.r, color.g, color.b, gxy, global_ubo.rcas_const0); imageStore(IMG_FSR_RCAS_OUTPUT, ivec2(gxy), vec4(color, 1)); gxy.y += 8; - FsrRcasF(color.r, color.g, color.b, gxy, global_ubo.rcas_const0); + FsrRcas(color.r, color.g, color.b, gxy, global_ubo.rcas_const0); imageStore(IMG_FSR_RCAS_OUTPUT, ivec2(gxy), vec4(color, 1)); gxy.x -= 8; - FsrRcasF(color.r, color.g, color.b, gxy, global_ubo.rcas_const0); + FsrRcas(color.r, color.g, color.b, gxy, global_ubo.rcas_const0); imageStore(IMG_FSR_RCAS_OUTPUT, ivec2(gxy), vec4(color, 1)); } diff --git a/src/refresh/vkpt/shader/fsr_rcas_fp16.comp b/src/refresh/vkpt/shader/fsr_rcas_fp16.comp new file mode 100644 index 000000000..0886edda5 --- /dev/null +++ b/src/refresh/vkpt/shader/fsr_rcas_fp16.comp @@ -0,0 +1,35 @@ +/* +Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#version 450 +#extension GL_GOOGLE_include_directive : enable +#extension GL_ARB_separate_shader_objects : enable +#extension GL_EXT_nonuniform_qualifier : enable + +#define A_HALF +#define FSR_RCAS_H 1 + +#define fsr_val AH1 +#define fsr_vec3 AH3 +#define fsr_vec4 AH4 +#define FsrRcas FsrRcasH +#define FsrRcasLoad FsrRcasLoadH +#define load_coord ASW2 +#define FsrRcasInput FsrRcasInputH + +#include "fsr_rcas.glsl" diff --git a/src/refresh/vkpt/shader/fsr_rcas_fp32.comp b/src/refresh/vkpt/shader/fsr_rcas_fp32.comp new file mode 100644 index 000000000..99bcb76a6 --- /dev/null +++ b/src/refresh/vkpt/shader/fsr_rcas_fp32.comp @@ -0,0 +1,34 @@ +/* +Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#version 450 +#extension GL_GOOGLE_include_directive : enable +#extension GL_ARB_separate_shader_objects : enable +#extension GL_EXT_nonuniform_qualifier : enable + +#define FSR_RCAS_F 1 + +#define fsr_val AF1 +#define fsr_vec3 AF3 +#define fsr_vec4 AF4 +#define FsrRcas FsrRcasF +#define FsrRcasLoad FsrRcasLoadF +#define load_coord ASU2 +#define FsrRcasInput FsrRcasInputF + +#include "fsr_rcas.glsl" diff --git a/src/refresh/vkpt/vkpt.h b/src/refresh/vkpt/vkpt.h index 4b3f737eb..9cd76bdd9 100644 --- a/src/refresh/vkpt/vkpt.h +++ b/src/refresh/vkpt/vkpt.h @@ -95,8 +95,10 @@ with this program; if not, write to the Free Software Foundation, Inc., SHADER_MODULE_DO(QVK_MOD_GOD_RAYS_FILTER_COMP) \ SHADER_MODULE_DO(QVK_MOD_SHADOW_MAP_VERT) \ SHADER_MODULE_DO(QVK_MOD_COMPOSITING_COMP) \ - SHADER_MODULE_DO(QVK_MOD_FSR_EASU_COMP) \ - SHADER_MODULE_DO(QVK_MOD_FSR_RCAS_COMP) \ + SHADER_MODULE_DO(QVK_MOD_FSR_EASU_FP16_COMP) \ + SHADER_MODULE_DO(QVK_MOD_FSR_EASU_FP32_COMP) \ + SHADER_MODULE_DO(QVK_MOD_FSR_RCAS_FP16_COMP) \ + SHADER_MODULE_DO(QVK_MOD_FSR_RCAS_FP32_COMP) \ #define LIST_RT_RGEN_SHADER_MODULES \ SHADER_MODULE_DO(QVK_MOD_PRIMARY_RAYS_RGEN) \ @@ -196,6 +198,7 @@ typedef struct QVK_s { qboolean use_ray_query; qboolean enable_validation; + qboolean supports_fp16; cmd_buf_group_t cmd_buffers_graphics; cmd_buf_group_t cmd_buffers_transfer; From 82a88c75dc35d1bedf18a1a1213615c7902a06f6 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Thu, 9 Sep 2021 15:21:52 +0200 Subject: [PATCH 32/55] Change FSR menu entry to a toggle --- baseq2/q2rtx.menu | 2 +- src/refresh/vkpt/fsr.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/baseq2/q2rtx.menu b/baseq2/q2rtx.menu index 05c6c5cc6..c3d9d26be 100644 --- a/baseq2/q2rtx.menu +++ b/baseq2/q2rtx.menu @@ -125,7 +125,7 @@ begin video range -p -f "%.0f%%" "contrast" tm_reinhard 0 1 0.1 range "texture LOD bias" pt_texture_lod_bias -2 2 0.5 pairs "anti-aliasing" flt_taa "none" 0 "temporal AA" 1 "temporal upscaling" 2 - pairs "AMD FSR 1.0" flt_fsr_enable "off" 0 "for upscaling" 1 "always" 2 + toggle "AMD FSR 1.0" flt_fsr_enable range --status "lower is sharper" "AMD FSR 1.0 sharpness" flt_fsr_sharpness 0 2 0.01 pairs "global illumination" pt_num_bounce_rays low 0.5 medium 1 high 2 pairs "reflection/refraction depth" pt_reflect_refract off 0 1 1 2 2 4 4 8 8 diff --git a/src/refresh/vkpt/fsr.c b/src/refresh/vkpt/fsr.c index 5a165586e..bf707597d 100644 --- a/src/refresh/vkpt/fsr.c +++ b/src/refresh/vkpt/fsr.c @@ -130,9 +130,9 @@ qboolean vkpt_fsr_is_enabled() return qfalse; if ((cvar_flt_fsr_enable->integer == 1) - && (qvk.extent_render.width > qvk.extent_unscaled.width || qvk.extent_render.height > qvk.extent_unscaled.height)) + && (qvk.extent_render.width >= qvk.extent_unscaled.width || qvk.extent_render.height >= qvk.extent_unscaled.height)) { - // "upscale only" option + // Only apply when upscaling by default (but allow tweaking this from the console) return qfalse; } From 28ce2bb8a7b722fae3156f0afa12a7183ebd220b Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Thu, 16 Sep 2021 11:48:57 +0200 Subject: [PATCH 33/55] Update copyright on new FSR-related files --- src/refresh/vkpt/fsr.c | 1 + src/refresh/vkpt/shader/fsr_easu.glsl | 1 + src/refresh/vkpt/shader/fsr_easu_fp16.comp | 1 + src/refresh/vkpt/shader/fsr_easu_fp32.comp | 1 + src/refresh/vkpt/shader/fsr_rcas.glsl | 1 + src/refresh/vkpt/shader/fsr_rcas_fp16.comp | 1 + src/refresh/vkpt/shader/fsr_rcas_fp32.comp | 1 + 7 files changed, 7 insertions(+) diff --git a/src/refresh/vkpt/fsr.c b/src/refresh/vkpt/fsr.c index bf707597d..513a78bd5 100644 --- a/src/refresh/vkpt/fsr.c +++ b/src/refresh/vkpt/fsr.c @@ -1,6 +1,7 @@ /* Copyright (C) 2018 Christoph Schied Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. +Copyright (C) 2021, Frank Richter. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/refresh/vkpt/shader/fsr_easu.glsl b/src/refresh/vkpt/shader/fsr_easu.glsl index 7eb234cb6..a5a7d8c94 100644 --- a/src/refresh/vkpt/shader/fsr_easu.glsl +++ b/src/refresh/vkpt/shader/fsr_easu.glsl @@ -1,5 +1,6 @@ /* Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. +Copyright (C) 2021, Frank Richter. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/refresh/vkpt/shader/fsr_easu_fp16.comp b/src/refresh/vkpt/shader/fsr_easu_fp16.comp index 994e6a2ac..3f7e0fb67 100644 --- a/src/refresh/vkpt/shader/fsr_easu_fp16.comp +++ b/src/refresh/vkpt/shader/fsr_easu_fp16.comp @@ -1,5 +1,6 @@ /* Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. +Copyright (C) 2021, Frank Richter. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/refresh/vkpt/shader/fsr_easu_fp32.comp b/src/refresh/vkpt/shader/fsr_easu_fp32.comp index 2c755b0c8..623a4e2d9 100644 --- a/src/refresh/vkpt/shader/fsr_easu_fp32.comp +++ b/src/refresh/vkpt/shader/fsr_easu_fp32.comp @@ -1,5 +1,6 @@ /* Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. +Copyright (C) 2021, Frank Richter. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/refresh/vkpt/shader/fsr_rcas.glsl b/src/refresh/vkpt/shader/fsr_rcas.glsl index e4628b261..3486344e4 100644 --- a/src/refresh/vkpt/shader/fsr_rcas.glsl +++ b/src/refresh/vkpt/shader/fsr_rcas.glsl @@ -1,5 +1,6 @@ /* Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. +Copyright (C) 2021, Frank Richter. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/refresh/vkpt/shader/fsr_rcas_fp16.comp b/src/refresh/vkpt/shader/fsr_rcas_fp16.comp index 0886edda5..0a3f59187 100644 --- a/src/refresh/vkpt/shader/fsr_rcas_fp16.comp +++ b/src/refresh/vkpt/shader/fsr_rcas_fp16.comp @@ -1,5 +1,6 @@ /* Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. +Copyright (C) 2021, Frank Richter. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/refresh/vkpt/shader/fsr_rcas_fp32.comp b/src/refresh/vkpt/shader/fsr_rcas_fp32.comp index 99bcb76a6..22f134fc5 100644 --- a/src/refresh/vkpt/shader/fsr_rcas_fp32.comp +++ b/src/refresh/vkpt/shader/fsr_rcas_fp32.comp @@ -1,5 +1,6 @@ /* Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. +Copyright (C) 2021, Frank Richter. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by From c3f7ac7960fdf9c303b36606a18a358c332dcc58 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Thu, 16 Sep 2021 11:56:52 +0200 Subject: [PATCH 34/55] Update 3rd party notices to list FSR code and include license text --- notice.txt | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/notice.txt b/notice.txt index 5fd671215..d296d190d 100644 --- a/notice.txt +++ b/notice.txt @@ -53,5 +53,32 @@ purposes only. Copyright © 2019 D Scott Boyce. All Rights Reserved. Subject to Creative Commons license version 1.0, +* FidelityFX Super Resolution 1.0 (FSR) Shader and Sample Code + Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. + Licensed under the terms of the "MIT" or "Expat" license, see below. + https://github.com/GPUOpen-Effects/FidelityFX-CAS + Roughness and specular channels were adjusted in texture maps to work with the Quake II RTX engine. + +FidelityFX Super Resolution 1.0 (FSR) License Notice +---------------------------------------------------- +Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. From 60942a5ead9f09c9d990446a5136c5df97af1ab6 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Thu, 16 Sep 2021 12:49:44 +0200 Subject: [PATCH 35/55] Add a number of comments throughout the FSR implementation --- src/refresh/vkpt/fsr.c | 55 ++++++++++++++++++++++ src/refresh/vkpt/shader/fsr_easu.glsl | 7 ++- src/refresh/vkpt/shader/fsr_easu_fp16.comp | 2 + src/refresh/vkpt/shader/fsr_easu_fp32.comp | 2 + src/refresh/vkpt/shader/fsr_rcas.glsl | 13 +++-- src/refresh/vkpt/shader/fsr_rcas_fp16.comp | 2 + src/refresh/vkpt/shader/fsr_rcas_fp32.comp | 2 + 7 files changed, 79 insertions(+), 4 deletions(-) diff --git a/src/refresh/vkpt/fsr.c b/src/refresh/vkpt/fsr.c index 513a78bd5..aa9db78e3 100644 --- a/src/refresh/vkpt/fsr.c +++ b/src/refresh/vkpt/fsr.c @@ -20,6 +20,56 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "vkpt.h" +/* + FidelityFX Super Resolution 1.0 ("FSR") implementation overview + =============================================================== + + FSR is a combination of an upscaling and a sharpening algorithm to produce + high-resolution output from low-resolution that is of high quality and + visually appealing. + + The input to FSR is the rendered image, in perceptual color space + (after tone mapping, sRGB), pre-antialiased, without HUD elements. + In our case the output from TAA fits this nicely. + + Step 1 is upscaling the input image to the output resolution + using the EASU ("Edge Adaptive Spatial Upsampling") algorithm. + This is implemented in the "fsr_easu" shader. + Shader inputs are various render dimensions, found in the global 'qvk' + structure. + + Step 2 is sharpening the image using the RCAS + ("Robust Contrast Adaptive Sharpening") algorithm. + This is implemented in the "fsr_rcas" shader. + Shader input is a "sharpness" value controlled by a cvar. + + For more details see the official documentation: + https://gpuopen.com/fidelityfx-superresolution/ + + Q2RTX cvars + ----------- + * flt_fsr_enable - 0 = disable FSR, 1 = enable FSR. + * flt_fsr_sharpness - float in the range [0,2] + Default is 0.2, a recommendation from the docs. + * flt_fsr_easu, flt_fsr_rcas - individual toggles for EASU and + RCAS steps. + The official docs ask nicely to only call it FSR when + both EASU and RCAS are used, so these options are not + exposed via the settings UI. These cvars are mainly provided + for testing purposes. + + Q2RTX FSR shaders + ----------------- + * Shader sources are the shader/fsr_* files, which in turn include + the headers in fsr/. Those headers actually contain the bulk of + the implementation (and are used from both C and GLSL). + * Shaders are compiled to FP16 and FP32 variants. FP16 is recommended + for best performance. However, there's actually hardware that can + run Q2RTX but doesn't have FP16 shader support (GTX 10 series), + so FP32 versions are provided for compatibility. + + */ + #define A_CPU #include "fsr/ffx_a.h" #include "fsr/ffx_fsr1.h" @@ -148,10 +198,13 @@ qboolean vkpt_fsr_needs_upscale() void vkpt_fsr_update_ubo(QVKUniformBuffer_t *ubo) { + // Set shader constants for FSR upscaling (EASU) pass FsrEasuCon(&ubo->easu_const0[0], &ubo->easu_const1[0], &ubo->easu_const2[0], &ubo->easu_const3[0], qvk.extent_render.width, qvk.extent_render.height, // render dimensions IMG_WIDTH_TAA, IMG_HEIGHT_TAA, // container texture dimensions qvk.extent_unscaled.width, qvk.extent_unscaled.height); // display dimensions + + // Set shader constants for FSR sharpening (RCAS) pass FsrRcasCon(&ubo->rcas_const0[0], cvar_flt_fsr_sharpness->value); } @@ -190,6 +243,7 @@ static void vkpt_fsr_easu(VkCommandBuffer cmd_buf) VkExtent2D dispatch_size = qvk.extent_unscaled; + // Dispatch size as described by the FSR Integration Overview vkCmdDispatch(cmd_buf, (dispatch_size.width + 15) / 16, (dispatch_size.height + 15) / 16, @@ -215,6 +269,7 @@ static void vkpt_fsr_rcas(VkCommandBuffer cmd_buf) VkExtent2D dispatch_size = qvk.extent_unscaled; + // Dispatch size as described by the FSR Integration Overview vkCmdDispatch(cmd_buf, (dispatch_size.width + 15) / 16, (dispatch_size.height + 15) / 16, diff --git a/src/refresh/vkpt/shader/fsr_easu.glsl b/src/refresh/vkpt/shader/fsr_easu.glsl index a5a7d8c94..1d0c8fedd 100644 --- a/src/refresh/vkpt/shader/fsr_easu.glsl +++ b/src/refresh/vkpt/shader/fsr_easu.glsl @@ -25,15 +25,19 @@ with this program; if not, write to the Free Software Foundation, Inc., #define GLOBAL_TEXTURES_DESC_SET_IDX 1 #include "global_textures.h" +/* FSR upsampling (EASU, "Edge Adaptive Spatial Upsampling") pass + * Also see overview in fsr.c */ + #define A_GPU 1 #define A_GLSL 1 +// Those headers contain the bulk of the implementation #include "ffx_a.h" #include "ffx_fsr1.h" layout(local_size_x=64) in; -// Input: TEX_TAA_OUTPUT +// Provide input for EASU, from TEX_TAA_OUTPUT fsr_vec4 FsrEasuR(AF2 p) { return fsr_vec4(textureGather(TEX_TAA_OUTPUT, p, 0)); @@ -56,6 +60,7 @@ void main() // Do remapping of local xy in workgroup for a more PS-like swizzle pattern. AU2 gxy = ARmp8x8(gl_LocalInvocationID.x) + AU2(gl_WorkGroupID.x << 4u, gl_WorkGroupID.y << 4u); + // Run the function four times, as recommended by the official docs fsr_vec3 color; FsrEasu(color, gxy, global_ubo.easu_const0, global_ubo.easu_const1, global_ubo.easu_const2, global_ubo.easu_const3); imageStore(IMG_FSR_EASU_OUTPUT, ivec2(gxy), vec4(color, 1)); diff --git a/src/refresh/vkpt/shader/fsr_easu_fp16.comp b/src/refresh/vkpt/shader/fsr_easu_fp16.comp index 3f7e0fb67..f1824e5e6 100644 --- a/src/refresh/vkpt/shader/fsr_easu_fp16.comp +++ b/src/refresh/vkpt/shader/fsr_easu_fp16.comp @@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #define A_HALF #define FSR_EASU_H 1 +// Macros for FP16/FP32 abstraction #define fsr_vec3 AH3 #define fsr_vec4 AH4 #define FsrEasu FsrEasuH @@ -32,4 +33,5 @@ with this program; if not, write to the Free Software Foundation, Inc., #define FsrEasuG FsrEasuGH #define FsrEasuB FsrEasuBH +// Actual implementation #include "fsr_easu.glsl" diff --git a/src/refresh/vkpt/shader/fsr_easu_fp32.comp b/src/refresh/vkpt/shader/fsr_easu_fp32.comp index 623a4e2d9..a3ae02cf7 100644 --- a/src/refresh/vkpt/shader/fsr_easu_fp32.comp +++ b/src/refresh/vkpt/shader/fsr_easu_fp32.comp @@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #define FSR_EASU_F 1 +// Macros for FP16/FP32 abstraction #define fsr_vec3 AF3 #define fsr_vec4 AF4 #define FsrEasu FsrEasuF @@ -31,4 +32,5 @@ with this program; if not, write to the Free Software Foundation, Inc., #define FsrEasuG FsrEasuGF #define FsrEasuB FsrEasuBF +// Actual implementation #include "fsr_easu.glsl" diff --git a/src/refresh/vkpt/shader/fsr_rcas.glsl b/src/refresh/vkpt/shader/fsr_rcas.glsl index 3486344e4..424ba6f23 100644 --- a/src/refresh/vkpt/shader/fsr_rcas.glsl +++ b/src/refresh/vkpt/shader/fsr_rcas.glsl @@ -27,34 +27,41 @@ layout(constant_id = 0) const uint spec_input_tex = 0; #define GLOBAL_TEXTURES_DESC_SET_IDX 1 #include "global_textures.h" +/* FSR sharpening (RCAS, "Robust Contrast Adaptive Sharpening") pass + * Also see overview in fsr.c */ + #define A_GPU 1 #define A_GLSL 1 +// Those headers contain the bulk of the implementation #include "ffx_a.h" #include "ffx_fsr1.h" layout(local_size_x=64) in; +// Provide input for RCAS fsr_vec4 FsrRcasLoad(load_coord p) { if(spec_input_tex == 0) - // RCAS after EASU + // RCAS after EASU (default case) return fsr_vec4(texelFetch(TEX_FSR_EASU_OUTPUT, ivec2(p), 0)); else - // RCAS after TAAU + // RCAS after TAAU (if EASU was disabled via cvar) return fsr_vec4(texelFetch(TEX_TAA_OUTPUT, ivec2(p), 0)); } +// Color space conversion void FsrRcasInput(inout fsr_val r, inout fsr_val g, inout fsr_val b) {} void main() { - /* Code from EASU application has been lifted from: + /* Code from RCAS application has been lifted from: https://raw.githubusercontent.com/GPUOpen-Effects/FidelityFX-FSR/master/docs/FidelityFX-FSR-Overview-Integration.pdf */ // Do remapping of local xy in workgroup for a more PS-like swizzle pattern. AU2 gxy = ARmp8x8(gl_LocalInvocationID.x) + AU2(gl_WorkGroupID.x << 4u, gl_WorkGroupID.y << 4u); + // Run the function four times, as recommended by the official docs fsr_vec3 color; FsrRcas(color.r, color.g, color.b, gxy, global_ubo.rcas_const0); imageStore(IMG_FSR_RCAS_OUTPUT, ivec2(gxy), vec4(color, 1)); diff --git a/src/refresh/vkpt/shader/fsr_rcas_fp16.comp b/src/refresh/vkpt/shader/fsr_rcas_fp16.comp index 0a3f59187..1fee71fee 100644 --- a/src/refresh/vkpt/shader/fsr_rcas_fp16.comp +++ b/src/refresh/vkpt/shader/fsr_rcas_fp16.comp @@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #define A_HALF #define FSR_RCAS_H 1 +// Macros for FP16/FP32 abstraction #define fsr_val AH1 #define fsr_vec3 AH3 #define fsr_vec4 AH4 @@ -33,4 +34,5 @@ with this program; if not, write to the Free Software Foundation, Inc., #define load_coord ASW2 #define FsrRcasInput FsrRcasInputH +// Actual implementation #include "fsr_rcas.glsl" diff --git a/src/refresh/vkpt/shader/fsr_rcas_fp32.comp b/src/refresh/vkpt/shader/fsr_rcas_fp32.comp index 22f134fc5..cca495b26 100644 --- a/src/refresh/vkpt/shader/fsr_rcas_fp32.comp +++ b/src/refresh/vkpt/shader/fsr_rcas_fp32.comp @@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #define FSR_RCAS_F 1 +// Macros for FP16/FP32 abstraction #define fsr_val AF1 #define fsr_vec3 AF3 #define fsr_vec4 AF4 @@ -32,4 +33,5 @@ with this program; if not, write to the Free Software Foundation, Inc., #define load_coord ASU2 #define FsrRcasInput FsrRcasInputF +// Actual implementation #include "fsr_rcas.glsl" From d76cd646c5e0c0241ead8a8a0f87771c63747911 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Thu, 16 Sep 2021 13:00:54 +0200 Subject: [PATCH 36/55] Add FSR cvars to client.md --- doc/client.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/doc/client.md b/doc/client.md index a2db45eaa..8dfdc89e7 100644 --- a/doc/client.md +++ b/doc/client.md @@ -694,6 +694,29 @@ and blue channel shows direct specular gradients. Default value is 0. #### `flt_taa` Enables temporal anti-aliasing and primary ray direction jitter. Default value is 1. +#### `flt_fsr_enable` +Enables FidelityFX Super Resolution 1.0 ("AMD FSR 1.0") upscaling. Default value is 0. +If enabled, upscaling is applied when the resolution scale is below 100%, either from +dynamic resolution scaling or by setting a fixes resolution scale. + +There's currently no UI to choose the AMD FSR 1.0 quality mode. +You can closely approximate that setting by using an appropriate fixed +resolution scale: +| AMD FSR 1.0 Quality Mode | Fixed resolution scale | +| ------------------------ | ---------------------- | +| Ultra Quality | 75% | +| Quality | 65% | +| Balanced | 60% | +| Performance | 50% | + +#### `flt_fsr_sharpness` +FidelityFX Super Resolution 1.0 sharpening amount. Default is 0.2. +Range is from 0.0 to 2.0, with lower meaning sharper. + +#### `flt_fsr_easu`, `flt_fsr_rcas` +Individual control of the upscaling and sharpening steps of FSR. Both default to 1. +Intended for testing purposes. + #### `gr_enable` Enables the god rays (volumetric lighting) effect. Default value is 1. From fe6e0743e93e75082f6c337f309039c56a9cf7c5 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Thu, 16 Sep 2021 13:15:37 +0200 Subject: [PATCH 37/55] Wording tweaks --- src/refresh/vkpt/fsr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/refresh/vkpt/fsr.c b/src/refresh/vkpt/fsr.c index aa9db78e3..d11cec74f 100644 --- a/src/refresh/vkpt/fsr.c +++ b/src/refresh/vkpt/fsr.c @@ -25,8 +25,8 @@ with this program; if not, write to the Free Software Foundation, Inc., =============================================================== FSR is a combination of an upscaling and a sharpening algorithm to produce - high-resolution output from low-resolution that is of high quality and - visually appealing. + high-resolution output - of high quality and visually appealing - + from lower resolution input. The input to FSR is the rendered image, in perceptual color space (after tone mapping, sRGB), pre-antialiased, without HUD elements. From 60bcea3cb0cd7b55acde5fe487ed788ec93a5a8e Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Fri, 10 Sep 2021 17:57:13 -0700 Subject: [PATCH 38/55] Moved the calls to update_payload_transparency out of the transparency logic functions to avoid code duplication, especially in ray query mode. --- .../vkpt/shader/path_tracer_beam.rahit | 7 ++- .../vkpt/shader/path_tracer_explosion.rahit | 7 ++- .../vkpt/shader/path_tracer_hit_shaders.h | 43 +++++++++++++++---- .../vkpt/shader/path_tracer_particle.rahit | 7 ++- src/refresh/vkpt/shader/path_tracer_rgen.h | 18 ++++++-- .../vkpt/shader/path_tracer_sprite.rahit | 7 ++- .../vkpt/shader/path_tracer_transparency.glsl | 4 +- 7 files changed, 75 insertions(+), 18 deletions(-) diff --git a/src/refresh/vkpt/shader/path_tracer_beam.rahit b/src/refresh/vkpt/shader/path_tracer_beam.rahit index cf92ac43b..1cbcc7c72 100644 --- a/src/refresh/vkpt/shader/path_tracer_beam.rahit +++ b/src/refresh/vkpt/shader/path_tracer_beam.rahit @@ -39,7 +39,12 @@ void main() { const vec2 beam_fade_and_thickness = unpackHalf2x16(beam_hit_attrib.fade_and_thickness); - pt_logic_beam(ray_payload, gl_PrimitiveID, beam_fade_and_thickness, gl_HitTEXT); + transparency_result_t transparency = pt_logic_beam(gl_PrimitiveID, beam_fade_and_thickness); + if (transparency.color.a > 0) + { + update_payload_transparency(ray_payload, transparency.color, transparency.thickness, gl_HitTEXT); + } + ignoreIntersectionEXT; } diff --git a/src/refresh/vkpt/shader/path_tracer_explosion.rahit b/src/refresh/vkpt/shader/path_tracer_explosion.rahit index b19e481f5..ec8fab659 100644 --- a/src/refresh/vkpt/shader/path_tracer_explosion.rahit +++ b/src/refresh/vkpt/shader/path_tracer_explosion.rahit @@ -37,7 +37,12 @@ hitAttributeEXT vec2 hit_attribs; void main() { - pt_logic_explosion(ray_payload, gl_PrimitiveID, gl_InstanceCustomIndexEXT, gl_HitTEXT, gl_WorldRayDirectionEXT, hit_attribs.xy); + transparency_result_t transparency = pt_logic_explosion(gl_PrimitiveID, gl_InstanceCustomIndexEXT, gl_WorldRayDirectionEXT, hit_attribs.xy); + + if (transparency.color.a > 0) + { + update_payload_transparency(ray_payload, transparency.color, transparency.thickness, gl_HitTEXT); + } ignoreIntersectionEXT; } diff --git a/src/refresh/vkpt/shader/path_tracer_hit_shaders.h b/src/refresh/vkpt/shader/path_tracer_hit_shaders.h index 0c30f3c84..f8fe90be3 100644 --- a/src/refresh/vkpt/shader/path_tracer_hit_shaders.h +++ b/src/refresh/vkpt/shader/path_tracer_hit_shaders.h @@ -67,13 +67,23 @@ bool pt_logic_masked(int primitiveID, uint instanceCustomIndex, vec2 bary) return mask_value.x >= 0.5; } -void pt_logic_particle(inout RayPayload ray_payload, int primitiveID, float hitT, vec2 bary) +struct transparency_result_t +{ + vec4 color; + float thickness; +}; + +transparency_result_t pt_logic_particle(int primitiveID, vec2 bary) { const vec3 barycentric = vec3(1.0 - bary.x - bary.y, bary.x, bary.y); const vec2 uv = vec2(0.0, 0.0) * barycentric.x + vec2(1.0, 0.0) * barycentric.y + vec2(1.0, 1.0) * barycentric.z; const float factor = pow(clamp(1.0 - length(vec2(0.5) - uv) * 2.0, 0.0, 1.0), global_ubo.pt_particle_softness); + transparency_result_t result; + result.color = vec4(0); + result.thickness = 0; + if (factor > 0.0) { const int particle_index = primitiveID / 2; @@ -83,15 +93,21 @@ void pt_logic_particle(inout RayPayload ray_payload, int primitiveID, float hitT color.rgb *= global_ubo.prev_adapted_luminance * 500; - update_payload_transparency(ray_payload, color, 0, hitT); + result.color = color; } + + return result; } -void pt_logic_beam(inout RayPayload ray_payload, int primitiveID, vec2 beam_fade_and_thickness, float hitT) +transparency_result_t pt_logic_beam(int primitiveID, vec2 beam_fade_and_thickness) { const float x = beam_fade_and_thickness.x; const float factor = pow(clamp(x, 0.0, 1.0), global_ubo.pt_beam_softness); + transparency_result_t result; + result.color = vec4(0); + result.thickness = 0; + if (factor > 0.0) { const int beam_index = primitiveID; @@ -107,11 +123,14 @@ void pt_logic_beam(inout RayPayload ray_payload, int primitiveID, vec2 beam_fade float noise = texelFetch(TEX_BLUE_NOISE, ivec3(texpos, texnum), 0).r; color.rgb *= noise * noise + 0.1; - update_payload_transparency(ray_payload, color, beam_fade_and_thickness.y, hitT); + result.color = color; + result.thickness = beam_fade_and_thickness.y; } + + return result; } -void pt_logic_sprite(inout RayPayload ray_payload, int primitiveID, float hitT, vec2 bary) +transparency_result_t pt_logic_sprite(int primitiveID, vec2 bary) { const vec3 barycentric = vec3(1.0 - bary.x - bary.y, bary.x, bary.y); @@ -139,10 +158,14 @@ void pt_logic_sprite(inout RayPayload ray_payload, int primitiveID, float hitT, color.rgb *= global_ubo.prev_adapted_luminance * 2000; } - update_payload_transparency(ray_payload, color, 0, hitT); + transparency_result_t result; + result.color = color; + result.thickness = 0; + + return result; } -void pt_logic_explosion(inout RayPayload ray_payload, int primitiveID, uint instanceCustomIndex, float hitT, vec3 worldRayDirection, vec2 bary) +transparency_result_t pt_logic_explosion(int primitiveID, uint instanceCustomIndex, vec3 worldRayDirection, vec2 bary) { const uint primitive_id = primitiveID + instanceCustomIndex & AS_INSTANCE_MASK_OFFSET; const Triangle triangle = get_instanced_triangle(primitive_id); @@ -165,7 +188,11 @@ void pt_logic_explosion(inout RayPayload ray_payload, int primitiveID, uint inst emission.rgb *= global_ubo.prev_adapted_luminance * 500; - update_payload_transparency(ray_payload, emission, 0, hitT); + transparency_result_t result; + result.color = emission; + result.thickness = 0; + + return result; } // Adapted from: http://www.pbr-book.org/3ed-2018/Utilities/Mathematical_Routines.html#SolvingQuadraticEquations diff --git a/src/refresh/vkpt/shader/path_tracer_particle.rahit b/src/refresh/vkpt/shader/path_tracer_particle.rahit index 7ad092905..503c38d74 100644 --- a/src/refresh/vkpt/shader/path_tracer_particle.rahit +++ b/src/refresh/vkpt/shader/path_tracer_particle.rahit @@ -37,7 +37,12 @@ hitAttributeEXT vec2 hit_attribs; void main() { - pt_logic_particle(ray_payload, gl_PrimitiveID, gl_HitTEXT, hit_attribs.xy); + transparency_result_t transparency = pt_logic_particle(gl_PrimitiveID, hit_attribs.xy); + + if (transparency.color.a > 0) + { + update_payload_transparency(ray_payload, transparency.color, transparency.thickness, gl_HitTEXT); + } ignoreIntersectionEXT; } diff --git a/src/refresh/vkpt/shader/path_tracer_rgen.h b/src/refresh/vkpt/shader/path_tracer_rgen.h index 7d415b005..9998c4a1c 100644 --- a/src/refresh/vkpt/shader/path_tracer_rgen.h +++ b/src/refresh/vkpt/shader/path_tracer_rgen.h @@ -288,6 +288,10 @@ trace_ray(Ray ray, bool cull_back_faces, int instance_mask, bool skip_procedural vec2 bary = rayQueryGetIntersectionBarycentricsEXT(rayQuery, false); bool isProcedural = rayQueryGetIntersectionTypeEXT(rayQuery, false) == gl_RayQueryCandidateIntersectionAABBEXT; + transparency_result_t transparency; + transparency.color = vec4(0); + transparency.thickness = 0; + if (isProcedural) { if (!skip_procedural) // this should be a compile-time constant @@ -304,7 +308,8 @@ trace_ray(Ray ray, bool cull_back_faces, int instance_mask, bool skip_procedural // Then the any-hit shader. if (intersectsWithBeam) { - pt_logic_beam(ray_payload_brdf, primitiveID, beam_fade_and_thickness, tShapeHit); + transparency = pt_logic_beam(primitiveID, beam_fade_and_thickness); + hitT = tShapeHit; } } } @@ -318,18 +323,23 @@ trace_ray(Ray ray, bool cull_back_faces, int instance_mask, bool skip_procedural break; case SBTO_PARTICLE: // particles - pt_logic_particle(ray_payload_brdf, primitiveID, hitT, bary); + transparency = pt_logic_particle(primitiveID, bary); break; case SBTO_EXPLOSION: // explosions - pt_logic_explosion(ray_payload_brdf, primitiveID, instanceCustomIndex, hitT, ray.direction, bary); + transparency = pt_logic_explosion(primitiveID, instanceCustomIndex, ray.direction, bary); break; case SBTO_SPRITE: // sprites - pt_logic_sprite(ray_payload_brdf, primitiveID, hitT, bary); + transparency = pt_logic_sprite(primitiveID, bary); break; } } + + if (transparency.color.a > 0) + { + update_payload_transparency(ray_payload_brdf, transparency.color, transparency.thickness, hitT); + } } if (rayQueryGetIntersectionTypeEXT(rayQuery, true) == gl_RayQueryCommittedIntersectionTriangleEXT) diff --git a/src/refresh/vkpt/shader/path_tracer_sprite.rahit b/src/refresh/vkpt/shader/path_tracer_sprite.rahit index 457866d0d..e5334abf9 100644 --- a/src/refresh/vkpt/shader/path_tracer_sprite.rahit +++ b/src/refresh/vkpt/shader/path_tracer_sprite.rahit @@ -37,7 +37,12 @@ hitAttributeEXT vec2 hit_attribs; void main() { - pt_logic_sprite(ray_payload, gl_PrimitiveID, gl_HitTEXT, hit_attribs.xy); + transparency_result_t transparency = pt_logic_sprite(gl_PrimitiveID, hit_attribs.xy); + if (transparency.color.a > 0) + { + update_payload_transparency(ray_payload, transparency.color, transparency.thickness, gl_HitTEXT); + } + ignoreIntersectionEXT; } diff --git a/src/refresh/vkpt/shader/path_tracer_transparency.glsl b/src/refresh/vkpt/shader/path_tracer_transparency.glsl index f555f79bf..3d9f310f3 100644 --- a/src/refresh/vkpt/shader/path_tracer_transparency.glsl +++ b/src/refresh/vkpt/shader/path_tracer_transparency.glsl @@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef PATH_TRACER_TRANSPARENCY_GLSL_ #define PATH_TRACER_TRANSPARENCY_GLSL_ -void update_payload_transparency(inout RayPayload rp, vec4 color, float depth, float hitT) +void update_payload_transparency(inout RayPayload rp, vec4 color, float thickness, float hitT) { if(hitT > rp.farthest_transparent_distance) { @@ -28,7 +28,7 @@ void update_payload_transparency(inout RayPayload rp, vec4 color, float depth, f rp.closest_max_transparent_distance = rp.farthest_transparent_distance; rp.farthest_transparency = packHalf4x16(color); rp.farthest_transparent_distance = hitT; - rp.farthest_transparent_depth = depth; + rp.farthest_transparent_depth = thickness; } else if(rp.closest_max_transparent_distance < hitT) { From 283acc989df319d5525236b58a5d573bae6ceb27 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Tue, 14 Sep 2021 10:42:40 -0700 Subject: [PATCH 39/55] Separated the transparent effects like explosions into their own ray payload, always with a dedicated ray to accumulate them. --- src/refresh/vkpt/path_tracer.c | 36 ++-- src/refresh/vkpt/shader/constants.h | 60 ++++--- .../vkpt/shader/indirect_lighting.rgen | 30 ++-- src/refresh/vkpt/shader/path_tracer.h | 15 +- src/refresh/vkpt/shader/path_tracer.rchit | 2 +- src/refresh/vkpt/shader/path_tracer.rmiss | 9 +- .../vkpt/shader/path_tracer_beam.rahit | 2 +- .../vkpt/shader/path_tracer_explosion.rahit | 2 +- .../vkpt/shader/path_tracer_hit_shaders.h | 2 +- .../vkpt/shader/path_tracer_masked.rahit | 1 - .../vkpt/shader/path_tracer_particle.rahit | 2 +- src/refresh/vkpt/shader/path_tracer_rgen.h | 159 ++++++++++-------- .../vkpt/shader/path_tracer_shadow.rmiss | 2 +- .../vkpt/shader/path_tracer_sprite.rahit | 2 +- .../vkpt/shader/path_tracer_transparency.glsl | 6 +- src/refresh/vkpt/shader/primary_rays.rgen | 58 +++---- src/refresh/vkpt/shader/reflect_refract.rgen | 28 +-- 17 files changed, 205 insertions(+), 211 deletions(-) diff --git a/src/refresh/vkpt/path_tracer.c b/src/refresh/vkpt/path_tracer.c index 8eb98bb48..92c6243f7 100644 --- a/src/refresh/vkpt/path_tracer.c +++ b/src/refresh/vkpt/path_tracer.c @@ -837,7 +837,7 @@ vkpt_pt_create_toplevel(VkCommandBuffer cmd_buf, int idx, qboolean include_world append_blas(instances, &num_instances, &blas_dynamic[idx], AS_INSTANCE_FLAG_DYNAMIC, AS_FLAG_OPAQUE, VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR, SBTO_OPAQUE); append_blas(instances, &num_instances, &blas_transparent_models[idx], AS_INSTANCE_FLAG_DYNAMIC | transparent_model_primitive_offset, AS_FLAG_TRANSPARENT, VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR, SBTO_OPAQUE); append_blas(instances, &num_instances, &blas_masked_models[idx], AS_INSTANCE_FLAG_DYNAMIC | masked_model_primitive_offset, AS_FLAG_OPAQUE, VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_KHR | VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR, SBTO_MASKED); - append_blas(instances, &num_instances, &blas_explosions[idx], AS_INSTANCE_FLAG_DYNAMIC | explosions_primitive_offset, AS_FLAG_EXPLOSIONS, 0, SBTO_EXPLOSION); + append_blas(instances, &num_instances, &blas_explosions[idx], AS_INSTANCE_FLAG_DYNAMIC | explosions_primitive_offset, AS_FLAG_EFFECTS, 0, SBTO_EXPLOSION); append_blas(instances, &num_instances, &blas_viewer_weapon[idx], AS_INSTANCE_FLAG_DYNAMIC | viewer_weapon_primitive_offset, AS_FLAG_VIEWER_WEAPON, VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR | (weapon_left_handed ? VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_KHR : 0), SBTO_OPAQUE); if (cl_player_model->integer == CL_PLAYER_MODEL_FIRST_PERSON) @@ -847,17 +847,17 @@ vkpt_pt_create_toplevel(VkCommandBuffer cmd_buf, int idx, qboolean include_world if (cvar_pt_enable_particles->integer != 0) { - append_blas(instances, &num_instances, &blas_particles[idx], 0, AS_FLAG_PARTICLES, VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR, SBTO_PARTICLE); + append_blas(instances, &num_instances, &blas_particles[idx], 0, AS_FLAG_EFFECTS, VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR, SBTO_PARTICLE); } if (cvar_pt_enable_beams->integer != 0) { - append_blas(instances, &num_instances, &blas_beams[idx], 0, AS_FLAG_PARTICLES, VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR, SBTO_BEAM); + append_blas(instances, &num_instances, &blas_beams[idx], 0, AS_FLAG_EFFECTS, VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR, SBTO_BEAM); } if (cvar_pt_enable_sprites->integer != 0) { - append_blas(instances, &num_instances, &blas_sprites[idx], 0, AS_FLAG_EXPLOSIONS, VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR, SBTO_SPRITE); + append_blas(instances, &num_instances, &blas_sprites[idx], 0, AS_FLAG_EFFECTS, VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR, SBTO_SPRITE); } void *instance_data = buffer_map(buf_instances + idx); @@ -1330,7 +1330,7 @@ vkpt_pt_create_pipelines() .anyHitShader = VK_SHADER_UNUSED_KHR, .intersectionShader = VK_SHADER_UNUSED_KHR }, - [SBT_RMISS_PATH_TRACER] = { + [SBT_RMISS_EMPTY] = { .sType = VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR, .type = VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_KHR, .generalShader = 1, @@ -1346,7 +1346,7 @@ vkpt_pt_create_pipelines() .anyHitShader = VK_SHADER_UNUSED_KHR, .intersectionShader = VK_SHADER_UNUSED_KHR }, - [SBT_RCHIT_OPAQUE] = { + [SBT_RCHIT_GEOMETRY] = { .sType = VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR, .type = VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR, .generalShader = VK_SHADER_UNUSED_KHR, @@ -1378,20 +1378,20 @@ vkpt_pt_create_pipelines() .anyHitShader = 4, .intersectionShader = VK_SHADER_UNUSED_KHR }, - [SBT_RAHIT_PARTICLE] = { + [SBT_RCHIT_EFFECTS] = { .sType = VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR, .type = VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR, .generalShader = VK_SHADER_UNUSED_KHR, .closestHitShader = VK_SHADER_UNUSED_KHR, - .anyHitShader = 5, + .anyHitShader = VK_SHADER_UNUSED_KHR, .intersectionShader = VK_SHADER_UNUSED_KHR }, - [SBT_RAHIT_PARTICLE_SHADOW] = { + [SBT_RAHIT_PARTICLE] = { .sType = VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR, .type = VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR, .generalShader = VK_SHADER_UNUSED_KHR, .closestHitShader = VK_SHADER_UNUSED_KHR, - .anyHitShader = VK_SHADER_UNUSED_KHR, + .anyHitShader = 5, .intersectionShader = VK_SHADER_UNUSED_KHR }, [SBT_RAHIT_EXPLOSION] = { @@ -1402,14 +1402,6 @@ vkpt_pt_create_pipelines() .anyHitShader = 6, .intersectionShader = VK_SHADER_UNUSED_KHR }, - [SBT_RAHIT_EXPLOSION_SHADOW] = { - .sType = VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR, - .type = VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR, - .generalShader = VK_SHADER_UNUSED_KHR, - .closestHitShader = VK_SHADER_UNUSED_KHR, - .anyHitShader = VK_SHADER_UNUSED_KHR, - .intersectionShader = VK_SHADER_UNUSED_KHR - }, [SBT_RAHIT_SPRITE] = { .sType = VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR, .type = VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR, @@ -1418,14 +1410,6 @@ vkpt_pt_create_pipelines() .anyHitShader = 7, .intersectionShader = VK_SHADER_UNUSED_KHR }, - [SBT_RAHIT_SPRITE_SHADOW] = { - .sType = VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR, - .type = VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR, - .generalShader = VK_SHADER_UNUSED_KHR, - .closestHitShader = VK_SHADER_UNUSED_KHR, - .anyHitShader = VK_SHADER_UNUSED_KHR, - .intersectionShader = VK_SHADER_UNUSED_KHR - }, [SBT_RINT_BEAM] = { .sType = VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR, .type = VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_KHR, diff --git a/src/refresh/vkpt/shader/constants.h b/src/refresh/vkpt/shader/constants.h index 1a399ee9a..2469f144f 100644 --- a/src/refresh/vkpt/shader/constants.h +++ b/src/refresh/vkpt/shader/constants.h @@ -108,43 +108,47 @@ with this program; if not, write to the Free Software Foundation, Inc., #define AS_FLAG_OPAQUE (1 << 0) #define AS_FLAG_TRANSPARENT (1 << 1) -#define AS_FLAG_PARTICLES (1 << 2) +#define AS_FLAG_EFFECTS (1 << 2) #define AS_FLAG_VIEWER_MODELS (1 << 3) #define AS_FLAG_VIEWER_WEAPON (1 << 4) -#define AS_FLAG_EXPLOSIONS (1 << 5) -#define AS_FLAG_SKY (1 << 6) -#define AS_FLAG_CUSTOM_SKY (1 << 7) +#define AS_FLAG_SKY (1 << 5) +#define AS_FLAG_CUSTOM_SKY (1 << 6) #define AS_FLAG_EVERYTHING 0xFF #define AS_INSTANCE_FLAG_DYNAMIC (1 << 23) #define AS_INSTANCE_FLAG_SKY (1 << 22) #define AS_INSTANCE_MASK_OFFSET (AS_INSTANCE_FLAG_SKY - 1) -#define SBT_RGEN 0 -#define SBT_RMISS_PATH_TRACER 1 -#define SBT_RMISS_SHADOW 2 -#define SBT_RCHIT_OPAQUE 3 -#define SBT_RCHIT_EMPTY 4 -#define SBT_RAHIT_MASKED 5 -#define SBT_RAHIT_MASKED_SHADOW 6 -#define SBT_RAHIT_PARTICLE 7 -#define SBT_RAHIT_PARTICLE_SHADOW 8 -#define SBT_RAHIT_EXPLOSION 9 -#define SBT_RAHIT_EXPLOSION_SHADOW 10 -#define SBT_RAHIT_SPRITE 11 -#define SBT_RAHIT_SPRITE_SHADOW 12 -#define SBT_RINT_BEAM 13 -#define SBT_ENTRIES_PER_PIPELINE 14 +#define RT_PAYLOAD_GEOMETRY 0 +#define RT_PAYLOAD_SHADOW 1 +#define RT_PAYLOAD_EFFECTS 2 + +#define SBT_RGEN 0 +#define SBT_RMISS_EMPTY 1 +#define SBT_RMISS_SHADOW 2 + +#define SBT_RCHIT_GEOMETRY 3 +#define SBT_RCHIT_EMPTY 4 +#define SBT_RAHIT_MASKED 5 +#define SBT_RAHIT_MASKED_SHADOW 6 + +#define SBT_RCHIT_EFFECTS 7 +#define SBT_RAHIT_PARTICLE 8 +#define SBT_RAHIT_EXPLOSION 9 +#define SBT_RAHIT_SPRITE 10 +#define SBT_RINT_BEAM 11 +#define SBT_ENTRIES_PER_PIPELINE 12 // vkpt_pt_create_pipelines() relies on all 'transparency' SBT entries coming after SBT_FIRST_TRANSPARENCY -#define SBT_FIRST_TRANSPARENCY SBT_RAHIT_PARTICLE - -// SBT indices, for primary rays -#define SBTO_OPAQUE (SBT_RCHIT_OPAQUE - SBT_RCHIT_OPAQUE) -#define SBTO_MASKED (SBT_RAHIT_MASKED - SBT_RCHIT_OPAQUE) -#define SBTO_PARTICLE (SBT_RAHIT_PARTICLE - SBT_RCHIT_OPAQUE) -#define SBTO_EXPLOSION (SBT_RAHIT_EXPLOSION - SBT_RCHIT_OPAQUE) -#define SBTO_SPRITE (SBT_RAHIT_SPRITE - SBT_RCHIT_OPAQUE) -#define SBTO_BEAM (SBT_RINT_BEAM - SBT_RCHIT_OPAQUE) +#define SBT_FIRST_TRANSPARENCY SBT_RCHIT_EFFECTS + +// SBT indices for geometry and shadow rays +#define SBTO_OPAQUE (SBT_RCHIT_GEOMETRY - SBT_RCHIT_GEOMETRY) +#define SBTO_MASKED (SBT_RAHIT_MASKED - SBT_RCHIT_GEOMETRY) +// SBT indices for effect rays +#define SBTO_PARTICLE (SBT_RAHIT_PARTICLE - SBT_RCHIT_EFFECTS) +#define SBTO_EXPLOSION (SBT_RAHIT_EXPLOSION - SBT_RCHIT_EFFECTS) +#define SBTO_SPRITE (SBT_RAHIT_SPRITE - SBT_RCHIT_EFFECTS) +#define SBTO_BEAM (SBT_RINT_BEAM - SBT_RCHIT_EFFECTS) #ifndef M_PI #define M_PI 3.1415926535897932384626433832795 diff --git a/src/refresh/vkpt/shader/indirect_lighting.rgen b/src/refresh/vkpt/shader/indirect_lighting.rgen index adb16b944..9efcb9b94 100644 --- a/src/refresh/vkpt/shader/indirect_lighting.rgen +++ b/src/refresh/vkpt/shader/indirect_lighting.rgen @@ -218,8 +218,7 @@ indirect_lighting( int bounce_cull_mask = BOUNCE_RAY_CULL_MASK; int shadow_cull_mask = SHADOW_RAY_CULL_MASK; - if(is_specular_ray) - bounce_cull_mask |= AS_FLAG_EXPLOSIONS; + if(global_ubo.first_person_model != 0 && !primary_is_weapon) { bounce_cull_mask |= AS_FLAG_VIEWER_MODELS; @@ -231,21 +230,24 @@ indirect_lighting( shadow_cull_mask |= AS_FLAG_VIEWER_WEAPON; } - trace_ray(bounce_ray, true, bounce_cull_mask, true); - - Triangle triangle; + trace_geometry_ray(bounce_ray, true, bounce_cull_mask); bounce_contrib = vec3(0); if(is_specular_ray) { - vec4 transparency = get_payload_transparency_simple(ray_payload_brdf); + if (found_intersection(ray_payload_geometry)) + bounce_ray.t_max = ray_payload_geometry.hit_distance; + + vec4 transparency = trace_effects_ray(bounce_ray, /* skip_procedural = */ true); bounce_contrib += transparency.rgb * transparency.a * bounce_throughput * (1.0 - direct_specular_weight); } + Triangle triangle; + bool bounce_is_sky_light = false; - if(!found_intersection(ray_payload_brdf)) + if(!found_intersection(ray_payload_geometry)) { if(spec_bounce_index < global_ubo.pt_num_bounce_rays - 1) { @@ -254,17 +256,17 @@ indirect_lighting( return; } - triangle = get_hit_triangle(ray_payload_brdf); + triangle = get_hit_triangle(ray_payload_geometry); float indirect_specular_weight = 1; if(is_specular_ray) { - float cone_size = ray_payload_brdf.hit_distance * primary_roughness; + float cone_size = ray_payload_geometry.hit_distance * primary_roughness; indirect_specular_weight = 1 - fake_specular_weight; indirect_specular_weight /= max(1, cone_size * global_ubo.pt_specular_anti_flicker * 0.01); } - if(is_sky(ray_payload_brdf)) + if(is_sky(ray_payload_geometry)) { // On the first bounce, analytic lights are processed in the direct lighting pass, so // check if `pt_direct_polygon_lights` is non-negative: @@ -293,7 +295,7 @@ indirect_lighting( { mat3 projected_positions = project_triangle(triangle.positions, position); - vec3 bary = get_hit_barycentric(ray_payload_brdf); + vec3 bary = get_hit_barycentric(ray_payload_geometry); vec3 pos_on_triangle = triangle.positions * bary; pos_on_triangle -= position; pos_on_triangle = normalize(pos_on_triangle); @@ -315,7 +317,7 @@ indirect_lighting( } else { - vec3 bary = get_hit_barycentric(ray_payload_brdf); + vec3 bary = get_hit_barycentric(ray_payload_geometry); vec2 tex_coord = triangle.tex_coords * bary; uint bounce_material_id = triangle.material_id; @@ -357,7 +359,7 @@ indirect_lighting( float spotlight = sqrt(max(0, -dot(bounce_direction, bounce_normal))); emissive *= spotlight; - // See the comment for `is_analytic_light` above under `if(is_sky(ray_payload_brdf))` + // See the comment for `is_analytic_light` above under `if(is_sky(ray_payload_geometry))` // Same logic applies. bool is_analytic_light = (bounce_material_id & MATERIAL_FLAG_LIGHT) != 0 && @@ -388,7 +390,7 @@ indirect_lighting( if(is_specular_ray) sun_bounce_range *= (1 - sqrt(primary_roughness)); - float sun_attenuation = square(clamp(1.0 - square(square(ray_payload_brdf.hit_distance / sun_bounce_range)), 0, 1)); + float sun_attenuation = square(clamp(1.0 - square(square(ray_payload_geometry.hit_distance / sun_bounce_range)), 0, 1)); if(spec_bounce_index == 0) { diff --git a/src/refresh/vkpt/shader/path_tracer.h b/src/refresh/vkpt/shader/path_tracer.h index 677d770c7..b120c4eaa 100644 --- a/src/refresh/vkpt/shader/path_tracer.h +++ b/src/refresh/vkpt/shader/path_tracer.h @@ -146,15 +146,18 @@ layout (push_constant) uniform push_constant_block { int bounce_index; } push_constants; -struct RayPayload { +struct RayPayloadGeometry { vec2 barycentric; uint instance_prim; float hit_distance; - uvec2 close_transparencies; // half4x16 - uvec2 farthest_transparency; // half4x16 - float closest_max_transparent_distance; - float farthest_transparent_distance; - float farthest_transparent_depth; +}; + +struct RayPayloadEffects { + uvec2 close_transparencies; // half4x16 + uvec2 farthest_transparency; // half4x16 + float closest_max_transparent_distance; + float farthest_transparent_distance; + float farthest_transparent_depth; }; struct RayPayloadShadow { diff --git a/src/refresh/vkpt/shader/path_tracer.rchit b/src/refresh/vkpt/shader/path_tracer.rchit index ac1e348cb..ef1722e3a 100644 --- a/src/refresh/vkpt/shader/path_tracer.rchit +++ b/src/refresh/vkpt/shader/path_tracer.rchit @@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "path_tracer_transparency.glsl" #include "path_tracer_hit_shaders.h" -rayPayloadInEXT RayPayload ray_payload; +layout (location = RT_PAYLOAD_GEOMETRY) rayPayloadInEXT RayPayloadGeometry ray_payload; hitAttributeEXT vec2 hit_attribs; diff --git a/src/refresh/vkpt/shader/path_tracer.rmiss b/src/refresh/vkpt/shader/path_tracer.rmiss index 6856f489f..4b1a47f4a 100644 --- a/src/refresh/vkpt/shader/path_tracer.rmiss +++ b/src/refresh/vkpt/shader/path_tracer.rmiss @@ -18,14 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc., */ #version 460 -#extension GL_GOOGLE_include_directive : enable -#include "path_tracer.h" - -rayPayloadInEXT RayPayload ray_payload; - -void -main() +void main() { - ray_payload.instance_prim = ~0u; } diff --git a/src/refresh/vkpt/shader/path_tracer_beam.rahit b/src/refresh/vkpt/shader/path_tracer_beam.rahit index 1cbcc7c72..c93c5d3cd 100644 --- a/src/refresh/vkpt/shader/path_tracer_beam.rahit +++ b/src/refresh/vkpt/shader/path_tracer_beam.rahit @@ -32,7 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "path_tracer_transparency.glsl" #include "path_tracer_hit_shaders.h" -rayPayloadInEXT RayPayload ray_payload; +layout (location = RT_PAYLOAD_EFFECTS) rayPayloadInEXT RayPayloadEffects ray_payload; hitAttributeEXT HitAttributeBeam beam_hit_attrib; void main() diff --git a/src/refresh/vkpt/shader/path_tracer_explosion.rahit b/src/refresh/vkpt/shader/path_tracer_explosion.rahit index ec8fab659..c31f63317 100644 --- a/src/refresh/vkpt/shader/path_tracer_explosion.rahit +++ b/src/refresh/vkpt/shader/path_tracer_explosion.rahit @@ -32,7 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "path_tracer_transparency.glsl" #include "path_tracer_hit_shaders.h" -rayPayloadInEXT RayPayload ray_payload; +layout (location = RT_PAYLOAD_EFFECTS) rayPayloadInEXT RayPayloadEffects ray_payload; hitAttributeEXT vec2 hit_attribs; void main() diff --git a/src/refresh/vkpt/shader/path_tracer_hit_shaders.h b/src/refresh/vkpt/shader/path_tracer_hit_shaders.h index f8fe90be3..84248b282 100644 --- a/src/refresh/vkpt/shader/path_tracer_hit_shaders.h +++ b/src/refresh/vkpt/shader/path_tracer_hit_shaders.h @@ -29,7 +29,7 @@ uniform utextureBuffer sprite_texure_buffer; layout(set = 0, binding = 4) uniform utextureBuffer beam_info_buffer; -void pt_logic_rchit(inout RayPayload ray_payload, int primitiveID, uint instanceCustomIndex, float hitT, vec2 bary) +void pt_logic_rchit(inout RayPayloadGeometry ray_payload, int primitiveID, uint instanceCustomIndex, float hitT, vec2 bary) { ray_payload.barycentric = bary.xy; ray_payload.instance_prim = primitiveID + instanceCustomIndex & AS_INSTANCE_MASK_OFFSET; diff --git a/src/refresh/vkpt/shader/path_tracer_masked.rahit b/src/refresh/vkpt/shader/path_tracer_masked.rahit index 4eae7ebde..a2be69621 100644 --- a/src/refresh/vkpt/shader/path_tracer_masked.rahit +++ b/src/refresh/vkpt/shader/path_tracer_masked.rahit @@ -32,7 +32,6 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "path_tracer_transparency.glsl" #include "path_tracer_hit_shaders.h" -rayPayloadInEXT RayPayload ray_payload; hitAttributeEXT vec2 hit_attribs; void main() diff --git a/src/refresh/vkpt/shader/path_tracer_particle.rahit b/src/refresh/vkpt/shader/path_tracer_particle.rahit index 503c38d74..a92671359 100644 --- a/src/refresh/vkpt/shader/path_tracer_particle.rahit +++ b/src/refresh/vkpt/shader/path_tracer_particle.rahit @@ -32,7 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "path_tracer_transparency.glsl" #include "path_tracer_hit_shaders.h" -rayPayloadInEXT RayPayload ray_payload; +layout (location = RT_PAYLOAD_EFFECTS) rayPayloadInEXT RayPayloadEffects ray_payload; hitAttributeEXT vec2 hit_attribs; void main() diff --git a/src/refresh/vkpt/shader/path_tracer_rgen.h b/src/refresh/vkpt/shader/path_tracer_rgen.h index 9998c4a1c..59e4d8ed9 100644 --- a/src/refresh/vkpt/shader/path_tracer_rgen.h +++ b/src/refresh/vkpt/shader/path_tracer_rgen.h @@ -54,8 +54,8 @@ uniform accelerationStructureEXT topLevelAS; #define RNG_SUNLIGHT_X(bounce) (4 + 7 + 9 * bounce) #define RNG_SUNLIGHT_Y(bounce) (4 + 8 + 9 * bounce) -#define PRIMARY_RAY_CULL_MASK (AS_FLAG_EVERYTHING & ~(AS_FLAG_VIEWER_MODELS | AS_FLAG_CUSTOM_SKY)) -#define REFLECTION_RAY_CULL_MASK (AS_FLAG_OPAQUE | AS_FLAG_PARTICLES | AS_FLAG_EXPLOSIONS | AS_FLAG_SKY) +#define PRIMARY_RAY_CULL_MASK (AS_FLAG_OPAQUE | AS_FLAG_TRANSPARENT | AS_FLAG_VIEWER_WEAPON | AS_FLAG_SKY) +#define REFLECTION_RAY_CULL_MASK (AS_FLAG_OPAQUE | AS_FLAG_SKY) #define BOUNCE_RAY_CULL_MASK (AS_FLAG_OPAQUE | AS_FLAG_SKY | AS_FLAG_CUSTOM_SKY) #define SHADOW_RAY_CULL_MASK (AS_FLAG_OPAQUE) @@ -70,18 +70,18 @@ uniform accelerationStructureEXT topLevelAS; layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in; -// Just a global variable in RQ mode. +// Just global variables in RQ mode. // No shadow payload necessary. -RayPayload ray_payload_brdf; +RayPayloadGeometry ray_payload_geometry; +RayPayloadEffects ray_payload_effects; #include "path_tracer_hit_shaders.h" #else // !KHR_RAY_QUERY -#define RT_PAYLOAD_SHADOW 0 -#define RT_PAYLOAD_BRDF 1 +layout(location = RT_PAYLOAD_GEOMETRY) rayPayloadEXT RayPayloadGeometry ray_payload_geometry; +layout(location = RT_PAYLOAD_EFFECTS) rayPayloadEXT RayPayloadEffects ray_payload_effects; layout(location = RT_PAYLOAD_SHADOW) rayPayloadEXT RayPayloadShadow ray_payload_shadow; -layout(location = RT_PAYLOAD_BRDF) rayPayloadEXT RayPayload ray_payload_brdf; #endif @@ -146,31 +146,31 @@ ivec2 get_image_size() } bool -found_intersection(RayPayload rp) +found_intersection(RayPayloadGeometry rp) { return rp.instance_prim != ~0u; } bool -is_sky(RayPayload rp) +is_sky(RayPayloadGeometry rp) { return (rp.instance_prim & INSTANCE_SKY_FLAG) != 0; } bool -is_dynamic_instance(RayPayload pay_load) +is_dynamic_instance(RayPayloadGeometry pay_load) { return (pay_load.instance_prim & INSTANCE_DYNAMIC_FLAG) > 0; } uint -get_primitive(RayPayload pay_load) +get_primitive(RayPayloadGeometry pay_load) { return pay_load.instance_prim & PRIM_ID_MASK; } Triangle -get_hit_triangle(RayPayload rp) +get_hit_triangle(RayPayloadGeometry rp) { uint prim = get_primitive(rp); @@ -180,7 +180,7 @@ get_hit_triangle(RayPayload rp) } vec3 -get_hit_barycentric(RayPayload rp) +get_hit_barycentric(RayPayloadGeometry rp) { vec3 bary; bary.yz = rp.barycentric; @@ -255,22 +255,74 @@ correct_emissive(uint material_id, vec3 emissive) } void -trace_ray(Ray ray, bool cull_back_faces, int instance_mask, bool skip_procedural) +trace_geometry_ray(Ray ray, bool cull_back_faces, int instance_mask) { uint rayFlags = 0; if (cull_back_faces) rayFlags |= gl_RayFlagsCullBackFacingTrianglesEXT; + rayFlags |= gl_RayFlagsSkipProceduralPrimitives; + + ray_payload_geometry.barycentric = vec2(0); + ray_payload_geometry.instance_prim = ~0u; + ray_payload_geometry.hit_distance = 0; + +#ifdef KHR_RAY_QUERY + + rayQueryEXT rayQuery; + rayQueryInitializeEXT(rayQuery, topLevelAS, rayFlags, instance_mask, + ray.origin, ray.t_min, ray.direction, ray.t_max); + + // Start traversal: return false if traversal is complete + while (rayQueryProceedEXT(rayQuery)) + { + uint sbtOffset = rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT(rayQuery, false); + int primitiveID = rayQueryGetIntersectionPrimitiveIndexEXT(rayQuery, false); + uint instanceCustomIndex = rayQueryGetIntersectionInstanceCustomIndexEXT(rayQuery, false); + float hitT = rayQueryGetIntersectionTEXT(rayQuery, false); + vec2 bary = rayQueryGetIntersectionBarycentricsEXT(rayQuery, false); + bool isProcedural = rayQueryGetIntersectionTypeEXT(rayQuery, false) == gl_RayQueryCandidateIntersectionAABBEXT; + + switch(sbtOffset) + { + case SBTO_MASKED: + if (pt_logic_masked(primitiveID, instanceCustomIndex, bary)) + rayQueryConfirmIntersectionEXT(rayQuery); + break; + } + } + + if (rayQueryGetIntersectionTypeEXT(rayQuery, true) == gl_RayQueryCommittedIntersectionTriangleEXT) + { + pt_logic_rchit(ray_payload_geometry, + rayQueryGetIntersectionPrimitiveIndexEXT(rayQuery, true), + rayQueryGetIntersectionInstanceCustomIndexEXT(rayQuery, true), + rayQueryGetIntersectionTEXT(rayQuery, true), + rayQueryGetIntersectionBarycentricsEXT(rayQuery, true)); + } + +#else + + traceRayEXT( topLevelAS, rayFlags, instance_mask, + SBT_RCHIT_GEOMETRY /*sbtRecordOffset*/, 0 /*sbtRecordStride*/, SBT_RMISS_EMPTY /*missIndex*/, + ray.origin, ray.t_min, ray.direction, ray.t_max, RT_PAYLOAD_GEOMETRY); + +#endif +} + +vec4 +trace_effects_ray(Ray ray, bool skip_procedural) +{ + uint rayFlags = 0; if (skip_procedural) rayFlags |= gl_RayFlagsSkipProceduralPrimitives; + + uint instance_mask = AS_FLAG_EFFECTS; - ray_payload_brdf.barycentric = vec2(0); - ray_payload_brdf.instance_prim = 0; - ray_payload_brdf.hit_distance = 0; - ray_payload_brdf.close_transparencies = uvec2(0); - ray_payload_brdf.farthest_transparency = uvec2(0); - ray_payload_brdf.closest_max_transparent_distance = 0; - ray_payload_brdf.farthest_transparent_distance = 0; - ray_payload_brdf.farthest_transparent_depth = 0; + ray_payload_effects.close_transparencies = uvec2(0); + ray_payload_effects.farthest_transparency = uvec2(0); + ray_payload_effects.closest_max_transparent_distance = 0; + ray_payload_effects.farthest_transparent_distance = 0; + ray_payload_effects.farthest_transparent_depth = 0; #ifdef KHR_RAY_QUERY @@ -317,11 +369,6 @@ trace_ray(Ray ray, bool cull_back_faces, int instance_mask, bool skip_procedural { switch(sbtOffset) { - case SBTO_MASKED: // masked materials - if (pt_logic_masked(primitiveID, instanceCustomIndex, bary)) - rayQueryConfirmIntersectionEXT(rayQuery); - break; - case SBTO_PARTICLE: // particles transparency = pt_logic_particle(primitiveID, bary); break; @@ -338,31 +385,19 @@ trace_ray(Ray ray, bool cull_back_faces, int instance_mask, bool skip_procedural if (transparency.color.a > 0) { - update_payload_transparency(ray_payload_brdf, transparency.color, transparency.thickness, hitT); + update_payload_transparency(ray_payload_effects, transparency.color, transparency.thickness, hitT); } } - if (rayQueryGetIntersectionTypeEXT(rayQuery, true) == gl_RayQueryCommittedIntersectionTriangleEXT) - { - pt_logic_rchit(ray_payload_brdf, - rayQueryGetIntersectionPrimitiveIndexEXT(rayQuery, true), - rayQueryGetIntersectionInstanceCustomIndexEXT(rayQuery, true), - rayQueryGetIntersectionTEXT(rayQuery, true), - rayQueryGetIntersectionBarycentricsEXT(rayQuery, true)); - } - else - { - // miss - ray_payload_brdf.instance_prim = ~0u; - } - #else traceRayEXT( topLevelAS, rayFlags, instance_mask, - SBT_RCHIT_OPAQUE /*sbtRecordOffset*/, 0 /*sbtRecordStride*/, SBT_RMISS_PATH_TRACER /*missIndex*/, - ray.origin, ray.t_min, ray.direction, ray.t_max, RT_PAYLOAD_BRDF); + SBT_RCHIT_EFFECTS /*sbtRecordOffset*/, 0 /*sbtRecordStride*/, SBT_RMISS_EMPTY /*missIndex*/, + ray.origin, ray.t_min, ray.direction, ray.t_max, RT_PAYLOAD_EFFECTS); #endif + + return get_payload_transparency(ray_payload_effects, ray.t_max); } Ray get_shadow_ray(vec3 p1, vec3 p2, float tmin) @@ -428,14 +463,9 @@ trace_shadow_ray(Ray ray, int cull_mask) vec3 trace_caustic_ray(Ray ray, int surface_medium) { - ray_payload_brdf.barycentric = vec2(0); - ray_payload_brdf.instance_prim = 0; - ray_payload_brdf.hit_distance = -1; - ray_payload_brdf.close_transparencies = uvec2(0); - ray_payload_brdf.farthest_transparency = uvec2(0); - ray_payload_brdf.closest_max_transparent_distance = 0; - ray_payload_brdf.farthest_transparent_distance = 0; - ray_payload_brdf.farthest_transparent_depth = 0; + ray_payload_geometry.barycentric = vec2(0); + ray_payload_geometry.instance_prim = ~0u; + ray_payload_geometry.hit_distance = -1; uint rayFlags = gl_RayFlagsCullBackFacingTrianglesEXT | gl_RayFlagsOpaqueEXT | gl_RayFlagsSkipProceduralPrimitives; @@ -451,47 +481,42 @@ trace_caustic_ray(Ray ray, int surface_medium) if (rayQueryGetIntersectionTypeEXT(rayQuery, true) == gl_RayQueryCommittedIntersectionTriangleEXT) { - pt_logic_rchit(ray_payload_brdf, + pt_logic_rchit(ray_payload_geometry, rayQueryGetIntersectionPrimitiveIndexEXT(rayQuery, true), rayQueryGetIntersectionInstanceCustomIndexEXT(rayQuery, true), rayQueryGetIntersectionTEXT(rayQuery, true), rayQueryGetIntersectionBarycentricsEXT(rayQuery, true)); } - else - { - // miss - ray_payload_brdf.instance_prim = ~0u; - } #else - traceRayEXT(topLevelAS, rayFlags, instance_mask, SBT_RCHIT_OPAQUE, 0, SBT_RMISS_PATH_TRACER, - ray.origin, ray.t_min, ray.direction, ray.t_max, RT_PAYLOAD_BRDF); + traceRayEXT(topLevelAS, rayFlags, instance_mask, SBT_RCHIT_GEOMETRY, 0, SBT_RMISS_EMPTY, + ray.origin, ray.t_min, ray.direction, ray.t_max, RT_PAYLOAD_GEOMETRY); #endif float extinction_distance = ray.t_max - ray.t_min; vec3 throughput = vec3(1); - if(found_intersection(ray_payload_brdf)) + if(found_intersection(ray_payload_geometry)) { - Triangle triangle = get_hit_triangle(ray_payload_brdf); + Triangle triangle = get_hit_triangle(ray_payload_geometry); vec3 geo_normal = triangle.normals[0]; bool is_vertical = abs(geo_normal.z) < 0.1; if((is_water(triangle.material_id) || is_slime(triangle.material_id)) && !is_vertical) { - vec3 position = ray.origin + ray.direction * ray_payload_brdf.hit_distance; + vec3 position = ray.origin + ray.direction * ray_payload_geometry.hit_distance; vec3 w = get_water_normal(triangle.material_id, geo_normal, triangle.tangents[0], position, true); float caustic = clamp((1 - pow(clamp(1 - length(w.xz), 0, 1), 2)) * 100, 0, 8); - caustic = mix(1, caustic, clamp(ray_payload_brdf.hit_distance * 0.02, 0, 1)); + caustic = mix(1, caustic, clamp(ray_payload_geometry.hit_distance * 0.02, 0, 1)); throughput = vec3(caustic); if(surface_medium != MEDIUM_NONE) { - extinction_distance = ray_payload_brdf.hit_distance; + extinction_distance = ray_payload_geometry.hit_distance; } else { @@ -500,12 +525,12 @@ trace_caustic_ray(Ray ray, int surface_medium) else surface_medium = MEDIUM_SLIME; - extinction_distance = max(0, ray.t_max - ray_payload_brdf.hit_distance); + extinction_distance = max(0, ray.t_max - ray_payload_geometry.hit_distance); } } else if(is_glass(triangle.material_id) || is_water(triangle.material_id) && is_vertical) { - vec3 bary = get_hit_barycentric(ray_payload_brdf); + vec3 bary = get_hit_barycentric(ray_payload_geometry); vec2 tex_coord = triangle.tex_coords * bary; MaterialInfo minfo = get_material_info(triangle.material_id); diff --git a/src/refresh/vkpt/shader/path_tracer_shadow.rmiss b/src/refresh/vkpt/shader/path_tracer_shadow.rmiss index 7a1488fa0..09805fd3f 100644 --- a/src/refresh/vkpt/shader/path_tracer_shadow.rmiss +++ b/src/refresh/vkpt/shader/path_tracer_shadow.rmiss @@ -21,7 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "path_tracer.h" -layout(location = 1) rayPayloadInEXT RayPayloadShadow ray_payload_shadow; +layout (location = RT_PAYLOAD_SHADOW) rayPayloadInEXT RayPayloadShadow ray_payload_shadow; void main() diff --git a/src/refresh/vkpt/shader/path_tracer_sprite.rahit b/src/refresh/vkpt/shader/path_tracer_sprite.rahit index e5334abf9..8dd5308dd 100644 --- a/src/refresh/vkpt/shader/path_tracer_sprite.rahit +++ b/src/refresh/vkpt/shader/path_tracer_sprite.rahit @@ -32,7 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "path_tracer_transparency.glsl" #include "path_tracer_hit_shaders.h" -rayPayloadInEXT RayPayload ray_payload; +layout (location = RT_PAYLOAD_EFFECTS) rayPayloadInEXT RayPayloadEffects ray_payload; hitAttributeEXT vec2 hit_attribs; void main() diff --git a/src/refresh/vkpt/shader/path_tracer_transparency.glsl b/src/refresh/vkpt/shader/path_tracer_transparency.glsl index 3d9f310f3..f591ffae9 100644 --- a/src/refresh/vkpt/shader/path_tracer_transparency.glsl +++ b/src/refresh/vkpt/shader/path_tracer_transparency.glsl @@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef PATH_TRACER_TRANSPARENCY_GLSL_ #define PATH_TRACER_TRANSPARENCY_GLSL_ -void update_payload_transparency(inout RayPayload rp, vec4 color, float thickness, float hitT) +void update_payload_transparency(inout RayPayloadEffects rp, vec4 color, float thickness, float hitT) { if(hitT > rp.farthest_transparent_distance) { @@ -39,7 +39,7 @@ void update_payload_transparency(inout RayPayload rp, vec4 color, float thicknes rp.close_transparencies = packHalf4x16(alpha_blend_premultiplied(color, unpackHalf4x16(rp.close_transparencies))); } -vec4 get_payload_transparency(in RayPayload rp, float solidDist) +vec4 get_payload_transparency(in RayPayloadEffects rp, float solidDist) { float scale_far = 1; if (rp.farthest_transparent_depth > 0) @@ -50,7 +50,7 @@ vec4 get_payload_transparency(in RayPayload rp, float solidDist) return alpha_blend_premultiplied(unpackHalf4x16(rp.close_transparencies), unpackHalf4x16(rp.farthest_transparency) * scale_far); } -vec4 get_payload_transparency_simple(in RayPayload rp) +vec4 get_payload_transparency_simple(in RayPayloadEffects rp) { return alpha_blend_premultiplied(unpackHalf4x16(rp.close_transparencies), unpackHalf4x16(rp.farthest_transparency)); } diff --git a/src/refresh/vkpt/shader/primary_rays.rgen b/src/refresh/vkpt/shader/primary_rays.rgen index 38bf14e7e..cc06f0174 100644 --- a/src/refresh/vkpt/shader/primary_rays.rgen +++ b/src/refresh/vkpt/shader/primary_rays.rgen @@ -155,20 +155,24 @@ main() if(global_ubo.pt_show_sky != 0) cull_mask |= AS_FLAG_CUSTOM_SKY; - trace_ray(ray, true, cull_mask, false); + trace_geometry_ray(ray, true, cull_mask); } + if (found_intersection(ray_payload_geometry)) + ray.t_max = ray_payload_geometry.hit_distance; + + vec4 effects = trace_effects_ray(ray, /* skip_procedural = */ false); + direction = ray.direction; // If the primary ray didn't hit anything, or it hit a sky polygon and pt_show_sky is disabled, // store the sky color and motion vectors. Doesn't apply to gradient samples because their rays intentionally miss. - if((!found_intersection(ray_payload_brdf) || (is_sky(ray_payload_brdf) && (global_ubo.pt_show_sky == 0)))) + if((!found_intersection(ray_payload_geometry) || (is_sky(ray_payload_geometry) && (global_ubo.pt_show_sky == 0)))) { vec3 env = env_map(ray.direction, false); env *= global_ubo.pt_env_scale; - vec4 ray_transparency = get_payload_transparency_simple(ray_payload_brdf); - vec4 transparent = alpha_blend(ray_transparency, vec4(env, 1)); + vec4 transparent = alpha_blend(effects, vec4(env, 1)); if(is_readback_pixel) { @@ -201,9 +205,9 @@ main() vec3 bary; { - bool is_dynamic_primitive = is_dynamic_instance(ray_payload_brdf); - uint primitive_id = get_primitive(ray_payload_brdf); - bary = get_hit_barycentric(ray_payload_brdf); + bool is_dynamic_primitive = is_dynamic_instance(ray_payload_geometry); + uint primitive_id = get_primitive(ray_payload_geometry); + bary = get_hit_barycentric(ray_payload_geometry); uvec2 vis_buf; vis_buf.x = is_dynamic_primitive @@ -437,50 +441,26 @@ main() } } - if(global_ubo.pt_show_sky != 0 && is_sky(ray_payload_brdf)) + // Start the transparency accumulation from the primary surface emissive component, with zero alpha + vec4 transparent = vec4(primary_emissive * throughput, 0); + + if(global_ubo.pt_show_sky != 0 && is_sky(ray_payload_geometry)) { // show additional information about sky boxes: triangle edges... if(any(lessThan(bary, vec3(0.02)))) { - imageStore(IMG_PT_TRANSPARENT, ipos, vec4(1,0,0,0.1)); - return; + transparent = alpha_blend(vec4(1,0,0,0.1), transparent); } // ... and light flags if((triangle.material_id & MATERIAL_FLAG_LIGHT) != 0) { - imageStore(IMG_PT_TRANSPARENT, ipos, vec4(0,0,1,0.1)); - return; + transparent = alpha_blend(vec4(0,0,1,0.1), transparent); } } - float hit_distance = ray_payload_brdf.hit_distance; - - if(ray_payload_brdf.farthest_transparent_distance <= hit_distance) - { - vec4 transparent = get_payload_transparency(ray_payload_brdf, hit_distance); - - // Blend in the emissive component from the primary surface, with zero alpha - transparent = alpha_blend_premultiplied(transparent, vec4(primary_emissive * throughput, 0)); - - imageStore(IMG_PT_TRANSPARENT, ipos, transparent); - return; - } - - // Difficult case: we found some transparency and it was behind the primary surface. - // Trace again. - - ray.t_max = hit_distance; - - { - int cull_mask = AS_FLAG_PARTICLES | AS_FLAG_EXPLOSIONS; - trace_ray(ray, true, cull_mask, false); - } - - vec4 transparent = get_payload_transparency(ray_payload_brdf, hit_distance); - - // Blend in the emissive component from the primary surface, with zero alpha - transparent = alpha_blend_premultiplied(transparent, vec4(primary_emissive * throughput, 0)); + // Add the world effects + transparent = alpha_blend_premultiplied(effects, transparent); imageStore(IMG_PT_TRANSPARENT, ipos, transparent); } diff --git a/src/refresh/vkpt/shader/reflect_refract.rgen b/src/refresh/vkpt/shader/reflect_refract.rgen index c62430461..b774a6080 100644 --- a/src/refresh/vkpt/shader/reflect_refract.rgen +++ b/src/refresh/vkpt/shader/reflect_refract.rgen @@ -481,18 +481,22 @@ main() else reflection_ray.origin -= normal.xyz * 0.001; - trace_ray(reflection_ray, backface_culling, reflection_cull_mask, false); + trace_geometry_ray(reflection_ray, backface_culling, reflection_cull_mask); // Add the transparency encountered along the reflection ray - vec4 payload_transparency = get_payload_transparency_simple(ray_payload_brdf); - transparent = alpha_blend(transparent, payload_transparency * vec4(throughput, 1)); - if(is_sky(ray_payload_brdf)) + if (found_intersection(ray_payload_geometry)) + reflection_ray.t_max = ray_payload_geometry.hit_distance; + + vec4 effects = trace_effects_ray(reflection_ray, /* skip_procedural = */ false); + transparent = alpha_blend_premultiplied(transparent, effects * vec4(throughput, 1)); + + if(is_sky(ray_payload_geometry)) { // Reflection ray hit the sky - store an empty surface into the G-buffer, // blend the environment under the transparency. - if(found_intersection(ray_payload_brdf)) + if(found_intersection(ray_payload_geometry)) { vec3 env = env_map(direction, false); env *= global_ubo.pt_env_scale; @@ -516,16 +520,16 @@ main() } // Throughput before extinction - imageStore(IMG_PT_GODRAYS_THROUGHPUT_DIST, ipos, vec4(throughput, ray_payload_brdf.hit_distance)); + imageStore(IMG_PT_GODRAYS_THROUGHPUT_DIST, ipos, vec4(throughput, ray_payload_geometry.hit_distance)); if(primary_medium != MEDIUM_NONE) { // Extinction along the reflected/refracted ray - throughput *= extinction(primary_medium, ray_payload_brdf.hit_distance); + throughput *= extinction(primary_medium, ray_payload_geometry.hit_distance); } - Triangle triangle = get_hit_triangle(ray_payload_brdf); - vec3 bary = get_hit_barycentric(ray_payload_brdf); + Triangle triangle = get_hit_triangle(ray_payload_geometry); + vec3 bary = get_hit_barycentric(ray_payload_geometry); vec2 tex_coord = triangle.tex_coords * bary; vec3 new_geo_normal = normalize(triangle.normals * bary); @@ -542,7 +546,7 @@ main() // in `primary_rays.rgen` and stored in the throughput texture. float lod = 0; { - optical_path_length += ray_payload_brdf.hit_distance; + optical_path_length += ray_payload_geometry.hit_distance; float footprint_size_over_distance = texelFetch(TEX_PT_BOUNCE_THROUGHPUT, ipos, 0).a; float ray_footprint = footprint_size_over_distance * optical_path_length; @@ -702,8 +706,8 @@ main() transparent = alpha_blend_premultiplied(transparent, vec4(primary_emissive * throughput, 0)); } - bool is_dynamic_primitive = is_dynamic_instance(ray_payload_brdf); - uint primitive_id = get_primitive(ray_payload_brdf); + bool is_dynamic_primitive = is_dynamic_instance(ray_payload_geometry); + uint primitive_id = get_primitive(ray_payload_geometry); uvec2 vis_buf; vis_buf.x = is_dynamic_primitive From 1f2f2361b12fbd9d454f88b0f908cf3821ff1367 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Tue, 14 Sep 2021 11:01:54 -0700 Subject: [PATCH 40/55] Removed the special "shadow" ray payload. --- src/CMakeLists.txt | 1 - src/refresh/vkpt/path_tracer.c | 41 ++++--------------- src/refresh/vkpt/shader/constants.h | 26 +++++------- src/refresh/vkpt/shader/path_tracer_rgen.h | 11 ++--- .../vkpt/shader/path_tracer_shadow.rmiss | 30 -------------- src/refresh/vkpt/vkpt.h | 1 - 6 files changed, 25 insertions(+), 85 deletions(-) delete mode 100644 src/refresh/vkpt/shader/path_tracer_shadow.rmiss diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1216bf40a..0c9dfb1fb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -348,7 +348,6 @@ set(SRC_RT_SHADERS refresh/vkpt/shader/path_tracer_beam.rahit refresh/vkpt/shader/path_tracer_beam.rint refresh/vkpt/shader/path_tracer_explosion.rahit - refresh/vkpt/shader/path_tracer_shadow.rmiss refresh/vkpt/shader/reflect_refract.rgen ) diff --git a/src/refresh/vkpt/path_tracer.c b/src/refresh/vkpt/path_tracer.c index 92c6243f7..e0e3c70a9 100644 --- a/src/refresh/vkpt/path_tracer.c +++ b/src/refresh/vkpt/path_tracer.c @@ -1242,7 +1242,6 @@ vkpt_pt_create_pipelines() // Shader module is set below }, SHADER_STAGE(QVK_MOD_PATH_TRACER_RMISS, VK_SHADER_STAGE_MISS_BIT_KHR), - SHADER_STAGE(QVK_MOD_PATH_TRACER_SHADOW_RMISS, VK_SHADER_STAGE_MISS_BIT_KHR), SHADER_STAGE(QVK_MOD_PATH_TRACER_RCHIT, VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR), SHADER_STAGE(QVK_MOD_PATH_TRACER_MASKED_RAHIT, VK_SHADER_STAGE_ANY_HIT_BIT_KHR), // Stages used by all pipelines that consider transparency @@ -1338,27 +1337,11 @@ vkpt_pt_create_pipelines() .anyHitShader = VK_SHADER_UNUSED_KHR, .intersectionShader = VK_SHADER_UNUSED_KHR }, - [SBT_RMISS_SHADOW] = { - .sType = VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR, - .type = VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_KHR, - .generalShader = 2, - .closestHitShader = VK_SHADER_UNUSED_KHR, - .anyHitShader = VK_SHADER_UNUSED_KHR, - .intersectionShader = VK_SHADER_UNUSED_KHR - }, [SBT_RCHIT_GEOMETRY] = { .sType = VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR, .type = VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR, .generalShader = VK_SHADER_UNUSED_KHR, - .closestHitShader = 3, - .anyHitShader = VK_SHADER_UNUSED_KHR, - .intersectionShader = VK_SHADER_UNUSED_KHR - }, - [SBT_RCHIT_EMPTY] = { - .sType = VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR, - .type = VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR, - .generalShader = VK_SHADER_UNUSED_KHR, - .closestHitShader = VK_SHADER_UNUSED_KHR, + .closestHitShader = 2, .anyHitShader = VK_SHADER_UNUSED_KHR, .intersectionShader = VK_SHADER_UNUSED_KHR }, @@ -1366,16 +1349,8 @@ vkpt_pt_create_pipelines() .sType = VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR, .type = VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR, .generalShader = VK_SHADER_UNUSED_KHR, - .closestHitShader = 3, - .anyHitShader = 4, - .intersectionShader = VK_SHADER_UNUSED_KHR - }, - [SBT_RAHIT_MASKED_SHADOW] = { - .sType = VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR, - .type = VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR, - .generalShader = VK_SHADER_UNUSED_KHR, - .closestHitShader = VK_SHADER_UNUSED_KHR, - .anyHitShader = 4, + .closestHitShader = 2, + .anyHitShader = 3, .intersectionShader = VK_SHADER_UNUSED_KHR }, [SBT_RCHIT_EFFECTS] = { @@ -1391,7 +1366,7 @@ vkpt_pt_create_pipelines() .type = VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR, .generalShader = VK_SHADER_UNUSED_KHR, .closestHitShader = VK_SHADER_UNUSED_KHR, - .anyHitShader = 5, + .anyHitShader = 4, .intersectionShader = VK_SHADER_UNUSED_KHR }, [SBT_RAHIT_EXPLOSION] = { @@ -1399,7 +1374,7 @@ vkpt_pt_create_pipelines() .type = VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR, .generalShader = VK_SHADER_UNUSED_KHR, .closestHitShader = VK_SHADER_UNUSED_KHR, - .anyHitShader = 6, + .anyHitShader = 5, .intersectionShader = VK_SHADER_UNUSED_KHR }, [SBT_RAHIT_SPRITE] = { @@ -1407,7 +1382,7 @@ vkpt_pt_create_pipelines() .type = VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR, .generalShader = VK_SHADER_UNUSED_KHR, .closestHitShader = VK_SHADER_UNUSED_KHR, - .anyHitShader = 7, + .anyHitShader = 6, .intersectionShader = VK_SHADER_UNUSED_KHR }, [SBT_RINT_BEAM] = { @@ -1415,8 +1390,8 @@ vkpt_pt_create_pipelines() .type = VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_KHR, .generalShader = VK_SHADER_UNUSED_KHR, .closestHitShader = VK_SHADER_UNUSED_KHR, - .anyHitShader = 8, - .intersectionShader = 9 + .anyHitShader = 7, + .intersectionShader = 8 } }; diff --git a/src/refresh/vkpt/shader/constants.h b/src/refresh/vkpt/shader/constants.h index 2469f144f..4b74a670d 100644 --- a/src/refresh/vkpt/shader/constants.h +++ b/src/refresh/vkpt/shader/constants.h @@ -120,24 +120,20 @@ with this program; if not, write to the Free Software Foundation, Inc., #define AS_INSTANCE_MASK_OFFSET (AS_INSTANCE_FLAG_SKY - 1) #define RT_PAYLOAD_GEOMETRY 0 -#define RT_PAYLOAD_SHADOW 1 -#define RT_PAYLOAD_EFFECTS 2 +#define RT_PAYLOAD_EFFECTS 1 #define SBT_RGEN 0 #define SBT_RMISS_EMPTY 1 -#define SBT_RMISS_SHADOW 2 - -#define SBT_RCHIT_GEOMETRY 3 -#define SBT_RCHIT_EMPTY 4 -#define SBT_RAHIT_MASKED 5 -#define SBT_RAHIT_MASKED_SHADOW 6 - -#define SBT_RCHIT_EFFECTS 7 -#define SBT_RAHIT_PARTICLE 8 -#define SBT_RAHIT_EXPLOSION 9 -#define SBT_RAHIT_SPRITE 10 -#define SBT_RINT_BEAM 11 -#define SBT_ENTRIES_PER_PIPELINE 12 + +#define SBT_RCHIT_GEOMETRY 2 +#define SBT_RAHIT_MASKED 3 + +#define SBT_RCHIT_EFFECTS 4 +#define SBT_RAHIT_PARTICLE 5 +#define SBT_RAHIT_EXPLOSION 6 +#define SBT_RAHIT_SPRITE 7 +#define SBT_RINT_BEAM 8 +#define SBT_ENTRIES_PER_PIPELINE 9 // vkpt_pt_create_pipelines() relies on all 'transparency' SBT entries coming after SBT_FIRST_TRANSPARENCY #define SBT_FIRST_TRANSPARENCY SBT_RCHIT_EFFECTS diff --git a/src/refresh/vkpt/shader/path_tracer_rgen.h b/src/refresh/vkpt/shader/path_tracer_rgen.h index 59e4d8ed9..4359311d1 100644 --- a/src/refresh/vkpt/shader/path_tracer_rgen.h +++ b/src/refresh/vkpt/shader/path_tracer_rgen.h @@ -81,7 +81,6 @@ RayPayloadEffects ray_payload_effects; layout(location = RT_PAYLOAD_GEOMETRY) rayPayloadEXT RayPayloadGeometry ray_payload_geometry; layout(location = RT_PAYLOAD_EFFECTS) rayPayloadEXT RayPayloadEffects ray_payload_effects; -layout(location = RT_PAYLOAD_SHADOW) rayPayloadEXT RayPayloadShadow ray_payload_shadow; #endif @@ -449,13 +448,15 @@ trace_shadow_ray(Ray ray, int cull_mask) #else - ray_payload_shadow.missed = 0; + ray_payload_geometry.barycentric = vec2(0); + ray_payload_geometry.instance_prim = ~0u; + ray_payload_geometry.hit_distance = -1; traceRayEXT( topLevelAS, rayFlags, cull_mask, - SBT_RCHIT_EMPTY /*sbtRecordOffset*/, 0 /*sbtRecordStride*/, SBT_RMISS_SHADOW /*missIndex*/, - ray.origin, ray.t_min, ray.direction, ray.t_max, RT_PAYLOAD_SHADOW); + SBT_RCHIT_GEOMETRY /*sbtRecordOffset*/, 0 /*sbtRecordStride*/, SBT_RMISS_EMPTY /*missIndex*/, + ray.origin, ray.t_min, ray.direction, ray.t_max, RT_PAYLOAD_GEOMETRY); - return float(ray_payload_shadow.missed); + return found_intersection(ray_payload_geometry) ? 0.0 : 1.0; #endif } diff --git a/src/refresh/vkpt/shader/path_tracer_shadow.rmiss b/src/refresh/vkpt/shader/path_tracer_shadow.rmiss deleted file mode 100644 index 09805fd3f..000000000 --- a/src/refresh/vkpt/shader/path_tracer_shadow.rmiss +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright (C) 2019, NVIDIA CORPORATION. All rights reserved. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ - -#version 460 -#extension GL_GOOGLE_include_directive : enable - -#include "path_tracer.h" - -layout (location = RT_PAYLOAD_SHADOW) rayPayloadInEXT RayPayloadShadow ray_payload_shadow; - -void -main() -{ - ray_payload_shadow.missed = 1; -} diff --git a/src/refresh/vkpt/vkpt.h b/src/refresh/vkpt/vkpt.h index 9cd76bdd9..c7b246db8 100644 --- a/src/refresh/vkpt/vkpt.h +++ b/src/refresh/vkpt/vkpt.h @@ -113,7 +113,6 @@ with this program; if not, write to the Free Software Foundation, Inc., SHADER_MODULE_DO(QVK_MOD_PATH_TRACER_BEAM_RAHIT) \ SHADER_MODULE_DO(QVK_MOD_PATH_TRACER_BEAM_RINT) \ SHADER_MODULE_DO(QVK_MOD_PATH_TRACER_RMISS) \ - SHADER_MODULE_DO(QVK_MOD_PATH_TRACER_SHADOW_RMISS) \ SHADER_MODULE_DO(QVK_MOD_PATH_TRACER_EXPLOSION_RAHIT) \ SHADER_MODULE_DO(QVK_MOD_PATH_TRACER_SPRITE_RAHIT) \ From 36902b1155896e94f3206df774b9d659fd9c2689 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Tue, 14 Sep 2021 11:30:48 -0700 Subject: [PATCH 41/55] Handle the TLAS using the same matching structures as those used for BLAS. This is done in preparation to add more TLAS. --- src/refresh/vkpt/path_tracer.c | 267 +++++++++++++++++---------------- 1 file changed, 138 insertions(+), 129 deletions(-) diff --git a/src/refresh/vkpt/path_tracer.c b/src/refresh/vkpt/path_tracer.c index e0e3c70a9..13d8ed662 100644 --- a/src/refresh/vkpt/path_tracer.c +++ b/src/refresh/vkpt/path_tracer.c @@ -39,23 +39,20 @@ static uint32_t shaderGroupHandleSize = 0; static uint32_t shaderGroupBaseAlignment = 0; static uint32_t minAccelerationStructureScratchOffsetAlignment = 0; -typedef struct accel_bottom_match_info_s { +typedef struct { int fast_build; uint32_t vertex_count; uint32_t index_count; uint32_t aabb_count; -} accel_bottom_match_info_t; - -typedef struct accel_top_match_info_s { - uint32_t instanceCount; -} accel_top_match_info_t; + uint32_t instance_count; +} accel_match_info_t; typedef struct { VkAccelerationStructureKHR accel; - accel_bottom_match_info_t match; + accel_match_info_t match; BufferResource_t mem; qboolean present; -} blas_t; +} accel_struct_t; typedef enum { PIPELINE_PRIMARY_RAYS, @@ -81,24 +78,22 @@ static int masked_model_primitive_offset = 0; static int viewer_model_primitive_offset = 0; static int viewer_weapon_primitive_offset = 0; static int explosions_primitive_offset = 0; -static blas_t blas_static; -static blas_t blas_transparent; -static blas_t blas_masked; -static blas_t blas_sky; -static blas_t blas_custom_sky; -static blas_t blas_dynamic[MAX_FRAMES_IN_FLIGHT]; -static blas_t blas_transparent_models[MAX_FRAMES_IN_FLIGHT]; -static blas_t blas_masked_models[MAX_FRAMES_IN_FLIGHT]; -static blas_t blas_viewer_models[MAX_FRAMES_IN_FLIGHT]; -static blas_t blas_viewer_weapon[MAX_FRAMES_IN_FLIGHT]; -static blas_t blas_explosions[MAX_FRAMES_IN_FLIGHT]; -static blas_t blas_particles[MAX_FRAMES_IN_FLIGHT]; -static blas_t blas_beams[MAX_FRAMES_IN_FLIGHT]; -static blas_t blas_sprites[MAX_FRAMES_IN_FLIGHT]; - -static VkAccelerationStructureKHR accel_top[MAX_FRAMES_IN_FLIGHT]; -static accel_top_match_info_t accel_top_match[MAX_FRAMES_IN_FLIGHT]; -static BufferResource_t mem_accel_top[MAX_FRAMES_IN_FLIGHT]; +static accel_struct_t blas_static; +static accel_struct_t blas_transparent; +static accel_struct_t blas_masked; +static accel_struct_t blas_sky; +static accel_struct_t blas_custom_sky; +static accel_struct_t blas_dynamic[MAX_FRAMES_IN_FLIGHT]; +static accel_struct_t blas_transparent_models[MAX_FRAMES_IN_FLIGHT]; +static accel_struct_t blas_masked_models[MAX_FRAMES_IN_FLIGHT]; +static accel_struct_t blas_viewer_models[MAX_FRAMES_IN_FLIGHT]; +static accel_struct_t blas_viewer_weapon[MAX_FRAMES_IN_FLIGHT]; +static accel_struct_t blas_explosions[MAX_FRAMES_IN_FLIGHT]; +static accel_struct_t blas_particles[MAX_FRAMES_IN_FLIGHT]; +static accel_struct_t blas_beams[MAX_FRAMES_IN_FLIGHT]; +static accel_struct_t blas_sprites[MAX_FRAMES_IN_FLIGHT]; + +static accel_struct_t tlas_geometry[MAX_FRAMES_IN_FLIGHT]; static BufferResource_t buf_shader_binding_table; @@ -288,7 +283,7 @@ vkpt_pt_update_descripter_set_bindings(int idx) VkWriteDescriptorSetAccelerationStructureKHR desc_accel_struct = { .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR, .accelerationStructureCount = 1, - .pAccelerationStructures = accel_top + idx + .pAccelerationStructures = &tlas_geometry[idx].accel }; VkBufferView particle_color_buffer_view = get_transparency_particle_color_buffer_view(); @@ -344,7 +339,7 @@ vkpt_pt_update_descripter_set_bindings(int idx) return VK_SUCCESS; } -static void destroy_blas(blas_t* blas) +static void destroy_accel_struct(accel_struct_t* blas) { buffer_destroy(&blas->mem); @@ -358,31 +353,32 @@ static void destroy_blas(blas_t* blas) blas->match.index_count = 0; blas->match.vertex_count = 0; blas->match.aabb_count = 0; + blas->match.instance_count = 0; } void vkpt_pt_destroy_static() { - destroy_blas(&blas_static); - destroy_blas(&blas_transparent); - destroy_blas(&blas_masked); - destroy_blas(&blas_sky); - destroy_blas(&blas_custom_sky); + destroy_accel_struct(&blas_static); + destroy_accel_struct(&blas_transparent); + destroy_accel_struct(&blas_masked); + destroy_accel_struct(&blas_sky); + destroy_accel_struct(&blas_custom_sky); } static void vkpt_pt_destroy_dynamic(int idx) { - destroy_blas(&blas_dynamic[idx]); - destroy_blas(&blas_transparent_models[idx]); - destroy_blas(&blas_masked_models[idx]); - destroy_blas(&blas_viewer_models[idx]); - destroy_blas(&blas_viewer_weapon[idx]); - destroy_blas(&blas_explosions[idx]); - destroy_blas(&blas_particles[idx]); - destroy_blas(&blas_beams[idx]); - destroy_blas(&blas_sprites[idx]); + destroy_accel_struct(&blas_dynamic[idx]); + destroy_accel_struct(&blas_transparent_models[idx]); + destroy_accel_struct(&blas_masked_models[idx]); + destroy_accel_struct(&blas_viewer_models[idx]); + destroy_accel_struct(&blas_viewer_weapon[idx]); + destroy_accel_struct(&blas_explosions[idx]); + destroy_accel_struct(&blas_particles[idx]); + destroy_accel_struct(&blas_beams[idx]); + destroy_accel_struct(&blas_sprites[idx]); } -static inline int accel_matches(accel_bottom_match_info_t *match, +static inline int accel_matches(accel_match_info_t *match, int fast_build, uint32_t vertex_count, uint32_t index_count) { @@ -391,13 +387,20 @@ static inline int accel_matches(accel_bottom_match_info_t *match, match->index_count >= index_count; } -static inline int accel_matches_aabb(accel_bottom_match_info_t *match, +static inline int accel_matches_aabb(accel_match_info_t *match, int fast_build, uint32_t aabb_count) { return match->fast_build == fast_build && match->aabb_count >= aabb_count; } +static inline int accel_matches_top_level(accel_match_info_t *match, + int fast_build, + uint32_t instance_count) { + return match->fast_build == fast_build && + match->instance_count >= instance_count; +} + // How much to bloat the dynamic geometry allocations // to try to avoid later allocations. #define DYNAMIC_GEOMETRY_BLOAT_FACTOR 2 @@ -412,7 +415,7 @@ vkpt_pt_create_accel_bottom( VkDeviceAddress offset_index, int num_vertices, int num_indices, - blas_t* blas, + accel_struct_t* blas, qboolean is_dynamic, qboolean fast_build) { @@ -474,7 +477,7 @@ vkpt_pt_create_accel_bottom( if (doFree) { - destroy_blas(blas); + destroy_accel_struct(blas); } // Find size to build on the device @@ -515,6 +518,7 @@ vkpt_pt_create_accel_bottom( blas->match.vertex_count = num_vertices_to_allocate; blas->match.index_count = num_indices_to_allocate; blas->match.aabb_count = 0; + blas->match.instance_count = 0; } // set where the build lands @@ -546,7 +550,7 @@ vkpt_pt_create_accel_bottom_aabb( BufferResource_t* buffer_aabb, VkDeviceAddress offset_aabb, int num_aabbs, - blas_t* blas, + accel_struct_t* blas, qboolean is_dynamic, qboolean fast_build) { @@ -603,7 +607,7 @@ vkpt_pt_create_accel_bottom_aabb( if (doFree) { - destroy_blas(blas); + destroy_accel_struct(blas); } // Find size to build on the device @@ -642,6 +646,7 @@ vkpt_pt_create_accel_bottom_aabb( blas->match.vertex_count = 0; blas->match.index_count = 0; blas->match.aabb_count = num_aabs_to_allocate; + blas->match.instance_count = 0; } // set where the build lands @@ -776,20 +781,8 @@ vkpt_pt_create_all_dynamic( return VK_SUCCESS; } -void -vkpt_pt_destroy_toplevel(int idx) -{ - if(accel_top[idx]) { - qvkDestroyAccelerationStructureKHR(qvk.device, accel_top[idx], NULL); - accel_top[idx] = VK_NULL_HANDLE; - accel_top_match[idx].instanceCount = 0; - } - - buffer_destroy(&mem_accel_top[idx]); -} - static void -append_blas(QvkGeometryInstance_t *instances, uint32_t *num_instances, blas_t* blas, int instance_id, int mask, int flags, int sbt_offset) +append_blas(QvkGeometryInstance_t *instances, uint32_t *num_instances, accel_struct_t* blas, int instance_id, int mask, int flags, int sbt_offset) { if (!blas->present) return; @@ -819,6 +812,88 @@ append_blas(QvkGeometryInstance_t *instances, uint32_t *num_instances, blas_t* b ++*num_instances; } +static void +build_tlas(VkCommandBuffer cmd_buf, accel_struct_t* as, VkDeviceAddress instance_data, uint32_t num_instances) +{ + // Build the TLAS + VkAccelerationStructureGeometryDataKHR geometry = { + .instances = { + .sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_INSTANCES_DATA_KHR, + .data = {.deviceAddress = instance_data} + } + }; + assert(buf_instances[idx].address); + + VkAccelerationStructureGeometryKHR topASGeometry = { + .sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR, + .geometryType = VK_GEOMETRY_TYPE_INSTANCES_KHR, + .geometry = geometry + }; + + // Find size to build on the device + VkAccelerationStructureBuildGeometryInfoKHR buildInfo = { + .sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_GEOMETRY_INFO_KHR, + .flags = VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_KHR, + .geometryCount = 1, + .pGeometries = &topASGeometry, + .mode = VK_BUILD_ACCELERATION_STRUCTURE_MODE_BUILD_KHR, + .type = VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR, + .srcAccelerationStructure = VK_NULL_HANDLE + }; + + VkAccelerationStructureBuildSizesInfoKHR sizeInfo = { .sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_SIZES_INFO_KHR }; + qvkGetAccelerationStructureBuildSizesKHR(qvk.device, VK_ACCELERATION_STRUCTURE_BUILD_TYPE_DEVICE_KHR, &buildInfo, &num_instances, &sizeInfo); + assert(sizeInfo.accelerationStructureSize < SIZE_SCRATCH_BUFFER); + + if (!accel_matches_top_level(&as->match, qtrue, num_instances)) + { + destroy_accel_struct(as); + + // Create the buffer for the acceleration structure + buffer_create(&as->mem, sizeInfo.accelerationStructureSize, + VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, + VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); + + // Create TLAS + // Create acceleration structure + VkAccelerationStructureCreateInfoKHR createInfo = { + .sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_KHR, + .type = VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR, + .size = sizeInfo.accelerationStructureSize, + .buffer = as->mem.buffer + }; + + // Create the acceleration structure + qvkCreateAccelerationStructureKHR(qvk.device, &createInfo, NULL, &as->accel); + + as->match.fast_build = qtrue; + as->match.index_count = 0; + as->match.vertex_count = 0; + as->match.aabb_count = 0; + as->match.instance_count = num_instances; + } + + // Update build information + buildInfo.dstAccelerationStructure = as->accel; + buildInfo.scratchData.deviceAddress = buf_accel_scratch.address + scratch_buf_ptr; + assert(buf_accel_scratch.address); + + // Update the scratch buffer ptr + scratch_buf_ptr += sizeInfo.buildScratchSize; + scratch_buf_ptr = align(scratch_buf_ptr, minAccelerationStructureScratchOffsetAlignment); + assert(scratch_buf_ptr < SIZE_SCRATCH_BUFFER); + + VkAccelerationStructureBuildRangeInfoKHR offset = { .primitiveCount = num_instances }; + + const VkAccelerationStructureBuildRangeInfoKHR* offsets = &offset; + + qvkCmdBuildAccelerationStructuresKHR( + cmd_buf, + 1, + &buildInfo, + &offsets); +} + VkResult vkpt_pt_create_toplevel(VkCommandBuffer cmd_buf, int idx, qboolean include_world, qboolean weapon_left_handed) { @@ -866,73 +941,7 @@ vkpt_pt_create_toplevel(VkCommandBuffer cmd_buf, int idx, qboolean include_world buffer_unmap(buf_instances + idx); instance_data = NULL; - { - // Build the TLAS - VkAccelerationStructureGeometryDataKHR geometry = { - .instances = { - .sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_INSTANCES_DATA_KHR, - .data = {.deviceAddress = buf_instances[idx].address } - } - }; - assert(buf_instances[idx].address); - - VkAccelerationStructureGeometryKHR topASGeometry = { - .sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR, - .geometryType = VK_GEOMETRY_TYPE_INSTANCES_KHR, - .geometry = geometry - }; - - // Find size to build on the device - VkAccelerationStructureBuildGeometryInfoKHR buildInfo = { - .sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_GEOMETRY_INFO_KHR, - .flags = VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_KHR, - .geometryCount = 1, - .pGeometries = &topASGeometry, - .mode = VK_BUILD_ACCELERATION_STRUCTURE_MODE_BUILD_KHR, - .type = VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR, - .srcAccelerationStructure = VK_NULL_HANDLE - }; - - VkAccelerationStructureBuildSizesInfoKHR sizeInfo = { .sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_SIZES_INFO_KHR }; - qvkGetAccelerationStructureBuildSizesKHR(qvk.device, VK_ACCELERATION_STRUCTURE_BUILD_TYPE_DEVICE_KHR, &buildInfo, &num_instances, &sizeInfo); - assert(sizeInfo.accelerationStructureSize < SIZE_SCRATCH_BUFFER); - - if (accel_top_match[idx].instanceCount < num_instances) { - vkpt_pt_destroy_toplevel(idx); - - // Create the buffer for the acceleration structure - buffer_create(&mem_accel_top[idx], sizeInfo.accelerationStructureSize, VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT); - - // Create TLAS - // Create acceleration structure - VkAccelerationStructureCreateInfoKHR createInfo = { - .sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_KHR, - .type = VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR, - .size = sizeInfo.accelerationStructureSize, - .buffer = mem_accel_top[idx].buffer - }; - - // Create the acceleration structure - qvkCreateAccelerationStructureKHR(qvk.device, &createInfo, NULL, &accel_top[idx]); - - accel_top_match[idx].instanceCount = num_instances; - } - - // Update build information - buildInfo.dstAccelerationStructure = accel_top[idx]; - buildInfo.scratchData.deviceAddress = buf_accel_scratch.address; - assert(buf_accel_scratch.address); - - VkAccelerationStructureBuildRangeInfoKHR offset = { .primitiveCount = num_instances }; - - const VkAccelerationStructureBuildRangeInfoKHR* offsets = &offset; - - qvkCmdBuildAccelerationStructuresKHR( - cmd_buf, - 1, - &buildInfo, - &offsets); - } + build_tlas(cmd_buf, &tlas_geometry[idx], buf_instances[idx].address, num_instances); MEM_BARRIER_BUILD_ACCEL(cmd_buf); /* probably not needed here but doesn't matter */ @@ -1189,7 +1198,7 @@ vkpt_pt_destroy() { for(int i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) { - vkpt_pt_destroy_toplevel(i); + destroy_accel_struct(tlas_geometry + i); buffer_destroy(buf_instances + i); vkpt_pt_destroy_dynamic(i); } From d4039bb07fafc2d234b40b58600d0328ace2667d Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Tue, 14 Sep 2021 12:10:46 -0700 Subject: [PATCH 42/55] Moved the effects into their own TLAS. --- src/refresh/vkpt/path_tracer.c | 26 +++++++++++++++++----- src/refresh/vkpt/shader/constants.h | 18 ++++++++++----- src/refresh/vkpt/shader/path_tracer_rgen.h | 19 ++++++++-------- 3 files changed, 42 insertions(+), 21 deletions(-) diff --git a/src/refresh/vkpt/path_tracer.c b/src/refresh/vkpt/path_tracer.c index 13d8ed662..a40701b6d 100644 --- a/src/refresh/vkpt/path_tracer.c +++ b/src/refresh/vkpt/path_tracer.c @@ -94,6 +94,7 @@ static accel_struct_t blas_beams[MAX_FRAMES_IN_FLIGHT]; static accel_struct_t blas_sprites[MAX_FRAMES_IN_FLIGHT]; static accel_struct_t tlas_geometry[MAX_FRAMES_IN_FLIGHT]; +static accel_struct_t tlas_effects[MAX_FRAMES_IN_FLIGHT]; static BufferResource_t buf_shader_binding_table; @@ -179,7 +180,7 @@ vkpt_pt_init() { .binding = RAY_GEN_ACCEL_STRUCTURE_BINDING_IDX, .descriptorType = VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR, - .descriptorCount = 1, + .descriptorCount = TLAS_COUNT, .stageFlags = qvk.use_ray_query ? VK_SHADER_STAGE_COMPUTE_BIT : VK_SHADER_STAGE_RAYGEN_BIT_KHR, }, { @@ -280,10 +281,15 @@ VkResult vkpt_pt_update_descripter_set_bindings(int idx) { /* update descriptor set bindings */ + const VkAccelerationStructureKHR tlas[TLAS_COUNT] = { + [TLAS_INDEX_GEOMETRY] = tlas_geometry[idx].accel, + [TLAS_INDEX_EFFECTS] = tlas_effects[idx].accel + }; + VkWriteDescriptorSetAccelerationStructureKHR desc_accel_struct = { .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR, - .accelerationStructureCount = 1, - .pAccelerationStructures = &tlas_geometry[idx].accel + .accelerationStructureCount = TLAS_COUNT, + .pAccelerationStructures = tlas }; VkBufferView particle_color_buffer_view = get_transparency_particle_color_buffer_view(); @@ -297,7 +303,7 @@ vkpt_pt_update_descripter_set_bindings(int idx) .pNext = (const void*)&desc_accel_struct, .dstSet = rt_descriptor_set[idx], .dstBinding = RAY_GEN_ACCEL_STRUCTURE_BINDING_IDX, - .descriptorCount = 1, + .descriptorCount = TLAS_COUNT, .descriptorType = VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR }, { @@ -912,14 +918,17 @@ vkpt_pt_create_toplevel(VkCommandBuffer cmd_buf, int idx, qboolean include_world append_blas(instances, &num_instances, &blas_dynamic[idx], AS_INSTANCE_FLAG_DYNAMIC, AS_FLAG_OPAQUE, VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR, SBTO_OPAQUE); append_blas(instances, &num_instances, &blas_transparent_models[idx], AS_INSTANCE_FLAG_DYNAMIC | transparent_model_primitive_offset, AS_FLAG_TRANSPARENT, VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR, SBTO_OPAQUE); append_blas(instances, &num_instances, &blas_masked_models[idx], AS_INSTANCE_FLAG_DYNAMIC | masked_model_primitive_offset, AS_FLAG_OPAQUE, VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_KHR | VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR, SBTO_MASKED); - append_blas(instances, &num_instances, &blas_explosions[idx], AS_INSTANCE_FLAG_DYNAMIC | explosions_primitive_offset, AS_FLAG_EFFECTS, 0, SBTO_EXPLOSION); append_blas(instances, &num_instances, &blas_viewer_weapon[idx], AS_INSTANCE_FLAG_DYNAMIC | viewer_weapon_primitive_offset, AS_FLAG_VIEWER_WEAPON, VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR | (weapon_left_handed ? VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_KHR : 0), SBTO_OPAQUE); if (cl_player_model->integer == CL_PLAYER_MODEL_FIRST_PERSON) { append_blas(instances, &num_instances, &blas_viewer_models[idx], AS_INSTANCE_FLAG_DYNAMIC | viewer_model_primitive_offset, AS_FLAG_VIEWER_MODELS, VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR | VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR, SBTO_OPAQUE); } + + uint32_t num_instances_geometry = num_instances; + append_blas(instances, &num_instances, &blas_explosions[idx], AS_INSTANCE_FLAG_DYNAMIC | explosions_primitive_offset, AS_FLAG_EFFECTS, 0, SBTO_EXPLOSION); + if (cvar_pt_enable_particles->integer != 0) { append_blas(instances, &num_instances, &blas_particles[idx], 0, AS_FLAG_EFFECTS, VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR, SBTO_PARTICLE); @@ -934,6 +943,8 @@ vkpt_pt_create_toplevel(VkCommandBuffer cmd_buf, int idx, qboolean include_world { append_blas(instances, &num_instances, &blas_sprites[idx], 0, AS_FLAG_EFFECTS, VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR, SBTO_SPRITE); } + + uint32_t num_instances_effects = num_instances - num_instances_geometry; void *instance_data = buffer_map(buf_instances + idx); memcpy(instance_data, &instances, sizeof(QvkGeometryInstance_t) * num_instances); @@ -941,7 +952,9 @@ vkpt_pt_create_toplevel(VkCommandBuffer cmd_buf, int idx, qboolean include_world buffer_unmap(buf_instances + idx); instance_data = NULL; - build_tlas(cmd_buf, &tlas_geometry[idx], buf_instances[idx].address, num_instances); + scratch_buf_ptr = 0; + build_tlas(cmd_buf, &tlas_geometry[idx], buf_instances[idx].address, num_instances_geometry); + build_tlas(cmd_buf, &tlas_effects[idx], buf_instances[idx].address + num_instances_geometry * sizeof(QvkGeometryInstance_t), num_instances_effects); MEM_BARRIER_BUILD_ACCEL(cmd_buf); /* probably not needed here but doesn't matter */ @@ -1199,6 +1212,7 @@ vkpt_pt_destroy() for(int i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) { destroy_accel_struct(tlas_geometry + i); + destroy_accel_struct(tlas_effects + i); buffer_destroy(buf_instances + i); vkpt_pt_destroy_dynamic(i); } diff --git a/src/refresh/vkpt/shader/constants.h b/src/refresh/vkpt/shader/constants.h index 4b74a670d..ec04e9e02 100644 --- a/src/refresh/vkpt/shader/constants.h +++ b/src/refresh/vkpt/shader/constants.h @@ -106,14 +106,20 @@ with this program; if not, write to the Free Software Foundation, Inc., #define MAX_LIGHT_SOURCES 32 #define MAX_LIGHT_STYLES 64 +#define TLAS_INDEX_GEOMETRY 0 +#define TLAS_INDEX_EFFECTS 1 +#define TLAS_COUNT 2 + +// Geometry TLAS flags #define AS_FLAG_OPAQUE (1 << 0) #define AS_FLAG_TRANSPARENT (1 << 1) -#define AS_FLAG_EFFECTS (1 << 2) -#define AS_FLAG_VIEWER_MODELS (1 << 3) -#define AS_FLAG_VIEWER_WEAPON (1 << 4) -#define AS_FLAG_SKY (1 << 5) -#define AS_FLAG_CUSTOM_SKY (1 << 6) -#define AS_FLAG_EVERYTHING 0xFF +#define AS_FLAG_VIEWER_MODELS (1 << 2) +#define AS_FLAG_VIEWER_WEAPON (1 << 3) +#define AS_FLAG_SKY (1 << 4) +#define AS_FLAG_CUSTOM_SKY (1 << 5) + +// Effects TLAS flags +#define AS_FLAG_EFFECTS (1 << 0) #define AS_INSTANCE_FLAG_DYNAMIC (1 << 23) #define AS_INSTANCE_FLAG_SKY (1 << 22) diff --git a/src/refresh/vkpt/shader/path_tracer_rgen.h b/src/refresh/vkpt/shader/path_tracer_rgen.h index 4359311d1..09fe1f8d8 100644 --- a/src/refresh/vkpt/shader/path_tracer_rgen.h +++ b/src/refresh/vkpt/shader/path_tracer_rgen.h @@ -23,7 +23,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #define RAY_GEN_DESCRIPTOR_SET_IDX 0 layout(set = RAY_GEN_DESCRIPTOR_SET_IDX, binding = 0) -uniform accelerationStructureEXT topLevelAS; +uniform accelerationStructureEXT topLevelAS[TLAS_COUNT]; + #define GLOBAL_TEXTURES_DESC_SET_IDX 2 #include "global_textures.h" @@ -268,7 +269,7 @@ trace_geometry_ray(Ray ray, bool cull_back_faces, int instance_mask) #ifdef KHR_RAY_QUERY rayQueryEXT rayQuery; - rayQueryInitializeEXT(rayQuery, topLevelAS, rayFlags, instance_mask, + rayQueryInitializeEXT(rayQuery, topLevelAS[TLAS_INDEX_GEOMETRY], rayFlags, instance_mask, ray.origin, ray.t_min, ray.direction, ray.t_max); // Start traversal: return false if traversal is complete @@ -301,7 +302,7 @@ trace_geometry_ray(Ray ray, bool cull_back_faces, int instance_mask) #else - traceRayEXT( topLevelAS, rayFlags, instance_mask, + traceRayEXT( topLevelAS[TLAS_INDEX_GEOMETRY], rayFlags, instance_mask, SBT_RCHIT_GEOMETRY /*sbtRecordOffset*/, 0 /*sbtRecordStride*/, SBT_RMISS_EMPTY /*missIndex*/, ray.origin, ray.t_min, ray.direction, ray.t_max, RT_PAYLOAD_GEOMETRY); @@ -326,7 +327,7 @@ trace_effects_ray(Ray ray, bool skip_procedural) #ifdef KHR_RAY_QUERY rayQueryEXT rayQuery; - rayQueryInitializeEXT(rayQuery, topLevelAS, rayFlags, instance_mask, + rayQueryInitializeEXT(rayQuery, topLevelAS[TLAS_INDEX_EFFECTS], rayFlags, instance_mask, ray.origin, ray.t_min, ray.direction, ray.t_max); // Start traversal: return false if traversal is complete @@ -390,7 +391,7 @@ trace_effects_ray(Ray ray, bool skip_procedural) #else - traceRayEXT( topLevelAS, rayFlags, instance_mask, + traceRayEXT( topLevelAS[TLAS_INDEX_EFFECTS], rayFlags, instance_mask, SBT_RCHIT_EFFECTS /*sbtRecordOffset*/, 0 /*sbtRecordStride*/, SBT_RMISS_EMPTY /*missIndex*/, ray.origin, ray.t_min, ray.direction, ray.t_max, RT_PAYLOAD_EFFECTS); @@ -423,7 +424,7 @@ trace_shadow_ray(Ray ray, int cull_mask) #ifdef KHR_RAY_QUERY rayQueryEXT rayQuery; - rayQueryInitializeEXT(rayQuery, topLevelAS, rayFlags, cull_mask, + rayQueryInitializeEXT(rayQuery, topLevelAS[TLAS_INDEX_GEOMETRY], rayFlags, cull_mask, ray.origin, ray.t_min, ray.direction, ray.t_max); while (rayQueryProceedEXT(rayQuery)) @@ -452,7 +453,7 @@ trace_shadow_ray(Ray ray, int cull_mask) ray_payload_geometry.instance_prim = ~0u; ray_payload_geometry.hit_distance = -1; - traceRayEXT( topLevelAS, rayFlags, cull_mask, + traceRayEXT( topLevelAS[TLAS_INDEX_GEOMETRY], rayFlags, cull_mask, SBT_RCHIT_GEOMETRY /*sbtRecordOffset*/, 0 /*sbtRecordStride*/, SBT_RMISS_EMPTY /*missIndex*/, ray.origin, ray.t_min, ray.direction, ray.t_max, RT_PAYLOAD_GEOMETRY); @@ -475,7 +476,7 @@ trace_caustic_ray(Ray ray, int surface_medium) #ifdef KHR_RAY_QUERY rayQueryEXT rayQuery; - rayQueryInitializeEXT(rayQuery, topLevelAS, rayFlags, instance_mask, + rayQueryInitializeEXT(rayQuery, topLevelAS[TLAS_INDEX_GEOMETRY], rayFlags, instance_mask, ray.origin, ray.t_min, ray.direction, ray.t_max); rayQueryProceedEXT(rayQuery); @@ -491,7 +492,7 @@ trace_caustic_ray(Ray ray, int surface_medium) #else - traceRayEXT(topLevelAS, rayFlags, instance_mask, SBT_RCHIT_GEOMETRY, 0, SBT_RMISS_EMPTY, + traceRayEXT(topLevelAS[TLAS_INDEX_GEOMETRY], rayFlags, instance_mask, SBT_RCHIT_GEOMETRY, 0, SBT_RMISS_EMPTY, ray.origin, ray.t_min, ray.direction, ray.t_max, RT_PAYLOAD_GEOMETRY); #endif From 29a3d59710e926a5a9bafa02b99ebb7f11d9a592 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Tue, 14 Sep 2021 14:26:58 -0700 Subject: [PATCH 43/55] Reduced the effects payload to get back the performance lost in ray pipeline mode, and because the split near/far tracking is no longer necessary. --- src/refresh/vkpt/shader/path_tracer.h | 11 +--- .../vkpt/shader/path_tracer_beam.rahit | 6 +-- .../vkpt/shader/path_tracer_explosion.rahit | 6 +-- .../vkpt/shader/path_tracer_hit_shaders.h | 50 +++++++------------ .../vkpt/shader/path_tracer_particle.rahit | 6 +-- src/refresh/vkpt/shader/path_tracer_rgen.h | 25 ++++------ .../vkpt/shader/path_tracer_sprite.rahit | 6 +-- .../vkpt/shader/path_tracer_transparency.glsl | 37 ++++++-------- 8 files changed, 55 insertions(+), 92 deletions(-) diff --git a/src/refresh/vkpt/shader/path_tracer.h b/src/refresh/vkpt/shader/path_tracer.h index b120c4eaa..652e22196 100644 --- a/src/refresh/vkpt/shader/path_tracer.h +++ b/src/refresh/vkpt/shader/path_tracer.h @@ -153,15 +153,8 @@ struct RayPayloadGeometry { }; struct RayPayloadEffects { - uvec2 close_transparencies; // half4x16 - uvec2 farthest_transparency; // half4x16 - float closest_max_transparent_distance; - float farthest_transparent_distance; - float farthest_transparent_depth; -}; - -struct RayPayloadShadow { - int missed; + uvec2 transparency; // half4x16 + uint distances; // half2x16 - min and max }; struct HitAttributeBeam { diff --git a/src/refresh/vkpt/shader/path_tracer_beam.rahit b/src/refresh/vkpt/shader/path_tracer_beam.rahit index c93c5d3cd..aaa0f9624 100644 --- a/src/refresh/vkpt/shader/path_tracer_beam.rahit +++ b/src/refresh/vkpt/shader/path_tracer_beam.rahit @@ -39,11 +39,11 @@ void main() { const vec2 beam_fade_and_thickness = unpackHalf2x16(beam_hit_attrib.fade_and_thickness); - transparency_result_t transparency = pt_logic_beam(gl_PrimitiveID, beam_fade_and_thickness); + vec4 transparency = pt_logic_beam(gl_PrimitiveID, beam_fade_and_thickness, gl_HitTEXT, gl_RayTmaxEXT); - if (transparency.color.a > 0) + if (transparency.a > 0) { - update_payload_transparency(ray_payload, transparency.color, transparency.thickness, gl_HitTEXT); + update_payload_transparency(ray_payload, transparency, gl_HitTEXT); } ignoreIntersectionEXT; diff --git a/src/refresh/vkpt/shader/path_tracer_explosion.rahit b/src/refresh/vkpt/shader/path_tracer_explosion.rahit index c31f63317..679316d5e 100644 --- a/src/refresh/vkpt/shader/path_tracer_explosion.rahit +++ b/src/refresh/vkpt/shader/path_tracer_explosion.rahit @@ -37,11 +37,11 @@ hitAttributeEXT vec2 hit_attribs; void main() { - transparency_result_t transparency = pt_logic_explosion(gl_PrimitiveID, gl_InstanceCustomIndexEXT, gl_WorldRayDirectionEXT, hit_attribs.xy); + vec4 transparency = pt_logic_explosion(gl_PrimitiveID, gl_InstanceCustomIndexEXT, gl_WorldRayDirectionEXT, hit_attribs.xy); - if (transparency.color.a > 0) + if (transparency.a > 0) { - update_payload_transparency(ray_payload, transparency.color, transparency.thickness, gl_HitTEXT); + update_payload_transparency(ray_payload, transparency, gl_HitTEXT); } ignoreIntersectionEXT; diff --git a/src/refresh/vkpt/shader/path_tracer_hit_shaders.h b/src/refresh/vkpt/shader/path_tracer_hit_shaders.h index 84248b282..5a9fbd443 100644 --- a/src/refresh/vkpt/shader/path_tracer_hit_shaders.h +++ b/src/refresh/vkpt/shader/path_tracer_hit_shaders.h @@ -67,23 +67,13 @@ bool pt_logic_masked(int primitiveID, uint instanceCustomIndex, vec2 bary) return mask_value.x >= 0.5; } -struct transparency_result_t -{ - vec4 color; - float thickness; -}; - -transparency_result_t pt_logic_particle(int primitiveID, vec2 bary) +vec4 pt_logic_particle(int primitiveID, vec2 bary) { const vec3 barycentric = vec3(1.0 - bary.x - bary.y, bary.x, bary.y); const vec2 uv = vec2(0.0, 0.0) * barycentric.x + vec2(1.0, 0.0) * barycentric.y + vec2(1.0, 1.0) * barycentric.z; const float factor = pow(clamp(1.0 - length(vec2(0.5) - uv) * 2.0, 0.0, 1.0), global_ubo.pt_particle_softness); - transparency_result_t result; - result.color = vec4(0); - result.thickness = 0; - if (factor > 0.0) { const int particle_index = primitiveID / 2; @@ -93,21 +83,17 @@ transparency_result_t pt_logic_particle(int primitiveID, vec2 bary) color.rgb *= global_ubo.prev_adapted_luminance * 500; - result.color = color; + return color; } - return result; + return vec4(0); } -transparency_result_t pt_logic_beam(int primitiveID, vec2 beam_fade_and_thickness) +vec4 pt_logic_beam(int primitiveID, vec2 beam_fade_and_thickness, float hitT, float maxT) { const float x = beam_fade_and_thickness.x; const float factor = pow(clamp(x, 0.0, 1.0), global_ubo.pt_beam_softness); - transparency_result_t result; - result.color = vec4(0); - result.thickness = 0; - if (factor > 0.0) { const int beam_index = primitiveID; @@ -123,14 +109,20 @@ transparency_result_t pt_logic_beam(int primitiveID, vec2 beam_fade_and_thicknes float noise = texelFetch(TEX_BLUE_NOISE, ivec3(texpos, texnum), 0).r; color.rgb *= noise * noise + 0.1; - result.color = color; - result.thickness = beam_fade_and_thickness.y; + float thickness = beam_fade_and_thickness.y; + if (thickness > 0) + { + float ratio = clamp((maxT - hitT) / thickness, 0.0, 1.0); + color.rgba *= ratio; + } + + return color; } - return result; + return vec4(0); } -transparency_result_t pt_logic_sprite(int primitiveID, vec2 bary) +vec4 pt_logic_sprite(int primitiveID, vec2 bary) { const vec3 barycentric = vec3(1.0 - bary.x - bary.y, bary.x, bary.y); @@ -158,14 +150,10 @@ transparency_result_t pt_logic_sprite(int primitiveID, vec2 bary) color.rgb *= global_ubo.prev_adapted_luminance * 2000; } - transparency_result_t result; - result.color = color; - result.thickness = 0; - - return result; + return color; } -transparency_result_t pt_logic_explosion(int primitiveID, uint instanceCustomIndex, vec3 worldRayDirection, vec2 bary) +vec4 pt_logic_explosion(int primitiveID, uint instanceCustomIndex, vec3 worldRayDirection, vec2 bary) { const uint primitive_id = primitiveID + instanceCustomIndex & AS_INSTANCE_MASK_OFFSET; const Triangle triangle = get_instanced_triangle(primitive_id); @@ -188,11 +176,7 @@ transparency_result_t pt_logic_explosion(int primitiveID, uint instanceCustomInd emission.rgb *= global_ubo.prev_adapted_luminance * 500; - transparency_result_t result; - result.color = emission; - result.thickness = 0; - - return result; + return emission; } // Adapted from: http://www.pbr-book.org/3ed-2018/Utilities/Mathematical_Routines.html#SolvingQuadraticEquations diff --git a/src/refresh/vkpt/shader/path_tracer_particle.rahit b/src/refresh/vkpt/shader/path_tracer_particle.rahit index a92671359..82ee77cc4 100644 --- a/src/refresh/vkpt/shader/path_tracer_particle.rahit +++ b/src/refresh/vkpt/shader/path_tracer_particle.rahit @@ -37,11 +37,11 @@ hitAttributeEXT vec2 hit_attribs; void main() { - transparency_result_t transparency = pt_logic_particle(gl_PrimitiveID, hit_attribs.xy); + vec4 transparency = pt_logic_particle(gl_PrimitiveID, hit_attribs.xy); - if (transparency.color.a > 0) + if (transparency.a > 0) { - update_payload_transparency(ray_payload, transparency.color, transparency.thickness, gl_HitTEXT); + update_payload_transparency(ray_payload, transparency, gl_HitTEXT); } ignoreIntersectionEXT; diff --git a/src/refresh/vkpt/shader/path_tracer_rgen.h b/src/refresh/vkpt/shader/path_tracer_rgen.h index 09fe1f8d8..999411600 100644 --- a/src/refresh/vkpt/shader/path_tracer_rgen.h +++ b/src/refresh/vkpt/shader/path_tracer_rgen.h @@ -318,11 +318,8 @@ trace_effects_ray(Ray ray, bool skip_procedural) uint instance_mask = AS_FLAG_EFFECTS; - ray_payload_effects.close_transparencies = uvec2(0); - ray_payload_effects.farthest_transparency = uvec2(0); - ray_payload_effects.closest_max_transparent_distance = 0; - ray_payload_effects.farthest_transparent_distance = 0; - ray_payload_effects.farthest_transparent_depth = 0; + ray_payload_effects.transparency = uvec2(0); + ray_payload_effects.distances = 0; #ifdef KHR_RAY_QUERY @@ -340,9 +337,7 @@ trace_effects_ray(Ray ray, bool skip_procedural) vec2 bary = rayQueryGetIntersectionBarycentricsEXT(rayQuery, false); bool isProcedural = rayQueryGetIntersectionTypeEXT(rayQuery, false) == gl_RayQueryCandidateIntersectionAABBEXT; - transparency_result_t transparency; - transparency.color = vec4(0); - transparency.thickness = 0; + vec4 transparent = vec4(0); if (isProcedural) { @@ -360,7 +355,7 @@ trace_effects_ray(Ray ray, bool skip_procedural) // Then the any-hit shader. if (intersectsWithBeam) { - transparency = pt_logic_beam(primitiveID, beam_fade_and_thickness); + transparent = pt_logic_beam(primitiveID, beam_fade_and_thickness, tShapeHit, ray.t_max); hitT = tShapeHit; } } @@ -370,22 +365,22 @@ trace_effects_ray(Ray ray, bool skip_procedural) switch(sbtOffset) { case SBTO_PARTICLE: // particles - transparency = pt_logic_particle(primitiveID, bary); + transparent = pt_logic_particle(primitiveID, bary); break; case SBTO_EXPLOSION: // explosions - transparency = pt_logic_explosion(primitiveID, instanceCustomIndex, ray.direction, bary); + transparent = pt_logic_explosion(primitiveID, instanceCustomIndex, ray.direction, bary); break; case SBTO_SPRITE: // sprites - transparency = pt_logic_sprite(primitiveID, bary); + transparent = pt_logic_sprite(primitiveID, bary); break; } } - if (transparency.color.a > 0) + if (transparent.a > 0) { - update_payload_transparency(ray_payload_effects, transparency.color, transparency.thickness, hitT); + update_payload_transparency(ray_payload_effects, transparent, hitT); } } @@ -397,7 +392,7 @@ trace_effects_ray(Ray ray, bool skip_procedural) #endif - return get_payload_transparency(ray_payload_effects, ray.t_max); + return get_payload_transparency(ray_payload_effects); } Ray get_shadow_ray(vec3 p1, vec3 p2, float tmin) diff --git a/src/refresh/vkpt/shader/path_tracer_sprite.rahit b/src/refresh/vkpt/shader/path_tracer_sprite.rahit index 8dd5308dd..23411cbd1 100644 --- a/src/refresh/vkpt/shader/path_tracer_sprite.rahit +++ b/src/refresh/vkpt/shader/path_tracer_sprite.rahit @@ -37,11 +37,11 @@ hitAttributeEXT vec2 hit_attribs; void main() { - transparency_result_t transparency = pt_logic_sprite(gl_PrimitiveID, hit_attribs.xy); + vec4 transparency = pt_logic_sprite(gl_PrimitiveID, hit_attribs.xy); - if (transparency.color.a > 0) + if (transparency.a > 0) { - update_payload_transparency(ray_payload, transparency.color, transparency.thickness, gl_HitTEXT); + update_payload_transparency(ray_payload, transparency, gl_HitTEXT); } ignoreIntersectionEXT; diff --git a/src/refresh/vkpt/shader/path_tracer_transparency.glsl b/src/refresh/vkpt/shader/path_tracer_transparency.glsl index f591ffae9..1d3527379 100644 --- a/src/refresh/vkpt/shader/path_tracer_transparency.glsl +++ b/src/refresh/vkpt/shader/path_tracer_transparency.glsl @@ -20,39 +20,30 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef PATH_TRACER_TRANSPARENCY_GLSL_ #define PATH_TRACER_TRANSPARENCY_GLSL_ -void update_payload_transparency(inout RayPayloadEffects rp, vec4 color, float thickness, float hitT) +void update_payload_transparency(inout RayPayloadEffects rp, vec4 color, float hitT) { - if(hitT > rp.farthest_transparent_distance) - { - rp.close_transparencies = packHalf4x16(alpha_blend_premultiplied(unpackHalf4x16(rp.close_transparencies), unpackHalf4x16(rp.farthest_transparency))); - rp.closest_max_transparent_distance = rp.farthest_transparent_distance; - rp.farthest_transparency = packHalf4x16(color); - rp.farthest_transparent_distance = hitT; - rp.farthest_transparent_depth = thickness; - } - else if(rp.closest_max_transparent_distance < hitT) + vec4 accumulated_color = unpackHalf4x16(rp.transparency); + vec2 distances = unpackHalf2x16(rp.distances); + + if(hitT < distances.x || distances.x == 0) { - rp.close_transparencies = packHalf4x16(alpha_blend_premultiplied(unpackHalf4x16(rp.close_transparencies), color)); - rp.closest_max_transparent_distance = hitT; + accumulated_color = alpha_blend_premultiplied(color, accumulated_color); + distances.x = hitT; } else - rp.close_transparencies = packHalf4x16(alpha_blend_premultiplied(color, unpackHalf4x16(rp.close_transparencies))); -} - -vec4 get_payload_transparency(in RayPayloadEffects rp, float solidDist) -{ - float scale_far = 1; - if (rp.farthest_transparent_depth > 0) { - scale_far = clamp((solidDist - rp.farthest_transparent_distance) / rp.farthest_transparent_depth, 0, 1); + accumulated_color = alpha_blend_premultiplied(accumulated_color, color); } + + distances.y = max(distances.y, hitT); - return alpha_blend_premultiplied(unpackHalf4x16(rp.close_transparencies), unpackHalf4x16(rp.farthest_transparency) * scale_far); + rp.transparency = packHalf4x16(accumulated_color); + rp.distances = packHalf2x16(distances); } -vec4 get_payload_transparency_simple(in RayPayloadEffects rp) +vec4 get_payload_transparency(in RayPayloadEffects rp) { - return alpha_blend_premultiplied(unpackHalf4x16(rp.close_transparencies), unpackHalf4x16(rp.farthest_transparency)); + return unpackHalf4x16(rp.transparency); } #endif // PATH_TRACER_TRANSPARENCY_GLSL_ From 8a2ea3f1689b174129063bdf24b86bd50d0eebba Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Thu, 16 Sep 2021 21:24:48 -0700 Subject: [PATCH 44/55] Fixed the debug build. --- src/refresh/vkpt/path_tracer.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/refresh/vkpt/path_tracer.c b/src/refresh/vkpt/path_tracer.c index a40701b6d..bba9d07d3 100644 --- a/src/refresh/vkpt/path_tracer.c +++ b/src/refresh/vkpt/path_tracer.c @@ -828,7 +828,6 @@ build_tlas(VkCommandBuffer cmd_buf, accel_struct_t* as, VkDeviceAddress instance .data = {.deviceAddress = instance_data} } }; - assert(buf_instances[idx].address); VkAccelerationStructureGeometryKHR topASGeometry = { .sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR, From 4abb98f446751269d064791362aabb18e00549d0 Mon Sep 17 00:00:00 2001 From: Johan Mattsson Date: Sat, 25 Sep 2021 15:27:42 +0200 Subject: [PATCH 45/55] Fix validation checks --- src/refresh/models.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/refresh/models.c b/src/refresh/models.c index ea5afe281..200157045 100644 --- a/src/refresh/models.c +++ b/src/refresh/models.c @@ -157,7 +157,7 @@ qerror_t MOD_ValidateMD2(dmd2header_t *header, size_t length) return Q_ERR_TOO_MANY; end = header->ofs_tris + sizeof(dmd2triangle_t) * header->num_tris; - if (header->ofs_tris < sizeof(header) || end < header->ofs_tris || end > length) + if (header->ofs_tris < sizeof(*header) || end < header->ofs_tris || end > length) return Q_ERR_BAD_EXTENT; // check st @@ -167,7 +167,7 @@ qerror_t MOD_ValidateMD2(dmd2header_t *header, size_t length) return Q_ERR_TOO_MANY; end = header->ofs_st + sizeof(dmd2stvert_t) * header->num_st; - if (header->ofs_st < sizeof(header) || end < header->ofs_st || end > length) + if (header->ofs_st < sizeof(*header) || end < header->ofs_st || end > length) return Q_ERR_BAD_EXTENT; // check xyz and frames @@ -185,7 +185,7 @@ qerror_t MOD_ValidateMD2(dmd2header_t *header, size_t length) return Q_ERR_BAD_EXTENT; end = header->ofs_frames + (size_t)header->framesize * header->num_frames; - if (header->ofs_frames < sizeof(header) || end < header->ofs_frames || end > length) + if (header->ofs_frames < sizeof(*header) || end < header->ofs_frames || end > length) return Q_ERR_BAD_EXTENT; // check skins @@ -194,7 +194,7 @@ qerror_t MOD_ValidateMD2(dmd2header_t *header, size_t length) return Q_ERR_TOO_MANY; end = header->ofs_skins + (size_t)MD2_MAX_SKINNAME * header->num_skins; - if (header->ofs_skins < sizeof(header) || end < header->ofs_skins || end > length) + if (header->ofs_skins < sizeof(*header) || end < header->ofs_skins || end > length) return Q_ERR_BAD_EXTENT; } From 23920ff8c178c4a78b2c2057afb00081082b19ad Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Wed, 29 Sep 2021 11:04:42 -0700 Subject: [PATCH 46/55] Added support for unlit fog volumes. See the comment in fog.c for more information. (Squashed from a feature branch) --- src/CMakeLists.txt | 2 + src/refresh/vkpt/fog.c | 270 ++++++++++++++++++ src/refresh/vkpt/fog.h | 40 +++ src/refresh/vkpt/main.c | 8 + src/refresh/vkpt/shader/constants.h | 2 + src/refresh/vkpt/shader/global_ubo.h | 22 ++ src/refresh/vkpt/shader/path_tracer.h | 2 + src/refresh/vkpt/shader/path_tracer_rgen.h | 69 ++++- .../vkpt/shader/path_tracer_transparency.glsl | 67 +++++ 9 files changed, 481 insertions(+), 1 deletion(-) create mode 100644 src/refresh/vkpt/fog.c create mode 100644 src/refresh/vkpt/fog.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0c9dfb1fb..7666b5a4b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -267,6 +267,7 @@ SET(SRC_VKPT refresh/vkpt/bloom.c refresh/vkpt/bsp_mesh.c refresh/vkpt/draw.c + refresh/vkpt/fog.c refresh/vkpt/freecam.c refresh/vkpt/fsr.c refresh/vkpt/main.c @@ -296,6 +297,7 @@ SET(HEADERS_VKPT refresh/vkpt/vk_util.h refresh/vkpt/buddy_allocator.h refresh/vkpt/device_memory_allocator.h + refresh/vkpt/fog.h refresh/vkpt/material.h refresh/vkpt/physical_sky.h refresh/vkpt/precomputed_sky.h diff --git a/src/refresh/vkpt/fog.c b/src/refresh/vkpt/fog.c new file mode 100644 index 000000000..6f353857c --- /dev/null +++ b/src/refresh/vkpt/fog.c @@ -0,0 +1,270 @@ +/* +Copyright (C) 2021, NVIDIA CORPORATION. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#include "fog.h" +#include "vkpt.h" + +#include + +/* +This file implements host-side control of the local fog volumes. The volumes +are manipulated using the "fog" console command and are reset before loading +a new map. Typically, the volumes should be defined using a map-specific config file. + +Up to MAX_FOG_VOLUMES volumes can be defined, and up to 2 volumes are supported +by the renderer per ray. Use volumes with caution to avoid placing more than +two in the same area. + +A fog volume is an axis-aligned box filled with uniform or gradient fog. +The volume is defined using two points on any diagonal of said box, a and b. +The fog parameters: color, density and gradient, are defined independently. +See the fog command help message for the options list. + + +Suggested workflow for defining a fog volume without access to a map editor +is to place the camera into the diagonal points, capturing each point: + + (place the camera in the first point) + > fog -v -a here + (move the camera) + > fog -v -b here + +Then set the color and density as necessary, and use "fog -v -p" +to print all the volume parameters. The output of that commnad can be copied +from the console directly into a map config file. + + +On the renderer side, the fog volumes are processed for the primary rays and for +the reflection, refraction, and camera rays. The implementation starts in +trace_effects_ray(...) - see path_tracer_rgen.h. That function first finds the +volumes that intersect with the ray, and selects the two closest volumes. +These two volumes are passed through the ray payload to the any-hit shaders +that deal with transparent effects such as explosions. These any-hit shaders +will accumulate the transparent effects along the ray and any fog that is +between these effects. After that's done, the fog between the ray origin and +the first effect is blended over the effects, and the fog between the last +effect and the end of the ray is blended under the effects. +*/ + +fog_volume_t fog_volumes[MAX_FOG_VOLUMES]; + + +static const cmd_option_t o_fog[] = { + { "v:int", "volume", "volume index" }, + { "p", "print", "print the selected volume to the console" }, + { "r", "reset", "reset the selected volume" }, + { "R", "reset-all", "reset all volumes" }, + { "a:x,y,z", "", "first point on the volume diagonal, or 'here'" }, + { "b:x,y,z", "", "second point on the volume diagonal, or 'here'" }, + { "c:r,g,b", "color", "fog color" }, + { "d:float", "distance", "distance at which objects in the fog are 50% visible" }, + { "f:face", "softface", "face where the density is zero: none, xa, xb, ya, yb, za, zb" }, + { "h", "help", "display this message" }, + { NULL } +}; + +static const char* o_softface[] = { + "none", "xa", "xb", "ya", "yb", "za", "zb" +}; + + +static void Fog_Cmd_c(genctx_t* ctx, int argnum) +{ + Cmd_Option_c(o_fog, NULL, ctx, argnum); +} + +static void Fog_Cmd_f(void) +{ + fog_volume_t* volume = NULL; + float x, y, z; + int index = -1; + int c, i; + while ((c = Cmd_ParseOptions(o_fog)) != -1) { + switch(c) + { + case 'h': + Cmd_PrintUsage(o_fog, NULL); + Com_Printf("Set parameters of a fog volume.\n"); + Cmd_PrintHelp(o_fog); + return; + case 'v': + if (1 != sscanf(cmd_optarg, "%d", &index) || index < 0 || index >= MAX_FOG_VOLUMES) { + Com_WPrintf("invalid volume index '%s'\n", cmd_optarg); + return; + } + volume = fog_volumes + index; + break; + case 'p': + if (!volume) goto no_volume; + Com_Printf("fog -v %d ", index); + Com_Printf("-a %.2f,%.2f,%.2f ", volume->point_a[0], volume->point_a[1], volume->point_a[2]); + Com_Printf("-b %.2f,%.2f,%.2f ", volume->point_b[0], volume->point_b[1], volume->point_b[2]); + Com_Printf("-c %.2f,%.2f,%.2f ", volume->color[0], volume->color[1], volume->color[2]); + Com_Printf("-d %.0f ", volume->half_extinction_distance); + Com_Printf("-f %s\n", o_softface[volume->softface]); + break; + case 'r': + if (!volume) goto no_volume; + memset(volume, 0, sizeof(*volume)); + break; + case 'R': + memset(fog_volumes, 0, sizeof(fog_volumes)); + break; + case 'a': + if (!volume) goto no_volume; + if (3 != sscanf(cmd_optarg, "%f,%f,%f", &x, &y, &z)) { + if (strcmp(cmd_optarg, "here") == 0) { + VectorCopy(vkpt_refdef.fd->vieworg, volume->point_a); + continue; + } + + Com_WPrintf("invalid coordinates '%s'\n", cmd_optarg); + return; + } + volume->point_a[0] = x; + volume->point_a[1] = y; + volume->point_a[2] = z; + break; + case 'b': + if (!volume) goto no_volume; + if (3 != sscanf(cmd_optarg, "%f,%f,%f", &x, &y, &z)) { + if (strcmp(cmd_optarg, "here") == 0) { + VectorCopy(vkpt_refdef.fd->vieworg, volume->point_b); + continue; + } + + Com_WPrintf("invalid coordinates '%s'\n", cmd_optarg); + return; + } + volume->point_b[0] = x; + volume->point_b[1] = y; + volume->point_b[2] = z; + break; + case 'c': + if (!volume) goto no_volume; + if (3 != sscanf(cmd_optarg, "%f,%f,%f", &x, &y, &z)) { + Com_WPrintf("invalid color '%s'\n", cmd_optarg); + return; + } + volume->color[0] = x; + volume->color[1] = y; + volume->color[2] = z; + break; + case 'd': + if (!volume) goto no_volume; + if (1 != sscanf(cmd_optarg, "%f", &x)) { + Com_WPrintf("invalid distance '%s'\n", cmd_optarg); + return; + } + volume->half_extinction_distance = x; + break; + case 'f': + if (!volume) goto no_volume; + for (i = 0; i < (int)q_countof(o_softface); i++) { + if (strcmp(cmd_optarg, o_softface[i]) == 0) { + volume->softface = i; + break; + } + } + if (i >= (int)q_countof(o_softface)) { + Com_WPrintf("invalid value for softface '%s'\n", cmd_optarg); + return; + } + break; + default: + return; + } + } + return; + +no_volume: + Com_WPrintf("volume not specified\n"); +} + +void vkpt_fog_init(void) +{ + vkpt_fog_reset(); + + cmdreg_t cmds[] = { + { "fog", &Fog_Cmd_f, &Fog_Cmd_c }, + { NULL, NULL, NULL } + }; + Cmd_Register(cmds); +} + +void vkpt_fog_shutdown(void) +{ + Cmd_RemoveCommand("fog"); +} + +void vkpt_fog_reset(void) +{ + memset(fog_volumes, 0, sizeof(fog_volumes)); +} + +void vkpt_fog_upload(struct ShaderFogVolume* dst) +{ + memset(dst, 0, sizeof(ShaderFogVolume_t) * MAX_FOG_VOLUMES); + + for (int i = 0; i < MAX_FOG_VOLUMES; i++) + { + const fog_volume_t* src = fog_volumes + i; + if (src->half_extinction_distance <= 0.f || src->point_a[0] == src->point_b[0] || src->point_a[1] == src->point_b[1] || src->point_a[2] == src->point_b[2]) + continue; + + VectorCopy(src->color, dst->color); + + // Find the min and max bounds to support specifying two points on any diagonal of the volume + for (int axis = 0; axis < 3; axis++) + { + dst->mins[axis] = min(src->point_a[axis], src->point_b[axis]); + dst->maxs[axis] = max(src->point_a[axis], src->point_b[axis]); + } + + // Convert the half-extinction distance into density + // exp(-kx) = 0.5 => k = -ln(0.5) / x + float density = 0.69315f / src->half_extinction_distance; + + if (1 <= src->softface && src->softface <= 6) + { + // Find the axis along which the density gradient is happening: x, y or z + int axis = (src->softface - 1) / 2; + + // Find the positions on that axis where the density multiplier is 0 (pos0) and 1 (pos1) + float pos0 = (src->softface & 1) ? src->point_a[axis] : src->point_b[axis]; + float pos1 = (src->softface & 1) ? src->point_b[axis] : src->point_a[axis]; + + // Derive the linear function of the form (ax + b) that describes the density along the axis + float a = density / (pos1 - pos0); + float b = -pos0 * a; + + // Convert the 1D linear funciton into a volumetric one + dst->density[axis] = a; + dst->density[3] = b; + } + else + { + // No density gradient, just store the density with 0 spatial coefficinents + Vector4Set(dst->density, 0.f, 0.f, 0.f, density); + } + + dst->is_active = 1; + + ++dst; + } +} diff --git a/src/refresh/vkpt/fog.h b/src/refresh/vkpt/fog.h new file mode 100644 index 000000000..893b9624e --- /dev/null +++ b/src/refresh/vkpt/fog.h @@ -0,0 +1,40 @@ +/* +Copyright (C) 2021, NVIDIA CORPORATION. All rights reserved. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#ifndef __FOG_H_ +#define __FOG_H_ + +#include + +typedef struct +{ + vec3_t point_a; + vec3_t point_b; + vec3_t color; + float half_extinction_distance; + int softface; // 0 = none, 1 = xa, 2 = xb, 3 = ya, 4 = yb, 5 = za, 6 = zb +} fog_volume_t; + +struct ShaderFogVolume; + +void vkpt_fog_init(void); +void vkpt_fog_shutdown(void); +void vkpt_fog_reset(void); +void vkpt_fog_upload(struct ShaderFogVolume* dst); + +#endif // __FOG_H_ diff --git a/src/refresh/vkpt/main.c b/src/refresh/vkpt/main.c index b51fa12e3..20fe575bb 100644 --- a/src/refresh/vkpt/main.c +++ b/src/refresh/vkpt/main.c @@ -32,6 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "system/hunk.h" #include "vkpt.h" #include "material.h" +#include "fog.h" #include "physical_sky.h" #include "../../client/client.h" #include "../../client/ui/ui.h" @@ -2524,6 +2525,8 @@ prepare_ubo(refdef_t *fd, mleaf_t* viewleaf, const reference_mode_t* ref_mode, c ubo->num_static_primitives = (vkpt_refdef.bsp_mesh_world.world_idx_count + vkpt_refdef.bsp_mesh_world.world_transparent_count + vkpt_refdef.bsp_mesh_world.world_masked_count) / 3; ubo->num_static_lights = vkpt_refdef.bsp_mesh_world.num_light_polys; + vkpt_fog_upload(ubo->fog_volumes); + #define UBO_CVAR_DO(name, default_value) ubo->name = cvar_##name->value; UBO_CVAR_LIST #undef UBO_CVAR_DO @@ -3531,6 +3534,8 @@ R_Init_RTX(qboolean total) Cmd_AddCommand("drop_balls", (xcommand_t)&vkpt_drop_shaderballs); #endif + vkpt_fog_init(); + for (int i = 0; i < 256; i++) { qvk.sintab[i] = sinf(i * (2 * M_PI / 255)); } @@ -3560,6 +3565,7 @@ R_Shutdown_RTX(qboolean total) Cmd_RemoveCommand("drop_balls"); #endif + vkpt_fog_shutdown(); MAT_Shutdown(); IMG_FreeAll(); vkpt_textures_destroy_unused(); @@ -3784,6 +3790,8 @@ R_BeginRegistration_RTX(const char *name) Com_Printf("loading %s\n", name); vkDeviceWaitIdle(qvk.device); + vkpt_fog_reset(); + Com_AddConfigFile("maps/default.cfg", 0); Com_AddConfigFile(va("maps/%s.cfg", name), 0); diff --git a/src/refresh/vkpt/shader/constants.h b/src/refresh/vkpt/shader/constants.h index ec04e9e02..a515854fe 100644 --- a/src/refresh/vkpt/shader/constants.h +++ b/src/refresh/vkpt/shader/constants.h @@ -40,6 +40,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #define MAX_CAMERAS 8 +#define MAX_FOG_VOLUMES 8 + #define AA_MODE_OFF 0 #define AA_MODE_TAA 1 #define AA_MODE_UPSCALE 2 diff --git a/src/refresh/vkpt/shader/global_ubo.h b/src/refresh/vkpt/shader/global_ubo.h index 577846804..d91c8d316 100644 --- a/src/refresh/vkpt/shader/global_ubo.h +++ b/src/refresh/vkpt/shader/global_ubo.h @@ -79,6 +79,7 @@ with this program; if not, write to the Free Software Foundation, Inc., UBO_CVAR_DO(pt_explosion_brightness, 4.0) /* brightness factor for explosions */ \ UBO_CVAR_DO(pt_fake_roughness_threshold, 0.20) /* roughness value where the path tracer starts switching indirect light specular sampling from NDF based to SH based, [0..1] */ \ UBO_CVAR_DO(pt_focus, 200) /* focal distance for the Depth of Field effect, in world units */ \ + UBO_CVAR_DO(pt_fog_brightness, 0.01) /* global multiplier for the color of fog volumes */ \ UBO_CVAR_DO(pt_indirect_polygon_lights, 1) /* switch for bounce lighting from local polygon lights, 0 or 1 */ \ UBO_CVAR_DO(pt_indirect_sphere_lights, 1) /* switch for bounce lighting from local sphere lights, 0 or 1 */ \ UBO_CVAR_DO(pt_light_stats, 1) /* switch for statistical light PDF correction, 0 or 1 */ \ @@ -217,6 +218,7 @@ with this program; if not, write to the Free Software Foundation, Inc., GLOBAL_UBO_VAR_LIST_DO(mat4, environment_rotation_matrix) \ GLOBAL_UBO_VAR_LIST_DO(mat4, shadow_map_VP) \ GLOBAL_UBO_VAR_LIST_DO(mat4, security_camera_data[MAX_CAMERAS]) \ + GLOBAL_UBO_VAR_LIST_DO(ShaderFogVolume, fog_volumes[MAX_FOG_VOLUMES]) \ \ UBO_CVAR_LIST // WARNING: Do not put any other members into global_ubo after this: the CVAR list is not vec4-aligned @@ -271,6 +273,16 @@ typedef struct { int frame; float padding[3]; } BspMeshInstance; +typedef struct ShaderFogVolume { + vec3_t mins; + uint is_active; + vec3_t maxs; + float pad2; + vec3_t color; + float pad3; + vec4_t density; +} ShaderFogVolume_t; + #define int_t int32_t typedef struct QVKUniformBuffer_s { #define GLOBAL_UBO_VAR_LIST_DO(type, name) type##_t name; @@ -306,6 +318,16 @@ struct BspMeshInstance { ivec4 frame; }; +struct ShaderFogVolume { + vec3 mins; + uint is_active; + vec3 maxs; + float pad2; + vec3 color; + float pad3; + vec4 density; +}; + struct GlobalUniformBuffer { #define GLOBAL_UBO_VAR_LIST_DO(type, name) type name; GLOBAL_UBO_VAR_LIST diff --git a/src/refresh/vkpt/shader/path_tracer.h b/src/refresh/vkpt/shader/path_tracer.h index 652e22196..b5bd30502 100644 --- a/src/refresh/vkpt/shader/path_tracer.h +++ b/src/refresh/vkpt/shader/path_tracer.h @@ -155,6 +155,8 @@ struct RayPayloadGeometry { struct RayPayloadEffects { uvec2 transparency; // half4x16 uint distances; // half2x16 - min and max + uvec4 fog1; // half8x16: .xy = color.rgba; .z = t_min, t_max; .w = density: a and b for (a*t + b) + uvec4 fog2; // same as fog1 but for a fog volume further away }; struct HitAttributeBeam { diff --git a/src/refresh/vkpt/shader/path_tracer_rgen.h b/src/refresh/vkpt/shader/path_tracer_rgen.h index 999411600..bfdb2ff07 100644 --- a/src/refresh/vkpt/shader/path_tracer_rgen.h +++ b/src/refresh/vkpt/shader/path_tracer_rgen.h @@ -309,6 +309,65 @@ trace_geometry_ray(Ray ray, bool cull_back_faces, int instance_mask) #endif } +float vmin(vec3 v) { return min(v.x, min(v.y, v.z)); } +float vmax(vec3 v) { return max(v.x, max(v.y, v.z)); } + +// Loops over the defined fog volumes and finds the two closest ones along the ray. +// They are stored in the order of min distance in rp.fog1 (closer) and rp.fog2 (further away). +// If the ray starts in a fog volume, that volume will be rp.fog1 with t_min = ray.t_min. +void find_fog_volumes(inout RayPayloadEffects rp, Ray ray) +{ + vec3 inv_dir = vec3(1.0) / ray.direction; + for (int i = 0; i < MAX_FOG_VOLUMES; i++) + { + const ShaderFogVolume volume = global_ubo.fog_volumes[i]; + + if (volume.is_active == 0) + return; + + vec3 t1 = (volume.mins - ray.origin) * inv_dir; + vec3 t2 = (volume.maxs - ray.origin) * inv_dir; + float t_in = vmax(min(t1, t2)); + float t_out = vmin(max(t1, t2)); + t_in = max(t_in, ray.t_min); + t_out = min(t_out, ray.t_max); + + if (t_out > t_in) + { + vec2 first_t_min_max = unpackHalf2x16(rp.fog1.w); + vec2 second_t_min_max = unpackHalf2x16(rp.fog2.w); + + bool replaces_first = t_in < first_t_min_max.x || first_t_min_max.y == 0; + bool replaces_second = t_in < second_t_min_max.x || second_t_min_max.y == 0; + + if (replaces_first || replaces_second) + { + uvec4 packed; + packed.xy = packHalf4x16(vec4(volume.color * global_ubo.pt_fog_brightness, 0)); + packed.z = packHalf2x16(vec2(t_in, t_out)); + + // Convert the volumetric density function into a 1D function along the ray + float density_variable = dot(volume.density.xyz, ray.direction) * 0.5; + float density_constant = dot(volume.density.xyz, ray.origin) + volume.density.w; + // Scale the density stored here because typical values are very small, in fp16 denormal range + packed.w = packHalf2x16(vec2(density_variable, density_constant) * 65536.0); + + if (replaces_first) + { + // Push fog1 to fog2, replace fog1 with the new volume + rp.fog2 = rp.fog1; + rp.fog1 = packed; + } + else // if (replaces_second) -- must be true + { + // Replace fog2 with the new volume + rp.fog2 = packed; + } + } + } + } +} + vec4 trace_effects_ray(Ray ray, bool skip_procedural) { @@ -320,6 +379,11 @@ trace_effects_ray(Ray ray, bool skip_procedural) ray_payload_effects.transparency = uvec2(0); ray_payload_effects.distances = 0; + ray_payload_effects.fog1 = uvec4(0); + ray_payload_effects.fog2 = uvec4(0); + + if (!skip_procedural) + find_fog_volumes(ray_payload_effects, ray); #ifdef KHR_RAY_QUERY @@ -392,7 +456,10 @@ trace_effects_ray(Ray ray, bool skip_procedural) #endif - return get_payload_transparency(ray_payload_effects); + if (skip_procedural) + return get_payload_transparency(ray_payload_effects); + + return get_payload_transparency_with_fog(ray_payload_effects, ray.t_max); } Ray get_shadow_ray(vec3 p1, vec3 p2, float tmin) diff --git a/src/refresh/vkpt/shader/path_tracer_transparency.glsl b/src/refresh/vkpt/shader/path_tracer_transparency.glsl index 1d3527379..02aef7b0c 100644 --- a/src/refresh/vkpt/shader/path_tracer_transparency.glsl +++ b/src/refresh/vkpt/shader/path_tracer_transparency.glsl @@ -20,6 +20,43 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef PATH_TRACER_TRANSPARENCY_GLSL_ #define PATH_TRACER_TRANSPARENCY_GLSL_ +vec4 evaluate_fog(uvec4 fog, float t1, float t2) +{ + vec2 fog_bounds = unpackHalf2x16(fog.z); + vec2 fog_density = unpackHalf2x16(fog.w) / 65536.0; // same scale as in find_fog_volume(...) + vec3 fog_color = unpackHalf4x16(fog.xy).rgb; + + t1 = max(t1, fog_bounds.x); + t2 = min(t2, fog_bounds.y); + + if (t1 >= t2) + return vec4(0); + + // solution to the diff equation: dL = -(at+b) dt, + // where L is luminance and alpha is (1 - L_out / L_in), + // a and b are the density function parameters + float alpha = 1.0 - exp((t1 * t1 - t2 * t2) * fog_density.x + (t1 - t2) * fog_density.y); + + return vec4(fog_color * alpha, alpha); +} + +void blend_fogs(in RayPayloadEffects rp, float t1, float t2, inout vec4 accumulated_color) +{ + // Blend the further fog volume first... + if (rp.fog2.w != 0) // test the density for being nonzero + { + vec4 fog_color = evaluate_fog(rp.fog2, t1, t2); + accumulated_color = alpha_blend_premultiplied(fog_color, accumulated_color); + } + + // ...Then blend the closer volume. + if (rp.fog1.w != 0) + { + vec4 fog_color = evaluate_fog(rp.fog1, t1, t2); + accumulated_color = alpha_blend_premultiplied(fog_color, accumulated_color); + } +} + void update_payload_transparency(inout RayPayloadEffects rp, vec4 color, float hitT) { vec4 accumulated_color = unpackHalf4x16(rp.transparency); @@ -27,11 +64,19 @@ void update_payload_transparency(inout RayPayloadEffects rp, vec4 color, float h if(hitT < distances.x || distances.x == 0) { + if (distances.x > 0) + { + blend_fogs(rp, hitT, distances.x, accumulated_color); + } accumulated_color = alpha_blend_premultiplied(color, accumulated_color); distances.x = hitT; } else { + if (hitT > distances.y && distances.y > 0) + { + blend_fogs(rp, distances.y, hitT, accumulated_color); + } accumulated_color = alpha_blend_premultiplied(accumulated_color, color); } @@ -46,4 +91,26 @@ vec4 get_payload_transparency(in RayPayloadEffects rp) return unpackHalf4x16(rp.transparency); } +vec4 get_payload_transparency_with_fog(in RayPayloadEffects rp, float t_max) +{ + vec2 distances = unpackHalf2x16(rp.distances); + + vec4 accumulator = vec4(0); + float current_dist = t_max; + + if (distances.y > 0) + { + blend_fogs(rp, distances.y, t_max, accumulator); + + vec4 ray_transparency = unpackHalf4x16(rp.transparency); + accumulator = alpha_blend_premultiplied(ray_transparency, accumulator); + + current_dist = distances.x; + } + + blend_fogs(rp, 0, current_dist, accumulator); + + return accumulator; +} + #endif // PATH_TRACER_TRANSPARENCY_GLSL_ From b611dcad47e0b1b464ff389a4dd4a78ef9542913 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Wed, 29 Sep 2021 11:11:18 -0700 Subject: [PATCH 47/55] Fixed a few Clang warnings. --- src/client/sound/ogg.c | 2 +- src/refresh/vkpt/bsp_mesh.c | 6 +++--- src/refresh/vkpt/main.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/client/sound/ogg.c b/src/client/sound/ogg.c index 06008fc7a..9f566f165 100644 --- a/src/client/sound/ogg.c +++ b/src/client/sound/ogg.c @@ -638,7 +638,7 @@ OGG_RecoverState(void) static void ogg_enable_changed(cvar_t *self) { - if (ogg_enable->integer && ogg_status == PAUSE || !ogg_enable->integer && ogg_status == PLAY) + if ((ogg_enable->integer && ogg_status == PAUSE) || (!ogg_enable->integer && ogg_status == PLAY)) { OGG_TogglePlayback(); } diff --git a/src/refresh/vkpt/bsp_mesh.c b/src/refresh/vkpt/bsp_mesh.c index 31d6f7613..b3bf1c86f 100644 --- a/src/refresh/vkpt/bsp_mesh.c +++ b/src/refresh/vkpt/bsp_mesh.c @@ -1185,7 +1185,7 @@ collect_sky_and_lava_light_polys(bsp_mesh_t *wm, bsp_t* bsp) light.cluster = BSP_PointLeaf(bsp->nodes, light.off_center)->cluster; if (is_sky_or_lava_cluster(wm, surf, light.cluster, surf->texinfo->material->flags) || - cvar_pt_bsp_sky_lights->integer && is_sky && is_light && (cvar_pt_bsp_sky_lights->integer > 1 || !is_nodraw)) + (cvar_pt_bsp_sky_lights->integer && is_sky && is_light && (cvar_pt_bsp_sky_lights->integer > 1 || !is_nodraw))) { light_poly_t* list_light = append_light_poly(&wm->num_light_polys, &wm->allocated_light_polys, &wm->light_polys); memcpy(list_light, &light, sizeof(light_poly_t)); @@ -1414,7 +1414,7 @@ load_sky_and_lava_clusters(bsp_mesh_t* wm, const char* map_name) const char* word = strtok(linebuf, delimiters); while (word) { - if (word[0] >= 'a' && word[0] <= 'z' || word[0] >= 'A' && word[0] <= 'Z') + if ((word[0] >= 'a' && word[0] <= 'z') || (word[0] >= 'A' && word[0] <= 'Z')) { qboolean matches = strcmp(word, map_name) == 0; @@ -1472,7 +1472,7 @@ load_cameras(bsp_mesh_t* wm, const char* map_name) vec3_t pos, dir; - if (linebuf[0] >= 'a' && linebuf[0] <= 'z' || linebuf[0] >= 'A' && linebuf[0] <= 'Z') + if ((linebuf[0] >= 'a' && linebuf[0] <= 'z') || (linebuf[0] >= 'A' && linebuf[0] <= 'Z')) { const char* delimiters = " \t\r\n"; const char* word = strtok(linebuf, delimiters); diff --git a/src/refresh/vkpt/main.c b/src/refresh/vkpt/main.c index 20fe575bb..34f682412 100644 --- a/src/refresh/vkpt/main.c +++ b/src/refresh/vkpt/main.c @@ -3238,7 +3238,7 @@ R_EndFrame_RTX(void) extent_unscaled_half.height = qvk.extent_unscaled.height / 2; if (extents_equal(qvk.extent_render, qvk.extent_unscaled) || - extents_equal(qvk.extent_render, extent_unscaled_half) && drs_effective_scale == 0) // don't do nearest filter 2x upscale with DRS enabled + (extents_equal(qvk.extent_render, extent_unscaled_half) && drs_effective_scale == 0)) // don't do nearest filter 2x upscale with DRS enabled vkpt_final_blit_simple(cmd_buf, qvk.images[VKPT_IMG_TAA_OUTPUT], qvk.extent_taa_output); else vkpt_final_blit_filtered(cmd_buf); From 8c671841a8a003aca599aacabf853308df53900a Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 7 Oct 2021 10:26:48 -0400 Subject: [PATCH 48/55] Fix load bug for QBSP --- src/common/bsp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/common/bsp.c b/src/common/bsp.c index c9dd41249..0090b2a50 100644 --- a/src/common/bsp.c +++ b/src/common/bsp.c @@ -1509,8 +1509,6 @@ qerror_t BSP_Load(const char *name, bsp_t **bsp_p) const lump_info_t *lumps = LittleLong(header->ident) == IDBSPHEADER ? bsp_lumps : qbsp_lumps; - bsp->extended = (lumps == qbsp_lumps); - // byte swap and validate all lumps memsize = 0; for (info = lumps; info->load; info++) { @@ -1542,6 +1540,7 @@ qerror_t BSP_Load(const char *name, bsp_t **bsp_p) bsp = Z_Mallocz(sizeof(*bsp) + len); memcpy(bsp->name, name, len + 1); bsp->refcount = 1; + bsp->extended = (lumps == qbsp_lumps); // add an extra page for cacheline alignment overhead Hunk_Begin(&bsp->hunk, memsize + 4096); From 0f9f98c2d41cb515e6f7d08f1abcf0aef19db348 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Thu, 7 Oct 2021 10:02:32 -0700 Subject: [PATCH 49/55] Fixed the collection of light polys from models when the entire light texture is emissive. --- src/refresh/vkpt/bsp_mesh.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/refresh/vkpt/bsp_mesh.c b/src/refresh/vkpt/bsp_mesh.c index b3bf1c86f..84cb3bac8 100644 --- a/src/refresh/vkpt/bsp_mesh.c +++ b/src/refresh/vkpt/bsp_mesh.c @@ -785,7 +785,7 @@ is_light_material(uint32_t material) } static void -collect_one_light_poly_entire_texture(bsp_t *bsp, mface_t *surf, mtexinfo_t *texinfo, +collect_one_light_poly_entire_texture(bsp_t *bsp, mface_t *surf, mtexinfo_t *texinfo, int model_idx, const vec3_t light_color, float emissive_factor, int light_style, int *num_lights, int *allocated_lights, light_poly_t **lights) { @@ -826,10 +826,14 @@ collect_one_light_poly_entire_texture(bsp_t *bsp, mface_t *surf, mtexinfo_t *tex if(!get_triangle_off_center(light.positions, light.off_center, NULL, 1.f)) continue; - light.cluster = BSP_PointLeaf(bsp->nodes, light.off_center)->cluster; light.emissive_factor = emissive_factor; - - if(light.cluster >= 0) + + if (model_idx >= 0) + light.cluster = -1; // Cluster will be determined when the model is instanced + else + light.cluster = BSP_PointLeaf(bsp->nodes, light.off_center)->cluster; + + if (model_idx >= 0 || light.cluster >= 0) { light_poly_t* list_light = append_light_poly(num_lights, allocated_lights, lights); memcpy(list_light, &light, sizeof(light_poly_t)); @@ -1093,7 +1097,7 @@ collect_light_polys(bsp_mesh_t *wm, bsp_t *bsp, int model_idx, int* num_lights, if (entire_texture_emissive) { - collect_one_light_poly_entire_texture(bsp, surf, texinfo, light_color, emissive_factor, light_style, + collect_one_light_poly_entire_texture(bsp, surf, texinfo, model_idx, light_color, emissive_factor, light_style, num_lights, allocated_lights, lights); continue; } From be978b3ea9b65e127e8dab9e211a5a5480548350 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Thu, 7 Oct 2021 18:20:52 -0700 Subject: [PATCH 50/55] Added a setting to enable the use of texture and model overrides in the GL renderer, gl_use_hd_assets. Requested in https://github.com/NVIDIA/Q2RTX/issues/151 --- baseq2/q2rtx.menu | 2 ++ src/refresh/gl/main.c | 2 ++ src/refresh/images.c | 3 ++- src/refresh/models.c | 3 ++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/baseq2/q2rtx.menu b/baseq2/q2rtx.menu index c3d9d26be..7888d8276 100644 --- a/baseq2/q2rtx.menu +++ b/baseq2/q2rtx.menu @@ -161,6 +161,8 @@ begin video pairs "texture intensity" intensity 1x 1 2x 2 3x 3 range "lightmap saturation" gl_coloredlightmaps 0 1 range "lightmap brightness" gl_brightness 0 0.3 + blank + toggle "use new textures and models" gl_use_hd_assets endif end diff --git a/src/refresh/gl/main.c b/src/refresh/gl/main.c index 591eaa2f9..92701e425 100644 --- a/src/refresh/gl/main.c +++ b/src/refresh/gl/main.c @@ -50,6 +50,7 @@ cvar_t *gl_doublelight_entities; cvar_t *gl_fragment_program; cvar_t *gl_vertex_buffer_object; cvar_t *gl_fontshadow; +cvar_t *gl_use_hd_assets; // development variables cvar_t *gl_znear; @@ -758,6 +759,7 @@ static void GL_Register(void) gl_vertex_buffer_object = Cvar_Get("gl_vertex_buffer_object", "1", CVAR_FILES); gl_vertex_buffer_object->modified = qtrue; gl_fontshadow = Cvar_Get("gl_fontshadow", "0", 0); + gl_use_hd_assets = Cvar_Get("gl_use_hd_assets", "0", CVAR_FILES); // development variables gl_znear = Cvar_Get("gl_znear", "2", CVAR_CHEAT); diff --git a/src/refresh/images.c b/src/refresh/images.c index c7290c413..9c2871f94 100644 --- a/src/refresh/images.c +++ b/src/refresh/images.c @@ -50,6 +50,7 @@ void stbi_write(void *context, void *data, int size) } extern cvar_t* vid_rtx; +extern cvar_t* gl_use_hd_assets; /* ==================================================================== @@ -1152,7 +1153,7 @@ static qerror_t find_or_load_image(const char *name, size_t len, } int override_textures = !!r_override_textures->integer; - if (!vid_rtx->integer && (type != IT_PIC)) + if (!vid_rtx->integer && (type != IT_PIC) && !gl_use_hd_assets->integer) override_textures = 0; if (flags & IF_EXACT) override_textures = 0; diff --git a/src/refresh/models.c b/src/refresh/models.c index 200157045..53f043466 100644 --- a/src/refresh/models.c +++ b/src/refresh/models.c @@ -41,6 +41,7 @@ model_t r_models[MAX_RMODELS]; int r_numModels; extern cvar_t *vid_rtx; +extern cvar_t *gl_use_hd_assets; static model_t *MOD_Alloc(void) { @@ -358,7 +359,7 @@ qhandle_t R_RegisterModel(const char *name) fs_flags = try_location == TRY_MODEL_SRC_GAME ? FS_PATH_GAME : FS_PATH_BASE; char* extension = normalized + namelen - 4; - if (namelen > 4 && (strcmp(extension, ".md2") == 0) && vid_rtx->integer) + if (namelen > 4 && (strcmp(extension, ".md2") == 0) && (vid_rtx->integer || gl_use_hd_assets->integer)) { memcpy(extension, ".md3", 4); From a10555d0b8d8a81fc7a503d8a922e74ca3b1e164 Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Mon, 11 Oct 2021 10:10:14 +0200 Subject: [PATCH 51/55] Only adjust DRS if world was rendered in previous frame --- src/refresh/vkpt/main.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/refresh/vkpt/main.c b/src/refresh/vkpt/main.c index 34f682412..43606fa53 100644 --- a/src/refresh/vkpt/main.c +++ b/src/refresh/vkpt/main.c @@ -77,6 +77,7 @@ extern cvar_t *cvar_bloom_enable; extern cvar_t* cvar_flt_taa; static int drs_current_scale = 0; static int drs_effective_scale = 0; +static qboolean drs_last_frame_world = qfalse; cvar_t* cvar_min_driver_version_nvidia = NULL; cvar_t* cvar_min_driver_version_amd = NULL; @@ -205,7 +206,20 @@ static inline qboolean extents_equal(VkExtent2D a, VkExtent2D b) static VkExtent2D get_render_extent() { - int scale = (drs_effective_scale != 0) ? drs_effective_scale : scr_viewsize->integer; + int scale; + if(drs_effective_scale) + { + scale = drs_effective_scale; + } + else + { + scale = scr_viewsize->integer; + if(cvar_drs_enable->integer) + { + // Ensure render extent stays below get_screen_image_extent() result + scale = min(cvar_drs_maxscale->integer, scale); + } + } VkExtent2D result; result.width = (uint32_t)(qvk.extent_unscaled.width * (float)scale / 100.f); @@ -2704,7 +2718,10 @@ R_RenderFrame_RTX(refdef_t *fd) LOG_FUNC(); if (!vkpt_refdef.bsp_mesh_world_loaded && render_world) + { + drs_last_frame_world = qfalse; return; + } vec3_t sky_matrix[3]; prepare_sky_matrix(fd->time, sky_matrix); @@ -2981,6 +2998,7 @@ R_RenderFrame_RTX(refdef_t *fd) temporal_frame_valid = ref_mode.enable_denoiser; frame_ready = qtrue; + drs_last_frame_world = qtrue; if (vkpt_refdef.fd && vkpt_refdef.fd->lightstyles) { memcpy(vkpt_refdef.prev_lightstyles, vkpt_refdef.fd->lightstyles, sizeof(vkpt_refdef.prev_lightstyles)); @@ -3060,11 +3078,22 @@ static void drs_process() return; } + if (!drs_last_frame_world) + { + /* Last frame world was not rendered: + * Frame times wouldn't be representative, so don't adjust DRS. + * If DRS wasn't adjusted previously return a constrained default value */ + int scale = drs_current_scale ? drs_current_scale : scr_viewsize->integer; + drs_effective_scale = max(cvar_drs_minscale->integer, min(cvar_drs_maxscale->integer, scale)); + return; + } + drs_effective_scale = drs_current_scale; double ms = vkpt_get_profiler_result(PROFILER_FRAME_TIME); - if (ms < 0 || ms > 1000) + // 0ms frame may happen if we just played a cinematic + if (ms <= 0 || ms > 1000) return; valid_frame_times[num_valid_frames] = ms; @@ -3844,6 +3873,8 @@ R_BeginRegistration_RTX(const char *name) memset(cluster_debug_mask, 0, sizeof(cluster_debug_mask)); cluster_debug_index = -1; + + drs_last_frame_world = qfalse; } void From d99a5d4887aac56a7ace484f61467a66ad0fcade Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Mon, 11 Oct 2021 11:53:30 +0200 Subject: [PATCH 52/55] Persist DRS scale between runs --- src/refresh/vkpt/main.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/refresh/vkpt/main.c b/src/refresh/vkpt/main.c index 43606fa53..6ba3b43d4 100644 --- a/src/refresh/vkpt/main.c +++ b/src/refresh/vkpt/main.c @@ -71,6 +71,7 @@ cvar_t *cvar_drs_maxscale = NULL; cvar_t *cvar_drs_adjust_up = NULL; cvar_t *cvar_drs_adjust_down = NULL; cvar_t *cvar_drs_gain = NULL; +cvar_t *cvar_drs_last_scale = NULL; cvar_t *cvar_tm_blend_enable = NULL; extern cvar_t *scr_viewsize; extern cvar_t *cvar_bloom_enable; @@ -3051,6 +3052,9 @@ static void drs_init() cvar_drs_gain = Cvar_Get("drs_gain", "20", 0); cvar_drs_adjust_up = Cvar_Get("drs_adjust_up", "0.92", 0); cvar_drs_adjust_down = Cvar_Get("drs_adjust_down", "0.98", 0); + + // Value of drs_current_scale from last run. To start with a close-to-desired scale + cvar_drs_last_scale = Cvar_Get("drs_last_scale", "0", CVAR_ARCHIVE); } static void drs_process() @@ -3078,17 +3082,22 @@ static void drs_process() return; } + int last_scale = drs_current_scale; + if(!last_scale) + last_scale = cvar_drs_last_scale->integer; + if(!last_scale) + last_scale = scr_viewsize->integer; + if (!drs_last_frame_world) { /* Last frame world was not rendered: - * Frame times wouldn't be representative, so don't adjust DRS. - * If DRS wasn't adjusted previously return a constrained default value */ - int scale = drs_current_scale ? drs_current_scale : scr_viewsize->integer; - drs_effective_scale = max(cvar_drs_minscale->integer, min(cvar_drs_maxscale->integer, scale)); + * Frame times wouldn't be representative, so don't adjust DRS. + * If DRS wasn't adjusted previously return a constrained default value */ + drs_effective_scale = max(cvar_drs_minscale->integer, min(cvar_drs_maxscale->integer, last_scale)); return; } - drs_effective_scale = drs_current_scale; + drs_effective_scale = last_scale; double ms = vkpt_get_profiler_result(PROFILER_FRAME_TIME); @@ -3114,7 +3123,7 @@ static void drs_process() double target_time = 1000.0 / cvar_drs_target->value; double f = cvar_drs_gain->value * (1.0 - representative_time / target_time) - 1.0; - int scale = drs_current_scale; + int scale = drs_effective_scale; if (representative_time < target_time * cvar_drs_adjust_up->value) { f += 0.5; @@ -3585,7 +3594,11 @@ R_Shutdown_RTX(qboolean total) vkpt_freecam_reset(); vkDeviceWaitIdle(qvk.device); - + + // Persist current DRS scale + if (drs_current_scale != 0) + Cvar_SetInteger(cvar_drs_last_scale, drs_current_scale, FROM_CODE); + Cmd_RemoveCommand("reload_shader"); Cmd_RemoveCommand("reload_textures"); Cmd_RemoveCommand("show_pvs"); From f5bc135c5ba7392e956e9068a49a0d2d1a05901b Mon Sep 17 00:00:00 2001 From: Frank Richter Date: Sat, 10 Apr 2021 17:46:17 +0200 Subject: [PATCH 53/55] By default, disable GMF_ENHANCED_SAVEGAMES checks Seems to work fine... (also confirmed in #150) --- src/server/save.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/server/save.c b/src/server/save.c index 03d0b0c00..7b1a15628 100644 --- a/src/server/save.c +++ b/src/server/save.c @@ -26,6 +26,10 @@ with this program; if not, write to the Free Software Foundation, Inc., #define SAVE_AUTO "save0" cvar_t *sv_savedir = NULL; +/* Don't require GMF_ENHANCED_SAVEGAMES feature for savegame support. + * Savegame logic may be less "safe", but in practice, this usually works fine. + * Still, allow it as an option for cautious people. */ +cvar_t *sv_force_enhanced_savegames = NULL; static int write_server_file(qboolean autosave) @@ -381,7 +385,7 @@ static int read_server_file(void) SV_InitGame(MVD_SPAWN_DISABLED); // error out immediately if game doesn't support safe savegames - if (!(g_features->integer & GMF_ENHANCED_SAVEGAMES)) + if (sv_force_enhanced_savegames->integer && !(g_features->integer & GMF_ENHANCED_SAVEGAMES)) Com_Error(ERR_DROP, "Game does not support enhanced savegames"); // read game state @@ -462,7 +466,7 @@ int SV_NoSaveGames(void) if (dedicated->integer && !Cvar_VariableInteger("coop")) return 1; - if (!(g_features->integer & GMF_ENHANCED_SAVEGAMES)) + if (sv_force_enhanced_savegames->integer && !(g_features->integer & GMF_ENHANCED_SAVEGAMES)) return 1; if (Cvar_VariableInteger("deathmatch")) @@ -642,7 +646,7 @@ static void SV_Savegame_f(void) } // don't bother saving if we can't read them back! - if (!(g_features->integer & GMF_ENHANCED_SAVEGAMES)) { + if (sv_force_enhanced_savegames->integer && !(g_features->integer & GMF_ENHANCED_SAVEGAMES)) { Com_Printf("Game does not support enhanced savegames.\n"); return; } @@ -707,4 +711,5 @@ void SV_RegisterSavegames(void) { Cmd_Register(c_savegames); sv_savedir = Cvar_Get("sv_savedir", "save", 0); + sv_force_enhanced_savegames = Cvar_Get("sv_force_enhanced_savegames", "0", 0); } From cd9c5c7a255aa1c2a1ad6004b85cfdaad6334d29 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Mon, 18 Oct 2021 16:21:37 -0700 Subject: [PATCH 54/55] Fixed the background blur behavior when the menu is opened on a system with over 24 days of uptime, and a few related type-casts. In case of such uptime, Sys_Milliseconds() returns a value over 2^31, which is cast to a negative int. --- src/refresh/vkpt/bloom.c | 8 ++++---- src/refresh/vkpt/physical_sky.c | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/refresh/vkpt/bloom.c b/src/refresh/vkpt/bloom.c index b4c924a64..40518cb2c 100644 --- a/src/refresh/vkpt/bloom.c +++ b/src/refresh/vkpt/bloom.c @@ -101,13 +101,13 @@ void vkpt_bloom_update(QVKUniformBuffer_t * ubo, float frame_time, qboolean unde bloom_sigma = mix(cvar_bloom_sigma->value, cvar_bloom_sigma_water->value, under_water_animation); } - static int menu_start_ms = -1; + static uint32_t menu_start_ms = 0; if (menu_mode) { - if (menu_start_ms < 0) + if (menu_start_ms == 0) menu_start_ms = Sys_Milliseconds(); - int current_ms = Sys_Milliseconds(); + uint32_t current_ms = Sys_Milliseconds(); float phase = max(0.f, min(1.f, (float)(current_ms - menu_start_ms) / 150.f)); phase = powf(phase, 0.25f); @@ -118,7 +118,7 @@ void vkpt_bloom_update(QVKUniformBuffer_t * ubo, float frame_time, qboolean unde } else { - menu_start_ms = -1; + menu_start_ms = 0; ubo->bloom_intensity = bloom_intensity; } diff --git a/src/refresh/vkpt/physical_sky.c b/src/refresh/vkpt/physical_sky.c index 5205cbc4e..3bba0bb4c 100644 --- a/src/refresh/vkpt/physical_sky.c +++ b/src/refresh/vkpt/physical_sky.c @@ -551,15 +551,15 @@ static void change_image_layouts(VkImage image, const VkImageSubresourceRange* s static void process_gamepad_input() { - static int prev_milliseconds = 0; - int curr_milliseconds = Sys_Milliseconds(); + static uint32_t prev_milliseconds = 0; + uint32_t curr_milliseconds = Sys_Milliseconds(); if (!prev_milliseconds) { prev_milliseconds = curr_milliseconds; return; } - int frame_time = curr_milliseconds - prev_milliseconds; + uint32_t frame_time = curr_milliseconds - prev_milliseconds; prev_milliseconds = curr_milliseconds; if (frame_time > 1000) @@ -575,10 +575,10 @@ process_gamepad_input() dx = powf(max(fabsf(dx) - deadzone, 0.f) / limit, 2.f) * (dx < 0 ? -1.f : 1.f); dy = powf(max(fabsf(dy) - deadzone, 0.f) / limit, 2.f) * (dy < 0 ? -1.f : 1.f); - dx *= frame_time * 0.05f; - dy *= frame_time * 0.05f; + dx *= (float)frame_time * 0.05f; + dy *= (float)frame_time * 0.05f; - if (dx) + if (dx != 0.f) { float azimuth = sun_azimuth->value; azimuth -= dx; @@ -588,7 +588,7 @@ process_gamepad_input() sun_azimuth->changed(sun_azimuth); } - if (dy) + if (dy != 0.f) { float elevation = sun_elevation->value; elevation -= dy; From 4d07b381ecbc4611e8436c20051dfa589335f5c3 Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Thu, 21 Oct 2021 18:32:59 -0700 Subject: [PATCH 55/55] Added support for smooth normals on the world mesh. The normals and tangents are coming from a new BSPX lump called "FACENORMALS", see inc/format/bsp.h for the description. --- inc/common/bsp.h | 15 ++ inc/format/bsp.h | 26 +++ src/common/bsp.c | 111 ++++++++++++ src/refresh/vkpt/bsp_mesh.c | 214 ++++++++++++++++-------- src/refresh/vkpt/shader/vertex_buffer.h | 21 +-- src/refresh/vkpt/vertex_buffer.c | 3 +- src/refresh/vkpt/vkpt.h | 1 + 7 files changed, 309 insertions(+), 82 deletions(-) diff --git a/inc/common/bsp.h b/inc/common/bsp.h index b374a5b59..2a6250902 100644 --- a/inc/common/bsp.h +++ b/inc/common/bsp.h @@ -64,6 +64,13 @@ typedef struct { vec3_t point; } mvertex_t; +typedef struct { + // indices into the bsp->basisvectors array + uint32_t normal; + uint32_t tangent; + uint32_t bitangent; +} mbasis_t; + typedef struct { mvertex_t *v[2]; #if USE_REF == REF_SOFT @@ -111,6 +118,8 @@ typedef struct mface_s { struct surfcache_s *cachespots[MIPLEVELS]; // surface generation data #endif + int firstbasis; + int drawframe; #if USE_DLIGHTS @@ -281,6 +290,12 @@ typedef struct bsp_s { int numsurfedges; msurfedge_t *surfedges; + + int numbasisvectors; + vec3_t *basisvectors; + + int numbases; + mbasis_t *bases; #endif byte *pvs_matrix; diff --git a/inc/format/bsp.h b/inc/format/bsp.h index 7a6507a05..7a8eb5674 100644 --- a/inc/format/bsp.h +++ b/inc/format/bsp.h @@ -289,4 +289,30 @@ typedef struct { uint32_t texinfo; } dbrushside_qbsp_t; +typedef struct { + char id[4]; // 'BSPX' + uint32_t numlumps; +} bspx_header_t; + +typedef struct { + char lumpname[24]; // up to 23 chars, zero-padded + uint32_t fileofs; // from file start + uint32_t filelen; +} bspx_lump_t; + +typedef struct { + uint32_t num_vectors; + /* followed by: + vec3 vectors[num_vectors] + + for each face in bsp { + for each vert in face { + u32 normal_index; + u32 tangent_index; + u32 bitangent_index; + } + } + */ +} bspx_facenormals_header_t; + #endif // FORMAT_BSP_H diff --git a/src/common/bsp.c b/src/common/bsp.c index 16a2deaba..e7e2e31bc 100644 --- a/src/common/bsp.c +++ b/src/common/bsp.c @@ -1453,6 +1453,101 @@ qboolean BSP_SavePatchedPVS(bsp_t *bsp) return qfalse; } +static qboolean BSP_FindBspxLump(dheader_t* header, size_t file_size, const char* name, const void** pLump, size_t* pLumpSize) +{ + // Find the end of the last BSP lump + size_t max_bsp_lump = 0; + for (uint32_t i = 0; i < HEADER_LUMPS; i++) + { + size_t end_of_lump = header->lumps[i].fileofs + header->lumps[i].filelen; + max_bsp_lump = max(max_bsp_lump, end_of_lump); + } + + // Align to 4 bytes + max_bsp_lump = (max_bsp_lump + 3) & ~3ull; + + // See if the BSPX header still fits in the file after the last BSP lump + if (max_bsp_lump + sizeof(bspx_header_t) > file_size) + return qfalse; + + // Validate the BSPX header + const bspx_header_t* bspx = (bspx_header_t*)((uint8_t*)header + max_bsp_lump); + if (bspx->id[0] != 'B' || bspx->id[1] != 'S' || bspx->id[2] != 'P' || bspx->id[3] != 'X') + return qfalse; + if (max_bsp_lump + sizeof(bspx_header_t) + sizeof(bspx_lump_t) * bspx->numlumps > file_size) + return qfalse; + + // Go over the BSPX lumps and find one with the right name + for (uint32_t i = 0; i < bspx->numlumps; i++) + { + const bspx_lump_t* lump = (const bspx_lump_t*)(bspx + 1) + i; + if (strncmp(name, lump->lumpname, sizeof(lump->lumpname) - 1) == 0) + { + // See if the lump as declared fits in the file + if (lump->fileofs + lump->filelen > file_size) + { + Com_WPrintf("Malformed BSPX file: lump '%s' points at data past the end of file\n", name); + return qfalse; + } + + // Found a valid lump, return it + *pLump = (uint8_t*)header + lump->fileofs; + *pLumpSize = lump->filelen; + return qtrue; + } + } + + return qfalse; +} + +#if USE_REF +static void BSP_LoadBspxNormals(bsp_t* bsp, const void* data, size_t data_size) +{ + if (data_size < sizeof(bspx_facenormals_header_t)) + return; + + // Count the total number of face-vertices in the BSP + uint32_t total_vertices = 0; + for (int i = 0; i < bsp->numfaces; i++) + { + mface_t* face = bsp->faces + i; + total_vertices += face->numsurfedges; + } + + // Validate the header and that all data fits into the lump + const bspx_facenormals_header_t* header = data; + size_t expected_data_size = + sizeof(bspx_facenormals_header_t) + + sizeof(vec3_t) * header->num_vectors + // vectors + sizeof(uint32_t) * 3 * total_vertices; // indices + if (data_size < expected_data_size) + return; + + // Allocate the storage arrays + bsp->basisvectors = ALLOC(sizeof(vec3_t) * header->num_vectors); + bsp->numbasisvectors = header->num_vectors; + bsp->bases = ALLOC(sizeof(mbasis_t) * total_vertices); + bsp->numbases = total_vertices; + + // Copy the vectors data + const float* vectors = (const float*)((const bspx_facenormals_header_t*)data + 1); + memcpy(bsp->basisvectors, vectors, sizeof(vec3_t) * header->num_vectors); + + // Copy the indices data + const uint32_t* indices = (const uint32_t*)(vectors + header->num_vectors * 3); + memcpy(bsp->bases, indices, sizeof(uint32_t) * 3 * total_vertices); + + // Add basis indexing + int basis_offset = 0; + for (int i = 0; i < bsp->numfaces; i++) + { + mface_t* face = bsp->faces + i; + face->firstbasis = basis_offset; + basis_offset += face->numsurfedges; + } +} +#endif + /* ================== BSP_Load @@ -1534,6 +1629,15 @@ qerror_t BSP_Load(const char *name, bsp_t **bsp_p) memsize += count * info->memsize; } + +#if USE_REF + const void* normal_lump_data = NULL; + size_t normal_lump_size = 0; + if (BSP_FindBspxLump(header, filelen, "FACENORMALS", &normal_lump_data, &normal_lump_size)) + { + memsize += normal_lump_size; + } +#endif // load into hunk len = strlen(name); @@ -1575,6 +1679,13 @@ qerror_t BSP_Load(const char *name, bsp_t **bsp_p) bsp->pvs_patched = qtrue; } +#if USE_REF + if (normal_lump_size) + { + BSP_LoadBspxNormals(bsp, normal_lump_data, normal_lump_size); + } +#endif + Hunk_End(&bsp->hunk); List_Append(&bsp_cache, &bsp->entry); diff --git a/src/refresh/vkpt/bsp_mesh.c b/src/refresh/vkpt/bsp_mesh.c index 84cb3bac8..b9b2e68b4 100644 --- a/src/refresh/vkpt/bsp_mesh.c +++ b/src/refresh/vkpt/bsp_mesh.c @@ -34,7 +34,7 @@ extern cvar_t* cvar_pt_bsp_radiance_scale; extern cvar_t *cvar_pt_bsp_sky_lights; static void -remove_collinear_edges(float* positions, float* tex_coords, int* num_vertices) +remove_collinear_edges(float* positions, float* tex_coords, mbasis_t* bases, int* num_vertices) { int num_vertices_local = *num_vertices; @@ -77,6 +77,13 @@ remove_collinear_edges(float* positions, float* tex_coords, int* num_vertices) float* t2 = tex_coords + ((i + 1) % num_vertices_local) * 2; memcpy(t1, t2, (num_vertices_local - i - 1) * 2 * sizeof(float)); } + + if (bases) + { + mbasis_t* b1 = bases + (i % num_vertices_local); + mbasis_t* b2 = bases + ((i + 1) % num_vertices_local); + memcpy(b1, b2, (num_vertices_local - i - 1) * sizeof(mbasis_t)); + } } num_vertices_local--; @@ -90,6 +97,33 @@ remove_collinear_edges(float* positions, float* tex_coords, int* num_vertices) *num_vertices = num_vertices_local; } +// direct port of the encode_normal function from utils.glsl +static uint32_t +encode_normal(const vec3_t normal) +{ + float invL1Norm = 1.0f / (fabsf(normal[0]) + fabsf(normal[1]) + fabsf(normal[2])); + + vec2_t p = { normal[0] * invL1Norm, normal[1] * invL1Norm }; + vec2_t pp = { p[0], p[1] }; + + if (normal[2] < 0.f) + { + pp[0] = (1.f - fabsf(p[1])) * ((p[0] >= 0.f) ? 1.f : -1.f); + pp[1] = (1.f - fabsf(p[0])) * ((p[1] >= 0.f) ? 1.f : -1.f); + } + + pp[0] = pp[0] * 0.5f + 0.5f; + pp[1] = pp[1] * 0.5f + 0.5f; + + clamp(pp[0], 0.f, 1.f); + clamp(pp[1], 0.f, 1.f); + + uint32_t ux = (uint32_t)(pp[0] * 0xffffu); + uint32_t uy = (uint32_t)(pp[1] * 0xffffu); + + return ux | (uy << 16); +} + #define DUMP_WORLD_MESH_TO_OBJ 0 #if DUMP_WORLD_MESH_TO_OBJ static FILE* obj_dump_file = NULL; @@ -98,16 +132,20 @@ static int obj_vertex_num = 0; static int create_poly( + const bsp_t *bsp, const mface_t *surf, uint32_t material_id, float *positions_out, float *tex_coord_out, + uint32_t *normals_out, + uint32_t *tangents_out, uint32_t *material_out, float *emissive_factors_out) { static const int max_vertices = 32; float positions [3 * /*max_vertices*/ 32]; float tex_coords[2 * /*max_vertices*/ 32]; + mbasis_t bases [ /*max_vertices*/ 32]; mtexinfo_t *texinfo = surf->texinfo; assert(surf->numsurfedges < max_vertices); @@ -141,6 +179,11 @@ create_poly( t[0] = (DotProduct(p, texinfo->axis[0]) + texinfo->offset[0]) * sc[0]; t[1] = (DotProduct(p, texinfo->axis[1]) + texinfo->offset[1]) * sc[1]; + if (bsp->basisvectors) + { + bases[i] = *(bsp->bases + surf->firstbasis + i); + } + #if DUMP_WORLD_MESH_TO_OBJ if (obj_dump_file) { @@ -161,13 +204,30 @@ create_poly( } #endif - pos_center[0] /= (float)surf->numsurfedges; - pos_center[1] /= (float)surf->numsurfedges; - pos_center[2] /= (float)surf->numsurfedges; - + float inv_edges = 1.f / (float)surf->numsurfedges; + VectorScale(pos_center, inv_edges, pos_center); + tc_center[0] = (DotProduct(pos_center, texinfo->axis[0]) + texinfo->offset[0]) * sc[0]; tc_center[1] = (DotProduct(pos_center, texinfo->axis[1]) + texinfo->offset[1]) * sc[1]; + if (bsp->basisvectors) + { + // Check the handedness using the basis of the first vertex + + const vec3_t* normal = bsp->basisvectors + bases->normal; + const vec3_t* tangent = bsp->basisvectors + bases->tangent; + const vec3_t* bitangent = bsp->basisvectors + bases->bitangent; + + vec3_t cross; + CrossProduct(*normal, *tangent, cross); + float dot = DotProduct(cross, *bitangent); + + if (dot < 0.0f) + { + material_id |= MATERIAL_FLAG_HANDEDNESS; + } + } + int num_vertices = surf->numsurfedges; qboolean is_sky = MAT_IsKind(material_id, MATERIAL_KIND_SKY); @@ -175,7 +235,7 @@ create_poly( { // process skybox geometry in the same way as we process it for analytic light generation // to avoid mismatches between lights and geometry - remove_collinear_edges(positions, tex_coords, &num_vertices); + remove_collinear_edges(positions, tex_coords, bases, &num_vertices); } #define CP_V(idx, src) \ @@ -193,9 +253,13 @@ create_poly( } while(0) int k = 0; - /* switch between triangle fan around center or first vertex */ + + // Switch between triangle fan around center or first vertex. + // Can't use the center-based fan if normals/tangents are provided + // because it's not trivial to compute the normal and tangent at the center + // of the polygon. //int tess_center = 0; - int tess_center = num_vertices > 4 && !is_sky; + int tess_center = num_vertices > 4 && !is_sky && !bsp->basisvectors; const int num_triangles = tess_center ? num_vertices @@ -204,6 +268,8 @@ create_poly( const float emissive_factor = (texinfo->c.flags & SURF_LIGHT) && texinfo->material->bsp_radiance ? (float)texinfo->radiance * cvar_pt_bsp_radiance_scale->value : 1.f; + + qboolean write_normals = bsp->basisvectors && (normals_out || tangents_out); for (int i = 0; i < num_triangles; i++) { @@ -212,14 +278,38 @@ create_poly( CP_V(k, tess_center ? pos_center : positions); CP_T(k, tess_center ? tc_center : tex_coords); + if (write_normals) + { + const mbasis_t* basis = bases; + const vec3_t* normal = bsp->basisvectors + basis->normal; + const vec3_t* tangent = bsp->basisvectors + basis->tangent; + if (normals_out) normals_out[k] = encode_normal(*normal); + if (tangents_out) tangents_out[k] = encode_normal(*tangent); + } k++; CP_V(k, positions + i1 * 3); CP_T(k, tex_coords + i1 * 2); + if (write_normals) + { + const mbasis_t* basis = bases + i1; + const vec3_t* normal = bsp->basisvectors + basis->normal; + const vec3_t* tangent = bsp->basisvectors + basis->tangent; + if (normals_out) normals_out[k] = encode_normal(*normal); + if (tangents_out) tangents_out[k] = encode_normal(*tangent); + } k++; CP_V(k, positions + i2 * 3); CP_T(k, tex_coords + i2 * 2); + if (write_normals) + { + const mbasis_t* basis = bases + i2; + const vec3_t* normal = bsp->basisvectors + basis->normal; + const vec3_t* tangent = bsp->basisvectors + basis->tangent; + if (normals_out) normals_out[k] = encode_normal(*normal); + if (tangents_out) tangents_out[k] = encode_normal(*tangent); + } k++; if (material_out) { @@ -562,13 +652,15 @@ collect_surfaces(int *idx_ctr, bsp_mesh_t *wm, bsp_t *bsp, int model_idx, int (* material_id = (material_id & ~MATERIAL_LIGHT_STYLE_MASK) | ((camera_id << MATERIAL_LIGHT_STYLE_SHIFT) & MATERIAL_LIGHT_STYLE_MASK); } - if (*idx_ctr + create_poly(surf, material_id, NULL, NULL, NULL, NULL) >= MAX_VERT_BSP) { + if (*idx_ctr + create_poly(bsp, surf, material_id, NULL, NULL, NULL, NULL, NULL, NULL) >= MAX_VERT_BSP) { Com_Error(ERR_FATAL, "error: exceeding max vertex limit\n"); } - int cnt = create_poly(surf, material_id, + int cnt = create_poly(bsp, surf, material_id, &wm->positions[*idx_ctr * 3], &wm->tex_coords[*idx_ctr * 2], + &wm->normals[*idx_ctr], + &wm->tangents[*idx_ctr], &wm->materials[*idx_ctr / 3], &wm->emissive_factors[*idx_ctr / 3]); @@ -803,7 +895,7 @@ collect_one_light_poly_entire_texture(bsp_t *bsp, mface_t *surf, mtexinfo_t *tex } int num_vertices = surf->numsurfedges; - remove_collinear_edges(positions, NULL, &num_vertices); + remove_collinear_edges(positions, NULL, NULL, &num_vertices); const int num_triangles = surf->numsurfedges - 2; @@ -1156,7 +1248,7 @@ collect_sky_and_lava_light_polys(bsp_mesh_t *wm, bsp_t* bsp) } int num_vertices = surf->numsurfedges; - remove_collinear_edges(positions, NULL, &num_vertices); + remove_collinear_edges(positions, NULL, NULL, &num_vertices); const int num_triangles = num_vertices - 2; @@ -1236,33 +1328,6 @@ is_model_masked(bsp_mesh_t *wm, bsp_model_t *model) return qfalse; } -// direct port of the encode_normal function from utils.glsl -uint32_t -encode_normal(vec3_t normal) -{ - float invL1Norm = 1.0f / (fabsf(normal[0]) + fabsf(normal[1]) + fabsf(normal[2])); - - vec2_t p = { normal[0] * invL1Norm, normal[1] * invL1Norm }; - vec2_t pp = { p[0], p[1] }; - - if(normal[2] < 0.f) - { - pp[0] = (1.f - fabsf(p[1])) * ((p[0] >= 0.f) ? 1.f : -1.f); - pp[1] = (1.f - fabsf(p[0])) * ((p[1] >= 0.f) ? 1.f : -1.f); - } - - pp[0] = pp[0] * 0.5f + 0.5f; - pp[1] = pp[1] * 0.5f + 0.5f; - - clamp(pp[0], 0.f, 1.f); - clamp(pp[1], 0.f, 1.f); - - uint32_t ux = (uint32_t)(pp[0] * 0xffffu); - uint32_t uy = (uint32_t)(pp[1] * 0xffffu); - - return ux | (uy << 16); -} - void compute_aabb(const float* positions, int numvert, float* aabb_min, float* aabb_max) { @@ -1284,14 +1349,11 @@ compute_aabb(const float* positions, int numvert, float* aabb_min, float* aabb_m } void -compute_world_tangents(bsp_mesh_t* wm) +compute_world_tangents(bsp_t* bsp, bsp_mesh_t* wm) { // compute tangent space uint32_t ntriangles = wm->num_indices / 3; - // tangent space is co-planar to triangle : only need to compute - // 1 vertex because all 3 verts share the same tangent space - wm->tangents = Z_Malloc(MAX_VERT_BSP * sizeof(uint32_t) / 3); wm->texel_density = Z_Malloc(MAX_VERT_BSP * sizeof(float) / 3); for (int idx_tri = 0; idx_tri < ntriangles; ++idx_tri) @@ -1316,38 +1378,49 @@ compute_world_tangents(bsp_mesh_t* wm) Vector2Subtract(tB, tA, dt0); Vector2Subtract(tC, tA, dt1); - float r = 1.f / (dt0[0] * dt1[1] - dt1[0] * dt0[1]); + if (!bsp->basisvectors) + { + float r = 1.f / (dt0[0] * dt1[1] - dt1[0] * dt0[1]); - vec3_t sdir = { - (dt1[1] * dP0[0] - dt0[1] * dP1[0]) * r, - (dt1[1] * dP0[1] - dt0[1] * dP1[1]) * r, - (dt1[1] * dP0[2] - dt0[1] * dP1[2]) * r }; + vec3_t sdir = { + (dt1[1] * dP0[0] - dt0[1] * dP1[0]) * r, + (dt1[1] * dP0[1] - dt0[1] * dP1[1]) * r, + (dt1[1] * dP0[2] - dt0[1] * dP1[2]) * r }; - vec3_t tdir = { - (dt0[0] * dP1[0] - dt1[0] * dP0[0]) * r, - (dt0[0] * dP1[1] - dt1[0] * dP0[1]) * r, - (dt0[0] * dP1[2] - dt1[0] * dP0[2]) * r }; + vec3_t tdir = { + (dt0[0] * dP1[0] - dt1[0] * dP0[0]) * r, + (dt0[0] * dP1[1] - dt1[0] * dP0[1]) * r, + (dt0[0] * dP1[2] - dt1[0] * dP0[2]) * r }; - vec3_t normal; - CrossProduct(dP0, dP1, normal); - VectorNormalize(normal); + vec3_t normal; + CrossProduct(dP0, dP1, normal); + VectorNormalize(normal); - vec3_t tangent; + uint32_t encoded_normal = encode_normal(normal); + wm->normals[idx_tri * 3 + 0] = encoded_normal; + wm->normals[idx_tri * 3 + 1] = encoded_normal; + wm->normals[idx_tri * 3 + 2] = encoded_normal; - vec3_t t; - VectorScale(normal, DotProduct(normal, sdir), t); - VectorSubtract(sdir, t, t); - VectorNormalize2(t, tangent); // Graham-Schmidt : t = normalize(t - n * (n.t)) + vec3_t tangent; - wm->tangents[idx_tri] = encode_normal(tangent); + vec3_t t; + VectorScale(normal, DotProduct(normal, sdir), t); + VectorSubtract(sdir, t, t); + VectorNormalize2(t, tangent); // Graham-Schmidt : t = normalize(t - n * (n.t)) - vec3_t cross; - CrossProduct(normal, t, cross); - float dot = DotProduct(cross, tdir); + uint32_t encoded_tangent = encode_normal(tangent); + wm->tangents[idx_tri * 3 + 0] = encoded_tangent; + wm->tangents[idx_tri * 3 + 1] = encoded_tangent; + wm->tangents[idx_tri * 3 + 2] = encoded_tangent; - if (dot < 0.0f) - { - wm->materials[idx_tri] |= MATERIAL_FLAG_HANDEDNESS; + vec3_t cross; + CrossProduct(normal, t, cross); + float dot = DotProduct(cross, tdir); + + if (dot < 0.0f) + { + wm->materials[idx_tri] |= MATERIAL_FLAG_HANDEDNESS; + } } float texel_density = 0.f; @@ -1805,6 +1878,8 @@ bsp_mesh_create_from_bsp(bsp_mesh_t *wm, bsp_t *bsp, const char* map_name) wm->num_indices = 0; wm->positions = Z_Malloc(MAX_VERT_BSP * 3 * sizeof(*wm->positions)); wm->tex_coords = Z_Malloc(MAX_VERT_BSP * 2 * sizeof(*wm->tex_coords)); + wm->normals = Z_Malloc(MAX_VERT_BSP * sizeof(uint32_t)); + wm->tangents = Z_Malloc(MAX_VERT_BSP * sizeof(uint32_t)); wm->materials = Z_Malloc(MAX_VERT_BSP / 3 * sizeof(*wm->materials)); wm->clusters = Z_Malloc(MAX_VERT_BSP / 3 * sizeof(*wm->clusters)); wm->emissive_factors = Z_Malloc(MAX_VERT_BSP / 3 * sizeof(*wm->emissive_factors)); @@ -1875,7 +1950,7 @@ bsp_mesh_create_from_bsp(bsp_mesh_t *wm, bsp_t *bsp, const char* map_name) for (int i = 0; i < wm->num_vertices; i++) wm->indices[i] = i; - compute_world_tangents(wm); + compute_world_tangents(bsp, wm); if (wm->num_vertices >= MAX_VERT_BSP) { Com_Error(ERR_FATAL, "The BSP model has too many vertices (%d)", wm->num_vertices); @@ -1928,7 +2003,8 @@ bsp_mesh_destroy(bsp_mesh_t *wm) Z_Free(wm->positions); Z_Free(wm->tex_coords); - Z_Free(wm->tangents); + Z_Free(wm->normals); + Z_Free(wm->tangents); Z_Free(wm->indices); Z_Free(wm->clusters); Z_Free(wm->materials); diff --git a/src/refresh/vkpt/shader/vertex_buffer.h b/src/refresh/vkpt/shader/vertex_buffer.h index dc79ad618..bfcde2151 100644 --- a/src/refresh/vkpt/shader/vertex_buffer.h +++ b/src/refresh/vkpt/shader/vertex_buffer.h @@ -62,7 +62,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #define BSP_VERTEX_BUFFER_LIST \ VERTEX_BUFFER_LIST_DO(float, 3, positions_bsp, (MAX_VERT_BSP )) \ VERTEX_BUFFER_LIST_DO(float, 2, tex_coords_bsp, (MAX_VERT_BSP )) \ - VERTEX_BUFFER_LIST_DO(uint32_t, 1, tangents_bsp, (MAX_VERT_BSP / 3 )) \ + VERTEX_BUFFER_LIST_DO(uint32_t, 1, normals_bsp, (MAX_VERT_BSP )) \ + VERTEX_BUFFER_LIST_DO(uint32_t, 1, tangents_bsp, (MAX_VERT_BSP )) \ VERTEX_BUFFER_LIST_DO(uint32_t, 1, materials_bsp, (MAX_VERT_BSP / 3 )) \ VERTEX_BUFFER_LIST_DO(uint32_t, 1, clusters_bsp, (MAX_VERT_BSP / 3 )) \ VERTEX_BUFFER_LIST_DO(float, 1, texel_density_bsp, (MAX_VERT_BSP / 3 )) \ @@ -435,23 +436,19 @@ get_bsp_triangle(uint prim_id) t.positions[2] = get_positions_bsp(prim_id * 3 + 2); t.positions_prev = t.positions; + + t.normals[0] = decode_normal(get_normals_bsp(prim_id * 3 + 0)); + t.normals[1] = decode_normal(get_normals_bsp(prim_id * 3 + 1)); + t.normals[2] = decode_normal(get_normals_bsp(prim_id * 3 + 2)); - vec3 normal = normalize(cross( - t.positions[1] - t.positions[0], - t.positions[2] - t.positions[0])); - - t.normals[0] = normal; - t.normals[1] = normal; - t.normals[2] = normal; + t.tangents[0] = decode_normal(get_tangents_bsp(prim_id * 3 + 0)); + t.tangents[1] = decode_normal(get_tangents_bsp(prim_id * 3 + 1)); + t.tangents[2] = decode_normal(get_tangents_bsp(prim_id * 3 + 2)); t.tex_coords[0] = get_tex_coords_bsp(prim_id * 3 + 0); t.tex_coords[1] = get_tex_coords_bsp(prim_id * 3 + 1); t.tex_coords[2] = get_tex_coords_bsp(prim_id * 3 + 2); - t.tangents[0] = decode_normal(get_tangents_bsp(prim_id)); - t.tangents[1] = t.tangents[0]; - t.tangents[2] = t.tangents[0]; - t.material_id = get_materials_bsp(prim_id); t.cluster = get_clusters_bsp(prim_id); diff --git a/src/refresh/vkpt/vertex_buffer.c b/src/refresh/vkpt/vertex_buffer.c index 4c6a438c2..41eaaa6e3 100644 --- a/src/refresh/vkpt/vertex_buffer.c +++ b/src/refresh/vkpt/vertex_buffer.c @@ -127,7 +127,8 @@ vkpt_vertex_buffer_upload_bsp_mesh_to_staging(bsp_mesh_t *bsp_mesh) memcpy(vbo->positions_bsp, bsp_mesh->positions, num_vertices * sizeof(float) * 3 ); memcpy(vbo->tex_coords_bsp, bsp_mesh->tex_coords,num_vertices * sizeof(float) * 2 ); - memcpy(vbo->tangents_bsp, bsp_mesh->tangents, num_vertices * sizeof(uint32_t) / 3); + memcpy(vbo->normals_bsp, bsp_mesh->normals, num_vertices * sizeof(uint32_t)); + memcpy(vbo->tangents_bsp, bsp_mesh->tangents, num_vertices * sizeof(uint32_t)); memcpy(vbo->materials_bsp, bsp_mesh->materials, num_vertices * sizeof(uint32_t) / 3); memcpy(vbo->emissive_factors_bsp, bsp_mesh->emissive_factors, num_vertices * sizeof(uint32_t) / 3); memcpy(vbo->clusters_bsp, bsp_mesh->clusters, num_vertices * sizeof(uint32_t) / 3); diff --git a/src/refresh/vkpt/vkpt.h b/src/refresh/vkpt/vkpt.h index c7b246db8..443da882b 100644 --- a/src/refresh/vkpt/vkpt.h +++ b/src/refresh/vkpt/vkpt.h @@ -365,6 +365,7 @@ typedef struct bsp_mesh_s { uint32_t world_custom_sky_count; float *positions, *tex_coords; + uint32_t* normals; uint32_t* tangents; int *indices; uint32_t *materials;