Go from zero to your first shader in minutes.
Install vsdf and its dependencies with Homebrew:
brew install jamylak/vsdf/vsdfEasiest way to install vsdf: Pre-built binaries for Linux are available in the GitHub Releases page. The only dependency is Vulkan.
To get the latest release:
LATEST_RELEASE_TAG=$(curl -sL https://api.github.com/repos/jamylak/vsdf/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
LINUX_ARCH=$( [ "$(uname -m)" = "aarch64" ] || [ "$(uname -m)" = "arm64" ] && echo arm64 || echo x86_64 )
LINUX_DIR="linux-${LINUX_ARCH}"
DOWNLOAD_URL="https://github.com/jamylak/vsdf/releases/download/${LATEST_RELEASE_TAG}/vsdf-linux-${LINUX_ARCH}.tar.gz"
echo "Downloading from: ${DOWNLOAD_URL}"
curl -LO "${DOWNLOAD_URL}"
tar -xzf vsdf-linux-${LINUX_ARCH}.tar.gz
chmod +x ${LINUX_DIR}/vsdf
sudo mv ${LINUX_DIR}/vsdf /usr/local/bin/vsdf
rm -rf vsdf-linux-${LINUX_ARCH}.tar.gz ${LINUX_DIR} # Clean up downloaded filesThe only dependency is Vulkan.
Download the pre-built Windows release (built without ffmpeg):
$tag = (Invoke-RestMethod https://api.github.com/repos/jamylak/vsdf/releases/latest).tag_name
$zip = "vsdf-windows-x86_64-disable_ffmpeg.zip"
$url = "https://github.com/jamylak/vsdf/releases/download/$tag/$zip"
Invoke-WebRequest -Uri $url -OutFile $zip
Expand-Archive $zip -DestinationPath vsdf
.\vsdf\vsdf.exe --versionIf you want to build from source or if you want ffmpeg integration to save videos.
- Install vcpkg:
git clone https://github.com/Microsoft/vcpkg.git cd vcpkg .\bootstrap-vcpkg.bat
- Install deps (includes Vulkan):
vcpkg install vulkan:x64-windows glfw3:x64-windows glslang:x64-windows spdlog:x64-windows glm:x64-windows gtest:x64-windows # (Optional) set -DDISABLE_FFMPEG=ON to skip vcpkg install ffmpeg[avcodec,avformat,swscale]:x64-windows vcpkg integrate install
- Build:
git submodule update --init --recursive # ffmpeg is optional; set `-DDISABLE_FFMPEG=ON` (see `CMakeLists.txt`) to build without it. cmake -B build -DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" . cmake --build build --config Release
The fastest way to get started is by using the vsdf command line tool directly.
- Create a new shader file:
vsdf --new-toy example.frag # Creates 'example.frag' with a default template
vsdf --new-toy plot.frag --template plot # Creates 'plot.frag' with the 2D plot template- Open the newly created shader file in your favorite editor (e.g., VS Code, Neovim, Sublime Text) and start editing!
code example.frag # VS Code
# or: nvim example.frag # Neovim
# or: subl example.frag # Sublime Text- While you're editing, run
vsdfin another terminal to see your changes hot-reload:
vsdf --toy example.fragFor a more integrated and faster experimental workflow with a shell function that creates the shader, opens the editor, and launches vsdf in one command, see the Shell Integration Guide.
vsdf --toy example.frag --frames 100 --ffmpeg-output out.mp4--toysets up push constants and other things in the format ShaderToy uses, e.g.,iTimeas well asmain()etc.--new-toycreates an example shader file starting point- Hot reload: Saving your shader file automatically reloads it in vsdf!
- Available templates:
default(colorful animation),plot(2D function plotter)
- Open the ShaderToy and copy the fragment shader code: https://www.shadertoy.com/view/Xds3zN
- Save it as
shaders/raymarching_primitives.frag. - Run it with the template prepended:
vsdf --toy shaders/raymarching_primitives.fragI would recommend visiting https://www.shadertoy.com to see their amazing shaders. Also check out https://iquilezles.org/