- Afegits un montó de shaders, pa provar

- Al executable hi ha que passar-li els shaders per linea de comandos
This commit is contained in:
2024-06-27 13:58:50 +02:00
parent 6afca2f2a6
commit 37a9e981a5
75 changed files with 2923 additions and 1 deletions

BIN
crt.zip Normal file

Binary file not shown.

10
crt/CRT-beam.glslp Normal file
View File

@@ -0,0 +1,10 @@
shaders = "1"
feedback_pass = "0"
shader0 = "shaders/CRT-Beam.glsl"
filter_linear0 = "true"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = ""
float_framebuffer0 = "false"
srgb_framebuffer0 = "false"

18
crt/GritsScanlines.glslp Normal file
View File

@@ -0,0 +1,18 @@
shaders = 2
shader0 = shaders/GritsScanlines/GritsScanlines.glsl
filter_linear0 = true
scale_type0 = source
scale_x0 = 1.0
scale_y0 = 4.0
shader1 = ../stock.glsl
filter_linear1 = true
textures = "scanlines_LUT;color_LUT;luminance_LUT"
scanlines_LUT = shaders/GritsScanlines/Scanline-LUT-4px.png
scanlines_LUT_linear = false
color_LUT = ../reshade/shaders/LUT/sony_trinitron_std_50.png
color_LUT_linear = true
luminance_LUT = shaders/GritsScanlines/Fake-Self-Illumination.png
luminance_LUT_linear = true

8
crt/crt-1tap.glslp Normal file
View File

@@ -0,0 +1,8 @@
shaders = "1"
shader0 = "shaders/crt-1tap.glsl"
filter_linear0 = "true"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = ""
float_framebuffer0 = "true"
srgb_framebuffer0 = "false"

8
crt/crt-Cyclon.glslp Normal file
View File

@@ -0,0 +1,8 @@
shaders = "1"
shader0 = "shaders/crt-Cyclon.glsl"
filter_linear0 = "true"
textures = bezel
bezel = "shaders/crt-consumer/bezel.png"
bezel_linear = true
bezel_wrap_mode = "clamp_to_edge"

4
crt/crt-aperture.glslp Normal file
View File

@@ -0,0 +1,4 @@
shaders = 1
shader0 = shaders/crt-aperture.glsl
filter_linear0 = false

25
crt/crt-blurPi-soft.glslp Normal file
View File

@@ -0,0 +1,25 @@
# crt-blurPi slang shader #
#
# Looks good on low res screens (640 x 480 or less), providing screen space scanlines.
# Works great for anbernic handheld devices.
# Use the "soft" variant if you are not using integer scaling
# Made by Oriol Ferrer Mesià (armadillu)
# http://uri.cat
# MIT license
shaders = 2
shader0 = shaders/crt-blurPi.glsl
filter_linear0 = true
scale_type0 = source
scale0 = 1.0
shader1 = shaders/crt-blurPiScanlines.glsl
filter_linear1 = true
scale_type1 = viewport
scale_x1 = 1.0
scale_y1 = 1.0
blurGain = "0.20"
blurRadius = "0.50"

25
crt/crt-blurPi.glslp Normal file
View File

@@ -0,0 +1,25 @@
# crt-blurPi slang shader #
#
# Looks good on low res screens (640 x 480 or less), providing screen space scanlines.
# Works great for anbernic handheld devices.
# Use the "soft" variant if you are not using integer scaling
# Made by Oriol Ferrer Mesià (armadillu)
# http://uri.cat
# MIT license
shaders = 2
shader0 = shaders/crt-blurPi.glsl
filter_linear0 = true
scale_type0 = source
scale0 = 1.0
shader1 = shaders/crt-blurPiScanlines.glsl
filter_linear1 = false
scale_type1 = viewport
scale_x1 = 1.0
scale_y1 = 1.0
blurGain = "0.20"
blurRadius = "0.50"

4
crt/crt-caligari.glslp Normal file
View File

@@ -0,0 +1,4 @@
shaders = 1
shader0 = shaders/crt-caligari.glsl
filter_linear0 = false

4
crt/crt-cgwg-fast.glslp Normal file
View File

@@ -0,0 +1,4 @@
shaders = 1
shader0 = shaders/crt-cgwg-fast.glsl
filter_linear0 = false

13
crt/crt-consumer.glslp Normal file
View File

@@ -0,0 +1,13 @@
shaders = "5"
feedback_pass = "0"
shader0 = "../misc/shaders/convergence.glsl"
filter_linear0 = "true"
shader1 = "../crt/shaders/crt-consumer/linearize.glsl"
filter_linear1 = "false"
shader2 = "../crt/shaders/crt-consumer/glow_x.glsl"
filter_linear2 = "true"
shader3 = "../crt/shaders/crt-consumer/glow_y.glsl"
filter_linear3 = "true"
shader4 = "../crt/shaders/crt-consumer/crt-consumer.glsl"
filter_linear4 = "true"

View File

@@ -0,0 +1,37 @@
shaders = "5"
shader0 = "shaders/crt-easymode-halation/linearize.glsl"
filter_linear0 = "false"
srgb_framebuffer0 = "true"
scale_type_x0 = "source"
scale_x0 = "1.000000"
scale_type_y0 = "source"
scale_y0 = "1.000000"
shader1 = "shaders/crt-easymode-halation/blur_horiz.glsl"
filter_linear1 = "false"
srgb_framebuffer1 = "true"
scale_type_x1 = "source"
scale_x1 = "1.000000"
scale_type_y1 = "source"
scale_y1 = "1.000000"
shader2 = "shaders/crt-easymode-halation/blur_vert.glsl"
filter_linear2 = "false"
srgb_framebuffer2 = "true"
scale_type_x2 = "source"
scale_x2 = "1.000000"
scale_type_y2 = "source"
scale_y2 = "1.000000"
shader3 = "shaders/crt-easymode-halation/threshold.glsl"
filter_linear3 = "false"
srgb_framebuffer3 = "true"
scale_type_x3 = "source"
scale_x3 = "1.000000"
scale_type_y3 = "source"
scale_y3 = "1.000000"
shader4 = "shaders/crt-easymode-halation/crt-easymode-halation.glsl"
filter_linear4 = "true"

4
crt/crt-easymode.glslp Normal file
View File

@@ -0,0 +1,4 @@
shaders = 1
shader0 = shaders/crt-easymode.glsl
filter_linear0 = false

4
crt/crt-gdv-mini.glslp Normal file
View File

@@ -0,0 +1,4 @@
shaders = "1"
feedback_pass = "0"
shader0 = shaders/crt-gdv-mini.glsl
filter_linear0 = "true"

3
crt/crt-geom-mini.glslp Normal file
View File

@@ -0,0 +1,3 @@
shaders = 1
shader0 = shaders/crt-geom-mini.glsl
filter_linear0 = true

4
crt/crt-geom.glslp Normal file
View File

@@ -0,0 +1,4 @@
shaders = 1
shader0 = shaders/crt-geom.glsl
filter_linear0 = false

View File

@@ -0,0 +1,39 @@
shaders = 5
shader0 = shaders/guest/lut/lut.glsl
filter_linear0 = false
scale_type0 = source
scale0 = 1.0
textures = "SamplerLUT1;SamplerLUT2;SamplerLUT3"
SamplerLUT1 = shaders/guest/lut/sony_trinitron1.png
SamplerLUT1_linear = true
SamplerLUT2 = shaders/guest/lut/sony_trinitron2.png
SamplerLUT2_linear = true
SamplerLUT3 = shaders/guest/lut/other1.png
SamplerLUT3_linear = true
shader1 = shaders/guest/fast/smoothing.glsl
filter_linear1 = false
scale_type1 = source
scale1 = 1.0
shader2 = shaders/guest/fast/linearize-multipass.glsl
filter_linear2 = false
scale_type2 = source
scale2 = 1.0
float_framebuffer2 = true
shader3 = shaders/guest/fast/crt-guest-dr-venom-pass1.glsl
filter_linear3 = false
scale_type_x3 = viewport
scale_x3 = 1.0
scale_type_y3 = source
scale_y3 = 1.0
float_framebuffer3 = true
shader4 = shaders/guest/fast/crt-guest-dr-venom-pass2.glsl
filter_linear4 = false
scale_type4 = viewport
scale_x4 = 1.0
scale_y4 = 1.0

View File

@@ -0,0 +1,70 @@
shaders = 11
shader0 = shaders/guest/lut/lut.glsl
filter_linear0 = false
scale_type0 = source
scale0 = 1.0
textures = "SamplerLUT1;SamplerLUT2;SamplerLUT3"
SamplerLUT1 = shaders/guest/lut/sony_trinitron1.png
SamplerLUT1_linear = true
SamplerLUT2 = shaders/guest/lut/sony_trinitron2.png
SamplerLUT2_linear = true
SamplerLUT3 = shaders/guest/lut/other1.png
SamplerLUT3_linear = true
shader1 = shaders/guest/color-profiles.glsl
filter_linear1 = false
scale_type1 = source
scale1 = 1.0
shader2 = shaders/guest/d65-d50.glsl
filter_linear2 = false
scale_type2 = source
scale2 = 1.0
shader3 = shaders/guest/afterglow.glsl
filter_linear3 = false
scale_type3 = source
scale3 = 1.0
shader4 = shaders/guest/avg-lum0.glsl
filter_linear4 = false
scale_type4 = source
scale4 = 1.0
shader5 = shaders/guest/avg-lum.glsl
filter_linear5 = false
scale_type5 = source
scale5 = 1.0
mipmap_input5 = true
shader6 = shaders/guest/linearize.glsl
filter_linear6 = false
scale_type6 = source
scale6 = 1.0
float_framebuffer6 = true
shader7 = shaders/guest/blur_horiz.glsl
filter_linear7 = false
scale_type7 = source
scale7 = 1.0
float_framebuffer7 = true
shader8 = shaders/guest/blur_vert.glsl
filter_linear8 = false
scale_type8 = source
scale8 = 1.0
float_framebuffer8 = true
shader9 = shaders/guest/linearize_scanlines.glsl
filter_linear9 = true
scale_type9 = source
scale9 = 1.0
float_framebuffer9 = true
shader10 = shaders/guest/crt-guest-dr-venom.glsl
filter_linear10 = true
scale_type10 = viewport
scale_x10 = 1.0
scale_y10 = 1.0

8
crt/crt-guest-sm.glslp Normal file
View File

