def smptebars_glitch(cfg): """SMPTE bars glitching at irregular intervals""" cfg.duration = 15 cfg.aspect_ratio = (4, 3) quad = ngl.Quad((-1, -1, 0), (2, 0, 0), (0, 2, 0)) program = ngl.Program(vertex=cfg.get_vert("smptebars"), fragment=cfg.get_frag("smptebars")) program.update_vert_out_vars(var_uvcoord=ngl.IOVec2()) render = ngl.Render(quad, program) freq = cfg.framerate[0] / cfg.framerate[1] + 1 render.update_frag_resources( active_noise=ngl.NoiseFloat(octaves=1), active_probability=ngl.UniformFloat(0.4), # glitch 40% of the time uv_noise_0=ngl.NoiseVec2(amplitude=0.05, frequency=freq, seed=1000 + 0), uv_noise_1=ngl.NoiseVec2(amplitude=0.05, frequency=freq, seed=1000 + 0x7FFF), uv_noise_2=ngl.NoiseVec2(amplitude=0.05, frequency=freq, seed=1000 + 0xFFFF), ) return render
def data_noise_wiggle(cfg): cfg.aspect_ratio = (1, 1) cfg.duration = 3 vert = ''' void main() { ngl_out_pos = ngl_projection_matrix * ngl_modelview_matrix * ngl_position; ngl_out_pos += vec4(wiggle, 0.0, 0.0); } ''' frag = ''' void main() { ngl_out_color = color; } ''' geometry = ngl.Circle(radius=0.25, npoints=6) program = ngl.Program(vertex=vert, fragment=frag) render = ngl.Render(geometry, program) render.update_vert_resources(wiggle=ngl.NoiseVec2(octaves=8)) render.update_frag_resources(color=ngl.UniformVec4(value=COLORS['white'])) return render
def data_noise_wiggle(cfg): cfg.aspect_ratio = (1, 1) cfg.duration = 3 vert = textwrap.dedent("""\ void main() { ngl_out_pos = ngl_projection_matrix * ngl_modelview_matrix * vec4(ngl_position, 1.0); ngl_out_pos += vec4(wiggle, 0.0, 0.0); } """) frag = textwrap.dedent("""\ void main() { ngl_out_color = vec4(color, 1.0); } """) geometry = ngl.Circle(radius=0.25, npoints=6) program = ngl.Program(vertex=vert, fragment=frag) render = ngl.Render(geometry, program) render.update_vert_resources(wiggle=ngl.NoiseVec2(octaves=8)) render.update_frag_resources(color=ngl.UniformVec3(value=COLORS.white)) return render