Author Topic: How to add curvature and scanlines to the snapshots?  (Read 730 times)

Elaphe666

  • Jr. Member
  • **
  • Posts: 12
    • View Profile
How to add curvature and scanlines to the snapshots?
« on: October 28, 2024, 10:27:59 AM »
Any example?

zestful

  • Full Member
  • ***
  • Posts: 35
    • View Profile
Re: How to add curvature and scanlines to the snapshots?
« Reply #1 on: October 30, 2024, 05:02:58 PM »
Code: [Select]
local shader_lottes=fe.add_shader(
    Shader.VertexAndFragment,
    "shaders/CRT-geom.vsh",
    "shaders/CRT-geom.fsh");

// APERATURE_TYPE
// 0 = VGA style shadow mask.
// 1.0 = Very compressed TV style shadow mask.
// 2.0 = Aperture-grille.
shader_lottes.set_param("aperature_type",0);
shader_lottes.set_param("hardScan", 0);   // Hardness of Scanline -8.0 = soft -16.0 = medium
shader_lottes.set_param("hardPix", -2.0);     // Hardness of pixels in scanline -2.0 = soft, -4.0 = hard
shader_lottes.set_param("maskDark", 2.0);     // Sets how dark a "dark subpixel" is in the aperture pattern.
shader_lottes.set_param("maskLight", 0.3);    // Sets how dark a "bright subpixel" is in the aperture pattern
shader_lottes.set_param("saturation", 0.1);   // 1.0 is normal saturation. Increase as needed.
shader_lottes.set_param("tint", 0.0);         // 0.0 is 0.0 degrees of Tint. Adjust as needed.
shader_lottes.set_param("distortion", 0.1); // 0.0 to 0.2 seems right
shader_lottes.set_param("cornersize", 0.01);  // 0.0 to 0.1
shader_lottes.set_param("cornersmooth", 10);  // Reduce jagginess of corners
shader_lottes.set_texture_param("texture");

video.shader = shader_lottes;

fe.add_transition_callback( "shader_transitions" );
shader_transitions <- function( ttype, var, ttime ) {
switch( ttype )
{
case Transition.ToNewList:
case Transition.EndNavigation:
video.shader.set_param("color_texture_sz", video.width, video.height);
video.shader.set_param("color_texture_pow2_sz", video.width, video.height);
break;
}
return false;
}
         video.alpha = 255;

stick the attached files (login to see) in the /shaders folder of your layout.   This is assuming the snap magic token is named as a variable called video

e.g. local video = fe.add_artwork( "snap", x,y,width,height);