@@ -0,0 +1,8 @@
shaders = 2
shader0 = shaders/guest/d65-d50.glsl
filter_linear0 = false
scale_type0 = source
scale0 = 1.0
shader1 = shaders/guest/crt-guest-sm.glsl

5
crt/crt-hyllian-3d.glslp Normal file
View File

@@ -0,0 +1,5 @@
shaders = 1
shader0 = shaders/hyllian/crt-hyllian-3d.glsl
filter_linear0 = true
srgb_framebuffer0 = true

View File

@@ -0,0 +1,9 @@
shaders = "1"
feedback_pass = "0"
shader0 = shaders/hyllian/crt-hyllian-fast.glsl
filter_linear0 = "false"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = ""
float_framebuffer0 = "false"
srgb_framebuffer0 = "false"

View File

@@ -0,0 +1,30 @@
shaders = 6
shader0 = shaders/glow/linearize.glsl
filter_linear0 = false
srgb_framebuffer0 = true
shader1 = shaders/hyllian/crt-hyllian-glow/crt-hyllian-glow.glsl
filter_linear1 = false
scale_type1 = viewport
scale1 = 1.0
srgb_framebuffer1 = true
alias1 = CRT_PASS
shader2 = shaders/glow/threshold.glsl
filter_linear2 = false
srgb_framebuffer2 = true
shader3 = shaders/glow/blur_horiz.glsl
mipmap_input3 = true
filter_linear3 = true
scale_type3 = source
scale3 = 0.25
srgb_framebuffer3 = true
shader4 = shaders/glow/blur_vert.glsl
filter_linear4 = true
srgb_framebuffer4 = true
shader5 = shaders/hyllian/crt-hyllian-glow/resolve2.glsl
filter_linear5 = true

View File

@@ -0,0 +1,13 @@
shaders = 2
shader0 = shaders/hyllian/crt-hyllian-multipass/crt-hyllian-pass0.glsl
filter_linear0 = false
srgb_framebuffer0 = true
scale_type_x0 = viewport
scale_type_y0 = source
scale_x0 = 1.0
scale_y0 = 1.0
shader1 = shaders/hyllian/crt-hyllian-multipass/crt-hyllian-pass1.glsl
filter_linear1 = false
srgb_framebuffer1 = false

5
crt/crt-hyllian.glslp Normal file
View File

@@ -0,0 +1,5 @@
shaders = 1
shader0 = shaders/hyllian/crt-hyllian.glsl
filter_linear0 = false
srgb_framebuffer0 = true

View File

@@ -0,0 +1,27 @@
shaders = "4"
shader0 = shaders/crt-interlaced-halation/crt-interlaced-halation-pass0.glsl
filter_linear0 = "true"
float_framebuffer0 = "false"
scale_type_x0 = "source"
scale_x0 = "1.000000"
scale_type_y0 = "source"
scale_y0 = "1.000000"
shader1 = shaders/crt-interlaced-halation/crt-interlaced-halation-pass1.glsl
filter_linear1 = "true"
float_framebuffer1 = "false"
scale_type_x1 = "source"
scale_x1 = "1.000000"
scale_type_y1 = "source"
scale_y1 = "1.000000"
shader2 = shaders/crt-interlaced-halation/crt-interlaced-halation-pass2.glsl
filter_linear2 = "true"
float_framebuffer2 = "false"
scale_type_x2 = "source"
scale_x2 = "3.000000"
scale_type_y2 = "source"
scale_y2 = "3.000000"
shader3 = ../interpolation/shaders/quilez.glsl
filter_linear3 = "true"
float_framebuffer3 = "false"

View File

@@ -0,0 +1,4 @@
shaders = 1
shader0 = shaders/crt-lottes-fast.glsl
filter_linear0 = true

11
crt/crt-lottes-mini.glslp Normal file
View File

@@ -0,0 +1,11 @@
shaders = "2"
feedback_pass = "0"
shader0 = "shaders/crt-consumer/linearize.glsl"
filter_linear0 = "false"
scale_type_x0 = "source"
scale_x0 = "1.000000"
scale_type_y0 = "source"
scale_y0 = "1.000000"
shader1 = "shaders/crt-lottes-mini.glsl"
filter_linear1 = "true"
g_in = 2.2

View File

@@ -0,0 +1,8 @@
shaders = 2
shader0 = shaders/crt-lottes-multipass/bloompass.glsl
alias0 = BloomPass
#doesn't work in GL_ES anyway, AFAICT
srgb_framebuffer0 = true
shader1 = shaders/crt-lottes-multipass/scanpass.glsl

4
crt/crt-lottes.glslp Normal file
View File

@@ -0,0 +1,4 @@
shaders = 1
shader0 = shaders/crt-lottes.glsl
filter_linear0 = false

4
crt/crt-mattias.glslp Normal file
View File

@@ -0,0 +1,4 @@
shaders = 1
shader0 = shaders/crt-mattias.glsl
filter_linear0 = false

3
crt/crt-nes-mini.glslp Normal file
View File

@@ -0,0 +1,3 @@
shaders = 1
shader0 = shaders/crt-nes-mini.glsl

4
crt/crt-nobody.glslp Normal file
View File

@@ -0,0 +1,4 @@
shaders = 1
shader0 = shaders/crt-nobody.glsl
filter_linear0 = false

View File

@@ -0,0 +1,8 @@
shaders = "1"
shader0 = "shaders/crt-pi-vertical.glsl"
filter_linear0 = "true"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = ""
float_framebuffer0 = "false"
srgb_framebuffer0 = "false"

8
crt/crt-pi.glslp Normal file
View File

@@ -0,0 +1,8 @@
shaders = "1"
shader0 = "shaders/crt-pi.glsl"
filter_linear0 = "true"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = ""
float_framebuffer0 = "false"
srgb_framebuffer0 = "false"

12
crt/crt-potato-BVM.glslp Normal file
View File

@@ -0,0 +1,12 @@
shaders = 1
shader0 = shaders/crt-potato/shader-files/ultra-potato.glsl
filter_linear0 = false
scale_type0 = viewport
scale0 = 1.0
alias0 = "PASS0"
textures = MASK
MASK = shaders/crt-potato/resources/mask1.png
MASK_linear = false
MASK_wrap_mode = "repeat"

12
crt/crt-potato-cool.glslp Normal file
View File

@@ -0,0 +1,12 @@
shaders = 1
shader0 = shaders/crt-potato/shader-files/crt-potato.glsl
filter_linear0 = false
scale_type0 = viewport
scale0 = 1.0
alias0 = "PASS0"
textures = MASK
MASK = shaders/crt-potato/resources/crt-potato-thin.png
MASK_linear = false
MASK_wrap_mode = "repeat"

12
crt/crt-potato-warm.glslp Normal file
View File

@@ -0,0 +1,12 @@
shaders = 1
shader0 = shaders/crt-potato/shader-files/crt-potato.glsl
filter_linear0 = false
scale_type0 = viewport
scale0 = 1.0
alias0 = "PASS0"
textures = MASK
MASK = shaders/crt-potato/resources/crt-potato-thick.png
MASK_linear = false
MASK_wrap_mode = "repeat"

View File

@@ -0,0 +1,131 @@
# 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 .glslp, but their
# compilation model doesn't currently allow the .glslp 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.glsl"
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.glsl"
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.glsl"
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/shaders/royale/blur9fast-vertical.glsl"
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/shaders/royale/blur9fast-horizontal.glsl"
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.glsl"
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.glsl"
filter_linear6 = "true"
scale_type6 = "viewport"
mipmap_input6 = "true"
texture_wrap_mode6 = "clamp_to_edge"

View File

@@ -0,0 +1,183 @@
# 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 .glslp, but their
# compilation model doesn't currently allow the .glslp 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 = "9"
# 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.glsl"
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.glsl"
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.glsl"
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/shaders/royale/blur9fast-vertical.glsl"
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/shaders/royale/blur9fast-horizontal.glsl"
alias4 = "HALATION_BLUR"
filter_linear4 = "true"
scale_type4 = "source"
scale4 = "1.0"
srgb_framebuffer4 = "true"
# Pass5: 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.5 + 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_y5 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_y5 = geom_max_aspect_ratio * min_scale_x
# # Some code might depend on equal scales:
# scale_x6 = scale_y5
# Given our default geom_max_aspect_ratio and min_allowed_viewport_triads:
# scale_y5 = 4.0/3.0 * 2.0/(341.33333 / 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!
shader5 = "shaders/crt-royale/src/crt-royale-mask-resize-vertical.glsl"
filter_linear5 = "true"
scale_type_x5 = "absolute"
scale_x5 = "64"
scale_type_y5 = "viewport"
scale_y5 = "0.0625" # Safe for >= 341.333 horizontal triads at viewport size
#srgb_framebuffer5 = "false" # mask_texture is already assumed linear
# Pass6: Lanczos-resize the phosphor mask horizontally. scale_x6 = scale_y5.
# TODO: Check again if the shaders actually require equal scales.
shader6 = "shaders/crt-royale/src/crt-royale-mask-resize-horizontal.glsl"
alias6 = "MASK_RESIZE"
filter_linear6 = "false"
scale_type_x6 = "viewport"
scale_x6 = "0.0625"
scale_type_y6 = "source"
scale_y6 = "1.0"
#srgb_framebuffer6 = "false" # mask_texture is already assumed linear
# Pass7: Resample (misconverged) scanlines horizontally, apply halation, and
# apply the phosphor mask, then fake a phosphor bloom, all in one pass.
shader7 = "shaders/crt-royale/src/crt-royale-scanlines-horizontal-apply-mask-fake-bloom.glsl"
alias7 = "MASKED_SCANLINES"
filter_linear7 = "true" # This could just as easily be nearest neighbor.
scale_type7 = "viewport"
scale7 = "1.0"
#float_framebuffer7 = "true"
srgb_framebuffer7 = "true"
# Pass 8: Compute curvature/AA:
shader8 = "shaders/crt-royale/src/crt-royale-geometry-aa-last-pass.glsl"
filter_linear8 = "true"
scale_type8 = "viewport"
mipmap_input8 = "true"
texture_wrap_mode8 = "clamp_to_edge"

View File

