Animation category - Stingray Shader Node Reference

Animation category

Description

The nodes in this category simulate local animations on the pixels being shaded.

Nodes

Inputs

scalar

FPS

The number of times per second that the flipbook node should switch to a new sprite or grid cell in the source texture.

Default value: 5

scalar

Time

The current system time. Required. You can get this value from the Input > Time node.

vector2

UV

Texture coordinates, typically output from a Vertex Inputs > Texcoord node. Required.

scalar

Sprite Rows

The number of rows in the sprite sheet.

Default value: 2

scalar

Sprite Columns

The number of columns in the sprite sheet.

Default value: 2

Outputs

Out

auto

The UV coordinates to sample from the animated texture for this frame.

The Flipbook node divides UV space into a grid with a configurable number of rows and columns. Each frame, it takes care of deciding which of these grid cells should be shown, based on the current time and the desired playback speed for the animation. It then produces output UV values that limit the texture coordinates to that single cell.

Node definition in file: core/shader_nodes/flipbook.shader_node

Inputs

vector4

Vertex Position

The position of the vertex being shaded, in world space. Required. You can get this value from the Vertex Inputs > Position node, if transform its value using Transform > Object To World.

vector4

Vertex Color

RGBA values that determine the way the leaves bend at a detailed level. These values are typically painted onto the vertices of the mesh by an artist working in a DCC tool like 3ds Max or Maya.

  • The red channel determines the stiffness of the leaves' edges.
  • The green channel determines per-leaf phase variation. By painting leaves with different intensities in this channel, you can avoid having all your leaves moving in the same direction at the same time.
  • The blue channel determines overall stiffness of the leaves.
  • The alpha channel is used for pre-computed ambient occlusion.

Required.

vector3

World Normal

The normal of the vertex being shaded, in world space. Required. You can get this value from the Vertex Inputs > World Normal node.

scalar

Time

The current system time. Required. You can get this value from the Input > Time node.

scalar

Speed

The speed of the simulation.

Default value: 0.5

vector2

Bend Amplitude Frequency

The first value in this pair determines how far the leaves can bend. The second value determines how quickly the leaves return to their original positions.

Default value: (0.3, 0.1)

vector2

Detail Amplitude Frequency

The first value in this pair determines how much the edges of the leaves can bend. The second value determines how quickly the edges return to their original positions.

Default value: (0.05, 0.5)

vector3

Wind

A vector that represents the direction and force of the wind along the X and Y axes. The Z value is not used.

Default value: (1.0, 1.0, 0.0)

scalar

Bend Scale

Determines how much the vegetation is deformed along the wind direction.

Default value: 0.005

Outputs

Out

vector3

The position offset calculated for the current frame. You can pass this output value into the Position Offset input plug in the Output > Standard Base shader node.

Pre-requisites
Output nodesThis node can only be used in a shader graph that contains the following output node:

Output > Standard Base

First, an overall vertex displacement is applied to the entire object along its vertical axis, to simulate the bending of a trunk. The direction and strength of this displacement is controlled by the Wind option, scaled by the Bend Scale option. In addition, the bend is automatically scaled according to the height of the mesh, so that the top of the mesh is deformed but the bottom of the mesh (i.e. the roots) does not move.

Then, the leaves and the leaf edges are individually animated according to the Bend Amplitude/Frequency and Detailed Amplitude/Frequency settings respectively. These leaf animation can also be controlled at a very detailed level by painting the vertices of the mesh. See the Vertex Color setting.

This node is based on the technique described in this chapter of GPU Gems 3 from NVIDIA.

For a tutorial that shows how to use this node, see this video.

Node definition in file: core/shader_nodes/vegetation_bending.shader_node