Fixed phosphor gamut being applied when sRGB colour space is used Reorganised shader parameters to be more intuitive Moved base crt-sony-megatron.slngp into the shader directory to edge users away from using it directly Passed in texcoord to functions Added vertical center, vertical size, horizontal center, horizontal size, pin phase, pin amp Added gamm_correct.h for easier integration

This commit is contained in:
MajorPainTheCactus 2022-04-09 21:48:02 +01:00
parent 9520a6c10e
commit 372ef75e5c
17 changed files with 117 additions and 81 deletions

View file

@ -1,4 +1,4 @@
#reference "crt-sony-megatron.slangp" #reference "shaders/crt-sony-megatron.slangp"
hcrt_hdr = "1.000000" hcrt_hdr = "1.000000"
hcrt_crt_screen_type = "2.000000" hcrt_crt_screen_type = "2.000000"

View file

@ -1,4 +1,4 @@
#reference "crt-sony-megatron.slangp" #reference "shaders/crt-sony-megatron.slangp"
hcrt_hdr = "1.000000" hcrt_hdr = "1.000000"
hcrt_crt_screen_type = "2.000000" hcrt_crt_screen_type = "2.000000"

View file

@ -1,4 +1,4 @@
#reference "crt-sony-megatron.slangp" #reference "shaders/crt-sony-megatron.slangp"
hcrt_hdr = "1.000000" hcrt_hdr = "1.000000"
hcrt_paper_white_nits = "700.000000" hcrt_paper_white_nits = "700.000000"

View file

@ -1,4 +1,4 @@
#reference "crt-sony-megatron.slangp" #reference "shaders/crt-sony-megatron.slangp"
hcrt_hdr = "1.000000" hcrt_hdr = "1.000000"
hcrt_crt_screen_type = "2.000000" hcrt_crt_screen_type = "2.000000"

View file

@ -1,4 +1,4 @@
#reference "crt-sony-megatron.slangp" #reference "shaders/crt-sony-megatron.slangp"
hcrt_hdr = "1.000000" hcrt_hdr = "1.000000"
hcrt_crt_screen_type = "2.000000" hcrt_crt_screen_type = "2.000000"

View file

@ -1,4 +1,4 @@
#reference "crt-sony-megatron.slangp" #reference "shaders/crt-sony-megatron.slangp"
hcrt_hdr = "1.000000" hcrt_hdr = "1.000000"
hcrt_crt_resolution = "0.000000" hcrt_crt_resolution = "0.000000"

View file

@ -1,4 +1,4 @@
#reference "crt-sony-megatron.slangp" #reference "shaders/crt-sony-megatron.slangp"
hcrt_hdr = "1.000000" hcrt_hdr = "1.000000"
hcrt_brightness = "0.150000" hcrt_brightness = "0.150000"

View file

@ -1,4 +1,4 @@
#reference "crt-sony-megatron.slangp" #reference "shaders/crt-sony-megatron.slangp"
hcrt_hdr = "1.000000" hcrt_hdr = "1.000000"
hcrt_brightness = "0.150000" hcrt_brightness = "0.150000"

View file

@ -1,4 +1,4 @@
#reference "crt-sony-megatron.slangp" #reference "shaders/crt-sony-megatron.slangp"
hcrt_hdr = "1.000000" hcrt_hdr = "1.000000"
hcrt_crt_screen_type = "1.000000" hcrt_crt_screen_type = "1.000000"

View file

@ -1,4 +1,4 @@
#reference "crt-sony-megatron.slangp" #reference "shaders/crt-sony-megatron.slangp"
hcrt_hdr = "1.000000" hcrt_hdr = "1.000000"
hcrt_crt_screen_type = "1.000000" hcrt_crt_screen_type = "1.000000"

View file