@@ -0,0 +1,224 @@
# 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 .glslp, but their
# compilation model doesn't currently allow the .glslp 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_y5 (among other values):
# 1.) geom_max_aspect_ratio = (geom_max_aspect_ratio used to calculate scale_y5)
shaders = "14"
# NTSC Shader Passes
shader0 = "../ntsc/shaders/ntsc-pass1-composite-3phase.glsl"
shader1 = "../ntsc/shaders/ntsc-pass2-3phase.glsl"
filter_linear0 = false
filter_linear1 = false
scale_type_x0 = absolute
scale_type_y0 = source
scale_x0 = 1024
scale_y0 = 1.0
frame_count_mod0 = 2
float_framebuffer0 = true
scale_type1 = source
scale_x1 = 0.5
scale_y1 = 1.0
# 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
# Pass2: Linearize the input based on CRT gamma and bob interlaced fields.
# (Bobbing ensures we can immediately blur without getting artifacts.)
shader2 = "shaders/crt-royale/src/crt-royale-first-pass-linearize-crt-gamma-bob-fields.glsl"
alias2 = "ORIG_LINEARIZED"
filter_linear2 = "false"
scale_type2 = "source"
scale2 = "1.0"
srgb_framebuffer2 = "true"
# Pass3: 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.
shader3 = "shaders/crt-royale/src/crt-royale-scanlines-vertical-interlacing.glsl"
alias3 = "VERTICAL_SCANLINES"
filter_linear3 = "true"
scale_type_x3 = "source"
scale_x3 = "1.0"
scale_type_y3 = "viewport"
scale_y3 = "1.0"
#float_framebuffer3 = "true"
srgb_framebuffer3 = "true"
# Pass4: 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).
shader4 = "shaders/crt-royale/src/crt-royale-bloom-approx.glsl"
alias4 = "BLOOM_APPROX"
filter_linear4 = "true"
scale_type4 = "absolute"
scale_x4 = "320"
scale_y4 = "240"
srgb_framebuffer4 = "true"
# Pass5: 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.
shader5 = "../blurs/shaders/royale/blur9fast-vertical.glsl"
filter_linear5 = "true"
scale_type5 = "source"
scale5 = "1.0"
srgb_framebuffer5 = "true"
# Pass6: Horizontally blur the input for halation and refractive diffusion.
# Note: Using a one-pass 9x9 blur is about 1% slower.
shader6 = "../blurs/shaders/royale/blur9fast-horizontal.glsl"
alias6 = "HALATION_BLUR"
filter_linear6 = "true"
scale_type6 = "source"
scale6 = "1.0"
srgb_framebuffer6 = "true"
# Pass7: Lanczos-resize the phosphor mask vertically. Set the absolute
# scale_x7 == 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.5 + 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_y5 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_y7 = geom_max_aspect_ratio * min_scale_x
# # Some code might depend on equal scales:
# scale_x8 = scale_y7
# Given our default geom_max_aspect_ratio and min_allowed_viewport_triads:
# scale_y7 = 4.0/3.0 * 2.0/(341.33333 / 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!
shader7 = "shaders/crt-royale/src/crt-royale-mask-resize-vertical.glsl"
filter_linear7 = "true"
scale_type_x7 = "absolute"
scale_x7 = "64"
scale_type_y7 = "viewport"
scale_y7 = "0.0625" # Safe for >= 341.333 horizontal triads at viewport size
#srgb_framebuffer7 = "false" # mask_texture is already assumed linear
# Pass8: Lanczos-resize the phosphor mask horizontally. scale_x8 = scale_y7.
# TODO: Check again if the shaders actually require equal scales.
shader8 = "shaders/crt-royale/src/crt-royale-mask-resize-horizontal.glsl"
alias8 = "MASK_RESIZE"
filter_linear8 = "false"
scale_type_x8 = "viewport"
scale_x8 = "0.0625"
scale_type_y8 = "source"
scale_y8 = "1.0"
#srgb_framebuffer8 = "false" # mask_texture is already assumed linear
# Pass9: Resample (misconverged) scanlines horizontally, apply halation, and
# apply the phosphor mask.
shader9 = "shaders/crt-royale/src/crt-royale-scanlines-horizontal-apply-mask.glsl"
alias9 = "MASKED_SCANLINES"
filter_linear9 = "true" # This could just as easily be nearest neighbor.
scale_type9 = "viewport"
scale9 = "1.0"
#float_framebuffer9 = "true"
srgb_framebuffer9 = "true"
# Pass 10: Compute a brightpass. This will require reading the final mask.
shader10 = "shaders/crt-royale/src/crt-royale-brightpass.glsl"
alias10 = "BRIGHTPASS"
filter_linear10 = "true" # This could just as easily be nearest neighbor.
scale_type10 = "viewport"
scale10 = "1.0"
srgb_framebuffer10 = "true"
# Pass 11: Blur the brightpass vertically
shader11 = "shaders/crt-royale/src/crt-royale-bloom-vertical.glsl"
filter_linear11 = "true" # This could just as easily be nearest neighbor.
scale_type11 = "source"
scale11 = "1.0"
srgb_framebuffer11 = "true"
# Pass 12: Blur the brightpass horizontally and combine it with the dimpass:
shader12 = "shaders/crt-royale/src/crt-royale-bloom-horizontal-reconstitute.glsl"
filter_linear12 = "true"
scale_type12 = "source"
scale12 = "1.0"
srgb_framebuffer12 = "true"
# Pass 13: Compute curvature/AA:
shader13 = "shaders/crt-royale/src/crt-royale-geometry-aa-last-pass.glsl"
filter_linear13 = "true"
scale_type13 = "viewport"
mipmap_input13 = "true"
texture_wrap_mode13 = "clamp_to_edge"

View File

@@ -0,0 +1,224 @@
# 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 .glslp, but their
# compilation model doesn't currently allow the .glslp 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_y5 (among other values):
# 1.) geom_max_aspect_ratio = (geom_max_aspect_ratio used to calculate scale_y5)
shaders = "14"
# NTSC Shader Passes
shader0 = "../ntsc/shaders/ntsc-pass1-svideo-3phase.glsl"
shader1 = "../ntsc/shaders/ntsc-pass2-3phase.glsl"
filter_linear0 = false
filter_linear1 = false
scale_type_x0 = absolute
scale_type_y0 = source
scale_x0 = 1536
scale_y0 = 1.0
frame_count_mod0 = 2
float_framebuffer0 = true
scale_type1 = source
scale_x1 = 0.5
scale_y1 = 1.0
# 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
# Pass2: Linearize the input based on CRT gamma and bob interlaced fields.
# (Bobbing ensures we can immediately blur without getting artifacts.)
shader2 = "shaders/crt-royale/src/crt-royale-first-pass-linearize-crt-gamma-bob-fields.glsl"
alias2 = "ORIG_LINEARIZED"
filter_linear2 = "false"
scale_type2 = "source"
scale2 = "1.0"
srgb_framebuffer2 = "true"
# Pass3: 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.
shader3 = "shaders/crt-royale/src/crt-royale-scanlines-vertical-interlacing.glsl"
alias3 = "VERTICAL_SCANLINES"
filter_linear3 = "true"
scale_type_x3 = "source"
scale_x3 = "1.0"
scale_type_y3 = "viewport"
scale_y3 = "1.0"
#float_framebuffer3 = "true"
srgb_framebuffer3 = "true"
# Pass4: 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).
shader4 = "shaders/crt-royale/src/crt-royale-bloom-approx.glsl"
alias4 = "BLOOM_APPROX"
filter_linear4 = "true"
scale_type4 = "absolute"
scale_x4 = "320"
scale_y4 = "240"
srgb_framebuffer4 = "true"
# Pass5: 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.
shader5 = "../blurs/shaders/royale/blur9fast-vertical.glsl"
filter_linear5 = "true"
scale_type5 = "source"
scale5 = "1.0"
srgb_framebuffer5 = "true"
# Pass6: Horizontally blur the input for halation and refractive diffusion.
# Note: Using a one-pass 9x9 blur is about 1% slower.
shader6 = "../blurs/shaders/royale/blur9fast-horizontal.glsl"
alias6 = "HALATION_BLUR"
filter_linear6 = "true"
scale_type6 = "source"
scale6 = "1.0"
srgb_framebuffer6 = "true"
# Pass7: Lanczos-resize the phosphor mask vertically. Set the absolute
# scale_x7 == 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.5 + 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_y5 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_y7 = geom_max_aspect_ratio * min_scale_x
# # Some code might depend on equal scales:
# scale_x8 = scale_y7
# Given our default geom_max_aspect_ratio and min_allowed_viewport_triads:
# scale_y7 = 4.0/3.0 * 2.0/(341.33333 / 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!
shader7 = "shaders/crt-royale/src/crt-royale-mask-resize-vertical.glsl"
filter_linear7 = "true"
scale_type_x7 = "absolute"
scale_x7 = "64"
scale_type_y7 = "viewport"
scale_y7 = "0.0625" # Safe for >= 341.333 horizontal triads at viewport size
#srgb_framebuffer7 = "false" # mask_texture is already assumed linear
# Pass8: Lanczos-resize the phosphor mask horizontally. scale_x8 = scale_y7.
# TODO: Check again if the shaders actually require equal scales.
shader8 = "shaders/crt-royale/src/crt-royale-mask-resize-horizontal.glsl"
alias8 = "MASK_RESIZE"
filter_linear8 = "false"
scale_type_x8 = "viewport"
scale_x8 = "0.0625"
scale_type_y8 = "source"
scale_y8 = "1.0"
#srgb_framebuffer8 = "false" # mask_texture is already assumed linear
# Pass9: Resample (misconverged) scanlines horizontally, apply halation, and
# apply the phosphor mask.
shader9 = "shaders/crt-royale/src/crt-royale-scanlines-horizontal-apply-mask.glsl"
alias9 = "MASKED_SCANLINES"
filter_linear9 = "true" # This could just as easily be nearest neighbor.
scale_type9 = "viewport"
scale9 = "1.0"
#float_framebuffer9 = "true"
srgb_framebuffer9 = "true"
# Pass 10: Compute a brightpass. This will require reading the final mask.
shader10 = "shaders/crt-royale/src/crt-royale-brightpass.glsl"
alias10 = "BRIGHTPASS"
filter_linear10 = "true" # This could just as easily be nearest neighbor.
scale_type10 = "viewport"
scale10 = "1.0"
srgb_framebuffer10 = "true"
# Pass 11: Blur the brightpass vertically
shader11 = "shaders/crt-royale/src/crt-royale-bloom-vertical.glsl"
filter_linear11 = "true" # This could just as easily be nearest neighbor.
scale_type11 = "source"
scale11 = "1.0"
srgb_framebuffer11 = "true"
# Pass 12: Blur the brightpass horizontally and combine it with the dimpass:
shader12 = "shaders/crt-royale/src/crt-royale-bloom-horizontal-reconstitute.glsl"
filter_linear12 = "true"
scale_type12 = "source"
scale12 = "1.0"
srgb_framebuffer12 = "true"
# Pass 13: Compute curvature/AA:
shader13 = "shaders/crt-royale/src/crt-royale-geometry-aa-last-pass.glsl"
filter_linear13 = "true"
scale_type13 = "viewport"
mipmap_input13 = "true"
texture_wrap_mode13 = "clamp_to_edge"

