044 · SLANG
NVIDIA · differentiable · una forma, multa membra
Project Lavos · The Stack
PLATE XLIV · LIVE · INTERACTIVE

Una forma, multa membra.

— ONE FORM, MANY MEMBERS —

the interface.

NVIDIA  ·  CMU  ·  Khronos  ·  2017 — 2024

SLANG · INTERFACE / IMPL · DIFFERENTIABLE · CROSS-COMPILES TO SPIR-V · DXIL · METAL · CUDA · WGSL

OSL describes a surface. WGSL dispatches a kernel. Slang introduces a third move: an interface. One contract, written once. Many implementations, swapped at compile time. The shader becomes generic — a surface that holds whichever physics you fit to it. Below: the same sphere; six implementations; one drag.

interface IBSDF { fn eval(ωi, ωo) vec3; } — the contract. drag the rail to swap the implementation. —

— Plate XLIV · IBSDF · live, in your browser — interface IBSDF · 6 implementations
IMPL · diffuse
interface IBSDF
interactive · drag the rail
Diffuse  ·  impl 1/6
— Scrubber · 6 implementations of IBSDF — each stop is a different .eval()

drag the knob  ·  or press

— Implementation — Diffuse
— Albedo — vec3(0.82, 0.78, 0.74)
— Roughness — 1.00
— Compiles To — SPIR-V · DXIL · MSL · CUDA

The trilogy completes. OSL is a closure — describe what the surface is. WGSL is a kernel — compute the same thing on every device. Slang is an interface — write the contract once, slot in any member that fits.

This is shader polymorphism in the style of Rust traits or Swift protocols. A material library becomes a set of IBSDF implementations; the renderer asks for one by name; the compiler specializes. One form. Many members.

And — the move that lifted Slang into the moment — the language is differentiable. Compose a shader, and the compiler will hand you back its gradient. The shader is no longer just a renderer. It's a layer in a network.

Authorship & Provenance colophon — interface IBSDF
Authorship
Tim Foley · NVIDIA & CMU
Slang Project · 2017
open-sourced 2018
Khronos working group · 2024
shader-slang.com
Architecture
HLSL-compatible · generics + interfaces
differentiable shaders
compiles to SPIR-V · DXIL · MSL · CUDA · WGSL · GLSL
slang.exe · slangc · libslang
Status
v1 stable · 2024
Khronos open-source · 2024
Falcor · NVIDIA's research renderer
used in production: NVIDIA Omniverse

— Lineage · one form, many members —

2007Tim Foley begins shader-language research at Stanford. The question: can shaders carry generics without losing GPU efficiency?
2017Slang first appears at NVIDIA Research. HLSL-compatible. Adds interfaces, generics, extensions — Rust-trait-style polymorphism in a shader language.
2018Open-sourced on GitHub. Falcor — NVIDIA's research path tracer — adopts Slang for its material system.
2020Compiles to SPIR-V, DXIL, MSL, GLSL, CUDA. The same Slang source now ships to every GPU backend that matters.
2022Differentiable Slang. The compiler will return a gradient for any function you write. Inverse rendering, learned BRDFs, neural shading become first-class.
2024Khronos adopts Slang as a working group. v1 spec stable. The shader language with generics, written for the GPU, ratified for the open ecosystem.
Una forma, multa membra. The interface holds. The implementations swap. The compiler decides the rest.

compose, then compile.

One contract. Six implementations. Six backends. The language that finally let shaders carry generics — and gradients — without leaving the GPU.

— § II · Shading · Generic / Differentiable —
Plate XLIV · MMXXVI
projectlavos-bauhaus · 044