RetroArch-Wii-U-Slang-Shaders/crt/crt-royale-fake-bloom-intel.slangp
2020-04-26 18:03:54 -05:00

135 lines
6.8 KiB
Text

# 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_for_fake = 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_y5 (among other values):
# 1.) geom_max_aspect_ratio = (geom_max_aspect_ratio used to calculate scale_y5)
shaders = "7"
# 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"
mask_grille_texture_small = "shaders/crt-royale/TileableLinearApertureGrille15Wide8And5d5SpacingResizeTo64.png"
mask_grille_texture_large = "shaders/crt-royale/TileableLinearApertureGrille15Wide8And5d5Spacing.png"
mask_slot_texture_small = "shaders/crt-royale/TileableLinearSlotMaskTall15Wide9And4d5Horizontal9d14VerticalSpacingResizeTo64.png"
mask_slot_texture_large = "shaders/crt-royale/TileableLinearSlotMaskTall15Wide9And4d5Horizontal9d14VerticalSpacing.png"
mask_shadow_texture_small = "shaders/crt-royale/TileableLinearShadowMaskEDPResizeTo64.png"
mask_shadow_texture_large = "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
# Pass0: Linearize the input based on CRT gamma and bob interlaced fields.
# (Bobbing ensures we can immediately blur without getting artifacts.)
shader0 = "shaders/crt-royale/src/crt-royale-first-pass-linearize-crt-gamma-bob-fields.slang"
alias0 = "ORIG_LINEARIZED"
filter_linear0 = "false"
scale_type0 = "source"
scale0 = "1.0"
srgb_framebuffer0 = "true"
# Pass1: 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.
shader1 = "shaders/crt-royale/src/crt-royale-scanlines-vertical-interlacing.slang"
alias1 = "VERTICAL_SCANLINES"
filter_linear1 = "true"
scale_type_x1 = "source"
scale_x1 = "1.0"
scale_type_y1 = "viewport"
scale_y1 = "1.0"
#float_framebuffer1 = "true"
srgb_framebuffer1 = "true"
# Pass2: 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:3 aspect ratio assumes the input has cropped geom_overscan (so it's
# *intended* for an ~4:3 aspect ratio).
shader2 = "shaders/crt-royale/src/crt-royale-bloom-approx-fake-bloom-intel.slang"
alias2 = "BLOOM_APPROX"
filter_linear2 = "true"
scale_type2 = "absolute"
scale_x2 = "400"
scale_y2 = "300"
srgb_framebuffer2 = "true"
# Pass3: 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.
shader3 = "../blurs/blur9fast-vertical.slang"
filter_linear3 = "true"
scale_type3 = "source"
scale3 = "1.0"
srgb_framebuffer3 = "true"
# Pass4: Horizontally blur the input for halation and refractive diffusion.
# Note: Using a one-pass 9x9 blur is about 1% slower.
shader4 = "../blurs/blur9fast-horizontal.slang"
alias4 = "HALATION_BLUR"
filter_linear4 = "true"
scale_type4 = "source"
scale4 = "1.0"
srgb_framebuffer4 = "true"
# Pass5: Resample (misconverged) scanlines horizontally, apply halation, and
# apply the phosphor mask, then fake a phosphor bloom, all in one pass.
shader5 = "shaders/crt-royale/src/crt-royale-scanlines-horizontal-apply-mask-fake-bloom-intel.slang"
alias5 = "MASKED_SCANLINES"
filter_linear5 = "true" # This could just as easily be nearest neighbor.
scale_type5 = "viewport"
scale5 = "1.0"
#float_framebuffer5 = "true"
srgb_framebuffer5 = "true"
# Pass 6: Compute curvature/AA:
shader6 = "shaders/crt-royale/src/crt-royale-geometry-aa-last-pass-intel.slang"
filter_linear6 = "true"
scale_type6 = "viewport"
mipmap_input6 = "true"
texture_wrap_mode6 = "clamp_to_edge"