Adjust light map rendering to allow for over-exposure

This commit is contained in:
MysterD 2023-06-09 21:18:49 -07:00
parent d2644e6640
commit c2a40b1564
2 changed files with 20 additions and 15 deletions

View file

@ -274,6 +274,7 @@ void gfx_direct3d_common_build_shader(char buf[4096], size_t& len, size_t& num_f
} else { } else {
append_line(buf, &len, " float4 texVal1 = g_texture1.Sample(g_sampler1, input.lightmap);"); append_line(buf, &len, " float4 texVal1 = g_texture1.Sample(g_sampler1, input.lightmap);");
} }
append_line(buf, &len, " texVal1.rgb = texVal1.rgb * texVal1.rgb + texVal1.rgb;");
} else { } else {
if (three_point_filtering) { if (three_point_filtering) {
append_line(buf, &len, " float4 texVal1;"); append_line(buf, &len, " float4 texVal1;");

View file

@ -383,22 +383,26 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(struct ColorC
} }
} }
append_str(fs_buf, &fs_len, (opt_alpha) ? "vec4 texel = " : "vec3 texel = "); if (opt_light_map) {
for (int i = 0; i < (opt_2cycle + 1); i++) { append_str(fs_buf, &fs_len, "vec3 texel = texVal0.rgb * (texVal1.rgb * texVal1.rgb + texVal1.rgb);\n");
u8* cmd = &cc->shader_commands[i * 8]; } else {
if (!ccf.color_alpha_same[i] && opt_alpha) { append_str(fs_buf, &fs_len, (opt_alpha) ? "vec4 texel = " : "vec3 texel = ");
append_str(fs_buf, &fs_len, "vec4("); for (int i = 0; i < (opt_2cycle + 1); i++) {
append_formula(fs_buf, &fs_len, cmd, ccf.do_single[i*2+0], ccf.do_multiply[i*2+0], ccf.do_mix[i*2+0], false, false, true); u8* cmd = &cc->shader_commands[i * 8];
append_str(fs_buf, &fs_len, ", "); if (!ccf.color_alpha_same[i] && opt_alpha) {
append_formula(fs_buf, &fs_len, cmd, ccf.do_single[i*2+1], ccf.do_multiply[i*2+1], ccf.do_mix[i*2+1], true, true, true); append_str(fs_buf, &fs_len, "vec4(");
append_str(fs_buf, &fs_len, ")"); append_formula(fs_buf, &fs_len, cmd, ccf.do_single[i*2+0], ccf.do_multiply[i*2+0], ccf.do_mix[i*2+0], false, false, true);
} else { append_str(fs_buf, &fs_len, ", ");
append_formula(fs_buf, &fs_len, cmd, ccf.do_single[i*2+0], ccf.do_multiply[i*2+0], ccf.do_mix[i*2+0], opt_alpha, false, opt_alpha); append_formula(fs_buf, &fs_len, cmd, ccf.do_single[i*2+1], ccf.do_multiply[i*2+1], ccf.do_mix[i*2+1], true, true, true);
} append_str(fs_buf, &fs_len, ")");
append_line(fs_buf, &fs_len, ";"); } else {
append_formula(fs_buf, &fs_len, cmd, ccf.do_single[i*2+0], ccf.do_multiply[i*2+0], ccf.do_mix[i*2+0], opt_alpha, false, opt_alpha);
}
append_line(fs_buf, &fs_len, ";");
if (i == 0 && opt_2cycle) { if (i == 0 && opt_2cycle) {
append_str(fs_buf, &fs_len, "texel = "); append_str(fs_buf, &fs_len, "texel = ");
}
} }
} }