Login / Registrieren
DE EN FR ES IT CZ
Zurück Nach oben

Torch effect like in Lone Survivor?

  • #1, by nerd 7 years ago Zitieren
    Torch effect like in Lone Survivor? I mean, the dark surrounding and following the player. Anyway to do that?
  • #2, by Nigec 7 years ago Zitieren
    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
  • #3, by Nigec 7 years ago Zitieren
    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}

    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;
    }
  • #4, by Nigec 7 years ago Zitieren
    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
  • #5, by nerd 7 years ago Zitieren
    Thank you guys I m gonna check it out.