Documentation / Node reference / code nodes

code/TextureLaplacian

How much the pixel this tex/Builder is writing differs from the average of the pixels around it.

Texture

Connect a texture, from a code/TextureInput (a picture wired into the tex/Builder) or a code/Param set to NodePath, and this node gives its Laplacian at the pixel being written: the average of the pixels around it, minus the pixel itself. It is 0 where the texture is flat, positive in a dip, negative on a bump. It reads all four channels at once and returns the four Laplacians.

This is what makes things spread out. Add a little of it to a picture, step after step in a tex/Solver, and the picture diffuses: a blur by steps, heat flowing, the two chemicals of a reaction-diffusion spreading before they react.

kernel says which pixels around it are averaged. On a 2D picture, FIVE_POINT takes the four side pixels, and NINE_POINT the eight around it, the corners weighed less: rounder spreading, for four more reads. On a 3D texture, in a 3D tex/Builder, SEVEN_POINT takes the six voxels that share a face, and TWENTY_SEVEN_POINT all 26 around it: smoother, for 20 more reads. A kernel for the other dimension than the texture's stops the build with a message saying which kernels to choose. ROUND and FAST follow the texture: ROUND is NINE_POINT on a picture and TWENTY_SEVEN_POINT on a 3D texture, FAST is FIVE_POINT and SEVEN_POINT, so one graph runs on either. A 2D picture in a 3D builder is read at the voxel's x and y, with a 2D kernel.

borderMode says what is read past the edge of the texture, on each axis, as in code/TextureTexel. REPEAT, the opposite side, is what a simulation on a tile needs.

The kernel input takes the kernel as a number, from a code/Param or a code/Constant of type UInt32, holding one of the kernel values (FIVE_POINT 0, NINE_POINT 1, SEVEN_POINT 2, TWENTY_SEVEN_POINT 3, ROUND 4, FAST 5). A code/Param changes it without rebuilding the shader. Wired, it follows the texture: FIVE_POINT, SEVEN_POINT and FAST read the side pixels or face voxels, any other value the round kernel of the texture's dimension.

Parameters

Name Type What it does
kernel UInt8 FIVE_POINT · NINE_POINT · SEVEN_POINT · TWENTY_SEVEN_POINT · ROUND · FAST Which neighbours are averaged, when nothing is wired into the kernel input. For a 2D picture: FIVE_POINT, the four side pixels (1/4 each), or NINE_POINT, the eight around it (sides 0.2, corners 0.05), rounder for four more reads. For a 3D texture: SEVEN_POINT, the six face neighbours (1/6 each), or TWENTY_SEVEN_POINT, all 26 around it (1/26 each), smoother for 20 more reads. A kernel for the other dimension stops the build with a message. ROUND (NINE_POINT or TWENTY_SEVEN_POINT) and FAST (FIVE_POINT or SEVEN_POINT) pick by the texture's dimension, for a graph meant for both.
borderMode UInt8 CLAMP · TRANSPARENT · REPEAT · MIRROR What is read past the edge of the texture. CLAMP: the edge pixels repeat. TRANSPARENT: transparent black. REPEAT: the opposite side of the texture, for a picture that tiles, as a simulation on a tile needs. MIRROR: the picture flipped at its edge.

Examples

Scenes you can open in the editor that teach this node.

The tex/ReactionDiffusion node grows a pattern from a star seeded in a picture: two chemicals spread and react, and the star becomes a maze of stripes. Other values of F and k give coral, worms, spots and holes.

tex/PolyNode tex/Solver tex/Builder code/TextureLaplacian

Materials Animation

The tex/ReactionDiffusion node grows a pattern in a 64 by 64 by 64 texture: two chemicals spread through the volume and react, and three seeded spheres grow into a maze of folded sheets. The viewer draws them as fog with a mat/Volume, and beside it as a solid with a mat/VolumeSurface, both reading the texture where the GPU wrote it. Open the texture panel to see it slice by slice or raymarched.

tex/PolyNode tex/Solver tex/Builder code/TextureLaplacian mat/Volume mat/VolumeSurface

Materials Animation

See also

This page is generated from the engine, so it describes the release you can download. The same text is in the editor's Help panel next to the node itself.