vhs effect

efeito vhs

 

Shader code
serializedVersion: 6
  m_ObjectHideFlags: 0
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}
  m_PrefabAsset: {fileID: 0}
  m_Name: VHSEffect
  m_Shader: {fileID: 4800000, guid: 149482f3dc87edc43b16a2edbd6b407f, type: 3}
  m_ShaderKeywords: 
  m_LightmapFlags: 4
  m_EnableInstancingVariants: 0
  m_DoubleSidedGI: 0
  m_CustomRenderQueue: -1
  stringTagMap: {}
  disabledShaderPasses: []
  m_SavedProperties:
    serializedVersion: 3
    m_TexEnvs:
    - _BumpMap:
        m_Texture: {fileID: 0}
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    - _DetailAlbedoMap:
        m_Texture: {fileID: 0}
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    - _DetailMask:
        m_Texture: {fileID: 0}
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    - _DetailNormalMap:
        m_Texture: {fileID: 0}
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    - _EmissionMap:
        m_Texture: {fileID: 0}
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    - _MainTex:
        m_Texture: {fileID: 0}
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    - _MetallicGlossMap:
        m_Texture: {fileID: 0}
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    - _NoiseTexture:
        m_Texture: {fileID: 2800000, guid: e66e29da532514e4082069f78205867a, type: 3}
        m_Scale: {x: 1, y: 20}
        m_Offset: {x: 0, y: 0}
    - _OcclusionMap:
        m_Texture: {fileID: 0}
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    - _ParallaxMap:
        m_Texture: {fileID: 0}
        m_Scale: {x: 1, y: 1}
        m_Offset: {x: 0, y: 0}
    m_Floats:
    - _BumpScale: 1
    - _ChromaticAberration: 4.32
    - _ColorBleedAmount: 1.15
    - _ColorBleedIterations: 10
    - _Contrast: 0.924
    - _Cutoff: 0.5
    - _DetailNormalMapScale: 1
    - _DstBlend: 0
    - _GlossMapScale: 1
    - _Glossiness: 0.5
    - _GlossyReflections: 1
    - _LensDistortion: 1.12
    - _LineAmount: 200
    - _LinesDisplacement: 0.64
    - _LinesSpeed: 1
    - _Metallic: 0
    - _Mode: 0
    - _OcclusionStrength: 1
    - _Parallax: 0.02
    - _SineLinesAmount: 14.9
    - _SineLinesDisplacement: 10.5
    - _SineLinesSpeed: 20
    - _SineLinesThreshold: 0.055
    - _SmoothnessTextureChannel: 0
    - _SpecularHighlights: 1
    - _SrcBlend: 1
    - _UVSec: 0
    - _Vignette: 0
    - _ZWrite: 1
    m_Colors:
    - _Color: {r: 1, g: 1, b: 1, a: 1}
    - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
Tags
efeito, VHS
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from elias

vhs effect

Related shaders

VHS and CRT monitor effect for GODOT4

VHS and CRT monitor effect

vhs effect

guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
mescalin1
9 days ago

this is a unity shader, not godot!!! here’s a quick copilot rewrite:

shader_type canvas_item;

uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
uniform sampler2D noise_texture;

uniform float chromatic_aberration = 4.32;
uniform float lens_distortion = 1.12;
uniform float line_amount = 200.0;
uniform float lines_speed = 1.0;
uniform float lines_displacement = 0.64;
uniform float sine_lines_amount = 14.9;
uniform float sine_lines_speed = 20.0;
uniform float sine_lines_displacement = 10.5;
uniform float sine_lines_threshold = 0.055;
uniform float contrast = 0.924;
uniform float noise_strength = 0.15;

void fragment() {
  vec2 uv = SCREEN_UV;

  // Lens distortion
  vec2 center = vec2(0.5);
  vec2 to_center = uv – center;
  float dist = length(to_center);
  uv += to_center * dist * lens_distortion * 0.01;

  // Sine wave scanline distortion
  float sine_wave = sin(uv.y * sine_lines_amount + TIME * sine_lines_speed);
  if (abs(sine_wave) < sine_lines_threshold) {
    uv.x += sine_wave * sine_lines_displacement * 0.001;
  }

  // Horizontal flicker lines
  float line_offset = sin(uv.y * line_amount + TIME * lines_speed) * lines_displacement * 0.001;
  uv.x += line_offset;

  // Chromatic aberration
  vec4 col;
  col.r = texture(SCREEN_TEXTURE, uv + vec2(chromatic_aberration * 0.001, 0.0)).r;
  col.g = texture(SCREEN_TEXTURE, uv).g;
  col.b = texture(SCREEN_TEXTURE, uv – vec2(chromatic_aberration * 0.001, 0.0)).b;
  col.a = 1.0;

  // Add noise flicker
  vec2 noise_uv = vec2(uv.x, uv.y * 20.0 + TIME * 10.0); // scroll vertically
  float noise = texture(noise_texture, noise_uv).r;
  col.rgb += noise * noise_strength;

  // Contrast adjustment
  col.rgb = (col.rgb – 0.5) * contrast + 0.5;

  COLOR = col;
}