View File

@@ -0,0 +1,224 @@
# 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 .glslp, but their
# compilation model doesn't currently allow the .glslp 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_y5 (among other values):
# 1.) geom_max_aspect_ratio = (geom_max_aspect_ratio used to calculate scale_y5)
shaders = "14"
# NTSC Shader Passes
shader0 = "../ntsc/shaders/ntsc-pass1-composite-2phase.glsl"
shader1 = "../ntsc/shaders/ntsc-pass2-2phase.glsl"
filter_linear0 = false
filter_linear1 = false
scale_type_x0 = absolute
scale_type_y0 = source
scale_x0 = 1280
scale_y0 = 1.0
frame_count_mod0 = 2
float_framebuffer0 = true
scale_type1 = source
scale_x1 = 0.5
scale_y1 = 1.0
# 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
# Pass2: Linearize the input based on CRT gamma and bob interlaced fields.
# (Bobbing ensures we can immediately blur without getting artifacts.)
shader2 = "shaders/crt-royale/src/crt-royale-first-pass-linearize-crt-gamma-bob-fields.glsl"
alias2 = "ORIG_LINEARIZED"
filter_linear2 = "false"
scale_type2 = "source"
scale2 = "1.0"
srgb_framebuffer2 = "true"
# Pass3: 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.
shader3 = "shaders/crt-royale/src/crt-royale-scanlines-vertical-interlacing.glsl"
alias3 = "VERTICAL_SCANLINES"
filter_linear3 = "true"
scale_type_x3 = "source"
scale_x3 = "1.0"
scale_type_y3 = "viewport"
scale_y3 = "1.0"
#float_framebuffer3 = "true"
srgb_framebuffer3 = "true"
# Pass4: 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).
shader4 = "shaders/crt-royale/src/crt-royale-bloom-approx.glsl"
alias4 = "BLOOM_APPROX"
filter_linear4 = "true"
scale_type4 = "absolute"
scale_x4 = "320"
scale_y4 = "240"
srgb_framebuffer4 = "true"
# Pass5: 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.
shader5 = "../blurs/shaders/royale/blur9fast-vertical.glsl"
filter_linear5 = "true"
scale_type5 = "source"
scale5 = "1.0"
srgb_framebuffer5 = "true"
# Pass6: Horizontally blur the input for halation and refractive diffusion.
# Note: Using a one-pass 9x9 blur is about 1% slower.
shader6 = "../blurs/shaders/royale/blur9fast-horizontal.glsl"
alias6 = "HALATION_BLUR"
filter_linear6 = "true"
scale_type6 = "source"
scale6 = "1.0"
srgb_framebuffer6 = "true"
# Pass7: Lanczos-resize the phosphor mask vertically. Set the absolute
# scale_x7 == 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.5 + 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_y5 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_y7 = geom_max_aspect_ratio * min_scale_x
# # Some code might depend on equal scales:
# scale_x8 = scale_y7
# Given our default geom_max_aspect_ratio and min_allowed_viewport_triads:
# scale_y7 = 4.0/3.0 * 2.0/(341.33333 / 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!
shader7 = "shaders/crt-royale/src/crt-royale-mask-resize-vertical.glsl"
filter_linear7 = "true"
scale_type_x7 = "absolute"
scale_x7 = "64"
scale_type_y7 = "viewport"
scale_y7 = "0.0625" # Safe for >= 341.333 horizontal triads at viewport size
#srgb_framebuffer7 = "false" # mask_texture is already assumed linear
# Pass8: Lanczos-resize the phosphor mask horizontally. scale_x8 = scale_y7.
# TODO: Check again if the shaders actually require equal scales.
shader8 = "shaders/crt-royale/src/crt-royale-mask-resize-horizontal.glsl"
alias8 = "MASK_RESIZE"
filter_linear8 = "false"
scale_type_x8 = "viewport"
scale_x8 = "0.0625"
scale_type_y8 = "source"
scale_y8 = "1.0"
#srgb_framebuffer8 = "false" # mask_texture is already assumed linear
# Pass9: Resample (misconverged) scanlines horizontally, apply halation, and
# apply the phosphor mask.
shader9 = "shaders/crt-royale/src/crt-royale-scanlines-horizontal-apply-mask.glsl"
alias9 = "MASKED_SCANLINES"
filter_linear9 = "true" # This could just as easily be nearest neighbor.
scale_type9 = "viewport"
scale9 = "1.0"
#float_framebuffer9 = "true"
srgb_framebuffer9 = "true"
# Pass 10: Compute a brightpass. This will require reading the final mask.
shader10 = "shaders/crt-royale/src/crt-royale-brightpass.glsl"
alias10 = "BRIGHTPASS"
filter_linear10 = "true" # This could just as easily be nearest neighbor.
scale_type10 = "viewport"
scale10 = "1.0"
srgb_framebuffer10 = "true"
# Pass 11: Blur the brightpass vertically
shader11 = "shaders/crt-royale/src/crt-royale-bloom-vertical.glsl"
filter_linear11 = "true" # This could just as easily be nearest neighbor.
scale_type11 = "source"
scale11 = "1.0"
srgb_framebuffer11 = "true"
# Pass 12: Blur the brightpass horizontally and combine it with the dimpass:
shader12 = "shaders/crt-royale/src/crt-royale-bloom-horizontal-reconstitute.glsl"
filter_linear12 = "true"
scale_type12 = "source"
scale12 = "1.0"
srgb_framebuffer12 = "true"
# Pass 13: Compute curvature/AA:
shader13 = "shaders/crt-royale/src/crt-royale-geometry-aa-last-pass.glsl"
filter_linear13 = "true"
scale_type13 = "viewport"
mipmap_input13 = "true"
texture_wrap_mode13 = "clamp_to_edge"

View File

@@ -0,0 +1,224 @@
# 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 .glslp, but their
# compilation model doesn't currently allow the .glslp 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_y5 (among other values):
# 1.) geom_max_aspect_ratio = (geom_max_aspect_ratio used to calculate scale_y5)
shaders = "14"
# NTSC Shader Passes
shader0 = "../ntsc/shaders/ntsc-pass1-svideo-2phase.glsl"
shader1 = "../ntsc/shaders/ntsc-pass2-2phase.glsl"
filter_linear0 = false
filter_linear1 = false
scale_type_x0 = absolute
scale_type_y0 = source
scale_x0 = 1920
scale_y0 = 1.0
frame_count_mod0 = 2
float_framebuffer0 = true
scale_type1 = source
scale_x1 = 0.5
scale_y1 = 1.0
# 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
# Pass2: Linearize the input based on CRT gamma and bob interlaced fields.
# (Bobbing ensures we can immediately blur without getting artifacts.)
shader2 = "shaders/crt-royale/src/crt-royale-first-pass-linearize-crt-gamma-bob-fields.glsl"
alias2 = "ORIG_LINEARIZED"
filter_linear2 = "false"
scale_type2 = "source"
scale2 = "1.0"
srgb_framebuffer2 = "true"
# Pass3: 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.
shader3 = "shaders/crt-royale/src/crt-royale-scanlines-vertical-interlacing.glsl"
alias3 = "VERTICAL_SCANLINES"
filter_linear3 = "true"
scale_type_x3 = "source"
scale_x3 = "1.0"
scale_type_y3 = "viewport"
scale_y3 = "1.0"
#float_framebuffer3 = "true"
srgb_framebuffer3 = "true"
# Pass4: 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).
shader4 = "shaders/crt-royale/src/crt-royale-bloom-approx.glsl"
alias4 = "BLOOM_APPROX"
filter_linear4 = "true"
scale_type4 = "absolute"
scale_x4 = "320"
scale_y4 = "240"
srgb_framebuffer4 = "true"
# Pass5: 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.
shader5 = "../blurs/shaders/royale/blur9fast-vertical.glsl"
filter_linear5 = "true"
scale_type5 = "source"
scale5 = "1.0"
srgb_framebuffer5 = "true"
# Pass6: Horizontally blur the input for halation and refractive diffusion.
# Note: Using a one-pass 9x9 blur is about 1% slower.
shader6 = "../blurs/shaders/royale/blur9fast-horizontal.glsl"
alias6 = "HALATION_BLUR"
filter_linear6 = "true"
scale_type6 = "source"
scale6 = "1.0"
srgb_framebuffer6 = "true"
# Pass7: Lanczos-resize the phosphor mask vertically. Set the absolute
# scale_x7 == 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.5 + 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_y5 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_y7 = geom_max_aspect_ratio * min_scale_x
# # Some code might depend on equal scales:
# scale_x8 = scale_y7
# Given our default geom_max_aspect_ratio and min_allowed_viewport_triads:
# scale_y7 = 4.0/3.0 * 2.0/(341.33333 / 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!
shader7 = "shaders/crt-royale/src/crt-royale-mask-resize-vertical.glsl"
filter_linear7 = "true"
scale_type_x7 = "absolute"
scale_x7 = "64"
scale_type_y7 = "viewport"
scale_y7 = "0.0625" # Safe for >= 341.333 horizontal triads at viewport size
#srgb_framebuffer7 = "false" # mask_texture is already assumed linear
# Pass8: Lanczos-resize the phosphor mask horizontally. scale_x8 = scale_y7.
# TODO: Check again if the shaders actually require equal scales.
shader8 = "shaders/crt-royale/src/crt-royale-mask-resize-horizontal.glsl"
alias8 = "MASK_RESIZE"
filter_linear8 = "false"
scale_type_x8 = "viewport"
scale_x8 = "0.0625"
scale_type_y8 = "source"
scale_y8 = "1.0"
#srgb_framebuffer8 = "false" # mask_texture is already assumed linear
# Pass9: Resample (misconverged) scanlines horizontally, apply halation, and
# apply the phosphor mask.
shader9 = "shaders/crt-royale/src/crt-royale-scanlines-horizontal-apply-mask.glsl"
alias9 = "MASKED_SCANLINES"
filter_linear9 = "true" # This could just as easily be nearest neighbor.
scale_type9 = "viewport"
scale9 = "1.0"
#float_framebuffer9 = "true"
srgb_framebuffer9 = "true"
# Pass 10: Compute a brightpass. This will require reading the final mask.
shader10 = "shaders/crt-royale/src/crt-royale-brightpass.glsl"
alias10 = "BRIGHTPASS"
filter_linear10 = "true" # This could just as easily be nearest neighbor.
scale_type10 = "viewport"
scale10 = "1.0"
srgb_framebuffer10 = "true"
# Pass 11: Blur the brightpass vertically
shader11 = "shaders/crt-royale/src/crt-royale-bloom-vertical.glsl"
filter_linear11 = "true" # This could just as easily be nearest neighbor.
scale_type11 = "source"
scale11 = "1.0"
srgb_framebuffer11 = "true"
# Pass 12: Blur the brightpass horizontally and combine it with the dimpass:
shader12 = "shaders/crt-royale/src/crt-royale-bloom-horizontal-reconstitute.glsl"
filter_linear12 = "true"
scale_type12 = "source"
scale12 = "1.0"
srgb_framebuffer12 = "true"
# Pass 13: Compute curvature/AA:
shader13 = "shaders/crt-royale/src/crt-royale-geometry-aa-last-pass.glsl"
filter_linear13 = "true"
scale_type13 = "viewport"
mipmap_input13 = "true"
texture_wrap_mode13 = "clamp_to_edge"

