surfacecurve-shaderbuilder

a JSON-based shader graph builder for WebGL

npm install surfacecurve-shaderbuilder
17 downloads in the last month

surfacecurve-shaderbuilder

A JSON-based shader graph builder for WebGL.

Overview

TBD.

Architecture

The basic architecture is as follows:

  1. An object is assigned a Material
  2. A Material is a shader graph along with it's assigned parameters
  3. Parameters may consist of explicit values, computed values, or context variables
  4. The graph is composed of Node objects which encapsulate a single "function" within the graph

Internally, the system (1) caches shared graphs - i.e. Materials that share the same graph and differ only by parameter, (2) supports explicitly named Materials as well as anonymous derived Materials that vary only by overrides.

Materials

TBD.

Nodes

TBD.

Context Variables

TBD.

Overrides / Overlays

Creates an anonymous Material from a named Material.

TBD.

Graph Cache

Ensures equivalent graphs are reused when only the input parameters, not the underlying code, vary -- thus allowing program reuse.

TBD.

Implict Conversions

As a domain-specific language, the ShaderBuilder supports implicit conversions that make sense in the context of a graphical shading language. An obvious convenience conversion would be from RGB to RGBA.

Full list of conversions TBD.

Future

  • Other targets (GLSL, C++ ray-tracer lambdas, etc.)
npm loves you