@ -25,6 +25,8 @@ THIS SHADER DOES NOT SUPPORT WRGB OLED (Due to the sub pixel layout of WRGB - RG
layout(push_constant) uniform Push layout(push_constant) uniform Push
{ {
float hcrt_hdr;
float hcrt_colour_space;
float hcrt_max_nits; float hcrt_max_nits;
float hcrt_paper_white_nits; float hcrt_paper_white_nits;
float hcrt_lcd_resolution; float hcrt_lcd_resolution;
@ -49,6 +51,8 @@ layout(std140, set = 0, binding = 0) uniform UBO
#include "include/parameters.h" #include "include/parameters.h"
#define HCRT_HDR params.hcrt_hdr
#define HCRT_OUTPUT_COLOUR_SPACE params.hcrt_colour_space
#define HCRT_CRT_COLOUR_SYSTEM params.hcrt_colour_system #define HCRT_CRT_COLOUR_SYSTEM params.hcrt_colour_system
#define HCRT_WHITE_TEMPERATURE params.hcrt_white_temperature #define HCRT_WHITE_TEMPERATURE params.hcrt_white_temperature
#define HCRT_BRIGHTNESS params.hcrt_brightness #define HCRT_BRIGHTNESS params.hcrt_brightness

View file

@ -77,6 +77,13 @@ layout(std140, set = 0, binding = 0) uniform UBO
vec4 OriginalSize; vec4 OriginalSize;
vec4 OutputSize; vec4 OutputSize;
uint FrameCount; uint FrameCount;
float hcrt_h_size;
float hcrt_v_size;
float hcrt_h_cent;
float hcrt_v_cent;
float hcrt_pin_phase;
float hcrt_pin_amp;
} global; } global;
#include "include/parameters.h" #include "include/parameters.h"
@ -117,6 +124,13 @@ layout(std140, set = 0, binding = 0) uniform UBO
#define HCRT_BLUE_BEAM_SHARPNESS params.hcrt_blue_beam_sharpness #define HCRT_BLUE_BEAM_SHARPNESS params.hcrt_blue_beam_sharpness
#define HCRT_BLUE_BEAM_ATTACK params.hcrt_blue_beam_attack #define HCRT_BLUE_BEAM_ATTACK params.hcrt_blue_beam_attack
#define HCRT_H_SIZE global.hcrt_h_size
#define HCRT_V_SIZE global.hcrt_v_size
#define HCRT_H_CENT global.hcrt_h_cent
#define HCRT_V_CENT global.hcrt_v_cent
#define HCRT_PIN_PHASE global.hcrt_pin_phase
#define HCRT_PIN_AMP global.hcrt_pin_amp
#define COMPAT_TEXTURE(c, d) texture(c, d) #define COMPAT_TEXTURE(c, d) texture(c, d)
#pragma stage vertex #pragma stage vertex
@ -393,44 +407,7 @@ const uint kBlackWhiteMasks[kResolutionAxis][kTVLAxis][kBGRAxis][kMaxBlackWhiteS
#include "include/scanline_generation.h" #include "include/scanline_generation.h"
#include "include/hdr10.h" #include "include/hdr10.h"
#include "include/gamma_correct.h"
// SDR Colour output spaces
float sRGBToLinear_1(const float channel)
{
return (channel > 0.04045f) ? pow((channel + 0.055f) * (1.0f / 1.055f), 2.4f + HCRT_GAMMA) : channel * (1.0f / 12.92f);
}
vec3 sRGBToLinear(const vec3 colour)
{
return vec3(sRGBToLinear_1(colour.r), sRGBToLinear_1(colour.g), sRGBToLinear_1(colour.b));
}
float LinearTosRGB_1(const float channel)
{
return (channel > 0.0031308f) ? (1.055f * pow(channel, 1.0f / 2.4f)) - 0.055f : channel * 12.92f;
}
vec3 LinearTosRGB(const vec3 colour)
{
return vec3(LinearTosRGB_1(colour.r), LinearTosRGB_1(colour.g), LinearTosRGB_1(colour.b));
}
vec3 LinearToDCIP3(const vec3 colour)
{
return pow(colour, vec3(1.0f / 2.6f));
}
vec3 GammaCorrect(const vec3 scanline_colour)
{
if(HCRT_HDR < 1.0f)
{
return HCRT_OUTPUT_COLOUR_SPACE == 0.0f ? LinearTosRGB(scanline_colour) : LinearToDCIP3(scanline_colour);
}
else
{
return Hdr10(scanline_colour, HCRT_PAPER_WHITE_NITS, HCRT_EXPAND_GAMUT);
}
}
void main() void main()
{ {
@ -439,6 +416,12 @@ void main()
const uint lcd_resolution = uint(HCRT_LCD_RESOLUTION); const uint lcd_resolution = uint(HCRT_LCD_RESOLUTION);
const uint lcd_subpixel_layout = uint(HCRT_LCD_SUBPIXEL); const uint lcd_subpixel_layout = uint(HCRT_LCD_SUBPIXEL);
vec2 tex_coord = vTexCoord - vec2(0.5f);
tex_coord = tex_coord * vec2(1.0f + (HCRT_PIN_PHASE * tex_coord.y), 1.0f);
tex_coord = tex_coord * vec2(HCRT_H_SIZE, HCRT_V_SIZE);
tex_coord = tex_coord + vec2(0.5f);
tex_coord = tex_coord + (vec2(HCRT_H_CENT, HCRT_V_CENT) / global.OutputSize.xy);
const vec2 current_position = vTexCoord * global.OutputSize.xy; const vec2 current_position = vTexCoord * global.OutputSize.xy;
uint colour_mask; uint colour_mask;
@ -506,7 +489,8 @@ void main()
{ {
const uint channel_0 = (colour_mask >> kFirstChannelShift) & 3; const uint channel_0 = (colour_mask >> kFirstChannelShift) & 3;
const float scanline_channel_0 = GenerateScanline(channel_0, const float scanline_channel_0 = GenerateScanline( channel_0,
tex_coord,
global.SourceSize.xy, global.SourceSize.xy,
scanline_size, scanline_size,
horizontal_convergence[channel_0], horizontal_convergence[channel_0],
@ -525,6 +509,7 @@ void main()
const uint channel_1 = (colour_mask >> kSecondChannelShift) & 3; const uint channel_1 = (colour_mask >> kSecondChannelShift) & 3;
const float scanline_channel_1 = GenerateScanline(channel_1, const float scanline_channel_1 = GenerateScanline(channel_1,
tex_coord,
global.SourceSize.xy, global.SourceSize.xy,
scanline_size, scanline_size,
horizontal_convergence[channel_1], horizontal_convergence[channel_1],
@ -543,6 +528,7 @@ void main()
const uint channel_2 = (colour_mask >> kThirdChannelShift) & 3; const uint channel_2 = (colour_mask >> kThirdChannelShift) & 3;
const float scanline_channel_2 = GenerateScanline(channel_2, const float scanline_channel_2 = GenerateScanline(channel_2,
tex_coord,
global.SourceSize.xy, global.SourceSize.xy,
scanline_size, scanline_size,
horizontal_convergence[channel_2], horizontal_convergence[channel_2],

View file

@ -29,7 +29,7 @@ DONT USE THIS PRESET DIRECTLY - Use any of the others in this directory
shaders = "3" shaders = "3"
feedback_pass = "0" feedback_pass = "0"
shader0 = "shaders/crt-sony-megatron-source-pass.slang" shader0 = "crt-sony-megatron-source-pass.slang"
filter_linear0 = "false" filter_linear0 = "false"
scale_type0 = "source" scale_type0 = "source"
scale0 = "1.0" scale0 = "1.0"
@ -37,7 +37,7 @@ wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false" mipmap_input0 = "false"
alias0 = "SourceSDR" alias0 = "SourceSDR"
shader1 = "shaders/crt-sony-megatron-hdr-pass.slang" shader1 = "crt-sony-megatron-hdr-pass.slang"
filter_linear1 = "false" filter_linear1 = "false"
scale_type1 = "source" scale_type1 = "source"
scale1 = "1.0" scale1 = "1.0"
@ -45,7 +45,7 @@ wrap_mode1 = "clamp_to_border"
mipmap_input1 = "false" mipmap_input1 = "false"
alias1 = "SourceHDR" alias1 = "SourceHDR"
shader2 = "shaders/crt-sony-megatron.slang" shader2 = "crt-sony-megatron.slang"
filter_linear2 = "false" filter_linear2 = "false"
wrap_mode2 = "clamp_to_border" wrap_mode2 = "clamp_to_border"
mipmap_input2 = "false" mipmap_input2 = "false"

View file

@ -217,7 +217,7 @@ vec3 ColourGrade(const vec3 colour)
const vec3 graded = BrightnessContrastSaturation(linear); const vec3 graded = BrightnessContrastSaturation(linear);
const vec3 gamut = kPhosphorGamut[colour_system] * graded; const vec3 gamut = (HCRT_HDR == 0.0f) && (HCRT_OUTPUT_COLOUR_SPACE == 0.0f) ? graded : kPhosphorGamut[colour_system] * graded;
const vec3 white_point = WhiteBalance(kTemperatures[colour_system] + HCRT_WHITE_TEMPERATURE, gamut); const vec3 white_point = WhiteBalance(kTemperatures[colour_system] + HCRT_WHITE_TEMPERATURE, gamut);

View file

@ -0,0 +1,37 @@
// SDR Colour output spaces
float sRGBToLinear_1(const float channel)
{
return (channel > 0.04045f) ? pow((channel + 0.055f) * (1.0f / 1.055f), 2.4f + HCRT_GAMMA) : channel * (1.0f / 12.92f);
}
vec3 sRGBToLinear(const vec3 colour)
{
return vec3(sRGBToLinear_1(colour.r), sRGBToLinear_1(colour.g), sRGBToLinear_1(colour.b));
}
float LinearTosRGB_1(const float channel)
{
return (channel > 0.0031308f) ? (1.055f * pow(channel, 1.0f / 2.4f)) - 0.055f : channel * 12.92f;
}
vec3 LinearTosRGB(const vec3 colour)
{
return vec3(LinearTosRGB_1(colour.r), LinearTosRGB_1(colour.g), LinearTosRGB_1(colour.b));
}
vec3 LinearToDCIP3(const vec3 colour)
{
return pow(colour, vec3(1.0f / 2.6f));
}
vec3 GammaCorrect(const vec3 scanline_colour)
{
if(HCRT_HDR < 1.0f)
{
return HCRT_OUTPUT_COLOUR_SPACE == 0.0f ? LinearTosRGB(scanline_colour) : LinearToDCIP3(scanline_colour);
}
else
{
return Hdr10(scanline_colour, HCRT_PAPER_WHITE_NITS, HCRT_EXPAND_GAMUT);
}
}

View file

@ -1,38 +1,38 @@
#pragma parameter hcrt_title "SONY MEGATRON COLOUR VIDEO MONITOR" 0.0 0.0 0.0001 0.0 #pragma parameter hcrt_title "SONY MEGATRON COLOUR VIDEO MONITOR" 0.0 0.0 0.0001 0.0001
#pragma parameter hcrt_space0 " " 0.0 0.0 0.0001 0.0 #pragma parameter hcrt_space0 " " 0.0 0.0 0.0001 0.0001
#pragma parameter hcrt_support0 "SDR mode: Turn up your TV's brightness as high as possible" 0.0 0.0 0.0001 0.0 #pragma parameter hcrt_support0 "SDR mode: Turn up your TV's brightness as high as possible" 0.0 0.0 0.0001 0.0001
#pragma parameter hcrt_support1 "HDR mode: Set the peak luminance to that of your TV." 0.0 0.0 0.0001 0.0 #pragma parameter hcrt_support1 "HDR mode: Set the peak luminance to that of your TV." 0.0 0.0 0.0001 0.0001
#pragma parameter hcrt_support2 "Then adjust paper white luminance until it looks right" 0.0 0.0 0.0001 0.0 #pragma parameter hcrt_support2 "Then adjust paper white luminance until it looks right" 0.0 0.0 0.0001 0.0001
#pragma parameter hcrt_space1 " " 0.0 0.0 0.0001 0.0 #pragma parameter hcrt_space1 " " 0.0 0.0 0.0001 0.0001
#pragma parameter hcrt_user_settings "USER SETTINGS:" 0.0 0.0 0.0001 0.0 #pragma parameter hcrt_user_settings "YOUR DISPLAY SETTINGS:" 0.0 0.0 0.0001 0.0001
#pragma parameter hcrt_hdr " SDR | HDR" 1.0 0.0 1.0 1.0 #pragma parameter hcrt_hdr " SDR | HDR" 1.0 0.0 1.0 1.0
#pragma parameter hcrt_colour_space " SDR: Display's Colour Space: sRGB | DCI-P3" 0.0 0.0 1.0 1.0
#pragma parameter hcrt_max_nits " HDR: Display's Peak Luminance" 700.0 0.0 10000.0 10.0 #pragma parameter hcrt_max_nits " HDR: Display's Peak Luminance" 700.0 0.0 10000.0 10.0
#pragma parameter hcrt_paper_white_nits " HDR: Display's Paper White Luminance" 700.0 0.0 10000.0 10.0 #pragma parameter hcrt_paper_white_nits " HDR: Display's Paper White Luminance" 700.0 0.0 10000.0 10.0
#pragma parameter hcrt_colour_space " SDR: Display's Colour Space: sRGB | DCI-P3" 0.0 0.0 1.0 1.0 #pragma parameter hcrt_expand_gamut " HDR: Original/Vivid" 0.0 0.0 1.0 1.0
#pragma parameter hcrt_lcd_resolution " Display's Resolution: 4K | 8K" 0.0 0.0 1.0 1.0 #pragma parameter hcrt_lcd_resolution " Display's Resolution: 4K | 8K" 0.0 0.0 1.0 1.0
#pragma parameter hcrt_lcd_subpixel " Display's Subpixel Layout: RGB | BGR" 0.0 0.0 1.0 1.0 #pragma parameter hcrt_lcd_subpixel " Display's Subpixel Layout: RGB | BGR" 0.0 0.0 1.0 1.0
#pragma parameter hcrt_red_vertical_convergence " Red Vertical Convergence" 0.00 -10.0 10.0 0.01 #pragma parameter hcrt_space2 " " 0.0 0.0 0.0001 0.0001
#pragma parameter hcrt_green_vertical_convergence " Green Vertical Convergence" 0.00 -10.0 10.0 0.01 #pragma parameter hcrt_developer_settings "CRT SETTINGS:" 0.0 0.0 0.0001 0.0001
#pragma parameter hcrt_blue_vertical_convergence " Blue Vertical Convergence" 0.00 -10.0 10.0 0.01 #pragma parameter hcrt_crt_screen_type " Screen Type: APERTURE GRILLE | SHADOW MASK | SLOT MASK" 0.0 0.0 3.0 1.0
#pragma parameter hcrt_red_horizontal_convergence " Red Horizontal Convergence" 0.00 -10.0 10.0 0.01 #pragma parameter hcrt_crt_resolution " Resolution: 300TVL | 600TVL | 800TVL | 1000TVL" 1.0 0.0 3.0 1.0
#pragma parameter hcrt_green_horizontal_convergence " Green Horizontal Convergence" 0.00 -10.0 10.0 0.01 #pragma parameter hcrt_colour_system " Colour System: PAL 6500K | NTSC-U 6500K | NTSC-J 9300K" 1.0 0.0 2.0 1.0
#pragma parameter hcrt_blue_horizontal_convergence " Blue Horizontal Convergence" 0.00 -10.0 10.0 0.01 #pragma parameter hcrt_white_temperature " White Temperature Offset (Kelvin)" 0.0 -5000.0 12000.0 100.0
#pragma parameter hcrt_space3 " " 0.0 0.0 0.0001 0.0
#pragma parameter hcrt_developer_settings "DEVELOPER SETTINGS:" 0.0 0.0 0.0001 0.0
#pragma parameter hcrt_crt_screen_type " CRT Type: APERTURE GRILLE | SHADOW MASK | SLOT MASK" 0.0 0.0 3.0 1.0
#pragma parameter hcrt_crt_resolution " CRT Resolution: 300TVL | 600TVL | 800TVL | 1000TVL" 1.0 0.0 3.0 1.0
#pragma parameter hcrt_colour_system " CRT Colour System: PAL | NTSC-U | NTSC-J" 1.0 0.0 2.0 1.0
#pragma parameter hcrt_white_temperature " White Point: (PAL:D65, NTSC-U:D65, NTSC-J:D93)" 0.0 -5000.0 12000.0 100.0
#pragma parameter hcrt_expand_gamut " HDR: Original/Vivid" 0.0 0.0 1.0 1.0
#pragma parameter hcrt_brightness " Brightness" 0.0 -1.0 1.0 0.01 #pragma parameter hcrt_brightness " Brightness" 0.0 -1.0 1.0 0.01
#pragma parameter hcrt_contrast " Contrast" 0.0 -1.0 1.0 0.01 #pragma parameter hcrt_contrast " Contrast" 0.0 -1.0 1.0 0.01
#pragma parameter hcrt_saturation " Saturation" 0.0 -1.0 1.0 0.01 #pragma parameter hcrt_saturation " Saturation" 0.0 -1.0 1.0 0.01
#pragma parameter hcrt_gamma " Gamma" 0.0 -1.0 1.0 0.01 #pragma parameter hcrt_gamma " Gamma" 0.0 -1.0 1.0 0.01
#pragma parameter hcrt_pin_phase " Pin Phase" 0.00 -0.2 0.2 0.01
#pragma parameter hcrt_developer_settings0 " VERTICAL SETTINGS:" 0.0 0.0 0.0001 0.0 #pragma parameter hcrt_pin_amp " Pin Amp" 0.00 -0.2 0.2 0.01
#pragma parameter hcrt_space3 " " 0.0 0.0 0.0001 0.0001
#pragma parameter hcrt_developer_settings0 " VERTICAL SETTINGS:" 0.0 0.0 0.0001 0.0001
#pragma parameter hcrt_v_size " Vertical Size" 1.00 0.8 1.2 0.01
#pragma parameter hcrt_v_cent " Vertical Center" 0.00 -200.0 200.0 1.0
#pragma parameter hcrt_red_vertical_convergence " Red Vertical Deconvergence" 0.00 -10.0 10.0 0.01
#pragma parameter hcrt_green_vertical_convergence " Green Vertical Deconvergence" 0.00 -10.0 10.0 0.01
#pragma parameter hcrt_blue_vertical_convergence " Blue Vertical Deconvergence" 0.00 -10.0 10.0 0.01
#pragma parameter hcrt_red_scanline_min " Red Scanline Min" 0.50 0.0 2.0 0.01 #pragma parameter hcrt_red_scanline_min " Red Scanline Min" 0.50 0.0 2.0 0.01
#pragma parameter hcrt_red_scanline_max " Red Scanline Max" 1.00 0.0 2.0 0.01 #pragma parameter hcrt_red_scanline_max " Red Scanline Max" 1.00 0.0 2.0 0.01
#pragma parameter hcrt_red_scanline_attack " Red Scanline Attack" 0.20 0.0 1.0 0.01 #pragma parameter hcrt_red_scanline_attack " Red Scanline Attack" 0.20 0.0 1.0 0.01
@ -42,7 +42,13 @@
#pragma parameter hcrt_blue_scanline_min " Blue Scanline Min" 0.50 0.0 2.0 0.01 #pragma parameter hcrt_blue_scanline_min " Blue Scanline Min" 0.50 0.0 2.0 0.01
#pragma parameter hcrt_blue_scanline_max " Blue Scanline Max" 1.00 0.0 2.0 0.01 #pragma parameter hcrt_blue_scanline_max " Blue Scanline Max" 1.00 0.0 2.0 0.01
#pragma parameter hcrt_blue_scanline_attack " Blue Scanline Attack" 0.20 0.0 1.0 0.01 #pragma parameter hcrt_blue_scanline_attack " Blue Scanline Attack" 0.20 0.0 1.0 0.01
#pragma parameter hcrt_developer_settings1 " HORIZONTAL SETTINGS:" 0.0 0.0 0.0001 0.0 #pragma parameter hcrt_space4 " " 0.0 0.0 0.0001 0.0001
#pragma parameter hcrt_developer_settings1 " HORIZONTAL SETTINGS:" 0.0 0.0 0.0001 0.0001
#pragma parameter hcrt_h_size " Horizontal Size" 1.00 0.8 1.2 0.01
#pragma parameter hcrt_h_cent " Horizontal Center" 0.00 -200.0 200.0 1.0
#pragma parameter hcrt_red_horizontal_convergence " Red Horizontal Deconvergence" 0.00 -10.0 10.0 0.01
#pragma parameter hcrt_green_horizontal_convergence " Green Horizontal Deconvergence" 0.00 -10.0 10.0 0.01
#pragma parameter hcrt_blue_horizontal_convergence " Blue Horizontal Deconvergence" 0.00 -10.0 10.0 0.01
#pragma parameter hcrt_red_beam_sharpness " Red Beam Sharpness" 1.75 0.0 5.0 0.05 #pragma parameter hcrt_red_beam_sharpness " Red Beam Sharpness" 1.75 0.0 5.0 0.05
#pragma parameter hcrt_red_beam_attack " Red Beam Attack" 0.50 0.0 2.0 0.01 #pragma parameter hcrt_red_beam_attack " Red Beam Attack" 0.50 0.0 2.0 0.01
#pragma parameter hcrt_green_beam_sharpness " Green Beam Sharpness" 1.75 0.0 5.0 0.05 #pragma parameter hcrt_green_beam_sharpness " Green Beam Sharpness" 1.75 0.0 5.0 0.05
@ -50,4 +56,3 @@
#pragma parameter hcrt_blue_beam_sharpness " Blue Beam Sharpness" 1.75 0.0 5.0 0.05 #pragma parameter hcrt_blue_beam_sharpness " Blue Beam Sharpness" 1.75 0.0 5.0 0.05
#pragma parameter hcrt_blue_beam_attack " Blue Beam Attack" 0.50 0.0 2.0 0.01 #pragma parameter hcrt_blue_beam_attack " Blue Beam Attack" 0.50 0.0 2.0 0.01

View file

@ -29,6 +29,7 @@ vec4 BeamControlPoints(const float beam_attack, const bool falloff)
} }
float ScanlineColour(const uint channel, float ScanlineColour(const uint channel,
const vec2 tex_coord,
const vec2 source_size, const vec2 source_size,
const float scanline_size, const float scanline_size,
const float source_tex_coord_x, const float source_tex_coord_x,
@ -40,7 +41,7 @@ float ScanlineColour(const uint channel,
const float scanline_attack, const float scanline_attack,
inout float next_prev) inout float next_prev)
{ {
const float current_source_position_y = ((vTexCoord.y * source_size.y) - vertical_convergence) + next_prev; const float current_source_position_y = ((tex_coord.y * source_size.y) - vertical_convergence) + next_prev;
const float current_source_center_y = floor(current_source_position_y) + 0.5f; const float current_source_center_y = floor(current_source_position_y) + 0.5f;
const float source_tex_coord_y = current_source_center_y / source_size.y; const float source_tex_coord_y = current_source_center_y / source_size.y;
@ -79,6 +80,7 @@ float ScanlineColour(const uint channel,
} }
float GenerateScanline( const uint channel, float GenerateScanline( const uint channel,
const vec2 tex_coord,
const vec2 source_size, const vec2 source_size,
const float scanline_size, const float scanline_size,
const float horizontal_convergence, const float horizontal_convergence,
@ -89,7 +91,7 @@ float GenerateScanline( const uint channel,
const float scanline_max, const float scanline_max,
const float scanline_attack) const float scanline_attack)
{ {
const float current_source_position_x = (vTexCoord.x * source_size.x) - horizontal_convergence; const float current_source_position_x = (tex_coord.x * source_size.x) - horizontal_convergence;
const float current_source_center_x = floor(current_source_position_x) + 0.5f; const float current_source_center_x = floor(current_source_position_x) + 0.5f;
const float source_tex_coord_x = current_source_center_x / source_size.x; const float source_tex_coord_x = current_source_center_x / source_size.x;
@ -101,6 +103,7 @@ float GenerateScanline( const uint channel,
float next_prev = 0.0f; float next_prev = 0.0f;
const float scanline_colour0 = ScanlineColour( channel, const float scanline_colour0 = ScanlineColour( channel,
tex_coord,
source_size, source_size,
scanline_size, scanline_size,
source_tex_coord_x, source_tex_coord_x,
@ -117,6 +120,7 @@ float GenerateScanline( const uint channel,
if(scanline_max > 1.0f) if(scanline_max > 1.0f)
{ {
scanline_colour1 = ScanlineColour( channel, scanline_colour1 = ScanlineColour( channel,
tex_coord,
source_size, source_size,
scanline_size, scanline_size,
source_tex_coord_x, source_tex_coord_x,