From f38aa5a41e508b7b3042ea854d1b04db3f267608 Mon Sep 17 00:00:00 2001 From: hunterk Date: Mon, 2 Nov 2020 10:08:10 -0600 Subject: [PATCH] update royale-kurozumi to latest --- presets/crt-royale-kurozumi.slangp | 366 ++++++++++++++--------------- 1 file changed, 177 insertions(+), 189 deletions(-) diff --git a/presets/crt-royale-kurozumi.slangp b/presets/crt-royale-kurozumi.slangp index df900b77..41a8479a 100755 --- a/presets/crt-royale-kurozumi.slangp +++ b/presets/crt-royale-kurozumi.slangp @@ -1,224 +1,186 @@ -# IMPORTANT: -# Shader passes need to know details about the image in the mask_texture LUT -# files, so set the following constants in user-cgp-constants.h accordingly: -# 1.) mask_triads_per_tile = (number of horizontal triads in mask texture LUT's) -# 2.) mask_texture_small_size = (texture size of mask*texture_small LUT's) -# 3.) mask_texture_large_size = (texture size of mask*texture_large LUT's) -# 4.) mask_grille_avg_color = (avg. brightness of mask_grille_texture* LUT's, in [0, 1]) -# 5.) mask_slot_avg_color = (avg. brightness of mask_slot_texture* LUT's, in [0, 1]) -# 6.) mask_shadow_avg_color = (avg. brightness of mask_shadow_texture* LUT's, in [0, 1]) -# Shader passes also need to know certain scales set in this .slangp, but their -# compilation model doesn't currently allow the .slangp file to tell them. Make -# sure to set the following constants in user-cgp-constants.h accordingly too: -# 1.) bloom_approx_scale_x = scale_x2 -# 2.) mask_resize_viewport_scale = float2(scale_x6, scale_y5) -# Finally, shader passes need to know the value of geom_max_aspect_ratio used to -# calculate scale_y6 (among other values): -# 1.) geom_max_aspect_ratio = (geom_max_aspect_ratio used to calculate scale_y5) - shaders = "13" - -# Set an identifier, filename, and sampling traits for the phosphor mask texture. -# Load an aperture grille, slot mask, and an EDP shadow mask, and load a small -# non-mipmapped version and a large mipmapped version. -# TODO: Test masks in other directories. -textures = "mask_grille_texture_small;mask_grille_texture_large;mask_slot_texture_small;mask_slot_texture_large;mask_shadow_texture_small;mask_shadow_texture_large;SamplerLUT1;SamplerLUT2" -mask_grille_texture_small = "../crt/shaders/crt-royale/TileableLinearApertureGrille15Wide8And5d5SpacingResizeTo64.png" -mask_grille_texture_large = "../crt/shaders/crt-royale/TileableLinearApertureGrille15Wide8And5d5Spacing.png" -mask_slot_texture_small = "../crt/shaders/crt-royale/TileableLinearSlotMaskTall15Wide9And4d5Horizontal9d14VerticalSpacingResizeTo64.png" -mask_slot_texture_large = "../crt/shaders/crt-royale/TileableLinearSlotMaskTall15Wide9And4d5Horizontal9d14VerticalSpacing.png" -mask_shadow_texture_small = "../crt/shaders/crt-royale/TileableLinearShadowMaskEDPResizeTo64.png" -mask_shadow_texture_large = "../crt/shaders/crt-royale/TileableLinearShadowMaskEDP.png" -mask_grille_texture_small_wrap_mode = "repeat" -mask_grille_texture_large_wrap_mode = "repeat" -mask_slot_texture_small_wrap_mode = "repeat" -mask_slot_texture_large_wrap_mode = "repeat" -mask_shadow_texture_small_wrap_mode = "repeat" -mask_shadow_texture_large_wrap_mode = "repeat" -mask_grille_texture_small_linear = "true" -mask_grille_texture_large_linear = "true" -mask_slot_texture_small_linear = "true" -mask_slot_texture_large_linear = "true" -mask_shadow_texture_small_linear = "true" -mask_shadow_texture_large_linear = "true" -mask_grille_texture_small_mipmap = "false" # Mipmapping causes artifacts with manually resized masks without tex2Dlod -mask_grille_texture_large_mipmap = "true" # Essential for hardware-resized masks -mask_slot_texture_small_mipmap = "false" # Mipmapping causes artifacts with manually resized masks without tex2Dlod -mask_slot_texture_large_mipmap = "true" # Essential for hardware-resized masks -mask_shadow_texture_small_mipmap = "false" # Mipmapping causes artifacts with manually resized masks without tex2Dlod -mask_shadow_texture_large_mipmap = "true" # Essential for hardware-resized masks -SamplerLUT1 = "../reshade/shaders/LUT/Kurozumi_64_D65_Rec601.png" -SamplerLUT1_linear = true -SamplerLUT2 = "../reshade/shaders/LUT/Kurozumi_64_D93_Rec601.png" -SamplerLUT2_linear = true - -# Pass0: LUT to correct screen colors. -# Digital Displays different color coordinates for primaries than CRTs (Rec709 vs Rec601). -shader0 = "../reshade/shaders/LUT/multiLUT.slang" - -# Pass1: Linearize the input based on CRT gamma and bob interlaced fields. -# (Bobbing ensures we can immediately blur without getting artifacts.) -shader1 = "../crt/shaders/crt-royale/src/crt-royale-first-pass-linearize-crt-gamma-bob-fields.slang" -alias1 = "ORIG_LINEARIZED" +shader0 = "shaders_slang/misc/grade.slang" +wrap_mode0 = "clamp_to_border" +mipmap_input0 = "false" +alias0 = "" +float_framebuffer0 = "false" +srgb_framebuffer0 = "false" +shader1 = "shaders_slang/crt/shaders/crt-royale/src/crt-royale-first-pass-linearize-crt-gamma-bob-fields.slang" filter_linear1 = "false" -scale_type1 = "source" -scale1 = "1.0" +wrap_mode1 = "clamp_to_border" +mipmap_input1 = "false" +alias1 = "ORIG_LINEARIZED" +float_framebuffer1 = "false" srgb_framebuffer1 = "true" - -# Pass2: Resample interlaced (and misconverged) scanlines vertically. -# Separating vertical/horizontal scanline sampling is faster: It lets us -# consider more scanlines while calculating weights for fewer pixels, and -# it reduces our samples from vertical*horizontal to vertical+horizontal. -# This has to come right after ORIG_LINEARIZED, because there's no -# "original_source" scale_type we can use later. -shader2 = "../crt/shaders/crt-royale/src/crt-royale-scanlines-vertical-interlacing.slang" -alias2 = "VERTICAL_SCANLINES" +scale_type_x1 = "source" +scale_x1 = "1.000000" +scale_type_y1 = "source" +scale_y1 = "1.000000" +shader2 = "shaders_slang/crt/shaders/crt-royale/src/crt-royale-scanlines-vertical-interlacing.slang" filter_linear2 = "true" -scale_type_x2 = "source" -scale_x2 = "1.0" -scale_type_y2 = "viewport" -scale_y2 = "1.0" -#float_framebuffer2 = "true" +wrap_mode2 = "clamp_to_border" +mipmap_input2 = "false" +alias2 = "VERTICAL_SCANLINES" +float_framebuffer2 = "false" srgb_framebuffer2 = "true" - -# Pass3: Do a small resize blur of ORIG_LINEARIZED at an absolute size, and -# account for convergence offsets. We want to blur a predictable portion of the -# screen to match the phosphor bloom, and absolute scale works best for -# reliable results with a fixed-size bloom. Picking a scale is tricky: -# a.) 400x300 is a good compromise for the "fake-bloom" version: It's low enough -# to blur high-res/interlaced sources but high enough that resampling -# doesn't smear low-res sources too much. -# b.) 320x240 works well for the "real bloom" version: It's 1-1.5% faster, and -# the only noticeable visual difference is a larger halation spread (which -# may be a good thing for people who like to crank it up). -# Note the 4:4 aspect ratio assumes the input has cropped geom_overscan (so it's -# *intended* for an ~4:4 aspect ratio). -shader3 = "../crt/shaders/crt-royale/src/crt-royale-bloom-approx.slang" -alias3 = "BLOOM_APPROX" +scale_type_x2 = "source" +scale_x2 = "1.000000" +scale_type_y2 = "viewport" +scale_y2 = "1.000000" +shader3 = "shaders_slang/crt/shaders/crt-royale/src/crt-royale-bloom-approx.slang" filter_linear3 = "true" -scale_type3 = "absolute" -scale_x3 = "320" -scale_y3 = "240" +wrap_mode3 = "clamp_to_border" +mipmap_input3 = "false" +alias3 = "BLOOM_APPROX" +float_framebuffer3 = "false" srgb_framebuffer3 = "true" - -# Pass4: Vertically blur the input for halation and refractive diffusion. -# Base this on BLOOM_APPROX: This blur should be small and fast, and blurring -# a constant portion of the screen is probably physically correct if the -# viewport resolution is proportional to the simulated CRT size. -shader4 = "../blurs/blur5fast-vertical.slang" +scale_type_x3 = "absolute" +scale_x3 = "320" +scale_type_y3 = "absolute" +scale_y3 = "240" +shader4 = "shaders_slang/blurs/blur5fast-vertical.slang" filter_linear4 = "true" -scale_type4 = "source" -scale4 = "1.0" +wrap_mode4 = "clamp_to_border" +mipmap_input4 = "false" +alias4 = "" +float_framebuffer4 = "false" srgb_framebuffer4 = "true" - -# Pass5: Horizontally blur the input for halation and refractive diffusion. -# Note: Using a one-pass 9x10 blur is about 1% slower. -shader5 = "../blurs/blur5fast-horizontal.slang" -alias5 = "HALATION_BLUR" +scale_type_x4 = "source" +scale_x4 = "1.000000" +scale_type_y4 = "source" +scale_y4 = "1.000000" +shader5 = "shaders_slang/blurs/blur5fast-horizontal.slang" filter_linear5 = "true" -scale_type5 = "source" -scale5 = "1.0" +wrap_mode5 = "clamp_to_border" +mipmap_input5 = "false" +alias5 = "HALATION_BLUR" +float_framebuffer5 = "false" srgb_framebuffer5 = "true" - -# Pass6: Lanczos-resize the phosphor mask vertically. Set the absolute -# scale_x5 == mask_texture_small_size.x (see IMPORTANT above). Larger scales -# will blur, and smaller scales could get nasty. The vertical size must be -# based on the viewport size and calculated carefully to avoid artifacts later. -# First calculate the minimum number of mask tiles we need to draw. -# Since curvature is computed after the scanline masking pass: -# num_resized_mask_tiles = 2.0; -# If curvature were computed in the scanline masking pass (it's not): -# max_mask_texel_border = ~3.0 * (1/3.0 + 4.0*sqrt(2.0) + 0.6 + 1.0); -# max_mask_tile_border = max_mask_texel_border/ -# (min_resized_phosphor_triad_size * mask_triads_per_tile); -# num_resized_mask_tiles = max(2.0, 1.0 + max_mask_tile_border * 2.0); -# At typical values (triad_size >= 2.0, mask_triads_per_tile == 8): -# num_resized_mask_tiles = ~3.8 -# Triad sizes are given in horizontal terms, so we need geom_max_aspect_ratio -# to relate them to vertical resolution. The widest we expect is: -# geom_max_aspect_ratio = 4.0/3.0 # Note: Shader passes need to know this! -# The fewer triads we tile across the screen, the larger each triad will be as a -# fraction of the viewport size, and the larger scale_y6 must be to draw a full -# num_resized_mask_tiles. Therefore, we must decide the smallest number of -# triads we'll guarantee can be displayed on screen. We'll set this according -# to 3-pixel triads at 768p resolution (the lowest anyone's likely to use): -# min_allowed_viewport_triads = 768.0*geom_max_aspect_ratio / 3.0 = 341.333333 -# Now calculate the viewport scale that ensures we can draw resized_mask_tiles: -# min_scale_x = resized_mask_tiles * mask_triads_per_tile / -# min_allowed_viewport_triads -# scale_y6 = geom_max_aspect_ratio * min_scale_x -# # Some code might depend on equal scales: -# scale_x7 = scale_y5 -# Given our default geom_max_aspect_ratio and min_allowed_viewport_triads: -# scale_y6 = 4.0/3.0 * 2.0/(341.33334 / 8.0) = 0.0625 -# IMPORTANT: The scales MUST be calculated in this way. If you wish to change -# geom_max_aspect_ratio, update that constant in user-cgp-constants.h! -shader6 = "../crt/shaders/crt-royale/src/crt-royale-mask-resize-vertical.slang" +scale_type_x5 = "source" +scale_x5 = "1.000000" +scale_type_y5 = "source" +scale_y5 = "1.000000" +shader6 = "shaders_slang/crt/shaders/crt-royale/src/crt-royale-mask-resize-vertical.slang" filter_linear6 = "true" +wrap_mode6 = "clamp_to_border" +mipmap_input6 = "false" +alias6 = "" +float_framebuffer6 = "false" +srgb_framebuffer6 = "false" scale_type_x6 = "absolute" scale_x6 = "64" scale_type_y6 = "viewport" -scale_y6 = "0.0625" # Safe for >= 341.334 horizontal triads at viewport size -#srgb_framebuffer6 = "false" # mask_texture is already assumed linear - -# Pass7: Lanczos-resize the phosphor mask horizontally. scale_x7 = scale_y5. -# TODO: Check again if the shaders actually require equal scales. -shader7 = "../crt/shaders/crt-royale/src/crt-royale-mask-resize-horizontal.slang" -alias7 = "MASK_RESIZE" +scale_y6 = "0.062500" +shader7 = "shaders_slang/crt/shaders/crt-royale/src/crt-royale-mask-resize-horizontal.slang" filter_linear7 = "false" +wrap_mode7 = "clamp_to_border" +mipmap_input7 = "false" +alias7 = "MASK_RESIZE" +float_framebuffer7 = "false" +srgb_framebuffer7 = "false" scale_type_x7 = "viewport" -scale_x7 = "0.0625" +scale_x7 = "0.062500" scale_type_y7 = "source" -scale_y7 = "1.0" -#srgb_framebuffer7 = "false" # mask_texture is already assumed linear - -# Pass8: Resample (misconverged) scanlines horizontally, apply halation, and -# apply the phosphor mask. -shader8 = "../crt/shaders/crt-royale/src/crt-royale-scanlines-horizontal-apply-mask.slang" +scale_y7 = "1.000000" +shader8 = "shaders_slang/crt/shaders/crt-royale/src/crt-royale-scanlines-horizontal-apply-mask.slang" +filter_linear8 = "true" +wrap_mode8 = "clamp_to_border" +mipmap_input8 = "false" alias8 = "MASKED_SCANLINES" -filter_linear8 = "true" # This could just as easily be nearest neighbor. -scale_type8 = "viewport" -scale8 = "1.0" -#float_framebuffer8 = "true" +float_framebuffer8 = "false" srgb_framebuffer8 = "true" - -# Pass 9: Compute a brightpass. This will require reading the final mask. -shader9 = "../crt/shaders/crt-royale/src/crt-royale-brightpass.slang" +scale_type_x8 = "viewport" +scale_x8 = "1.000000" +scale_type_y8 = "viewport" +scale_y8 = "1.000000" +shader9 = "shaders_slang/crt/shaders/crt-royale/src/crt-royale-brightpass.slang" +filter_linear9 = "true" +wrap_mode9 = "clamp_to_border" +mipmap_input9 = "false" alias9 = "BRIGHTPASS" -filter_linear9 = "true" # This could just as easily be nearest neighbor. -scale_type9 = "viewport" -scale9 = "1.0" +float_framebuffer9 = "false" srgb_framebuffer9 = "true" - -# Pass 10: Blur the brightpass vertically -shader10 = "../crt/shaders/crt-royale/src/crt-royale-bloom-vertical.slang" -filter_linear10 = "true" # This could just as easily be nearest neighbor. -scale_type10 = "source" -scale10 = "1.0" +scale_type_x9 = "viewport" +scale_x9 = "1.000000" +scale_type_y9 = "viewport" +scale_y9 = "1.000000" +shader10 = "shaders_slang/crt/shaders/crt-royale/src/crt-royale-bloom-vertical.slang" +filter_linear10 = "true" +wrap_mode10 = "clamp_to_border" +mipmap_input10 = "false" +alias10 = "" +float_framebuffer10 = "false" srgb_framebuffer10 = "true" - -# Pass 11: Blur the brightpass horizontally and combine it with the dimpass: -shader11 = "../crt/shaders/crt-royale/src/crt-royale-bloom-horizontal-reconstitute.slang" +scale_type_x10 = "source" +scale_x10 = "1.000000" +scale_type_y10 = "source" +scale_y10 = "1.000000" +shader11 = "shaders_slang/crt/shaders/crt-royale/src/crt-royale-bloom-horizontal-reconstitute.slang" filter_linear11 = "true" -scale_type11 = "source" -scale11 = "1.0" +wrap_mode11 = "clamp_to_border" +mipmap_input11 = "false" +alias11 = "" +float_framebuffer11 = "false" srgb_framebuffer11 = "true" - -# Pass 12: Compute curvature/AA: -shader12 = "../crt/shaders/crt-royale/src/crt-royale-geometry-aa-last-pass.slang" +scale_type_x11 = "source" +scale_x11 = "1.000000" +scale_type_y11 = "source" +scale_y11 = "1.000000" +shader12 = "shaders_slang/crt/shaders/crt-royale/src/crt-royale-geometry-aa-last-pass.slang" filter_linear12 = "true" -scale_type12 = "viewport" +wrap_mode12 = "clamp_to_border" mipmap_input12 = "true" -texture_wrap_mode12 = "clamp_to_edge" - -parameters = "crt_gamma;lcd_gamma;levels_contrast;halation_weight;diffusion_weight;bloom_underestimate_levels;bloom_excess;beam_min_sigma;beam_max_sigma;beam_spot_power;beam_min_shape;beam_max_shape;beam_shape_power;beam_horiz_filter;beam_horiz_sigma;beam_horiz_linear_rgb_weight;convergence_offset_x_r;convergence_offset_x_g;convergence_offset_x_b;convergence_offset_y_r;convergence_offset_y_g;convergence_offset_y_b;mask_type;mask_sample_mode_desired;mask_specify_num_triads;mask_triad_size_desired;mask_num_triads_desired;aa_subpixel_r_offset_x_runtime;aa_subpixel_r_offset_y_runtime;aa_cubic_c;aa_gauss_sigma;geom_mode_runtime;geom_radius;geom_view_dist;geom_tilt_angle_x;geom_tilt_angle_y;geom_aspect_ratio_x;geom_aspect_ratio_y;geom_overscan_x;geom_overscan_y;border_size;border_darkness;border_compress;interlace_bff;interlace_1080i" +alias12 = "" +float_framebuffer12 = "false" +srgb_framebuffer12 = "false" +scale_type_x12 = "viewport" +scale_x12 = "1.000000" +scale_type_y12 = "viewport" +scale_y12 = "1.000000" +parameters = "g_gamma_in;g_signal_type;g_gamma_type;g_crtgamut;g_space_out;g_hue_degrees;g_I_SHIFT;g_Q_SHIFT;g_I_MUL;g_Q_MUL;g_lum_fix;g_vignette;g_vstr;g_vpower;g_lum;g_cntrst;g_mid;wp_temperature;g_sat;g_vibr;g_satr;g_satg;g_satb;g_lift;blr;blg;blb;wlr;wlg;wlb;rg;rb;gr;gb;br;bg;LUT_Size1;LUT1_toggle;LUT_Size2;LUT2_toggle;crt_gamma;lcd_gamma;levels_contrast;halation_weight;diffusion_weight;bloom_underestimate_levels;bloom_excess;beam_min_sigma;beam_max_sigma;beam_spot_power;beam_min_shape;beam_max_shape;beam_shape_power;beam_horiz_filter;beam_horiz_sigma;beam_horiz_linear_rgb_weight;convergence_offset_x_r;convergence_offset_x_g;convergence_offset_x_b;convergence_offset_y_r;convergence_offset_y_g;convergence_offset_y_b;mask_type;mask_sample_mode_desired;mask_specify_num_triads;mask_triad_size_desired;mask_num_triads_desired;aa_subpixel_r_offset_x_runtime;aa_subpixel_r_offset_y_runtime;aa_cubic_c;aa_gauss_sigma;geom_mode_runtime;geom_radius;geom_view_dist;geom_tilt_angle_x;geom_tilt_angle_y;geom_aspect_ratio_x;geom_aspect_ratio_y;geom_overscan_x;geom_overscan_y;border_size;border_darkness;border_compress;interlace_detect_toggle;interlace_bff;interlace_1080i" +g_gamma_in = "2.400000" +g_signal_type = "0.000000" +g_gamma_type = "1.000000" +g_crtgamut = "1.000000" +g_space_out = "-1.000000" +g_hue_degrees = "0.000000" +g_I_SHIFT = "0.000000" +g_Q_SHIFT = "0.000000" +g_I_MUL = "1.000000" +g_Q_MUL = "1.000000" +g_lum_fix = "0.000000" +g_vignette = "0.000000" +g_vstr = "40.000000" +g_vpower = "0.200000" +g_lum = "0.000000" +g_cntrst = "0.000000" +g_mid = "0.500000" +wp_temperature = "6504.000000" +g_sat = "0.000000" +g_vibr = "0.000000" +g_satr = "0.000000" +g_satg = "0.000000" +g_satb = "0.000000" +g_lift = "0.000000" +blr = "0.000000" +blg = "0.000000" +blb = "0.000000" +wlr = "1.000000" +wlg = "1.000000" +wlb = "1.000000" +rg = "0.000000" +rb = "0.000000" +gr = "0.000000" +gb = "0.000000" +br = "0.000000" +bg = "0.000000" crt_gamma = "2.400000" lcd_gamma = "2.400000" levels_contrast = "0.670000" halation_weight = "0.003700" diffusion_weight = "0.001100" -bloom_underestimate_levels = "0.650000" -bloom_excess = "0.020000" +bloom_underestimate_levels = "0.680000" +bloom_excess = "0.000000" beam_min_sigma = "0.020000" beam_max_sigma = "0.160000" beam_spot_power = "0.380000" @@ -255,5 +217,31 @@ geom_overscan_y = "1.000000" border_size = "0.005000" border_darkness = "0.000000" border_compress = "2.500000" +interlace_detect_toggle = "1.000000" interlace_bff = "0.000000" interlace_1080i = "0.000000" +textures = "mask_grille_texture_small;mask_grille_texture_large;mask_slot_texture_small;mask_slot_texture_large;mask_shadow_texture_small;mask_shadow_texture_large" +mask_grille_texture_small = "shaders_slang/crt/shaders/crt-royale/TileableLinearApertureGrille15Wide8And5d5SpacingResizeTo64.png" +mask_grille_texture_small_linear = "true" +mask_grille_texture_small_wrap_mode = "repeat" +mask_grille_texture_small_mipmap = "false" +mask_grille_texture_large = "shaders_slang/crt/shaders/crt-royale/TileableLinearApertureGrille15Wide8And5d5Spacing.png" +mask_grille_texture_large_linear = "true" +mask_grille_texture_large_wrap_mode = "repeat" +mask_grille_texture_large_mipmap = "true" +mask_slot_texture_small = "shaders_slang/crt/shaders/crt-royale/TileableLinearSlotMaskTall15Wide9And4d5Horizontal9d14VerticalSpacingResizeTo64.png" +mask_slot_texture_small_linear = "true" +mask_slot_texture_small_wrap_mode = "repeat" +mask_slot_texture_small_mipmap = "false" +mask_slot_texture_large = "shaders_slang/crt/shaders/crt-royale/TileableLinearSlotMaskTall15Wide9And4d5Horizontal9d14VerticalSpacing.png" +mask_slot_texture_large_linear = "true" +mask_slot_texture_large_wrap_mode = "repeat" +mask_slot_texture_large_mipmap = "true" +mask_shadow_texture_small = "shaders_slang/crt/shaders/crt-royale/TileableLinearShadowMaskEDPResizeTo64.png" +mask_shadow_texture_small_linear = "true" +mask_shadow_texture_small_wrap_mode = "repeat" +mask_shadow_texture_small_mipmap = "false" +mask_shadow_texture_large = "shaders_slang/crt/shaders/crt-royale/TileableLinearShadowMaskEDP.png" +mask_shadow_texture_large_linear = "true" +mask_shadow_texture_large_wrap_mode = "repeat" +mask_shadow_texture_large_mipmap = "true"