WonderTexture Get WonderTexture
Docs / Graph Types / Function Graphs
Graph Types • WonderTexture

Function Graphs

Build reusable numerical logic with math, vectors, conditions, variables, texture sampling, and typed Function Outputs.

// FUNCTION GRAPH

What Function Graphs Are

A Function Graph is WonderTexture’s graph type for reusable calculations, values, vectors, conditions, variables, and procedural logic.

Use one when a calculation becomes complex enough to deserve its own reusable graph—for example mathematical utilities, range remapping, vector operations, conditional logic, procedural parameter calculations, randomized value logic, or shared helper functions.

A useful mental model is to treat a Function Graph like a custom calculation node built from smaller pieces. Internal Function nodes perform the logic, exposed parameters define configurable inputs, Function Output defines the returned type, and a Function Graph Instance lets other graphs reuse it.

FUNCTION GRAPH Build a reusable calculation with function nodes, expose its controls, and use it through a Function Graph Instance.

// CORE CONTRACT

Nodes, Data & Output

Function Graphs use function-compatible node families such as Variables, Math, Vectors, and Logic. These cover Float, Integer, Boolean and vector values, Function Graph instances, Random Value, Time, Math, Vector Math, Mix/Lerp, Clamp, Combine/Separate Components, Compare, Switch, Boolean Math, Sequence, and While Loop.

Function logic works with typed values:

DATA TYPEDESCRIPTION
FloatFloating-point numerical value.
IntegerWhole-number numerical value.
BooleanLogical true / false condition or state.
Vector2Two-component vector data.
Vector3Three-component vector data.
Vector4Four-component vector data, also suitable for RGBA-style values where appropriate.

Some nodes require one exact type, while others adapt dynamically to the data connected to them.

A Function Graph ends at Function Output. Choose the result type—Float, Integer, Boolean, Vector 2D, Vector 3D, or Vector 4D / Color—and connect the value you want the graph to return.

// PARAMETERS & COMPOSITION

Parameters & Reuse

Parameters inside a Function Graph can be exposed as reusable inputs. A remapping utility, for example, might expose Input Minimum, Input Maximum, Output Minimum, and Output Maximum. When instanced, those controls become part of the Function Graph Instance and can also appear as compatible value sockets.

Add Shift+A → Functions → Variables → Function Graph and select the source Function Graph. WonderTexture rebuilds the instance from the source interface, including exposed parameters, supported texture-sampler inputs, and the typed Result output. A Float Function Output produces a Float Result; a Vector3 Function Output produces a Vector3 Result, and so on.

Function Graphs can also contain other Function Graph Instances. This makes it possible to build larger calculations from smaller reusable pieces—for example, a Range Utility reused inside a Weathering Control Function.

Function logic is not limited to Function Graphs either. Function Graph Instances can act as reusable calculation blocks inside Standard, Pixel Composer, and FX-Map workflows when compatible value logic is needed.

BUILD SMALL REUSABLE FUNCTIONS
If a calculation has one clear purpose and is useful in more than one place, moving it into a Function Graph can make the larger system easier to understand and maintain.
// TEXTURE / SPATIAL

Texture Sampling & Spatial Context

Function Graphs can receive texture data through a small set of Texture / Spatial tools: Input (Texture), Sample Texture, and $pos (UV). These tools let Function logic access a texture and sample it at a UV coordinate without turning the graph into a Standard texture graph.

Input (Texture) provides a Texture Sampler. Sample Texture reads that sampler at a Vector2 UV and returns a Vector4 color value that can continue through ordinary Function logic.

SAMPLING OPTIONDESCRIPTION
Bilinear (Filtering)Smoothly interpolates neighboring texels during sampling.
Nearest (Filtering)Uses nearest-neighbor sampling for a sharper or intentionally pixelated result.
Repeat (Addressing)Repeats the sampled texture when UV coordinates move outside the normal 0–1 range.
Clamp to Edge (Addressing)Uses edge values instead of repeating the texture outside the normal range.

These settings belong to the sampler itself and are separate from the Standard Graph Tiling base parameter.

The $pos node outputs the normalized UV coordinate supplied by the current compatible evaluation context. You can transform that Vector2 with ordinary Function nodes and feed it into Sample Texture, for example $pos → Vector Math → Sample Texture UV.

A Function Graph may sample texture data internally, but its public result is still whatever Function Output returns. A chain such as Texture Sampler → Sample Texture → Vector Math → Float → Function Output returns one Float value, not a complete image.

Resolution and precision can still matter when a Function Graph runs inside a spatial or texture-processing context, especially while sampling textures, but they are not the graph’s primary contract. The main contract remains the type of value returned by Function Output.

FUNCTION GRAPH RETURNS DATA, NOT AN IMAGE
If you need to evaluate function-style logic across every pixel and produce a texture, use a Pixel Composer Graph.
// REUSABLE ASSETS

Baking & Reusable Assets

Function Graphs can be baked into reusable Function assets. Graph Baking packages the calculation logic and public interface so the function can be reused without the original editable source graph. This is procedural asset baking, not texture-image baking.

The full workflow is covered under Graph Baking & Library.