All Projects → danilw → shadertoy-to-video-with-FBO

danilw / shadertoy-to-video-with-FBO

Licence: BSD-3-Clause license
Render a ShaderToy script directly to a video file. (added FrameBuffers support)

Projects that are alternatives of or similar to shadertoy-to-video-with-FBO

YALCT
Yet Another Live Coding Tool - Powered by Veldrid and elbow grease
Stars: ✭ 25 (-3.85%)
Mutual labels:  glsl, shadertoy
Riftray
Step into the worlds of Shadertoy with an Oculus Rift.
Stars: ✭ 68 (+161.54%)
Mutual labels:  glsl, shadertoy
Shader Doodle
A friendly web-component for writing and rendering shaders.
Stars: ✭ 356 (+1269.23%)
Mutual labels:  glsl, shadertoy
music visualizer
Shader viewer / music visualizer for Windows and Linux
Stars: ✭ 137 (+426.92%)
Mutual labels:  glsl, shadertoy
DuEngine
An efficient interactive C++ renderer for ShaderToy-alike demos with 2D/3D/CubeMap/Video/Camera/LightField/Volume textures. (Partially used in my I3D 2018 papers)
Stars: ✭ 62 (+138.46%)
Mutual labels:  glsl, shadertoy
30-days-of-shade
30 days of shaders in GLSL using GLSLCanvas
Stars: ✭ 134 (+415.38%)
Mutual labels:  glsl, shadertoy
Bonzomatic
Live shader coding tool and Shader Showdown workhorse
Stars: ✭ 829 (+3088.46%)
Mutual labels:  glsl, shadertoy
GLSLShaderShrinker
Optimizes the size of GLSL shader code.
Stars: ✭ 39 (+50%)
Mutual labels:  glsl, shadertoy
Noodlesplate
Offline Shader Editor with many cool features
Stars: ✭ 79 (+203.85%)
Mutual labels:  glsl, shadertoy
Shady
CLI tool to render GLSL shaders
Stars: ✭ 79 (+203.85%)
Mutual labels:  glsl, shadertoy
card-game-GLSL
card game in the single GLSL shader
Stars: ✭ 20 (-23.08%)
Mutual labels:  glsl, shadertoy
ofxShadertoy
Addon for openFrameworks that sets up and loads Shadertoy (http://www.shadertoy.com) shaders
Stars: ✭ 77 (+196.15%)
Mutual labels:  glsl, shadertoy
Shaderman
Convert ShaderToy to Unity HLSL/CG
Stars: ✭ 734 (+2723.08%)
Mutual labels:  glsl, shadertoy
Shadertoy React
6kB "Shadertoy" like react component letting you easily render your fragment shaders in your React web projects, without having to worry about implementing the WebGL part.
Stars: ✭ 74 (+184.62%)
Mutual labels:  glsl, shadertoy
shady
A GTK+ shader editor, that aims for Shadertoy.com compatibility (and more…)
Stars: ✭ 22 (-15.38%)
Mutual labels:  glsl, shadertoy
ShaderBoy
Simple text editor that lets you write Shadertoy shaders more comfortably, anytime, anywhere.
Stars: ✭ 133 (+411.54%)
Mutual labels:  glsl, shadertoy
PyGraphicsGui
A "CookieCutter" for a Pythonic GUI with custom graphics - clone this to jump-start your project and learn how to integrate between ModernGL and Tkinter on Python3.6.
Stars: ✭ 30 (+15.38%)
Mutual labels:  glsl
ShaderToy-Chrome-Plugin
Web extension for shadertoy.com
Stars: ✭ 159 (+511.54%)
Mutual labels:  shadertoy
MTTransitions
iOS Transitions ports from GL-Transitions.
Stars: ✭ 178 (+584.62%)
Mutual labels:  glsl
ray-marching-distance-fields
Haskell and GLSL program containing my distance field / ray marching related experiments
Stars: ✭ 32 (+23.08%)
Mutual labels:  glsl

shadertoy-render

What is it: creating video from shaders on Shadertoy. This my fork has many changes and fixes from original.

Windows OS support instruction, how to launch it on Windows OS scroll down. (tested/works on Linux and Windows)

My Youtube playlist - videos created from my shaders using this script. GLSL Auto Tetris video also recorded by this script.

Contact: Join discord server


Uploading created video to Twitter/Instagram - pixel format set to yuv420p for libx264 codec and .mp4 video can be uploaded to any social platform without problems.


Supported - Buffers A-D same as on Shadertoy. Images. discard supported in buffers and image shader.

Supported recording video format: (look line 832 in shadertoy-render.py for encoding parameters)

  • *.mp4 - h264, alpha ignored
  • *.webm - v8 codec, support alpha
  • *.mov - frames without compression, support alpha

Not supported - Cubemaps, Shader-Cubemap, 3d texture, audio and video input also not supported. (2d textures without mipmaps)


Shader uniforms:

iChannel0 to iChannel3 uniform is Buf0.glsl to Buf3.glsl file.

iTexture0 to iTexture3 uniform is 0.png to 3.png file

if you want/need to change order of iChannels - added renamed copy u_channel0 to u_channel3 uniform

#define iChannel0 u_channel3
#define iChannel3 iTexture0

Examples:

example_one_shader - New shader on Shadertoy, single shader example.

example_shadertoy_fbo - test for Buffer queue order to be same as on Shadertoy, Shadertoy link src webm video recorded with RGBA and test for correct buffers queue video link

example_textures - example using textures.

Command to encode example:

cd example_shadertoy_fbo
python3 ../shadertoy-render.py --output 1.mp4 --size=800x450 --rate=30 --duration=5.0 --bitrate=5M main_image.glsl

Command line options:

--output 1.mp4 - file name for video file.

--size=800x450 - resolution of video for recording, for 1080p set 1920x1080

--rate=30 - frame rate, FPS for shader

--duration=5.0 - duration in seconds, support fractional part of second example 2.5 two sec and 500ms (half of second)

--bitrate=5M - bitrate of video, used only for mp4 and webm file format

--tile-size=512 tile rendering - useful when you want render very slow shader for 4k video, or you have very slow GPU. Also useful for Windows OS to avoid driver crash when frames rendered for longer than 2 sec.

Tile rendering works only on Image shader (main_image.glsl file). Buffers (A-D) still rendered full frame at once. (also remember that discard in shader will be broken when used tile rendering)


When recording visual result not equal to Shadertoy:

Many shaders(even top rated) on Shadertoy may use lots of unitialized variables and clamp(1,0,-1)/pow(-1,2)/(0/0)/normalize(0)...etc, that work in not same way(have not same result) in OpenGL and webbrowser Angle/GLES, black screen(or other random "results") because of this. (also sin-noise could be broken in OpenGL)

The only way to fix your shader - is hand debugging and fixing all bugs.

Also remember to set Alpha in main_image.glsl when recording rgba video.

And check for used buffers and textures parameters, this script has clamp_to_edge with linear interpolation for buffers, and repeat with linear without y-flip for textures, Mipmaps not supported.


Windows OS instruction to launch: (tested summer 2022 works)

  1. install python3 python 3.10 or latest, click Add Python to PATH in setup Window
  2. press Win+R write cmd to launch console
  3. in Windows console write
pip install vispy
pip install watchdog
pip install glfw
pip install Pillow
  1. download ffmpeg-git-full (example - Windows builds from gyan - ffmpeg-git-full.7z) and extract

  2. download or clone this shadertoy-to-video-with-FBO

  3. open shadertoy-render.py in text editor

  4. edit line 41 to location of ffmpeg.exe downloaded and extracted on step 4 notice that / used as separator

  5. press Win+R write cmd to launch console and launch command, first command path is location of example folder

    > cd C:\shadertoy-to-video-with-FBO-master\example_shadertoy_fbo

    > python ../shadertoy-render.py --output 1.mp4 --size=800x450 --rate=30 --duration=5.0 --bitrate=5M main_image.glsl


Useful ffmpeg commands:

To exptract .png frames with Alpha without compression:

Two options:

  1. if you need just a single frame - add --interactive to this script command line, and press S(keyboard) to save frame.
  2. for many frames - save video as .mov (change file format in comand line) and then:
ffmpeg -i video.mov -vf fps=1 "frames/out%d.png"

To convert Video to Gif ffmpeg commands:

best quality (Linux only) delay = 100/fps

ffmpeg -i video.mp4 -vf "fps=25,scale=480:-1:flags=lanczos" -c:v pam -f image2pipe - | convert -delay 4 - -loop 0 -layers optimize output.gif

not best quality (work on Windows and Linux)

ffmpeg -i video.mp4 -vf "fps=25,scale=640:-1:flags=lanczos" output.gif
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].