Skip to content

Code

Your own HLSL, run for every pixel.

A input of the preview
APerlin · Fbm
B input of the preview
BHexagons · Mask
Code output
Category
Operations
Inputs
A, B, C, D
Outputs
Output
ParameterTypeDefaultRange
XNumber0–
YNumber0–
ZNumber0–
WNumber0–

Write the body of a function that returns the pixel’s colour (float4) in the node’s Code option. Available:

  • a, b, c, d: the four inputs at this pixel (float4; mid grey when not connected).
  • uv (0..1), pixel (uint2), Width, Height.
  • x, y, z, w: the node’s four parameters, which you can also wire.
  • SampleA(uv) … SampleD(uv): an input anywhere (bilinear, wrapping), for offsets and distortions.
float stripes = 0.5 + 0.5 * sin((uv.x + uv.y) * 6.2832 * 8.0 + x);
return lerp(a, b, stripes);

The code is compiled when the graph is saved (the node’s Compile button, or Ctrl S / Cmd S). Until then the node keeps its last result and says it is not compiled. Compile errors show on the node and in the Console, with the line in your code. The code is saved in the graph, so it bakes the same on every machine.