hShadertoy

Experimental Shadertoy.com importer for Houdini 21 Copernicus

https://youtu.be/ULpn8tGFsRI

Project Overview

“You know what would be cool, if you could import a Shadertoy shader to Houdini COPs, do you think it’s possible?”

  1. Editor Shadertoy Mini IDE. input/output shadertoyAPI JSON.
  2. Builder Sets hShadertoy HDA parameters and uses the transpiler to set OpenCL code.
  3. Transpiler Translates GLSL to OpenCL - madness! never been done!

Shadertoy features implementation in Houdini Digital Asset (HDA)

Installation

  1. Download and unpack hShadertoy to a local directory (eg: C:/dev/hShadertoy )

  2. Install tree-sitter:

    pip install tree-sitter

  3. Install tree-sitter-glsl:

    pip install tree-sitter-glsl

  4. Copy houdini/packages/hShadertoy.json to your package directory (eg $HOUDINI_USER_PREF_DIR/packages )

  5. Configure hShadertoy.json and set the following 3 env variables:

     { "HSHADERTOY_ROOT": "C:/dev/hShadertoy" },
     { "HSHADERTOY_HOUDINI": "C:/dev/hShadertoy/houdini" },
     { "SHADERTOY_API_KEY": "YOUR_API_KEY"},
    

    Get your API key: https://www.shadertoy.com/howto

    Note: Shadertoy API is currently blocked. Importing shaderts using API is not working.

  6. Open Editor in hShadertoy shelf

Known limitations

Development

Required

tree-sitter>=0.25.0
tree-sitter-glsl>=0.2.0
numpy>=2.3.0
pytest>=8.4.0
pytest-cov>=7.0.0
black>=24.0.0
pylint>=3.0.0
pyopencl>=2025.2

Pipeline

  1. houdini/toolbar/hShadertoy.shelf
  2. houdini/scripts/python/hshadertoy/gui/editor.py
  3. houdini/scripts/python/hshadertoy/builder/builder.py
  4. houdini/scripts/python/hshadertoy/transpiler/transpile_glsl.py
  5. src/glsl_to_opencl
  6. houdini/otls/hShadertoy.hda - hShadertoy::shadertoy
  7. magic!

GLSL to OpenCL specification:

Unit Tests

Full Transpilation Test

OpenCL Compilation Test

Known BUGS

TODO

Transpiler:

Builder

HDA