View File

@@ -0,0 +1,219 @@
# 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 .glslp, but their
# compilation model doesn't currently allow the .glslp file to tell them. Make
# sure to set the following constants in user-cgp-constants.h accordingly too:
# 1.) bloom_approx_scale_x = scale_x3
# 2.) mask_resize_viewport_scale = float2(scale_x7, scale_y6)
# 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 = "13"
shader0 = "../pal/shaders/pal-r57shell.glsl"
nes_lut = "../pal/resources/nes_lut.png"
nes_lut_linear = "false"
nes_lut_wrap_mode = "repeat"
nes_lut_mipmap = "false"
filter_linear0 = false
scale_type_x0 = absolute
scale_type_y0 = source
scale_x0 = 1024
scale_y0 = 1.0
frame_count_mod0 = 2
# 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 = "nes_lut;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
# Pass1: Linearize the input based on CRT gamma and bob interlaced fields.
# (Bobbing ensures we can immediately blur without getting artifacts.)
shader1 = "shaders/crt-royale/src/crt-royale-first-pass-linearize-crt-gamma-bob-fields.glsl"
alias1 = "ORIG_LINEARIZED"
filter_linear1 = "false"
scale_type1 = "source"
scale1 = "1.0"
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 = "shaders/crt-royale/src/crt-royale-scanlines-vertical-interlacing.glsl"
alias2 = "VERTICAL_SCANLINES"
filter_linear2 = "true"
scale_type_x2 = "source"
scale_x2 = "1.0"
scale_type_y2 = "viewport"
scale_y2 = "1.0"
#float_framebuffer2 = "true"
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:3 aspect ratio assumes the input has cropped geom_overscan (so it's
# *intended* for an ~4:3 aspect ratio).
shader3 = "shaders/crt-royale/src/crt-royale-bloom-approx.glsl"
alias3 = "BLOOM_APPROX"
filter_linear3 = "true"
scale_type3 = "absolute"
scale_x3 = "320"
scale_y3 = "240"
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/shaders/royale/blur9fast-vertical.glsl"
filter_linear4 = "true"
scale_type4 = "source"
scale4 = "1.0"
srgb_framebuffer4 = "true"
# Pass5: Horizontally blur the input for halation and refractive diffusion.
# Note: Using a one-pass 9x9 blur is about 1% slower.
shader5 = "../blurs/shaders/royale/blur9fast-horizontal.glsl"
alias5 = "HALATION_BLUR"
filter_linear5 = "true"
scale_type5 = "source"
scale5 = "1.0"
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.5 + 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_y5 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_y6
# Given our default geom_max_aspect_ratio and min_allowed_viewport_triads:
# scale_y6 = 4.0/3.0 * 2.0/(341.33333 / 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 = "shaders/crt-royale/src/crt-royale-mask-resize-vertical.glsl"
filter_linear6 = "true"
scale_type_x6 = "absolute"
scale_x6 = "64"
scale_type_y6 = "viewport"
scale_y6 = "0.0625" # Safe for >= 341.333 horizontal triads at viewport size
#srgb_framebuffer6 = "false" # mask_texture is already assumed linear
# Pass7: Lanczos-resize the phosphor mask horizontally. scale_x7 = scale_y6.
# TODO: Check again if the shaders actually require equal scales.
shader7 = "shaders/crt-royale/src/crt-royale-mask-resize-horizontal.glsl"
alias7 = "MASK_RESIZE"
filter_linear7 = "false"
scale_type_x7 = "viewport"
scale_x7 = "0.0625"
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 = "shaders/crt-royale/src/crt-royale-scanlines-horizontal-apply-mask.glsl"
alias8 = "MASKED_SCANLINES"
filter_linear8 = "true" # This could just as easily be nearest neighbor.
scale_type8 = "viewport"
scale8 = "1.0"
#float_framebuffer8 = "true"
srgb_framebuffer8 = "true"
# Pass 9: Compute a brightpass. This will require reading the final mask.
shader9 = "shaders/crt-royale/src/crt-royale-brightpass.glsl"
alias9 = "BRIGHTPASS"
filter_linear9 = "true" # This could just as easily be nearest neighbor.
scale_type9 = "viewport"
scale9 = "1.0"
srgb_framebuffer9 = "true"
# Pass 10: Blur the brightpass vertically
shader10 = "shaders/crt-royale/src/crt-royale-bloom-vertical.glsl"
filter_linear10 = "true" # This could just as easily be nearest neighbor.
scale_type10 = "source"
scale10 = "1.0"
srgb_framebuffer10 = "true"
# Pass 11: Blur the brightpass horizontally and combine it with the dimpass:
shader11 = "shaders/crt-royale/src/crt-royale-bloom-horizontal-reconstitute.glsl"
filter_linear11 = "true"
scale_type11 = "source"
scale11 = "1.0"
srgb_framebuffer11 = "true"
# Pass 12: Compute curvature/AA:
shader12 = "shaders/crt-royale/src/crt-royale-geometry-aa-last-pass.glsl"
filter_linear12 = "true"
scale_type12 = "viewport"
mipmap_input12 = "true"
texture_wrap_mode12 = "clamp_to_edge"

203
crt/crt-royale.glslp Normal file
View File

@@ -0,0 +1,203 @@
# IMPORTANT:
# Shader passes need to know details about the image in the mask_texture LUT
# files, so set the following constants in user-preset-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 preset, but their
# compilation model doesn't currently allow the preset file to tell them. Make
# sure to set the following constants in user-preset-constants.h accordingly too:
# 1.) bloom_approx_scale_x = scale_x2
# 2.) mask_resize_viewport_scale = vec2(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 = "12"
# 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.glsl"
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.glsl"
alias1 = "VERTICAL_SCANLINES"
filter_linear1 = "true"
scale_type_x1 = "source"
scale_x1 = "1.0"
scale_type_y1 = "viewport"
scale_y1 = "1.0"
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.glsl"
alias2 = "BLOOM_APPROX"
filter_linear2 = "true"
scale_type2 = "absolute"
scale_x2 = "320"
scale_y2 = "240"
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/shaders/royale/blur9fast-vertical.glsl"
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/shaders/royale/blur9fast-horizontal.glsl"
alias4 = "HALATION_BLUR"
filter_linear4 = "true"
scale_type4 = "source"
scale4 = "1.0"
srgb_framebuffer4 = "true"
# Pass5: 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.5 + 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_y5 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_y5 = geom_max_aspect_ratio * min_scale_x
# # Some code might depend on equal scales:
# scale_x6 = scale_y5
# Given our default geom_max_aspect_ratio and min_allowed_viewport_triads:
# scale_y5 = 4.0/3.0 * 2.0/(341.33333 / 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-preset-constants.h!
shader5 = "shaders/crt-royale/src/crt-royale-mask-resize-vertical.glsl"
filter_linear5 = "true"
scale_type_x5 = "absolute"
scale_x5 = "64"
scale_type_y5 = "viewport"
scale_y5 = "0.0625" # Safe for >= 341.333 horizontal triads at viewport size
#srgb_framebuffer5 = "false" # mask_texture is already assumed linear
# Pass6: Lanczos-resize the phosphor mask horizontally. scale_x6 = scale_y5.
# TODO: Check again if the shaders actually require equal scales.
shader6 = "shaders/crt-royale/src/crt-royale-mask-resize-horizontal.glsl"
alias6 = "MASK_RESIZE"
filter_linear6 = "false"
scale_type_x6 = "viewport"
scale_x6 = "0.0625"
scale_type_y6 = "source"
scale_y6 = "1.0"
#srgb_framebuffer6 = "false" # mask_texture is already assumed linear
# Pass7: Resample (misconverged) scanlines horizontally, apply halation, and
# apply the phosphor mask.
shader7 = "shaders/crt-royale/src/crt-royale-scanlines-horizontal-apply-mask.glsl"
alias7 = "MASKED_SCANLINES"
filter_linear7 = "true" # This could just as easily be nearest neighbor.
scale_type7 = "viewport"
scale7 = "1.0"
srgb_framebuffer7 = "true"
# Pass 8: Compute a brightpass. This will require reading the final mask.
shader8 = "shaders/crt-royale/src/crt-royale-brightpass.glsl"
alias8 = "BRIGHTPASS"
filter_linear8 = "true" # This could just as easily be nearest neighbor.
scale_type8 = "viewport"
scale8 = "1.0"
srgb_framebuffer8 = "true"
# Pass 9: Blur the brightpass vertically
shader9 = "shaders/crt-royale/src/crt-royale-bloom-vertical.glsl"
filter_linear9 = "true" # This could just as easily be nearest neighbor.
scale_type9 = "source"
scale9 = "1.0"
srgb_framebuffer9 = "true"
# Pass 10: Blur the brightpass horizontally and combine it with the dimpass:
shader10 = "shaders/crt-royale/src/crt-royale-bloom-horizontal-reconstitute.glsl"
filter_linear10 = "true"
scale_type10 = "source"
scale10 = "1.0"
srgb_framebuffer10 = "true"
# Pass 11: Compute curvature/AA:
shader11 = "shaders/crt-royale/src/crt-royale-geometry-aa-last-pass.glsl"
filter_linear11 = "true"
scale_type11 = "viewport"
mipmap_input11 = "false"
texture_wrap_mode11 = "clamp_to_edge"

27
crt/crt-sines.glslp Normal file
View File

@@ -0,0 +1,27 @@
shaders = "5"
feedback_pass = "0"
shader0 = "shaders/crt-consumer/linearize.glsl"
filter_linear0 = "false"
scale_type_x0 = "source"
scale_x0 = "1.000000"
scale_type_y0 = "source"
scale_y0 = "1.000000"
shader1 = "shaders/crt-consumer/glow_x.glsl"
filter_linear1 = "true""
scale_type_x1 = "source"
scale_x1 = "1.000000"
scale_type_y1 = "source"
scale_y1 = "1.000000"
shader2 = "shaders/crt-consumer/glow_y.glsl"
filter_linear2 = "true"
scale_type_x2 = "source"
scale_x2 = "1.000000"
scale_type_y2 = "source"
scale_y2 = "1.000000"
shader3 = "shaders/crt-consumer/resolve.glsl"
scale_type_x3 = "source"
scale_x3 = "1.000000"
scale_type_y3 = "source"
scale_y3 = "1.000000"
shader4 = "shaders/crt-sines.glsl"
filter_linear4 = "true"

View File

@@ -0,0 +1,44 @@
shaders = 7
shader0 = shaders/torridgristle/Scanline-Interpolation.glsl
filter_linear0 = true
scale_type0 = source
shader1 = shaders/torridgristle/ScanlineSimple.glsl
filter_linear1 = true
scale_type1 = source
scale1 = 3.0
shader2 = ../reshade/shaders/blendoverlay/blendoverlay.glsl
filter_linear2 = true
scale_type2 = viewport
shader3 = shaders/torridgristle/Brighten.glsl
filter_linear3 = true
alias3 = candy_ref
shader4 = shaders/torridgristle/sunset-gaussian-vert.glsl
filter_linear4 = true
scale_type4 = source
shader5 = shaders/torridgristle/sunset-gaussian-horiz.glsl
filter_linear5 = true
scale_type5 = source
shader6 = shaders/torridgristle/Candy-Bloom.glsl
filter_linear6 = true
textures = "overlay"
overlay = ../reshade/shaders/blendoverlay/shadowmask-4x4.png
filter_overlay = linear
parameters = "ScanlineSize;YIQAmount;BrightenLevel;BrightenAmount;GlowLevel;GlowTightness;LUTHeight;LUTWidth;OverlayMix"
ScanlineSize = 3.0;
YIQAmount = 0.35;
BrightenLevel = 2.0;
BrightenAmount = 0.1;
GlowLevel = 1.0;
GlowTightness = 0.8;
LUTWidth = 4.0
LUTHeight = 4.0
OverlayMix = 0.5

View File

@@ -0,0 +1,22 @@
shaders = 3
shader0 = "shaders/crt-yo6/crt-yo6-native-resolution.glsl"
filter_linear0 = true
wrap_mode0 = "clamp_to_edge"
scale_type0 = "absolute"
scale_x0 = 439
scale_y0 = 233
shader1 = "shaders/crt-yo6/crt-yo6-warp.glsl"
filter_linear1 = true
wrap_mode1 = "clamp_to_edge"
scale_type1 = "absolute"
scale_x1 = 1684
scale_y1 = 1329
shader2 = "../stock.glsl"
filter_linear2 = true
textures = TEX_CRT
TEX_CRT = "shaders/crt-yo6/KV-M1420B.png"
TEX_CRT_linear = false

View File

@@ -0,0 +1,27 @@
shaders = 3
shader0 = "shaders/crt-yo6/crt-yo6-native-resolution.glsl"
filter_linear0 = true
wrap_mode0 = "clamp_to_edge"
scale_type0 = "absolute"
scale_x0 = 439
scale_y0 = 233
shader1 = "shaders/crt-yo6/crt-yo6-warp.glsl"
filter_linear1 = true
wrap_mode1 = "clamp_to_edge"
scale_type1 = "absolute"
scale_x1 = 1684
scale_y1 = 1329
shader2 = "../windowed/shaders/jinc2-params.glsl"
filter_linear2 = false
textures = TEX_CRT
TEX_CRT = "shaders/crt-yo6/KV-M1420B.png"
TEX_CRT_linear = false
parameters = "JINC2_WINDOW_SINC;JINC2_SINC;JINC2_AR_STRENGTH"
JINC2_WINDOW_SINC = 0.44
JINC2_SINC = 0.82
JINC2_AR_STRENGTH = 0.5

View File

@@ -0,0 +1,27 @@
shaders = 3
shader0 = "shaders/crt-yo6/crt-yo6-native-resolution.glsl"
filter_linear0 = true
wrap_mode0 = "clamp_to_edge"
scale_type0 = "absolute"
scale_x0 = 439
scale_y0 = 233
shader1 = "shaders/crt-yo6/crt-yo6-warp.glsl"
filter_linear1 = true
wrap_mode1 = "clamp_to_edge"
scale_type1 = "absolute"
scale_x1 = 1684
scale_y1 = 1329
shader2 = "../windowed/shaders/jinc2-params.glsl"
filter_linear2 = false
textures = TEX_CRT
TEX_CRT = "shaders/crt-yo6/KV-M1420B.png"
TEX_CRT_linear = false
parameters = "JINC2_WINDOW_SINC;JINC2_SINC;JINC2_AR_STRENGTH"
JINC2_WINDOW_SINC = 0.44
JINC2_SINC = 0.40
JINC2_AR_STRENGTH = 0.0

38
crt/crtglow_gauss.glslp Normal file
View File

@@ -0,0 +1,38 @@
shaders = 7
shader0 = shaders/glow/linearize.glsl
filter_linear0 = false
srgb_framebuffer0 = true
shader1 = shaders/glow/gauss_horiz.glsl
filter_linear1 = false
scale_type_x1 = viewport
scale_type_y1 = source
scale_x0 = 1.0
scale_y0 = 1.0
srgb_framebuffer1 = true
shader2 = shaders/glow/gauss_vert.glsl
filter_linear2 = false
scale_type2 = viewport
scale2 = 1.0
srgb_framebuffer2 = true
shader3 = shaders/glow/threshold.glsl
filter_linear3 = false
srgb_framebuffer3 = true
shader4 = shaders/glow/blur_horiz.glsl
mipmap_input4 = true
filter_linear4 = true
scale_type4 = source
scale4 = 0.25
srgb_framebuffer4 = true
shader5 = shaders/glow/blur_vert.glsl
filter_linear5 = true
srgb_framebuffer5 = true
shader6 = shaders/glow/resolve.glsl
filter_linear6 = true

View File

@@ -0,0 +1,49 @@
shaders = 8
shader0 = ../ntsc/shaders/ntsc-pass1-composite-3phase.glsl
filter_linear0 = false
scale_type0 = source
scale_x0 = 4.0
scale_y0 = 1.0
frame_count_mod0 = 2
float_framebuffer0 = true
shader1 = ../ntsc/shaders/ntsc-pass2-3phase-linear.glsl
scale_type1 = source
scale_x1 = 0.5
scale_y1 = 1.0
filter_linear1 = false
srgb_framebuffer1 = true
shader2 = shaders/glow/gauss_horiz.glsl
filter_linear2 = false
scale_type_x2 = viewport
scale_type_y2 = source
scale_x2 = 1.0
scale_y2 = 1.0
srgb_framebuffer2 = true
shader3 = shaders/glow/gauss_vert.glsl
filter_linear3 = false
scale_type3 = viewport
scale3 = 1.0
srgb_framebuffer3 = true
shader4 = shaders/glow/threshold.glsl
filter_linear4 = false
srgb_framebuffer4 = true
shader5 = shaders/glow/blur_horiz.glsl
mipmap_input5 = true
filter_linear5 = true
scale_type5 = source
scale5 = 0.25
srgb_framebuffer5 = true
shader6 = shaders/glow/blur_vert.glsl
filter_linear6 = true
srgb_framebuffer6 = true
shader7 = shaders/glow/resolve.glsl
filter_linear7 = true

38
crt/crtglow_lanczos.glslp Normal file
View File

@@ -0,0 +1,38 @@
shaders = 7
shader0 = shaders/glow/linearize.glsl
filter_linear0 = false
srgb_framebuffer0 = true
shader1 = shaders/glow/lanczos_horiz.glsl
filter_linear1 = false
scale_type_x1 = viewport
scale_type_y1 = source
scale_x1 = 1.0
scale_y1 = 1.0
srgb_framebuffer1 = true
shader2 = shaders/glow/gauss_vert.glsl
filter_linear2 = false
scale_type2 = viewport
scale2 = 1.0
srgb_framebuffer2 = true
shader3 = shaders/glow/threshold.glsl
filter_linear3 = false
srgb_framebuffer3 = true
shader4 = shaders/glow/blur_horiz.glsl
mipmap_input4 = true
filter_linear4 = true
scale_type4 = source
scale4 = 0.25
srgb_framebuffer4 = true
shader5 = shaders/glow/blur_vert.glsl
filter_linear5 = true
srgb_framebuffer5 = true
shader6 = shaders/glow/resolve.glsl
filter_linear6 = true

23
crt/crtsim.glslp Normal file
View File

@@ -0,0 +1,23 @@
shaders = 5
shader0 = shaders/crtsim/composite.glsl
filter_linear0 = false
shader1 = ../stock.glsl
alias1 = CRTPASS
shader2 = shaders/crtsim/post-downsample.glsl
filter_linear2 = true
shader3 = shaders/crtsim/post-upsample.glsl
filter_linear3 = true
shader4 = shaders/crtsim/present.glsl
filter_linear4 = true
textures = "NTSCArtifactSampler;shadowMaskSampler"
NTSCArtifactSampler = "shaders/crtsim/artifacts.png"
NTSCArtifactSampler_linear = true
shadowMaskSampler = "shaders/crtsim/mask.png"
shadowMaskSampler_linear = true
shadowMaskSampler_repeat = true

View File

@@ -0,0 +1,4 @@
shaders = "1"
feedback_pass = "0"
shader0 = shaders/fake-CRT-Geom-potato.glsl
filter_linear0 = "true"

5
crt/fake-CRT-Geom.glslp Normal file
View File

@@ -0,0 +1,5 @@
shaders = "1"
feedback_pass = "0"
shader0 = shaders/fake-CRT-Geom.glsl
filter_linear0 = "true"

4
crt/fakelottes.glslp Normal file
View File

@@ -0,0 +1,4 @@
shaders = 1
shader0 = shaders/fakelottes.glsl
filter_linear0 = true

14
crt/gizmo-crt.glslp Normal file
View File

@@ -0,0 +1,14 @@
shaders = "1"
shader0 = "shaders/gizmo-crt.glsl"
filter_linear0 = "true"
scale_type0 = viewport
parameters = "BRIGHTNESS;HORIZONTAL_BLUR;VERTICAL_BLUR;BLUR_OFFSET;BGR_LCD_PATTERN;SHRINK"
CURVATURE_X = "0.0"
CURVATURE_Y = "0.0"
BRIGHTNESS = "0.5"
HORIZONTAL_BLUR = "0.0"
VERTICAL_BLUR = "0.0"
BLUR_OFFSET = "0.0"
BGR_LCD_PATTERN = "0.0"
SHRINK = "0.0"

View File

@@ -0,0 +1,22 @@
shaders = "1"
shader0 = "shaders/gizmo-slotmask-crt.glsl"
filter_linear0 = "true"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = ""
float_framebuffer0 = "false"
srgb_framebuffer0 = "false"
parameters = "BRIGHTNESS;HORIZONTAL_BLUR;VERTICAL_BLUR;BLUR_OFFSET;BGR_LCD_PATTERN;SHRINK;SNR;COLOUR_BLEEDING;GRID;SLOTMASK"
CURVATURE_X = "0.15"
CURVATURE_Y = "0.15"
BRIGHTNESS = "0.5"
HORIZONTAL_BLUR = "1.0"
VERTICAL_BLUR = "0.0"
BLUR_OFFSET = "0.65"
BGR_LCD_PATTERN = "0.0"
SHRINK = "0.0"
SNR = "2.6"
COLOUR_BLEEDING = "0.15"
GRID = "0.30"
SLOTMASK = "1.0"

19
crt/gtuv50.glslp Normal file
View File

@@ -0,0 +1,19 @@
shaders = 3
shader0 = shaders/gtu-v050/pass1.glsl
scale_type0 = source
scale0 = 1.0
float_framebuffer0 = true
shader1 = shaders/gtu-v050/pass2.glsl
scale_type_x1 = viewport
scale_x1 = 1.0
scale_type_y1 = source
scale_y1 = 1.0
filter_linear1 = false
float_framebuffer1 = true
shader2 = shaders/gtu-v050/pass3.glsl
scale_type2 = viewport
scale2 = 1.0
filter_linear2 = false

87
crt/mame_hlsl.glslp Normal file
View File

@@ -0,0 +1,87 @@
# info on how the passes come together can be found in mame/src/osd/modules/render/d3d/d3dhlsl.cpp
shaders = 12
# NTSC emulation doesn't work for some reason; replacing with stock shader
# shader0 = shaders/mame_ntsc.glsl
shader0 = shaders/mame_hlsl/shaders/mame_params.glsl
filter_linear0 = true
alias0 = NTSCPass
scale_type0 = source
scale0 = 1.0
shader1 = shaders/mame_hlsl/shaders/mame_color.glsl
alias1 = ColorPass
scale_type1 = source
scale1 = 1.0
filter_linear1 = true
shader2 = ../interpolation/shaders/sharp-bilinear.glsl
alias2 = PrescalePass
scale_type2 = source
filter_linear2 = true
scale2 = 4.0
shader3 = shaders/mame_hlsl/shaders/mame_deconverge.glsl
alias3 = DeconvergePass
filter_linear3 = true
scale_type3 = source
scale3 = 0.5
shader4 = shaders/mame_hlsl/shaders/mame_scanline.glsl
alias4 = ScanlinePass
filter_linear4 = true
scale_type4 = source
scale4 = 2.0
shader5 = shaders/mame_hlsl/shaders/mame_focus.glsl
alias5 = FocusPass
filter_linear5 = true
shader6 = shaders/mame_hlsl/shaders/mame_phosphor.glsl
alias6 = PhosphorPass
filter_linear6 = true
shader7 = shaders/mame_hlsl/shaders/mame_post.glsl
alias7 = PostPass
filter_linear7 = true
scale_type7 = viewport
shader8 = shaders/mame_hlsl/shaders/mame_chroma.glsl
alias8 = ChromaPass
filter_linear8 = true
scale_type8 = viewport
shader9 = shaders/mame_hlsl/shaders/mame_downsample.glsl
alias9 = DownsamplePass
filter_linear9 = true
shader10 = shaders/mame_hlsl/shaders/mame_bloom.glsl
alias10 = BloomPass
filter_linear10 = true
scale_type10 = source
mipmap_input10 = true
shader11 = shaders/mame_hlsl/shaders/mame_distortion.glsl
alias11 = DistortionPass
filter_linear11 = true
# doesn't work so never actually ported
#shader12 = shaders/mame_hlsl/shaders/mame_vector.glsl
#alias12 = VectorPass
#filter_linear12 = true
# mame's textures are available here: https://github.com/mamedev/mame/tree/master/artwork
textures = "MaskTexture"
MaskTexture = shaders/mame_hlsl/resources/aperture-grille.png
parameters = "AUTO_PRESCALE;chromaa_x;chromaa_y;chromab_x;chromab_y;chromac_x;chromac_y;ygain_r;ygain_g;ygain_b"
chromaa_x = "0.630"
chromaa_y = "0.340"
chromab_x = "0.310"
chromab_y = "0.595"
chromac_x = "0.155"
chromac_y = "0.070"
ygain_r = "0.1875"
ygain_g = "0.6940"
ygain_b = "0.1185"
AUTO_PRESCALE = "0.0"

9
crt/metacrt.glslp Normal file
View File

@@ -0,0 +1,9 @@
shaders = 1
shader0 = shaders/metacrt/bufC.glsl
textures = "cubeMap;table"
cubeMap = shaders/metacrt/basilica.png
cubeMap_wrap_mode = repeat
table = shaders/metacrt/woodgrain.png
table_wrap_mode = repeat

38
crt/phosphorlut.glslp Normal file
View File

@@ -0,0 +1,38 @@
shaders = 5
shader0 = shaders/phosphorlut/scanlines-interlace-linearize.glsl
alias0 = firstPass
scale0 = 2.0
scale_type0 = source
srgb_framebuffer0 = true
filter_linear0 = false
shader1 = ../blurs/shaders/blur-gauss-v.glsl
scale_type1 = source
scale1 = 1.0
srgb_framebuffer1 = true
filter_linear1 = true
alias1 = blurPassV
shader2 = ../blurs/shaders/blur-gauss-h.glsl
alias2 = blurPass
filter_linear2 = true
scale2 = 1.0
scale_type2 = source
srgb_framebuffer2 = true
shader3 = shaders/phosphorlut/phosphorlut-pass0.glsl
alias3 = phosphorPass
filter_linear3 = true
scale_type3 = source
scale_x3 = 4.0
scale_y3 = 2.0
srgb_framebuffer3 = true
shader4 = shaders/phosphorlut/phosphorlut-pass1.glsl
filter_linear4 = true
textures = "shadow;aperture;slot"
shadow = shaders/phosphorlut/luts/shadowmask.png
aperture = shaders/phosphorlut/luts/aperture-grille.png
slot = shaders/phosphorlut/luts/slotmask.png

View File

@@ -0,0 +1,4 @@
shaders = 1
shader0 = shaders/smuberstep-glow.glsl
filter_linear0 = true

View File

@@ -0,0 +1,26 @@
shaders = "2"
shader0 = "shaders/tvout-tweaks-multipass/tvout-tweaks-pass-0.glsl"
float_framebuffer0 = "true"
srgb_framebuffer0 = "true"
scale_type_x0 = "source"
scale_x0 = "1.000000"
scale_type_y0 = "source"
scale_y0 = "1.000000"
shader1 = "shaders/tvout-tweaks-multipass/tvout-tweaks-pass-1.glsl"
float_framebuffer1 = "false"
srgb_framebuffer1 = "false"
scale_type_x1 = "viewport"
scale_x1 = "1.000000"
scale_type_y1 = "source"
scale_y1 = "1.000000"
parameters = "TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS;TVOUT_RESOLUTION;TVOUT_RESOLUTION_Y;TVOUT_RESOLUTION_I;TVOUT_RESOLUTION_Q"
TVOUT_COMPOSITE_CONNECTION = "0.000000"
TVOUT_RESOLUTION = "256.000000"
TVOUT_RESOLUTION_I = "83.199997"
TVOUT_RESOLUTION_Q = "25.600000"
TVOUT_RESOLUTION_Y = "256.000000"
TVOUT_TV_COLOR_LEVELS = "0.000000"

3
crt/yee64.glslp Normal file
View File

@@ -0,0 +1,3 @@
shaders = 1
shader0 = shaders/yee64.glsl

4
crt/yeetron.glslp Normal file
View File

@@ -0,0 +1,4 @@
shaders = 1
shader0 = shaders/yeetron.glsl
filter_linear0 = false

View File

@@ -0,0 +1,3 @@
shaders = "1"
shader0 = "shaders/zfast_crt_composite.glsl"
filter_linear0 = "true"

4
crt/zfast-crt.glslp Normal file
View File

@@ -0,0 +1,4 @@
shaders = 1
shader0 = shaders/zfast_crt.glsl
filter_linear0 = true

9
crt/zfast_crt_geo.glslp Normal file
View File

@@ -0,0 +1,9 @@
shaders = "1"
shader0 = "shaders/zfast_crt_geo.glsl"
filter_linear0 = "true"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = ""
float_framebuffer0 = "false"
srgb_framebuffer0 = "false"

View File

@@ -0,0 +1,9 @@
shaders = "1"
shader0 = "shaders/zfast_crt_geo_svideo.glsl"
filter_linear0 = "true"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = ""
float_framebuffer0 = "false"
srgb_framebuffer0 = "false"

View File

@@ -0,0 +1,9 @@
shaders = "1"
shader0 = "shaders/zfast_crt_nogeo.glsl"
filter_linear0 = "true"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = ""
float_framebuffer0 = "false"
srgb_framebuffer0 = "false"

View File

@@ -0,0 +1,9 @@
shaders = "1"
shader0 = "shaders/zfast_crt_nogeo_svideo.glsl"
filter_linear0 = "true"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = ""
float_framebuffer0 = "false"
srgb_framebuffer0 = "false"

233
crtpi.glsl Normal file
View File

@@ -0,0 +1,233 @@
/*
crt-pi - A Raspberry Pi friendly CRT shader.
Copyright (C) 2015-2016 davej
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.
Notes:
This shader is designed to work well on Raspberry Pi GPUs (i.e. 1080P @ 60Hz on a game with a 4:3 aspect ratio). It pushes the Pi's GPU hard and enabling some features will slow it down so that it is no longer able to match 1080P @ 60Hz. You will need to overclock your Pi to the fastest setting in raspi-config to get the best results from this shader: 'Pi2' for Pi2 and 'Turbo' for original Pi and Pi Zero. Note: Pi2s are slower at running the shader than other Pis, this seems to be down to Pi2s lower maximum memory speed. Pi2s don't quite manage 1080P @ 60Hz - they drop about 1 in 1000 frames. You probably won't notice this, but if you do, try enabling FAKE_GAMMA.
SCANLINES enables scanlines. You'll almost certainly want to use it with MULTISAMPLE to reduce moire effects. SCANLINE_WEIGHT defines how wide scanlines are (it is an inverse value so a higher number = thinner lines). SCANLINE_GAP_BRIGHTNESS defines how dark the gaps between the scan lines are. Darker gaps between scan lines make moire effects more likely.
GAMMA enables gamma correction using the values in INPUT_GAMMA and OUTPUT_GAMMA. FAKE_GAMMA causes it to ignore the values in INPUT_GAMMA and OUTPUT_GAMMA and approximate gamma correction in a way which is faster than true gamma whilst still looking better than having none. You must have GAMMA defined to enable FAKE_GAMMA.
CURVATURE distorts the screen by CURVATURE_X and CURVATURE_Y. Curvature slows things down a lot.
By default the shader uses linear blending horizontally. If you find this too blury, enable SHARPER.
BLOOM_FACTOR controls the increase in width for bright scanlines.
MASK_TYPE defines what, if any, shadow mask to use. MASK_BRIGHTNESS defines how much the mask type darkens the screen.
*/
#pragma parameter CURVATURE_X "Screen curvature - horizontal" 0.10 0.0 1.0 0.01
#pragma parameter CURVATURE_Y "Screen curvature - vertical" 0.15 0.0 1.0 0.01
#pragma parameter MASK_BRIGHTNESS "Mask brightness" 0.70 0.0 1.0 0.01
#pragma parameter SCANLINE_WEIGHT "Scanline weight" 6.0 0.0 15.0 0.1
#pragma parameter SCANLINE_GAP_BRIGHTNESS "Scanline gap brightness" 0.12 0.0 1.0 0.01
#pragma parameter BLOOM_FACTOR "Bloom factor" 1.5 0.0 5.0 0.01
#pragma parameter INPUT_GAMMA "Input gamma" 2.4 0.0 5.0 0.01
#pragma parameter OUTPUT_GAMMA "Output gamma" 2.2 0.0 5.0 0.01
// Haven't put these as parameters as it would slow the code down.
#define SCANLINES
#define MULTISAMPLE
#define GAMMA
//#define FAKE_GAMMA
//#define CURVATURE
//#define SHARPER
// MASK_TYPE: 0 = none, 1 = green/magenta, 2 = trinitron(ish)
#define MASK_TYPE 1
#ifdef GL_ES
#define COMPAT_PRECISION mediump
precision mediump float;
#else
#define COMPAT_PRECISION
#endif
#ifdef PARAMETER_UNIFORM
uniform COMPAT_PRECISION float CURVATURE_X;
uniform COMPAT_PRECISION float CURVATURE_Y;
uniform COMPAT_PRECISION float MASK_BRIGHTNESS;
uniform COMPAT_PRECISION float SCANLINE_WEIGHT;
uniform COMPAT_PRECISION float SCANLINE_GAP_BRIGHTNESS;
uniform COMPAT_PRECISION float BLOOM_FACTOR;
uniform COMPAT_PRECISION float INPUT_GAMMA;
uniform COMPAT_PRECISION float OUTPUT_GAMMA;
#else
#define CURVATURE_X 0.10
#define CURVATURE_Y 0.25
#define MASK_BRIGHTNESS 0.70
#define SCANLINE_WEIGHT 6.0
#define SCANLINE_GAP_BRIGHTNESS 0.12
#define BLOOM_FACTOR 1.5
#define INPUT_GAMMA 2.4
#define OUTPUT_GAMMA 2.2
#endif
/* COMPATIBILITY
- GLSL compilers
*/
uniform vec2 TextureSize;
#if defined(CURVATURE)
varying vec2 screenScale;
#endif
varying vec2 TEX0;
varying float filterWidth;
#if defined(VERTEX)
uniform mat4 MVPMatrix;
attribute vec4 VertexCoord;
attribute vec2 TexCoord;
uniform vec2 InputSize;
uniform vec2 OutputSize;
void main()
{
#if defined(CURVATURE)
screenScale = TextureSize / InputSize;
#endif
filterWidth = (InputSize.y / OutputSize.y) / 3.0;
TEX0 = TexCoord*1.0001;
gl_Position = MVPMatrix * VertexCoord;
}
#elif defined(FRAGMENT)
uniform sampler2D Texture;
#if defined(CURVATURE)
vec2 Distort(vec2 coord)
{
vec2 CURVATURE_DISTORTION = vec2(CURVATURE_X, CURVATURE_Y);
// Barrel distortion shrinks the display area a bit, this will allow us to counteract that.
vec2 barrelScale = 1.0 - (0.23 * CURVATURE_DISTORTION);
coord *= screenScale;
coord -= vec2(0.5);
float rsq = coord.x * coord.x + coord.y * coord.y;
coord += coord * (CURVATURE_DISTORTION * rsq);
coord *= barrelScale;
if (abs(coord.x) >= 0.5 || abs(coord.y) >= 0.5)
coord = vec2(-1.0); // If out of bounds, return an invalid value.
else
{
coord += vec2(0.5);
coord /= screenScale;
}
return coord;
}
#endif
float CalcScanLineWeight(float dist)
{
return max(1.0-dist*dist*SCANLINE_WEIGHT, SCANLINE_GAP_BRIGHTNESS);
}
float CalcScanLine(float dy)
{
float scanLineWeight = CalcScanLineWeight(dy);
#if defined(MULTISAMPLE)
scanLineWeight += CalcScanLineWeight(dy-filterWidth);
scanLineWeight += CalcScanLineWeight(dy+filterWidth);
scanLineWeight *= 0.3333333;
#endif
return scanLineWeight;
}
void main()
{
#if defined(CURVATURE)
vec2 texcoord = Distort(TEX0);
if (texcoord.x < 0.0)
gl_FragColor = vec4(0.0);
else
#else
vec2 texcoord = TEX0;
#endif
{
vec2 texcoordInPixels = texcoord * TextureSize;
#if defined(SHARPER)
vec2 tempCoord = floor(texcoordInPixels) + 0.5;
vec2 coord = tempCoord / TextureSize;
vec2 deltas = texcoordInPixels - tempCoord;
float scanLineWeight = CalcScanLine(deltas.y);
vec2 signs = sign(deltas);
deltas.x *= 2.0;
deltas = deltas * deltas;
deltas.y = deltas.y * deltas.y;
deltas.x *= 0.5;
deltas.y *= 8.0;
deltas /= TextureSize;
deltas *= signs;
vec2 tc = coord + deltas;
#else
float tempY = floor(texcoordInPixels.y) + 0.5;
float yCoord = tempY / TextureSize.y;
float dy = texcoordInPixels.y - tempY;
float scanLineWeight = CalcScanLine(dy);
float signY = sign(dy);
dy = dy * dy;
dy = dy * dy;
dy *= 8.0;
dy /= TextureSize.y;
dy *= signY;
vec2 tc = vec2(texcoord.x, yCoord + dy);
#endif
vec3 colour = texture2D(Texture, tc).rgb;
#if defined(SCANLINES)
#if defined(GAMMA)
#if defined(FAKE_GAMMA)
colour = colour * colour;
#else
colour = pow(colour, vec3(INPUT_GAMMA));
#endif
#endif
scanLineWeight *= BLOOM_FACTOR;
colour *= scanLineWeight;
#if defined(GAMMA)
#if defined(FAKE_GAMMA)
colour = sqrt(colour);
#else
colour = pow(colour, vec3(1.0/OUTPUT_GAMMA));
#endif
#endif
#endif
#if MASK_TYPE == 0
gl_FragColor = vec4(colour, 1.0);
#else
#if MASK_TYPE == 1
float whichMask = fract((gl_FragCoord.x*1.0001) * 0.5);
vec3 mask;
if (whichMask < 0.5)
mask = vec3(MASK_BRIGHTNESS, 1.0, MASK_BRIGHTNESS);
else
mask = vec3(1.0, MASK_BRIGHTNESS, 1.0);
#elif MASK_TYPE == 2
float whichMask = fract((gl_FragCoord.x*1.0001) * 0.3333333);
vec3 mask = vec3(MASK_BRIGHTNESS, MASK_BRIGHTNESS, MASK_BRIGHTNESS);
if (whichMask < 0.3333333)
mask.x = 1.0;
else if (whichMask < 0.6666666)
mask.y = 1.0;
else
mask.z = 1.0;
#endif
gl_FragColor = vec4(colour * mask, 1.0);
#endif
}
}
#endif

View File

@@ -117,6 +117,10 @@ GLuint compileProgram(const char* vtxFile, const char* fragFile) {
std::ifstream f(vtxFile);
std::string source((std::istreambuf_iterator<char>(f)),
std::istreambuf_iterator<char>());
/*const char *sources[2] = { "#define VERTEX\n", source.c_str() };
glShaderSourceARB(shader, 2, sources, NULL);*/
vtxShaderId = compileShader(source.c_str(), GL_VERTEX_SHADER);
f=std::ifstream(fragFile);
@@ -212,6 +216,15 @@ void initializeFileSystem() {
#endif
int main(int argc, char **argv){
if (argc < 2) {
std::cerr << "Uso: shaders [vertex shader] [fragment shader]" << "\n";
std::cerr << " shaders [unique shader]" << "\n";
return 1;
}
char *vertex_shader = argv[1];
char *fragment_shader = argc<3 ? vertex_shader : argv[2];
GLuint programId;
#ifdef __APPLE__
@@ -245,7 +258,7 @@ int main(int argc, char **argv){
}
#endif
// Compilar el shader y dejarlo listo para usar.
programId = compileProgram("std.vertex", "crt.fragment");
programId = compileProgram(vertex_shader, fragment_shader);
std::cout << "programId = " << programId << std::endl;
}