Graph Texture Generator

The Graph texture generator uses a PopcornFX nodegraph to compute the color of each texel from its UV or integer coordinates.

Properties

Property name

Default value

Description

All common properties, see Texture Generators

Cubemap

false

When enabled, will generate a cubemap instead of a regular texture

Seed

0

Random seed used to generate the texture

BackgroundColor

0, 0, 0, 0

Texel color to clear the texture with before evaluating the graph

Atlas

Tiles

1, 1, 1

Number of atlas tiles along each dimension of the texture

Animation

AnimationStart

0.0

When using atlas tiles, time in seconds of the start of the animation (on the first tile)

AnimationEnd

1.0

When using atlas tiles, time in seconds of the emd of the animation (on the last tile)

Texture Graph

The texture graph is run once per texel of the final texture, to compute the color of this texel.
The base texture graph consists of an input template TextureGeneratorArgs, which outputs various useful properties such as the UV coordinates of the texel, and an output template TextureGeneratorOutputs, which expects as an input the color to write into the texel.

Texture Graph

Current Limitations

  1. You cannot make local templates

  2. You cannot use custom attributes

  3. The simulation will be one-shot, it cannot be iterated over multiple frames to make a simulation converge using previous texel values

Available Inputs

The TextureGeneratorArgs template outputs the following values:

Property

Type

Description

UV

float2

Normalized UV coordinates of the center of the current texel in the current atlas tile, for 1D & 2D textures.

UVW

float3

Normalized UVW coordinates of the center of the current voxel in the current atlas tile, for 3D textures.

Coords

int3

Integer coordinates of the current texel in the current atlas tile.

GlobalCoords

int3

Integer coordinates of the current texel in the whole texture.

TexelID

int

Flat index of the current texel.

Resolution

int3

Texture resolution.

CellSize

float3

Texel size in UV space.

TileSize

float3

Size of the current atlas tile in UV space.

TileAspectRatio

float3

Tile size in the [0, 1] range, normalized by the largest side of the tile. Should be named NormalizedTileSize instead.

FaceID

int

Index of the current cubemap face.

FaceID

CubeFace

Normal

Tangent

Bitangent

0

+X

-1,0,0

0,0,-1

0,-1,0

1

-X

+1,0,0

0,0,+1

0,-1,0

2

+Y

0,+1,0

-1,0,0

0,0,+1

3

-Y

0,-1,0

-1,0,0

0,0,-1

4

+Z

0,0,+1

-1,0,0

0,-1,0

5

-Z

0,0,-1

+1,0,0

0,-1,0

FaceNormal

float3

Normal of the current cubemap face, pointing outwards.

FaceTangent

float3

Vector tangent to the current cubemap face.

CubemapVector

float3

Normalized vector that points from the center of the cubemap to the center of the current texel.

FrameID

int

Integer frame number in an animated vector-field. For static vector-fields, this will always be 0.

FrameRatio

float

Normalized animation cursor in the [0, 1] range.

AnimationCursor

float

Animation time in seconds, between the AnimationStart and AnimationEnd values of the generator.

Available Outputs

The TextureGeneratorOutputs template takes the following values as inputs:

Property

Type

Description

RGBA

float4

Texel color. Also accepts float, float2, or float3 values