Torch effect like in Lone Survivor?

  • #1, by nerdSunday, 17. February 2019, 15:29 A year ago
    Torch effect like in Lone Survivor? I mean, the dark surrounding and following the player. Anyway to do that?

    Forum Fan

    147 Posts


  • #2, by NigecMonday, 18. February 2019, 08:46 A year ago
    The professional way would be a shader, but I have no idea how to do that, maybe look into vignetting?

    The age old  way is and image with a transparent dot in the center twice the size of the stage as a cursor or following overlay

    Key Killer

    520 Posts

  • #3, by NigecMonday, 18. February 2019, 15:32 A year ago
    You can do it with a Shader, I failed dismally but Simon put me right:
    local name = "vignette"
    shader_effects[name] = { shader = Shaders.vignette.Compiled }
    shaderAddEffect(name)
    shader_effects[name].num.u_resolution = {1920,1080}
    shader_effects[name].num.vPos = {1920/2,1080/2}
    1
    2
    3
    4
    5

    varying vec2 uv;
    uniform sampler2D texel;
    uniform vec2 u_resolution;
    uniform vec2 vPos;
    void main ()
    {
      vec4 color = texture2D(texel, uv);
      vec2 position = uv - vec2(0.5);           
      float dist = length(position * vec2(u_resolution.x/u_resolution.y, 1.0));

      float radius = 0.5;
      float softness = 0.09;
      float vignette = smoothstep(radius, radius - softness, dist);
      color.rgb = color.rgb - (1.0 - vignette);
      gl_FragColor = color;
    }
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16

    Key Killer

    520 Posts

  • #4, by NigecMonday, 18. February 2019, 15:40 A year ago
    You need the shader tool kit, its called  shaderscript11.lua and you'll find it in the wiki


    Order matters! so the shaderscript11 is listed first then the script with the vignette shader script

    Key Killer

    520 Posts

  • #5, by nerdTuesday, 19. February 2019, 16:20 A year ago
    Thank you guys I m gonna check it out.

    Forum Fan

    147 Posts

Write post