mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-23 00:01:31 +11:00
add some royale parameters
This commit is contained in:
parent
ae8692aa04
commit
abda62a6aa
|
@ -116,15 +116,15 @@ void main()
|
||||||
brightpass_tex_uv).rgb;
|
brightpass_tex_uv).rgb;
|
||||||
const vec3 dimpass = intensity_dim - brightpass;
|
const vec3 dimpass = intensity_dim - brightpass;
|
||||||
const vec3 phosphor_bloom = (dimpass + blurred_brightpass) *
|
const vec3 phosphor_bloom = (dimpass + blurred_brightpass) *
|
||||||
mask_amplify * undim_factor * levels_contrast;
|
mask_amplify * undim_factor * params.levels_contrast;
|
||||||
|
|
||||||
// Sample the halation texture, and let some light bleed into refractive
|
// Sample the halation texture, and let some light bleed into refractive
|
||||||
// diffusion. Conceptually this occurs before the phosphor bloom, but
|
// diffusion. Conceptually this occurs before the phosphor bloom, but
|
||||||
// adding it in earlier passes causes black crush in the diffusion colors.
|
// adding it in earlier passes causes black crush in the diffusion colors.
|
||||||
const vec3 diffusion_color = levels_contrast * tex2D_linearize(
|
const vec3 diffusion_color = params.levels_contrast * tex2D_linearize(
|
||||||
HALATION_BLUR, halation_tex_uv).rgb;
|
HALATION_BLUR, halation_tex_uv).rgb;
|
||||||
const vec3 final_bloom = mix(phosphor_bloom,
|
const vec3 final_bloom = mix(phosphor_bloom,
|
||||||
diffusion_color, diffusion_weight);
|
diffusion_color, params.diffusion_weight);
|
||||||
|
|
||||||
// Encode and output the bloomed image:
|
// Encode and output the bloomed image:
|
||||||
FragColor = encode_output(vec4(final_bloom, 1.0));
|
FragColor = encode_output(vec4(final_bloom, 1.0));
|
||||||
|
|
|
@ -92,12 +92,12 @@ void main()
|
||||||
const float undim_factor = 1.0/auto_dim_factor;
|
const float undim_factor = 1.0/auto_dim_factor;
|
||||||
const float mask_amplify = get_mask_amplify();
|
const float mask_amplify = get_mask_amplify();
|
||||||
const vec3 intensity = intensity_dim * undim_factor * mask_amplify *
|
const vec3 intensity = intensity_dim * undim_factor * mask_amplify *
|
||||||
levels_contrast;
|
params.levels_contrast;
|
||||||
|
|
||||||
// Sample BLOOM_APPROX to estimate what a straight blur of masked scanlines
|
// Sample BLOOM_APPROX to estimate what a straight blur of masked scanlines
|
||||||
// would look like, so we can estimate how much energy we'll receive from
|
// would look like, so we can estimate how much energy we'll receive from
|
||||||
// blooming neighbors:
|
// blooming neighbors:
|
||||||
const vec3 phosphor_blur_approx = levels_contrast * tex2D_linearize(
|
const vec3 phosphor_blur_approx = params.levels_contrast * tex2D_linearize(
|
||||||
BLOOM_APPROX, blur3x3_tex_uv).rgb;
|
BLOOM_APPROX, blur3x3_tex_uv).rgb;
|
||||||
|
|
||||||
// Compute the blur weight for the center texel and the maximum energy we
|
// Compute the blur weight for the center texel and the maximum energy we
|
||||||
|
@ -111,15 +111,15 @@ void main()
|
||||||
// because it actually gets better results (on top of being very simple),
|
// because it actually gets better results (on top of being very simple),
|
||||||
// but adjust all intensities for the user's desired underestimate factor:
|
// but adjust all intensities for the user's desired underestimate factor:
|
||||||
const vec3 area_contrib_underestimate =
|
const vec3 area_contrib_underestimate =
|
||||||
bloom_underestimate_levels * max_area_contribution_approx;
|
params.bloom_underestimate_levels * max_area_contribution_approx;
|
||||||
const vec3 intensity_underestimate =
|
const vec3 intensity_underestimate =
|
||||||
bloom_underestimate_levels * intensity;
|
params.bloom_underestimate_levels * intensity;
|
||||||
|
|
||||||
// Calculate the blur_ratio, the ratio of intensity we want to blur:
|
// Calculate the blur_ratio, the ratio of intensity we want to blur:
|
||||||
#ifdef BRIGHTPASS_AREA_BASED
|
#ifdef BRIGHTPASS_AREA_BASED
|
||||||
// This area-based version changes blur_ratio more smoothly and blurs
|
// This area-based version changes blur_ratio more smoothly and blurs
|
||||||
// more, clipping less but offering less phosphor differentiation:
|
// more, clipping less but offering less phosphor differentiation:
|
||||||
const vec3 phosphor_blur_underestimate = bloom_underestimate_levels *
|
const vec3 phosphor_blur_underestimate = params.bloom_underestimate_levels *
|
||||||
phosphor_blur_approx;
|
phosphor_blur_approx;
|
||||||
const vec3 soft_intensity = max(intensity_underestimate,
|
const vec3 soft_intensity = max(intensity_underestimate,
|
||||||
phosphor_blur_underestimate * mask_amplify);
|
phosphor_blur_underestimate * mask_amplify);
|
||||||
|
@ -136,7 +136,7 @@ void main()
|
||||||
// Calculate the brightpass based on the auto-dimmed, unamplified, masked
|
// Calculate the brightpass based on the auto-dimmed, unamplified, masked
|
||||||
// scanlines, encode if necessary, and return!
|
// scanlines, encode if necessary, and return!
|
||||||
const vec3 brightpass = intensity_dim *
|
const vec3 brightpass = intensity_dim *
|
||||||
mix(blur_ratio, vec3(1.0), bloom_excess);
|
mix(blur_ratio, vec3(1.0), params.bloom_excess);
|
||||||
|
|
||||||
FragColor = encode_output(vec4(brightpass, 1.0));
|
FragColor = encode_output(vec4(brightpass, 1.0));
|
||||||
}
|
}
|
|
@ -140,7 +140,7 @@ void main()
|
||||||
// Get an optimal eye position based on geom_view_dist, viewport_aspect,
|
// Get an optimal eye position based on geom_view_dist, viewport_aspect,
|
||||||
// and CRT radius/rotation:
|
// and CRT radius/rotation:
|
||||||
#ifdef RUNTIME_GEOMETRY_MODE
|
#ifdef RUNTIME_GEOMETRY_MODE
|
||||||
const float geom_mode = geom_mode_runtime;
|
geom_mode = params.geom_mode_runtime;
|
||||||
#else
|
#else
|
||||||
const float geom_mode = geom_mode_static;
|
const float geom_mode = geom_mode_static;
|
||||||
#endif
|
#endif
|
||||||
|
@ -178,7 +178,7 @@ void main()
|
||||||
const mat3x3 global_to_local = geom_global_to_local_static;
|
const mat3x3 global_to_local = geom_global_to_local_static;
|
||||||
#endif
|
#endif
|
||||||
#ifdef RUNTIME_GEOMETRY_MODE
|
#ifdef RUNTIME_GEOMETRY_MODE
|
||||||
const float geom_mode = geom_mode_runtime;
|
geom_mode = params.geom_mode_runtime;
|
||||||
#else
|
#else
|
||||||
const float geom_mode = geom_mode_static;
|
const float geom_mode = geom_mode_static;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -115,13 +115,13 @@ void main()
|
||||||
const vec2 src_tex_uv = fract(src_tex_uv_wrap);
|
const vec2 src_tex_uv = fract(src_tex_uv_wrap);
|
||||||
vec3 pixel_color;
|
vec3 pixel_color;
|
||||||
// If mask_type is static, this branch will be resolved statically.
|
// If mask_type is static, this branch will be resolved statically.
|
||||||
if(mask_type < 0.5)
|
if(params.mask_type < 0.5)
|
||||||
{
|
{
|
||||||
pixel_color = downsample_vertical_sinc_tiled(
|
pixel_color = downsample_vertical_sinc_tiled(
|
||||||
mask_grille_texture_large, src_tex_uv, mask_resize_src_lut_size,
|
mask_grille_texture_large, src_tex_uv, mask_resize_src_lut_size,
|
||||||
src_dy, resize_magnification_scale.y, 1.0);
|
src_dy, resize_magnification_scale.y, 1.0);
|
||||||
}
|
}
|
||||||
else if(mask_type < 1.5)
|
else if(params.mask_type < 1.5)
|
||||||
{
|
{
|
||||||
pixel_color = downsample_vertical_sinc_tiled(
|
pixel_color = downsample_vertical_sinc_tiled(
|
||||||
mask_slot_texture_large, src_tex_uv, mask_resize_src_lut_size,
|
mask_slot_texture_large, src_tex_uv, mask_resize_src_lut_size,
|
||||||
|
@ -169,13 +169,13 @@ void main()
|
||||||
const vec2 src_tex_uv = fract(src_tex_uv_wrap);
|
const vec2 src_tex_uv = fract(src_tex_uv_wrap);
|
||||||
vec3 pixel_color;
|
vec3 pixel_color;
|
||||||
// If mask_type is static, this branch will be resolved statically.
|
// If mask_type is static, this branch will be resolved statically.
|
||||||
if(mask_type < 0.5)
|
if(params.mask_type < 0.5)
|
||||||
{
|
{
|
||||||
pixel_color = downsample_vertical_sinc_tiled(
|
pixel_color = downsample_vertical_sinc_tiled(
|
||||||
mask_grille_texture_small, src_tex_uv, mask_resize_src_lut_size,
|
mask_grille_texture_small, src_tex_uv, mask_resize_src_lut_size,
|
||||||
src_dy, resize_magnification_scale.y, 1.0);
|
src_dy, resize_magnification_scale.y, 1.0);
|
||||||
}
|
}
|
||||||
else if(mask_type < 1.5)
|
else if(params.mask_type < 1.5)
|
||||||
{
|
{
|
||||||
pixel_color = downsample_vertical_sinc_tiled(
|
pixel_color = downsample_vertical_sinc_tiled(
|
||||||
mask_slot_texture_small, src_tex_uv, mask_resize_src_lut_size,
|
mask_slot_texture_small, src_tex_uv, mask_resize_src_lut_size,
|
||||||
|
|
|
@ -163,12 +163,12 @@ void main()
|
||||||
if(sample_orig_luts)
|
if(sample_orig_luts)
|
||||||
{
|
{
|
||||||
// If mask_type is static, this branch will be resolved statically.
|
// If mask_type is static, this branch will be resolved statically.
|
||||||
if(mask_type < 0.5)
|
if(params.mask_type < 0.5)
|
||||||
{
|
{
|
||||||
phosphor_mask_sample = tex2D_linearize(
|
phosphor_mask_sample = tex2D_linearize(
|
||||||
mask_grille_texture_large, mask_tex_uv).rgb;
|
mask_grille_texture_large, mask_tex_uv).rgb;
|
||||||
}
|
}
|
||||||
else if(mask_type < 1.5)
|
else if(params.mask_type < 1.5)
|
||||||
{
|
{
|
||||||
phosphor_mask_sample = tex2D_linearize(
|
phosphor_mask_sample = tex2D_linearize(
|
||||||
mask_slot_texture_large, mask_tex_uv).rgb;
|
mask_slot_texture_large, mask_tex_uv).rgb;
|
||||||
|
@ -242,7 +242,7 @@ void main()
|
||||||
// full brightness, not minimal blurring. To fix it, base blend_ratio
|
// full brightness, not minimal blurring. To fix it, base blend_ratio
|
||||||
// on a max area intensity only so it varies more smoothly:
|
// on a max area intensity only so it varies more smoothly:
|
||||||
const vec3 phosphor_blur_underestimate =
|
const vec3 phosphor_blur_underestimate =
|
||||||
phosphor_blur_approx * bloom_underestimate_levels;
|
phosphor_blur_approx * params.bloom_underestimate_levels;
|
||||||
const vec3 area_max_underestimate =
|
const vec3 area_max_underestimate =
|
||||||
phosphor_blur_underestimate * mask_amplify;
|
phosphor_blur_underestimate * mask_amplify;
|
||||||
#ifdef PHOSPHOR_BLOOM_FAKE_WITH_SIMPLE_BLEND
|
#ifdef PHOSPHOR_BLOOM_FAKE_WITH_SIMPLE_BLEND
|
||||||
|
@ -258,9 +258,9 @@ void main()
|
||||||
// the phosphor emission, but I haven't found a way to make the
|
// the phosphor emission, but I haven't found a way to make the
|
||||||
// brightness correct across the whole color range, especially with
|
// brightness correct across the whole color range, especially with
|
||||||
// different bloom_underestimate_levels values.)
|
// different bloom_underestimate_levels values.)
|
||||||
const float desired_triad_size = mix(mask_triad_size_desired,
|
const float desired_triad_size = mix(params.mask_triad_size_desired,
|
||||||
registers.OutputSize.x/mask_num_triads_desired,
|
registers.OutputSize.x/params.mask_num_triads_desired,
|
||||||
mask_specify_num_triads);
|
params.mask_specify_num_triads);
|
||||||
const float bloom_sigma = get_min_sigma_to_blur_triad(
|
const float bloom_sigma = get_min_sigma_to_blur_triad(
|
||||||
desired_triad_size, bloom_diff_thresh);
|
desired_triad_size, bloom_diff_thresh);
|
||||||
const float center_weight = get_center_weight(bloom_sigma);
|
const float center_weight = get_center_weight(bloom_sigma);
|
||||||
|
@ -268,7 +268,7 @@ void main()
|
||||||
max(vec3(0.0), phosphor_blur_approx -
|
max(vec3(0.0), phosphor_blur_approx -
|
||||||
center_weight * phosphor_emission);
|
center_weight * phosphor_emission);
|
||||||
const vec3 area_contrib_underestimate =
|
const vec3 area_contrib_underestimate =
|
||||||
bloom_underestimate_levels * max_area_contribution_approx;
|
params.bloom_underestimate_levels * max_area_contribution_approx;
|
||||||
const vec3 blend_ratio_temp =
|
const vec3 blend_ratio_temp =
|
||||||
((vec3(1.0) - area_contrib_underestimate) /
|
((vec3(1.0) - area_contrib_underestimate) /
|
||||||
area_max_underestimate - vec3(1.0)) / (center_weight - 1.0);
|
area_max_underestimate - vec3(1.0)) / (center_weight - 1.0);
|
||||||
|
@ -277,13 +277,13 @@ void main()
|
||||||
// min/max/clamp are BIZARRELY broken with lerp (optimization bug?),
|
// min/max/clamp are BIZARRELY broken with lerp (optimization bug?),
|
||||||
// and this redundant sequence avoids bugs, at least on nVidia cards:
|
// and this redundant sequence avoids bugs, at least on nVidia cards:
|
||||||
const vec3 blend_ratio_clamped = max(clamp(blend_ratio_temp, 0.0, 1.0), 0.0);
|
const vec3 blend_ratio_clamped = max(clamp(blend_ratio_temp, 0.0, 1.0), 0.0);
|
||||||
const vec3 blend_ratio = mix(blend_ratio_clamped, vec3(1.0), bloom_excess);
|
const vec3 blend_ratio = mix(blend_ratio_clamped, vec3(1.0), params.bloom_excess);
|
||||||
// Blend the blurred and unblurred images:
|
// Blend the blurred and unblurred images:
|
||||||
const vec3 phosphor_emission_unclipped =
|
const vec3 phosphor_emission_unclipped =
|
||||||
mix(phosphor_emission, phosphor_blur_approx, blend_ratio);
|
mix(phosphor_emission, phosphor_blur_approx, blend_ratio);
|
||||||
// Simulate refractive diffusion by reusing the halation sample.
|
// Simulate refractive diffusion by reusing the halation sample.
|
||||||
const vec3 pixel_color = mix(phosphor_emission_unclipped,
|
const vec3 pixel_color = mix(phosphor_emission_unclipped,
|
||||||
halation_color, diffusion_weight);
|
halation_color, params.diffusion_weight);
|
||||||
#else
|
#else
|
||||||
const vec3 pixel_color = phosphor_emission_dim;
|
const vec3 pixel_color = phosphor_emission_dim;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -60,7 +60,7 @@ vec2 intersect_sphere(const vec3 view_vec, const vec3 eye_pos_vec)
|
||||||
// Quadratic formula coefficients (b_over_2 is guaranteed negative):
|
// Quadratic formula coefficients (b_over_2 is guaranteed negative):
|
||||||
const float a = dot(view_vec, view_vec);
|
const float a = dot(view_vec, view_vec);
|
||||||
const float b_over_2 = dot(view_vec, eye_pos_vec); // * 2.0 factored out
|
const float b_over_2 = dot(view_vec, eye_pos_vec); // * 2.0 factored out
|
||||||
const float c = dot(eye_pos_vec, eye_pos_vec) - geom_radius*geom_radius;
|
const float c = dot(eye_pos_vec, eye_pos_vec) - params.geom_radius*params.geom_radius;
|
||||||
return quadratic_solve(a, b_over_2, c);
|
return quadratic_solve(a, b_over_2, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ vec2 intersect_cylinder(const vec3 view_vec, const vec3 eye_pos_vec)
|
||||||
// Real-Time Collision Detection, p. 195-196, and this version
|
// Real-Time Collision Detection, p. 195-196, and this version
|
||||||
// uses LaGrange's identity to reduce operations.
|
// uses LaGrange's identity to reduce operations.
|
||||||
// Arbitrary "cylinder top" reference point for an infinite cylinder:
|
// Arbitrary "cylinder top" reference point for an infinite cylinder:
|
||||||
const vec3 cylinder_top_vec = vec3(0.0, geom_radius, 0.0);
|
const vec3 cylinder_top_vec = vec3(0.0, params.geom_radius, 0.0);
|
||||||
const vec3 cylinder_axis_vec = vec3(0.0, 1.0, 0.0);//vec3(0.0, 2.0*geom_radius, 0.0);
|
const vec3 cylinder_axis_vec = vec3(0.0, 1.0, 0.0);//vec3(0.0, 2.0*geom_radius, 0.0);
|
||||||
const vec3 top_to_eye_vec = eye_pos_vec - cylinder_top_vec;
|
const vec3 top_to_eye_vec = eye_pos_vec - cylinder_top_vec;
|
||||||
const vec3 axis_x_view = cross(cylinder_axis_vec, view_vec);
|
const vec3 axis_x_view = cross(cylinder_axis_vec, view_vec);
|
||||||
|
@ -86,7 +86,7 @@ vec2 intersect_cylinder(const vec3 view_vec, const vec3 eye_pos_vec)
|
||||||
const float a = dot(axis_x_view, axis_x_view);
|
const float a = dot(axis_x_view, axis_x_view);
|
||||||
const float b_over_2 = dot(axis_x_top_to_eye, axis_x_view);
|
const float b_over_2 = dot(axis_x_top_to_eye, axis_x_view);
|
||||||
const float c = dot(axis_x_top_to_eye, axis_x_top_to_eye) -
|
const float c = dot(axis_x_top_to_eye, axis_x_top_to_eye) -
|
||||||
geom_radius*geom_radius;//*dot(cylinder_axis_vec, cylinder_axis_vec);
|
params.geom_radius*params.geom_radius;//*dot(cylinder_axis_vec, cylinder_axis_vec);
|
||||||
return quadratic_solve(a, b_over_2, c);
|
return quadratic_solve(a, b_over_2, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ vec2 cylinder_xyz_to_uv(const vec3 intersection_pos_local,
|
||||||
// Start with a numerically robust arc length calculation.
|
// Start with a numerically robust arc length calculation.
|
||||||
const float angle_from_image_center = atan(intersection_pos_local.z,
|
const float angle_from_image_center = atan(intersection_pos_local.z,
|
||||||
intersection_pos_local.x);
|
intersection_pos_local.x);
|
||||||
const float signed_arc_len = angle_from_image_center * geom_radius;
|
const float signed_arc_len = angle_from_image_center * params.geom_radius;
|
||||||
// Get a uv-mapping where [-0.5, 0.5] maps to a "square" area, then divide
|
// Get a uv-mapping where [-0.5, 0.5] maps to a "square" area, then divide
|
||||||
// by the aspect ratio to stretch the mapping appropriately:
|
// by the aspect ratio to stretch the mapping appropriately:
|
||||||
const vec2 square_uv = vec2(signed_arc_len, -intersection_pos_local.y);
|
const vec2 square_uv = vec2(signed_arc_len, -intersection_pos_local.y);
|
||||||
|
@ -117,9 +117,9 @@ vec3 cylinder_uv_to_xyz(const vec2 video_uv, const vec2 geom_aspect)
|
||||||
// then calculate an xyz position for the cylindrical mapping above.
|
// then calculate an xyz position for the cylindrical mapping above.
|
||||||
const vec2 square_uv = video_uv * geom_aspect;
|
const vec2 square_uv = video_uv * geom_aspect;
|
||||||
const float arc_len = square_uv.x;
|
const float arc_len = square_uv.x;
|
||||||
const float angle_from_image_center = arc_len / geom_radius;
|
const float angle_from_image_center = arc_len / params.geom_radius;
|
||||||
const float x_pos = sin(angle_from_image_center) * geom_radius;
|
const float x_pos = sin(angle_from_image_center) * params.geom_radius;
|
||||||
const float z_pos = cos(angle_from_image_center) * geom_radius;
|
const float z_pos = cos(angle_from_image_center) * params.geom_radius;
|
||||||
// Or: z = sqrt(geom_radius**2 - x**2)
|
// Or: z = sqrt(geom_radius**2 - x**2)
|
||||||
// Or: z = geom_radius/sqrt(1.0 + tan(angle)**2), x = z * tan(angle)
|
// Or: z = geom_radius/sqrt(1.0 + tan(angle)**2), x = z * tan(angle)
|
||||||
const vec3 intersection_pos_local = vec3(x_pos, -square_uv.y, z_pos);
|
const vec3 intersection_pos_local = vec3(x_pos, -square_uv.y, z_pos);
|
||||||
|
@ -143,12 +143,12 @@ vec2 sphere_xyz_to_uv(const vec3 intersection_pos_local,
|
||||||
// sphere intersection point and the image center using a method posted by
|
// sphere intersection point and the image center using a method posted by
|
||||||
// Roger Stafford on comp.soft-sys.matlab:
|
// Roger Stafford on comp.soft-sys.matlab:
|
||||||
// https://groups.google.com/d/msg/comp.soft-sys.matlab/zNbUui3bjcA/c0HV_bHSx9cJ
|
// https://groups.google.com/d/msg/comp.soft-sys.matlab/zNbUui3bjcA/c0HV_bHSx9cJ
|
||||||
const vec3 image_center_pos_local = vec3(0.0, 0.0, geom_radius);
|
const vec3 image_center_pos_local = vec3(0.0, 0.0, params.geom_radius);
|
||||||
const float cp_len =
|
const float cp_len =
|
||||||
length(cross(intersection_pos_local, image_center_pos_local));
|
length(cross(intersection_pos_local, image_center_pos_local));
|
||||||
const float dp = dot(intersection_pos_local, image_center_pos_local);
|
const float dp = dot(intersection_pos_local, image_center_pos_local);
|
||||||
const float angle_from_image_center = atan(dp, cp_len);
|
const float angle_from_image_center = atan(dp, cp_len);
|
||||||
const float arc_len = angle_from_image_center * geom_radius;
|
const float arc_len = angle_from_image_center * params.geom_radius;
|
||||||
// Get a uv-mapping where [-0.5, 0.5] maps to a "square" area, then divide
|
// Get a uv-mapping where [-0.5, 0.5] maps to a "square" area, then divide
|
||||||
// by the aspect ratio to stretch the mapping appropriately:
|
// by the aspect ratio to stretch the mapping appropriately:
|
||||||
const vec2 square_uv_unit = normalize(vec2(intersection_pos_local.x,
|
const vec2 square_uv_unit = normalize(vec2(intersection_pos_local.x,
|
||||||
|
@ -172,12 +172,12 @@ vec3 sphere_uv_to_xyz(const vec2 video_uv, const vec2 geom_aspect)
|
||||||
//float arc_len = length(square_uv);
|
//float arc_len = length(square_uv);
|
||||||
const vec2 square_uv_unit = normalize(square_uv);
|
const vec2 square_uv_unit = normalize(square_uv);
|
||||||
const float arc_len = square_uv.y/square_uv_unit.y;
|
const float arc_len = square_uv.y/square_uv_unit.y;
|
||||||
const float angle_from_image_center = arc_len / geom_radius;
|
const float angle_from_image_center = arc_len / params.geom_radius;
|
||||||
const float xy_dist_from_sphere_center =
|
const float xy_dist_from_sphere_center =
|
||||||
sin(angle_from_image_center) * geom_radius;
|
sin(angle_from_image_center) * params.geom_radius;
|
||||||
//vec2 xy_pos = xy_dist_from_sphere_center * (square_uv/FIX_ZERO(arc_len));
|
//vec2 xy_pos = xy_dist_from_sphere_center * (square_uv/FIX_ZERO(arc_len));
|
||||||
const vec2 xy_pos = xy_dist_from_sphere_center * square_uv_unit;
|
const vec2 xy_pos = xy_dist_from_sphere_center * square_uv_unit;
|
||||||
const float z_pos = cos(angle_from_image_center) * geom_radius;
|
const float z_pos = cos(angle_from_image_center) * params.geom_radius;
|
||||||
const vec3 intersection_pos_local = vec3(xy_pos.x, -xy_pos.y, z_pos);
|
const vec3 intersection_pos_local = vec3(xy_pos.x, -xy_pos.y, z_pos);
|
||||||
return intersection_pos_local;
|
return intersection_pos_local;
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ vec2 sphere_alt_xyz_to_uv(const vec3 intersection_pos_local,
|
||||||
// See cylinder_xyz_to_uv() for implementation details (very similar).
|
// See cylinder_xyz_to_uv() for implementation details (very similar).
|
||||||
const vec2 angle_from_image_center = atan((intersection_pos_local.zz),
|
const vec2 angle_from_image_center = atan((intersection_pos_local.zz),
|
||||||
vec2(intersection_pos_local.x, -intersection_pos_local.y));
|
vec2(intersection_pos_local.x, -intersection_pos_local.y));
|
||||||
const vec2 signed_arc_len = angle_from_image_center * geom_radius;
|
const vec2 signed_arc_len = angle_from_image_center * params.geom_radius;
|
||||||
const vec2 video_uv = signed_arc_len / geom_aspect;
|
const vec2 video_uv = signed_arc_len / geom_aspect;
|
||||||
return video_uv;
|
return video_uv;
|
||||||
}
|
}
|
||||||
|
@ -205,9 +205,9 @@ vec3 sphere_alt_uv_to_xyz(const vec2 video_uv, const vec2 geom_aspect)
|
||||||
// See cylinder_uv_to_xyz() for implementation details (very similar).
|
// See cylinder_uv_to_xyz() for implementation details (very similar).
|
||||||
const vec2 square_uv = video_uv * geom_aspect;
|
const vec2 square_uv = video_uv * geom_aspect;
|
||||||
const vec2 arc_len = square_uv;
|
const vec2 arc_len = square_uv;
|
||||||
const vec2 angle_from_image_center = arc_len / geom_radius;
|
const vec2 angle_from_image_center = arc_len / params.geom_radius;
|
||||||
const vec2 xy_pos = sin(angle_from_image_center) * geom_radius;
|
const vec2 xy_pos = sin(angle_from_image_center) * params.geom_radius;
|
||||||
const float z_pos = sqrt(geom_radius*geom_radius - dot(xy_pos, xy_pos));
|
const float z_pos = sqrt(params.geom_radius*params.geom_radius - dot(xy_pos, xy_pos));
|
||||||
return vec3(xy_pos.x, -xy_pos.y, z_pos);
|
return vec3(xy_pos.x, -xy_pos.y, z_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ vec3 get_ideal_global_eye_pos_for_points(vec3 eye_pos,
|
||||||
// offset_ul and offset_dr represent the farthest we can move the
|
// offset_ul and offset_dr represent the farthest we can move the
|
||||||
// eye_pos up-left and down-right. Save the min of all offset_dr's
|
// eye_pos up-left and down-right. Save the min of all offset_dr's
|
||||||
// and the max of all offset_ul's (since it's negative).
|
// and the max of all offset_ul's (since it's negative).
|
||||||
float abs_radius = abs(geom_radius); // In case anyone gets ideas. ;)
|
float abs_radius = abs(params.geom_radius); // In case anyone gets ideas. ;)
|
||||||
vec2 offset_dr_min = vec2(10.0 * abs_radius, 10.0 * abs_radius);
|
vec2 offset_dr_min = vec2(10.0 * abs_radius, 10.0 * abs_radius);
|
||||||
vec2 offset_ul_max = vec2(-10.0 * abs_radius, -10.0 * abs_radius);
|
vec2 offset_ul_max = vec2(-10.0 * abs_radius, -10.0 * abs_radius);
|
||||||
for(int i = 0; i < num_points; i++)
|
for(int i = 0; i < num_points; i++)
|
||||||
|
@ -317,9 +317,9 @@ vec3 get_ideal_global_eye_pos_for_points(vec3 eye_pos,
|
||||||
const vec2 flipy = vec2(1.0, -1.0);
|
const vec2 flipy = vec2(1.0, -1.0);
|
||||||
vec3 eyespace_xyz = eyespace_coords[i];
|
vec3 eyespace_xyz = eyespace_coords[i];
|
||||||
vec2 offset_dr = eyespace_xyz.xy - vec2(-0.5) *
|
vec2 offset_dr = eyespace_xyz.xy - vec2(-0.5) *
|
||||||
(geom_aspect * -eyespace_xyz.z) / (geom_view_dist * flipy);
|
(geom_aspect * -eyespace_xyz.z) / (params.geom_view_dist * flipy);
|
||||||
vec2 offset_ul = eyespace_xyz.xy - vec2(0.5) *
|
vec2 offset_ul = eyespace_xyz.xy - vec2(0.5) *
|
||||||
(geom_aspect * -eyespace_xyz.z) / (geom_view_dist * flipy);
|
(geom_aspect * -eyespace_xyz.z) / (params.geom_view_dist * flipy);
|
||||||
offset_dr_min = min(offset_dr_min, offset_dr);
|
offset_dr_min = min(offset_dr_min, offset_dr);
|
||||||
offset_ul_max = max(offset_ul_max, offset_ul);
|
offset_ul_max = max(offset_ul_max, offset_ul);
|
||||||
}
|
}
|
||||||
|
@ -347,13 +347,13 @@ vec3 get_ideal_global_eye_pos_for_points(vec3 eye_pos,
|
||||||
// We'll vectorize the actual computation. Take the maximum of
|
// We'll vectorize the actual computation. Take the maximum of
|
||||||
// these four for a single offset, and continue taking the max
|
// these four for a single offset, and continue taking the max
|
||||||
// for every point (use max because offset.z is negative).
|
// for every point (use max because offset.z is negative).
|
||||||
float offset_z_max = -10.0 * geom_radius * geom_view_dist;
|
float offset_z_max = -10.0 * params.geom_radius * params.geom_view_dist;
|
||||||
for(int i = 0; i < num_points; i++)
|
for(int i = 0; i < num_points; i++)
|
||||||
{
|
{
|
||||||
vec3 eyespace_xyz_flipy = eyespace_coords[i] *
|
vec3 eyespace_xyz_flipy = eyespace_coords[i] *
|
||||||
vec3(1.0, -1.0, 1.0);
|
vec3(1.0, -1.0, 1.0);
|
||||||
vec4 offset_zzzz = eyespace_xyz_flipy.zzzz +
|
vec4 offset_zzzz = eyespace_xyz_flipy.zzzz +
|
||||||
(eyespace_xyz_flipy.xyxy * geom_view_dist) /
|
(eyespace_xyz_flipy.xyxy * params.geom_view_dist) /
|
||||||
(vec4(-0.5, -0.5, 0.5, 0.5) * vec4(geom_aspect, geom_aspect));
|
(vec4(-0.5, -0.5, 0.5, 0.5) * vec4(geom_aspect, geom_aspect));
|
||||||
// Ignore offsets that push positive x/y values to opposite
|
// Ignore offsets that push positive x/y values to opposite
|
||||||
// boundaries, and vice versa, and don't let the camera move
|
// boundaries, and vice versa, and don't let the camera move
|
||||||
|
@ -379,14 +379,14 @@ vec3 get_ideal_global_eye_pos(const mat3x3 local_to_global,
|
||||||
{
|
{
|
||||||
// Start with an initial eye_pos that includes the entire primitive
|
// Start with an initial eye_pos that includes the entire primitive
|
||||||
// (sphere or cylinder) in its field-of-view:
|
// (sphere or cylinder) in its field-of-view:
|
||||||
const vec3 high_view = vec3(0.0, geom_aspect.y, -geom_view_dist);
|
const vec3 high_view = vec3(0.0, geom_aspect.y, -params.geom_view_dist);
|
||||||
const vec3 low_view = high_view * vec3(1.0, -1.0, 1.0);
|
const vec3 low_view = high_view * vec3(1.0, -1.0, 1.0);
|
||||||
const float len_sq = dot(high_view, high_view);
|
const float len_sq = dot(high_view, high_view);
|
||||||
const float fov = abs(acos(dot(high_view, low_view)/len_sq));
|
const float fov = abs(acos(dot(high_view, low_view)/len_sq));
|
||||||
// Trigonometry/similar triangles say distance = geom_radius/sin(fov/2):
|
// Trigonometry/similar triangles say distance = geom_radius/sin(fov/2):
|
||||||
const float eye_z_spherical = geom_radius/sin(fov*0.5);
|
const float eye_z_spherical = params.geom_radius/sin(fov*0.5);
|
||||||
vec3 eye_pos = vec3(0.0, 0.0, eye_z_spherical);
|
vec3 eye_pos = vec3(0.0, 0.0, eye_z_spherical);
|
||||||
if (geom_mode < 2.5) eye_pos = vec3(0.0, 0.0, max(geom_view_dist, eye_z_spherical));
|
if (geom_mode < 2.5) eye_pos = vec3(0.0, 0.0, max(params.geom_view_dist, eye_z_spherical));
|
||||||
|
|
||||||
// Get global xyz coords of extreme sample points on the simulated CRT
|
// Get global xyz coords of extreme sample points on the simulated CRT
|
||||||
// screen. Start with the center, edge centers, and corners of the
|
// screen. Start with the center, edge centers, and corners of the
|
||||||
|
@ -602,7 +602,7 @@ vec2 get_curved_video_uv_coords_and_tangent_matrix(
|
||||||
// units of the viewport's physical diagonal size.
|
// units of the viewport's physical diagonal size.
|
||||||
const vec2 view_uv = (flat_video_uv - vec2(0.5)) * geom_aspect;
|
const vec2 view_uv = (flat_video_uv - vec2(0.5)) * geom_aspect;
|
||||||
const vec3 view_vec_global =
|
const vec3 view_vec_global =
|
||||||
vec3(view_uv.x, -view_uv.y, -geom_view_dist);
|
vec3(view_uv.x, -view_uv.y, -params.geom_view_dist);
|
||||||
// Transform the view vector into the CRT's local coordinate frame, convert
|
// Transform the view vector into the CRT's local coordinate frame, convert
|
||||||
// to video_uv coords, and get the local 3D intersection position:
|
// to video_uv coords, and get the local 3D intersection position:
|
||||||
const vec3 view_vec_local = (view_vec_global * global_to_local);
|
const vec3 view_vec_local = (view_vec_global * global_to_local);
|
||||||
|
@ -674,11 +674,11 @@ float get_border_dim_factor(const vec2 video_uv, const vec2 geom_aspect)
|
||||||
const vec2 edge_dists = min(video_uv, vec2(1.0) - video_uv) *
|
const vec2 edge_dists = min(video_uv, vec2(1.0) - video_uv) *
|
||||||
geom_aspect;
|
geom_aspect;
|
||||||
const vec2 border_penetration =
|
const vec2 border_penetration =
|
||||||
max(vec2(border_size) - edge_dists, vec2(0.0));
|
max(vec2(params.border_size) - edge_dists, vec2(0.0));
|
||||||
const float penetration_ratio = length(border_penetration)/border_size;
|
const float penetration_ratio = length(border_penetration)/params.border_size;
|
||||||
const float border_escape_ratio = max(1.0 - penetration_ratio, 0.0);
|
const float border_escape_ratio = max(1.0 - penetration_ratio, 0.0);
|
||||||
const float border_dim_factor =
|
const float border_dim_factor =
|
||||||
pow(border_escape_ratio, border_darkness) * max(1.0, border_compress);
|
pow(border_escape_ratio, params.border_darkness) * max(1.0, params.border_compress);
|
||||||
return min(border_dim_factor, 1.0);
|
return min(border_dim_factor, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
|
#ifndef PARAMS_INC
|
||||||
|
#define PARAMS_INC
|
||||||
|
|
||||||
layout(std140, set = 0, binding = 0) uniform UBO
|
layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
{
|
{
|
||||||
mat4 MVP;
|
mat4 MVP;
|
||||||
float crt_gamma;
|
// float crt_gamma;
|
||||||
float lcd_gamma;
|
// float lcd_gamma;
|
||||||
float levels_contrast;
|
float levels_contrast;
|
||||||
float halation_weight;
|
float halation_weight;
|
||||||
float diffusion_weight;
|
float diffusion_weight;
|
||||||
|
@ -16,7 +19,7 @@ layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
float beam_shape_power;
|
float beam_shape_power;
|
||||||
float beam_horiz_filter;
|
float beam_horiz_filter;
|
||||||
float beam_horiz_sigma;
|
float beam_horiz_sigma;
|
||||||
float beam_horiz_linear_rgb_weight;
|
// float beam_horiz_linear_rgb_weight;
|
||||||
float convergence_offset_x_r;
|
float convergence_offset_x_r;
|
||||||
float convergence_offset_x_g;
|
float convergence_offset_x_g;
|
||||||
float convergence_offset_x_b;
|
float convergence_offset_x_b;
|
||||||
|
@ -28,8 +31,8 @@ layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
float mask_specify_num_triads;
|
float mask_specify_num_triads;
|
||||||
float mask_triad_size_desired;
|
float mask_triad_size_desired;
|
||||||
float mask_num_triads_desired;
|
float mask_num_triads_desired;
|
||||||
float aa_subpixel_r_offset_x_runtime;
|
// float aa_subpixel_r_offset_x_runtime;
|
||||||
float aa_subpixel_r_offset_y_runtime;
|
// float aa_subpixel_r_offset_y_runtime;
|
||||||
float aa_cubic_c;
|
float aa_cubic_c;
|
||||||
float aa_gauss_sigma;
|
float aa_gauss_sigma;
|
||||||
float geom_mode_runtime;
|
float geom_mode_runtime;
|
||||||
|
@ -48,8 +51,8 @@ layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
} params;
|
} params;
|
||||||
|
|
||||||
// Set shader params for all passes here:
|
// Set shader params for all passes here:
|
||||||
#pragma parameter crt_gamma "crt_gamma" 2.5 1.0 5.0 0.025
|
//#pragma parameter crt_gamma "crt_gamma" 2.5 1.0 5.0 0.025
|
||||||
#pragma parameter lcd_gamma "lcd_gamma" 2.2 1.0 5.0 0.025
|
//#pragma parameter lcd_gamma "lcd_gamma" 2.2 1.0 5.0 0.025
|
||||||
#pragma parameter levels_contrast "levels_contrast" 1.0 0.0 4.0 0.015625
|
#pragma parameter levels_contrast "levels_contrast" 1.0 0.0 4.0 0.015625
|
||||||
#pragma parameter halation_weight "halation_weight" 0.0 0.0 1.0 0.005
|
#pragma parameter halation_weight "halation_weight" 0.0 0.0 1.0 0.005
|
||||||
#pragma parameter diffusion_weight "diffusion_weight" 0.075 0.0 1.0 0.005
|
#pragma parameter diffusion_weight "diffusion_weight" 0.075 0.0 1.0 0.005
|
||||||
|
@ -63,7 +66,7 @@ layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
#pragma parameter beam_shape_power "beam_shape_power" 0.25 0.01 16.0 0.01
|
#pragma parameter beam_shape_power "beam_shape_power" 0.25 0.01 16.0 0.01
|
||||||
#pragma parameter beam_horiz_filter "beam_horiz_filter" 0.0 0.0 2.0 1.0
|
#pragma parameter beam_horiz_filter "beam_horiz_filter" 0.0 0.0 2.0 1.0
|
||||||
#pragma parameter beam_horiz_sigma "beam_horiz_sigma" 0.35 0.0 0.67 0.005
|
#pragma parameter beam_horiz_sigma "beam_horiz_sigma" 0.35 0.0 0.67 0.005
|
||||||
#pragma parameter beam_horiz_linear_rgb_weight "beam_horiz_linear_rgb_weight" 1.0 0.0 1.0 0.01
|
//#pragma parameter beam_horiz_linear_rgb_weight "beam_horiz_linear_rgb_weight" 1.0 0.0 1.0 0.01
|
||||||
#pragma parameter convergence_offset_x_r "convergence_offset_x_r" 0.0 -4.0 4.0 0.05
|
#pragma parameter convergence_offset_x_r "convergence_offset_x_r" 0.0 -4.0 4.0 0.05
|
||||||
#pragma parameter convergence_offset_x_g "convergence_offset_x_g" 0.0 -4.0 4.0 0.05
|
#pragma parameter convergence_offset_x_g "convergence_offset_x_g" 0.0 -4.0 4.0 0.05
|
||||||
#pragma parameter convergence_offset_x_b "convergence_offset_x_b" 0.0 -4.0 4.0 0.05
|
#pragma parameter convergence_offset_x_b "convergence_offset_x_b" 0.0 -4.0 4.0 0.05
|
||||||
|
@ -75,8 +78,8 @@ layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
#pragma parameter mask_specify_num_triads "mask_specify_num_triads" 0.0 0.0 1.0 1.0
|
#pragma parameter mask_specify_num_triads "mask_specify_num_triads" 0.0 0.0 1.0 1.0
|
||||||
#pragma parameter mask_triad_size_desired "mask_triad_size_desired" 3.0 1.0 18.0 0.125
|
#pragma parameter mask_triad_size_desired "mask_triad_size_desired" 3.0 1.0 18.0 0.125
|
||||||
#pragma parameter mask_num_triads_desired "mask_num_triads_desired" 480.0 342.0 1920.0 1.0
|
#pragma parameter mask_num_triads_desired "mask_num_triads_desired" 480.0 342.0 1920.0 1.0
|
||||||
#pragma parameter aa_subpixel_r_offset_x_runtime "aa_subpixel_r_offset_x" -0.333333333 -0.333333333 0.333333333 0.333333333
|
//#pragma parameter aa_subpixel_r_offset_x_runtime "aa_subpixel_r_offset_x" -0.333333333 -0.333333333 0.333333333 0.333333333
|
||||||
#pragma parameter aa_subpixel_r_offset_y_runtime "aa_subpixel_r_offset_y" 0.0 -0.333333333 0.333333333 0.333333333
|
//#pragma parameter aa_subpixel_r_offset_y_runtime "aa_subpixel_r_offset_y" 0.0 -0.333333333 0.333333333 0.333333333
|
||||||
#pragma parameter aa_cubic_c "antialias_cubic_sharpness" 0.5 0.0 4.0 0.015625
|
#pragma parameter aa_cubic_c "antialias_cubic_sharpness" 0.5 0.0 4.0 0.015625
|
||||||
#pragma parameter aa_gauss_sigma "antialias_gauss_sigma" 0.5 0.0625 1.0 0.015625
|
#pragma parameter aa_gauss_sigma "antialias_gauss_sigma" 0.5 0.0625 1.0 0.015625
|
||||||
#pragma parameter geom_mode_runtime "geom_mode" 0.0 0.0 3.0 1.0
|
#pragma parameter geom_mode_runtime "geom_mode" 0.0 0.0 3.0 1.0
|
||||||
|
@ -92,3 +95,5 @@ layout(std140, set = 0, binding = 0) uniform UBO
|
||||||
#pragma parameter border_darkness "border_darkness" 2.0 0.0 16.0 0.0625
|
#pragma parameter border_darkness "border_darkness" 2.0 0.0 16.0 0.0625
|
||||||
#pragma parameter border_compress "border_compress" 2.5 1.0 64.0 0.0625
|
#pragma parameter border_compress "border_compress" 2.5 1.0 64.0 0.0625
|
||||||
#pragma parameter interlace_1080i "interlace_1080i" 0.0 0.0 1.0 1.0
|
#pragma parameter interlace_1080i "interlace_1080i" 0.0 0.0 1.0 1.0
|
||||||
|
|
||||||
|
#endif
|
|
@ -237,9 +237,9 @@ vec2 get_resized_mask_tile_size(const vec2 estimated_viewport_size,
|
||||||
// If mask_specify_num_triads is 1.0/true and estimated_viewport_size.x is
|
// If mask_specify_num_triads is 1.0/true and estimated_viewport_size.x is
|
||||||
// wrong, the user preference will be misinterpreted:
|
// wrong, the user preference will be misinterpreted:
|
||||||
const float desired_tile_size_x = mask_triads_per_tile * mix(
|
const float desired_tile_size_x = mask_triads_per_tile * mix(
|
||||||
mask_triad_size_desired,
|
params.mask_triad_size_desired,
|
||||||
estimated_viewport_size.x / mask_num_triads_desired,
|
estimated_viewport_size.x / params.mask_num_triads_desired,
|
||||||
mask_specify_num_triads);
|
params.mask_specify_num_triads);
|
||||||
if(get_mask_sample_mode() > 0.5)
|
if(get_mask_sample_mode() > 0.5)
|
||||||
{
|
{
|
||||||
// We don't need constraints unless we're sampling MASK_RESIZE.
|
// We don't need constraints unless we're sampling MASK_RESIZE.
|
||||||
|
|
|
@ -189,8 +189,8 @@
|
||||||
// 2.) C = 0.5 (default) is Catmull-Rom; higher C's apply sharpening.
|
// 2.) C = 0.5 (default) is Catmull-Rom; higher C's apply sharpening.
|
||||||
// 3.) C = 1.0/3.0 is the Mitchell-Netravali filter.
|
// 3.) C = 1.0/3.0 is the Mitchell-Netravali filter.
|
||||||
// 4.) C = 0.0 is a soft spline filter.
|
// 4.) C = 0.0 is a soft spline filter.
|
||||||
const float aa_cubic_c = 0.5;
|
// const float aa_cubic_c = 0.5;
|
||||||
const float aa_gauss_sigma = 0.5 / aa_pixel_diameter;
|
// const float aa_gauss_sigma = 0.5 / aa_pixel_diameter;
|
||||||
// Users may override the subpixel offset accessor function with their own.
|
// Users may override the subpixel offset accessor function with their own.
|
||||||
// A function is used for compatibility with scalar runtime shader params.
|
// A function is used for compatibility with scalar runtime shader params.
|
||||||
vec2 get_aa_subpixel_r_offset()
|
vec2 get_aa_subpixel_r_offset()
|
||||||
|
@ -235,14 +235,14 @@ void assign_aa_cubic_constants()
|
||||||
#ifdef RUNTIME_ANTIALIAS_WEIGHTS
|
#ifdef RUNTIME_ANTIALIAS_WEIGHTS
|
||||||
if(aa_filter > 5.5 && aa_filter < 7.5)
|
if(aa_filter > 5.5 && aa_filter < 7.5)
|
||||||
{
|
{
|
||||||
aa_cubic_b = 1.0 - 2.0*aa_cubic_c;
|
aa_cubic_b = 1.0 - 2.0*params.aa_cubic_c;
|
||||||
cubic_branch1_x3_coeff = 12.0 - 9.0*aa_cubic_b - 6.0*aa_cubic_c;
|
cubic_branch1_x3_coeff = 12.0 - 9.0*aa_cubic_b - 6.0*params.aa_cubic_c;
|
||||||
cubic_branch1_x2_coeff = -18.0 + 12.0*aa_cubic_b + 6.0*aa_cubic_c;
|
cubic_branch1_x2_coeff = -18.0 + 12.0*aa_cubic_b + 6.0*params.aa_cubic_c;
|
||||||
cubic_branch1_x0_coeff = 6.0 - 2.0 * aa_cubic_b;
|
cubic_branch1_x0_coeff = 6.0 - 2.0 * aa_cubic_b;
|
||||||
cubic_branch2_x3_coeff = -aa_cubic_b - 6.0 * aa_cubic_c;
|
cubic_branch2_x3_coeff = -aa_cubic_b - 6.0 * params.aa_cubic_c;
|
||||||
cubic_branch2_x2_coeff = 6.0*aa_cubic_b + 30.0*aa_cubic_c;
|
cubic_branch2_x2_coeff = 6.0*aa_cubic_b + 30.0*params.aa_cubic_c;
|
||||||
cubic_branch2_x1_coeff = -12.0*aa_cubic_b - 48.0*aa_cubic_c;
|
cubic_branch2_x1_coeff = -12.0*aa_cubic_b - 48.0*params.aa_cubic_c;
|
||||||
cubic_branch2_x0_coeff = 8.0*aa_cubic_b + 24.0*aa_cubic_c;
|
cubic_branch2_x0_coeff = 8.0*aa_cubic_b + 24.0*params.aa_cubic_c;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -306,7 +306,7 @@ float eval_tent_filter(const float dist)
|
||||||
|
|
||||||
float eval_gaussian_filter(const float dist)
|
float eval_gaussian_filter(const float dist)
|
||||||
{
|
{
|
||||||
return exp(-(dist*dist) / (2.0*aa_gauss_sigma*aa_gauss_sigma));
|
return exp(-(dist*dist) / (2.0*params.aa_gauss_sigma*params.aa_gauss_sigma));
|
||||||
}
|
}
|
||||||
|
|
||||||
float eval_cubic_filter(const float dist)
|
float eval_cubic_filter(const float dist)
|
||||||
|
@ -315,14 +315,14 @@ float eval_cubic_filter(const float dist)
|
||||||
#ifndef RUNTIME_ANTIALIAS_WEIGHTS
|
#ifndef RUNTIME_ANTIALIAS_WEIGHTS
|
||||||
// When runtime weights are used, these values are instead written to
|
// When runtime weights are used, these values are instead written to
|
||||||
// global uniforms at the beginning of each tex2Daa* call.
|
// global uniforms at the beginning of each tex2Daa* call.
|
||||||
const float aa_cubic_b = 1.0 - 2.0*aa_cubic_c;
|
const float aa_cubic_b = 1.0 - 2.0*params.aa_cubic_c;
|
||||||
const float cubic_branch1_x3_coeff = 12.0 - 9.0*aa_cubic_b - 6.0*aa_cubic_c;
|
const float cubic_branch1_x3_coeff = 12.0 - 9.0*aa_cubic_b - 6.0*params.aa_cubic_c;
|
||||||
const float cubic_branch1_x2_coeff = -18.0 + 12.0*aa_cubic_b + 6.0*aa_cubic_c;
|
const float cubic_branch1_x2_coeff = -18.0 + 12.0*aa_cubic_b + 6.0*params.aa_cubic_c;
|
||||||
const float cubic_branch1_x0_coeff = 6.0 - 2.0 * aa_cubic_b;
|
const float cubic_branch1_x0_coeff = 6.0 - 2.0 * aa_cubic_b;
|
||||||
const float cubic_branch2_x3_coeff = -aa_cubic_b - 6.0 * aa_cubic_c;
|
const float cubic_branch2_x3_coeff = -aa_cubic_b - 6.0 * params.aa_cubic_c;
|
||||||
const float cubic_branch2_x2_coeff = 6.0*aa_cubic_b + 30.0*aa_cubic_c;
|
const float cubic_branch2_x2_coeff = 6.0*aa_cubic_b + 30.0*params.aa_cubic_c;
|
||||||
const float cubic_branch2_x1_coeff = -12.0*aa_cubic_b - 48.0*aa_cubic_c;
|
const float cubic_branch2_x1_coeff = -12.0*aa_cubic_b - 48.0*params.aa_cubic_c;
|
||||||
const float cubic_branch2_x0_coeff = 8.0*aa_cubic_b + 24.0*aa_cubic_c;
|
const float cubic_branch2_x0_coeff = 8.0*aa_cubic_b + 24.0*params.aa_cubic_c;
|
||||||
#endif
|
#endif
|
||||||
const float abs_dist = abs(dist);
|
const float abs_dist = abs(dist);
|
||||||
// Compute the cubic based on the Horner's method formula in:
|
// Compute the cubic based on the Horner's method formula in:
|
||||||
|
|
Loading…
Reference in a new issue