Functions

Function nodes are the building blocks for more complex behavior in your Rule Editor.

Function Nodes

Break: Break Sand to its properties

break_break_sand_to_its_properties_image

Break Sand to its properties

Inputs
InputKind
sand_insand
Outputs
OutputKind
id_outU32
color_outVec3
velocity_outVec2
is_moved_outBool
extra_bit_outBool

Break: Break Vec2 to X and Y

break_break_vec2_to_x_and_y_image

Break Vec2 to X and Y

Inputs
InputKind
vec2_invec2
Outputs
OutputKind
x_outF32
y_outF32

Break: Break Vec3 to X and Y and Z

break_break_vec3_to_x_and_y_and_z_image

Break Vec3 to X and Y and Z

Inputs
InputKind
vec3_invec3
Outputs
OutputKind
x_outF32
y_outF32
z_outF32

Canvas: Read Average Color (3x3) At Pos

canvas_read_average_color_3x3_at_pos_image

Read 3x3 Average Color at Pos from canvas image

Inputs
InputKind
pos_inivec2
Outputs
OutputKind
color_outVec3

Canvas: Read Color At Pos

canvas_read_color_at_pos_image

Read Color At Pos from canvas image

Inputs
InputKind
pos_inivec2
Outputs
OutputKind
color_outVec3

Canvas: Read Gaussian Blur (3x3) At Pos

canvas_read_gaussian_blur_3x3_at_pos_image

Read 3x3 Gaussian Blur at Pos from canvas image

Inputs
InputKind
pos_inivec2
Outputs
OutputKind
color_outVec3

Comment: Comment Box

comment_comment_box_image

Comment boxes help you document your functions

Inputs
InputKind
Outputs
OutputKind

Comparison: Eq bool

comparison_eq_bool_image

Check if bool equals another

Inputs
InputKind
a_inbool
b_inbool
Outputs
OutputKind
outBool

Comparison: Eq characteristic

comparison_eq_characteristic_image

Check if characteristic equals another

Inputs
InputKind
a_incharacteristic
b_incharacteristic
Outputs
OutputKind
outBool

Comparison: Eq direction

comparison_eq_direction_image

Check if direction equals another

Inputs
InputKind
a_indirection
b_indirection
Outputs
OutputKind
outBool

Comparison: Eq f32

comparison_eq_f32_image

Check if f32 equals another

Inputs
InputKind
a_inf32
b_inf32
Outputs
OutputKind
outBool

Comparison: Eq i32

comparison_eq_i32_image

Check if i32 equals another

Inputs
InputKind
a_ini32
b_ini32
Outputs
OutputKind
outBool

Comparison: Eq ivec2

comparison_eq_ivec2_image

Check if ivec2 equals another

Inputs
InputKind
a_inivec2
b_inivec2
Outputs
OutputKind
outBool

Comparison: Eq sand

comparison_eq_sand_image

Check if sand equals another

Inputs
InputKind
a_insand
b_insand
Outputs
OutputKind
outBool

Comparison: Eq sand_id

comparison_eq_sand_id_image

Check if sand_id equals another

Inputs
InputKind
a_insand_id
b_insand_id
Outputs
OutputKind
outBool

Comparison: Eq u32

comparison_eq_u32_image

Check if u32 equals another

Inputs
InputKind
a_inu32
b_inu32
Outputs
OutputKind
outBool

Comparison: Eq vec2

comparison_eq_vec2_image

Check if vec2 equals another

Inputs
InputKind
a_invec2
b_invec2
Outputs
OutputKind
outBool

Comparison: Eq vec3

comparison_eq_vec3_image

Check if vec3 equals another

Inputs
InputKind
a_invec3
b_invec3
Outputs
OutputKind
outBool

Comparison: Greater than f32

comparison_greater_than_f32_image

Check if f32 is greater than another

Inputs
InputKind
a_inf32
b_inf32
Outputs
OutputKind
outBool

Comparison: Greater than i32

comparison_greater_than_i32_image

Check if i32 is greater than another

Inputs
InputKind
a_ini32
b_ini32
Outputs
OutputKind
outBool

Comparison: Greater than u32

comparison_greater_than_u32_image

Check if u32 is greater than another

Inputs
InputKind
a_inu32
b_inu32
Outputs
OutputKind
outBool

Comparison: Less than f32

comparison_less_than_f32_image

Check if f32 is less than another

Inputs
InputKind
a_inf32
b_inf32
Outputs
OutputKind
outBool

Comparison: Less than i32

comparison_less_than_i32_image

Check if i32 is less than another

Inputs
InputKind
a_ini32
b_ini32
Outputs
OutputKind
outBool

Comparison: Less than u32

comparison_less_than_u32_image

Check if u32 is less than another

Inputs
InputKind
a_inu32
b_inu32
Outputs
OutputKind
outBool

Convert: f32 To i32

convert_f32_to_i32_image

Convert floating point number to integer

Inputs
InputKind
f32_inf32
Outputs
OutputKind
i32_outI32

Convert: i32 To f32

convert_i32_to_f32_image

Convert integer to floating point number

Inputs
InputKind
i32_ini32
Outputs
OutputKind
f32_outF32

Convert: i32 To u32

convert_i32_to_u32_image

Convert integer to unsigned integer

Inputs
InputKind
i32_ini32
Outputs
OutputKind
u32_outU32

Convert: ivec2 To vec2

convert_ivec2_to_vec2_image

Convert integer vec2 to float vec2

Inputs
InputKind
ivec2_inivec2
Outputs
OutputKind
vec2_outVec2

Convert: vec2 To ivec2

convert_vec2_to_ivec2_image

Convert float vec2 to integer vec2

Inputs
InputKind
vec2_invec2
Outputs
OutputKind
ivec2_outIVec2

Get: Characteristic

get_characteristic_image

Get characteristics of sand. Characteristics are used to define reactive behavior between types of sand. With characteristics, you can bundle functionality between multiple sand types.

Inputs
InputKind
sand_insand
Outputs
OutputKind
char_outU32

Get: Color

get_color_image

Get color of sand

Inputs
InputKind
sand_insand
Outputs
OutputKind
color_outVec3

Get: Extra Bit

get_extra_bit_image

Get extra bit of sand, you can read the boolean value.

Inputs
InputKind
sand_insand
Outputs
OutputKind
extra_bit_outBool

Get: Id

get_id_image

Get id of sand

Inputs
InputKind
sand_insand
Outputs
OutputKind
id_outU32

Get: IsMoved

get_ismoved_image

Get is_moved flag of sand. This tells whether sand was moved this frame. Useful for custom behavior

Inputs
InputKind
sand_insand
Outputs
OutputKind
is_moved_outBool

Get: Velocity

get_velocity_image

Get velocity of sand

Inputs
InputKind
sand_insand
Outputs
OutputKind
velocity_outVec2

Input: Get Arrow Key State

input_get_arrow_key_state_image

Get arrow key state. Use this for arrow input related behavior

Inputs
InputKind
Outputs
OutputKind
up_outBool
down_outBool
left_outBool
right_outBool

Input: Get Canvas Size

input_get_canvas_size_image

Get size of the canvas. You can use this to apply transformations to position etc.

Inputs
InputKind
Outputs
OutputKind
size_outIVec2

Input: Get Delta Time

input_get_delta_time_image

Get last frame's delta time.

Inputs
InputKind
Outputs
OutputKind
dt_outF32

Input: Get Down

input_get_down_image

Get neighbor of input sand from down

Inputs
InputKind
Outputs
OutputKind
sand_outSand

Input: Get Down Left

input_get_down_left_image

Get neighbor of input sand from down left

Inputs
InputKind
Outputs
OutputKind
sand_outSand

Input: Get Down Right

input_get_down_right_image

Get neighbor of input sand from down right

Inputs
InputKind
Outputs
OutputKind
sand_outSand

Input: Get Left

input_get_left_image

Get neighbor of input sand from left

Inputs
InputKind
Outputs
OutputKind
sand_outSand

Input: Get Mouse Canvas Pos

input_get_mouse_canvas_pos_image

Get mouse canvas position. You can use this for mouse position related behavior

Inputs
InputKind
Outputs
OutputKind
mouse_outVec2

Input: Get Position

input_get_position_image

Get position of currently inspected input sand. Each pixel represents sand on the canvas. The sand gets swapped by the simulator. This position refers to the current position of an individual sand

Inputs
InputKind
Outputs
OutputKind
ivec2_outIVec2

Input: Get Right

input_get_right_image

Get neighbor of input sand from right

Inputs
InputKind
Outputs
OutputKind
sand_outSand

Input: Get Sand

input_get_sand_image

Get sand. This is the sand for which the current rule is applied.

Inputs
InputKind
Outputs
OutputKind
sand_outSand

Input: Get Time

input_get_time_image

Get time since app start. You can use this for time based rules.

Inputs
InputKind
Outputs
OutputKind
time_outF32

Input: Get Up

input_get_up_image

Get neighbor of input sand from up

Inputs
InputKind
Outputs
OutputKind
sand_outSand

Input: Get Up Left

input_get_up_left_image

Get neighbor of input sand from up left

Inputs
InputKind
Outputs
OutputKind
sand_outSand

Input: Get Up Right

input_get_up_right_image

Get neighbor of input sand from up right

Inputs
InputKind
Outputs
OutputKind
sand_outSand

Logic: And

logic_and_image

Check both input values are true

Inputs
InputKind
test_a_inbool
test_b_inbool
Outputs
OutputKind
outBool

Logic: Characteristic Contains

logic_characteristic_contains_image

Check if sand characteristic contains another characteristic

Inputs
InputKind
char_acharacteristic
char_bcharacteristic
Outputs
OutputKind
outBool

Logic: If, else bool

logic_if_else_bool_image

If given test is true, use first bool, else use the other bool

Inputs
InputKind
bool_test_inbool
value_true_inbool
value_false_inbool
Outputs
OutputKind
outBool

Logic: If, else direction

logic_if_else_direction_image

If given test is true, use first direction, else use the other direction

Inputs
InputKind
bool_test_inbool
value_true_indirection
value_false_indirection
Outputs
OutputKind
outU32

Logic: If, else f32

logic_if_else_f32_image

If given test is true, use first f32, else use the other f32

Inputs
InputKind
bool_test_inbool
value_true_inf32
value_false_inf32
Outputs
OutputKind
outF32

Logic: If, else i32

logic_if_else_i32_image

If given test is true, use first i32, else use the other i32

Inputs
InputKind
bool_test_inbool
value_true_ini32
value_false_ini32
Outputs
OutputKind
outI32

Logic: If, else ivec2

logic_if_else_ivec2_image

If given test is true, use first ivec2, else use the other ivec2

Inputs
InputKind
bool_test_inbool
value_true_inivec2
value_false_inivec2
Outputs
OutputKind
outIVec2

Logic: If, else sand

logic_if_else_sand_image

If given test is true, use first sand, else use the other sand

Inputs
InputKind
bool_test_inbool
value_true_insand
value_false_insand
Outputs
OutputKind
outSand

Logic: If, else sand_id

logic_if_else_sand_id_image

If given test is true, use first sand_id, else use the other sand_id

Inputs
InputKind
bool_test_inbool
value_true_insand_id
value_false_insand_id
Outputs
OutputKind
outU32

Logic: If, else u32

logic_if_else_u32_image

If given test is true, use first u32, else use the other u32

Inputs
InputKind
bool_test_inbool
value_true_inu32
value_false_inu32
Outputs
OutputKind
outU32

Logic: If, else vec2

logic_if_else_vec2_image

If given test is true, use first vec2, else use the other vec2

Inputs
InputKind
bool_test_inbool
value_true_invec2
value_false_invec2
Outputs
OutputKind
outVec2

Logic: If, else vec3

logic_if_else_vec3_image

If given test is true, use first vec3, else use the other vec3

Inputs
InputKind
bool_test_inbool
value_true_invec3
value_false_invec3
Outputs
OutputKind
outVec3

Logic: Not

logic_not_image

Negate the boolean value

Inputs
InputKind
test_inbool
Outputs
OutputKind
outBool

Logic: Or

logic_or_image

Check at least one of input values is true

Inputs
InputKind
test_a_inbool
test_b_inbool
Outputs
OutputKind
outBool

Math: Abs

math_abs_image

Absolute value of the input f32

Inputs
InputKind
f32_inf32
Outputs
OutputKind
f32_outF32

Math: Add: bool

math_add_bool_image

Add: bool to another bool

Inputs
InputKind
a_inbool
b_inbool
Outputs
OutputKind
outBool

Math: Add: f32

math_add_f32_image

Add: f32 to another f32

Inputs
InputKind
a_inf32
b_inf32
Outputs
OutputKind
outF32

Math: Add: i32

math_add_i32_image

Add: i32 to another i32

Inputs
InputKind
a_ini32
b_ini32
Outputs
OutputKind
outI32

Math: Add: ivec2

math_add_ivec2_image

Add: ivec2 to another ivec2

Inputs
InputKind
a_inivec2
b_inivec2
Outputs
OutputKind
outIVec2

Math: Add: u32

math_add_u32_image

Add: u32 to another u32

Inputs
InputKind
a_inu32
b_inu32
Outputs
OutputKind
outU32

Math: Add: vec2

math_add_vec2_image

Add: vec2 to another vec2

Inputs
InputKind
a_invec2
b_invec2
Outputs
OutputKind
outVec2

Math: Add: vec3

math_add_vec3_image

Add: vec3 to another vec3

Inputs
InputKind
a_invec3
b_invec3
Outputs
OutputKind
outVec3

Math: Atan2

math_atan2_image

Atan2 returns an angle, in radians, in the interval [-π, π] whose tangent is y / x

Inputs
InputKind
y_inf32
x_inf32
Outputs
OutputKind
rad_outF32

Math: Ceil

math_ceil_image

Ceil rounds up

Inputs
InputKind
f32_inf32
Outputs
OutputKind
f32_outF32

Math: Clamp

math_clamp_image

Clamp a number between two other numbers

Inputs
InputKind
f32_inf32
min_inf32
max_inf32
Outputs
OutputKind
f32_outF32

Math: Clamp Vec2 Length

math_clamp_vec2_length_image

Clamp vec2 by length

Inputs
InputKind
vec2_invec2
len_inf32
Outputs
OutputKind
vec2_outVec2

Math: Cos

math_cos_image

Cosine of the input

Inputs
InputKind
f32_inf32
Outputs
OutputKind
f32_outF32

Math: Cosh

math_cosh_image

Hyperbolic cosine

Inputs
InputKind
f32_inf32
Outputs
OutputKind
f32_outF32

Math: Cross Vec2

math_cross_vec2_image

Cross product of two vec2

Inputs
InputKind
a_invec2
b_invec2
Outputs
OutputKind
vec2_outVec2

Math: Cross Vec3

math_cross_vec3_image

Cross product of two vec3

Inputs
InputKind
a_invec3
b_invec3
Outputs
OutputKind
vec3_outVec3

Math: Distance

math_distance_image

Distance between two vec2

Inputs
InputKind
a_invec2
b_invec2
Outputs
OutputKind
f32_outF32

Math: Divide: bool

math_divide_bool_image

Divide: bool with another bool

Inputs
InputKind
a_inbool
b_inbool
Outputs
OutputKind
outBool

Math: Divide: f32

math_divide_f32_image

Divide: f32 with another f32

Inputs
InputKind
a_inf32
b_inf32
Outputs
OutputKind
outF32

Math: Divide: i32

math_divide_i32_image

Divide: i32 with another i32

Inputs
InputKind
a_ini32
b_ini32
Outputs
OutputKind
outI32

Math: Divide: ivec2

math_divide_ivec2_image

Divide: ivec2 with another ivec2

Inputs
InputKind
a_inivec2
b_inivec2
Outputs
OutputKind
outIVec2

Math: Divide: u32

math_divide_u32_image

Divide: u32 with another u32

Inputs
InputKind
a_inu32
b_inu32
Outputs
OutputKind
outU32

Math: Divide: vec2

math_divide_vec2_image

Divide: vec2 with another vec2

Inputs
InputKind
a_invec2
b_invec2
Outputs
OutputKind
outVec2

Math: Divide: vec3

math_divide_vec3_image

Divide: vec3 with another vec3

Inputs
InputKind
a_invec3
b_invec3
Outputs
OutputKind
outVec3

Math: Dot

math_dot_image

Dot Product of two vec2

Inputs
InputKind
a_invec2
b_invec2
Outputs
OutputKind
f32_outF32

Math: Exp

math_exp_image

Exp returne e to the power of input value

Inputs
InputKind
f32_inf32
Outputs
OutputKind
f32_outF32

Math: Floor

math_floor_image

Floor rounds down

Inputs
InputKind
f32_inf32
Outputs
OutputKind
f32_outF32

Math: Fract

math_fract_image

Fractional part of a number

Inputs
InputKind
f32_inf32
Outputs
OutputKind
f32_outF32

Math: Inverse Sqrt

math_inverse_sqrt_image

Inverse Square Root

Inputs
InputKind
f32_inf32
Outputs
OutputKind
f32_outF32

Math: Length

math_length_image

Length of a vec2

Inputs
InputKind
vec2_invec2
Outputs
OutputKind
f32_outF32

Math: Log

math_log_image

Natural logarithm of x. value y which satisfies x=e^y

Inputs
InputKind
f32_inf32
Outputs
OutputKind
f32_outF32

Math: Log2

math_log2_image

Base 2 logarithm of x. value y which satisfies x=2^y

Inputs
InputKind
f32_inf32
Outputs
OutputKind
f32_outF32

Math: Max

math_max_image

Max of two numbers

Inputs
InputKind
f32_a_inf32
f32_b_inf32
Outputs
OutputKind
f32_outF32

Math: Min

math_min_image

Min of two numbers

Inputs
InputKind
f32_a_inf32
f32_b_inf32
Outputs
OutputKind
f32_outF32

Math: Mix Vec2

math_mix_vec2_image

Mix of two vec2. Returns a * (1.0 - blend) + b * blend

Inputs
InputKind
a_invec2
b_invec2
blend_inf32
Outputs
OutputKind
vec2_outVec2

Math: Mix Vec3

math_mix_vec3_image

Mix of two vec3. Returns a * (1.0 - blend) + b * blend

Inputs
InputKind
a_invec3
b_invec3
blend_inf32
Outputs
OutputKind
vec3_outVec3

Math: Multiply: bool

math_multiply_bool_image

Multiply: bool with another bool

Inputs
InputKind
a_inbool
b_inbool
Outputs
OutputKind
outBool

Math: Multiply: f32

math_multiply_f32_image

Multiply: f32 with another f32

Inputs
InputKind
a_inf32
b_inf32
Outputs
OutputKind
outF32

Math: Multiply: i32

math_multiply_i32_image

Multiply: i32 with another i32

Inputs
InputKind
a_ini32
b_ini32
Outputs
OutputKind
outI32

Math: Multiply: ivec2

math_multiply_ivec2_image

Multiply: ivec2 with another ivec2

Inputs
InputKind
a_inivec2
b_inivec2
Outputs
OutputKind
outIVec2

Math: Multiply: u32

math_multiply_u32_image

Multiply: u32 with another u32

Inputs
InputKind
a_inu32
b_inu32
Outputs
OutputKind
outU32

Math: Multiply: vec2

math_multiply_vec2_image

Multiply: vec2 with another vec2

Inputs
InputKind
a_invec2
b_invec2
Outputs
OutputKind
outVec2

Math: Multiply: vec3

math_multiply_vec3_image

Multiply: vec3 with another vec3

Inputs
InputKind
a_invec3
b_invec3
Outputs
OutputKind
outVec3

Math: Normalize Vec2

math_normalize_vec2_image

Normalize vec2

Inputs
InputKind
vec2_invec2
Outputs
OutputKind
vec2_outVec2

Math: Normalize Vec3

math_normalize_vec3_image

Normalize vec3

Inputs
InputKind
vec3_invec3
Outputs
OutputKind
vec3_outVec3

Math: Pow

math_pow_image

A number raised to given power

Inputs
InputKind
f32_inf32
exp_inf32
Outputs
OutputKind
f32_outF32

Math: Random

math_random_image

A random number 0.0-1.0 seeded with current position and running time. Calling this multiple times will result with the same value within one frame. Use Random with seed (float) to use multiple random numbers for various purposes.

Inputs
InputKind
Outputs
OutputKind
random_outF32

Math: Random Color

math_random_color_image

Random color (R, G, B, ranging 0.0-1.0)

Inputs
InputKind
Outputs
OutputKind
random_outVec3

Math: Random Direction Step

math_random_direction_step_image

Random direction step. (Offset for: UpLeft, Up, UpRight, Right, DownRight, Down, DownLeft, Left)

Inputs
InputKind
Outputs
OutputKind
ivec_outIVec2

Math: Random Norm Dir Step Vec2

math_random_norm_dir_step_vec2_image

Random direction step that is normalized

Inputs
InputKind
Outputs
OutputKind
vec_outVec2

Math: Random Range

math_random_range_image

Random between given min and max

Inputs
InputKind
range_min_inf32
range_max_inf32
Outputs
OutputKind
random_outF32

Math: Random Unit Vec2

math_random_unit_vec2_image

Random unit vector.

Inputs
InputKind
Outputs
OutputKind
vec_outVec2

Math: Random with seed

math_random_with_seed_image

Random number 0.0-1.0 seeded with position, running time, and a floating point seed offset. Change the seed offset if you want the probabilities to vary between random numbers in your graph (compared to just Random)

Inputs
InputKind
seed_inf32
Outputs
OutputKind
random_outF32

Math: Randomize Color By Range

math_randomize_color_by_range_image

Vary input color by given range. This can be used to vary color slightly. Do consider that colors are between 0.0 and 1.0

Inputs
InputKind
color_invec3
range_inf32
Outputs
OutputKind
color_outVec3

Math: Reflect

math_reflect_image

Reflection vector of a vector and given normal input

Inputs
InputKind
vec2_invec2
normal_invec2
Outputs
OutputKind
reflectVec2

Math: Rotate Vec2 Radians

math_rotate_vec2_radians_image

Rotate vec2 by input radian angle

Inputs
InputKind
vec2_invec2
rads_inf32
Outputs
OutputKind
vec2_outVec2

Math: Round

math_round_image

Round number to closest integer

Inputs
InputKind
f32_inf32
Outputs
OutputKind
f32_outF32

Math: Sign

math_sign_image

Sign of a number

Inputs
InputKind
f32_inf32
Outputs
OutputKind
f32_outF32

Math: Sin

math_sin_image

Sine of the input

Inputs
InputKind
f32_inf32
Outputs
OutputKind
f32_outF32

Math: Sinh

math_sinh_image

Hyperbolic sine

Inputs
InputKind
f32_inf32
Outputs
OutputKind
f32_outF32

Math: Smoothstep

math_smoothstep_image

Smoothstep performs smooth Hermite interpolation between 0 and 1 when a < value < b. This is useful in cases where a threshold function with a smooth transition is desired.

Inputs
InputKind
f32_a_inf32
f32_b_inf32
f32_value_inf32
Outputs
OutputKind
f32_outF32

Math: Sqrt

math_sqrt_image

Square root of the input

Inputs
InputKind
f32_inf32
Outputs
OutputKind
f32_outF32

Math: Step

math_step_image

Step: Outputs 0.0 if a < b, and 1.0 otherwise.

Inputs
InputKind
f32_a_inf32
f32_b_inf32
Outputs
OutputKind
f32_outF32

Math: Sub: bool

math_sub_bool_image

Subtract: bool from another bool

Inputs
InputKind
a_inbool
b_inbool
Outputs
OutputKind
outBool

Math: Sub: f32

math_sub_f32_image

Subtract: f32 from another f32

Inputs
InputKind
a_inf32
b_inf32
Outputs
OutputKind
outF32

Math: Sub: i32

math_sub_i32_image

Subtract: i32 from another i32

Inputs
InputKind
a_ini32
b_ini32
Outputs
OutputKind
outI32

Math: Sub: ivec2

math_sub_ivec2_image

Subtract: ivec2 from another ivec2

Inputs
InputKind
a_inivec2
b_inivec2
Outputs
OutputKind
outIVec2

Math: Sub: u32

math_sub_u32_image

Subtract: u32 from another u32

Inputs
InputKind
a_inu32
b_inu32
Outputs
OutputKind
outU32

Math: Sub: vec2

math_sub_vec2_image

Subtract: vec2 from another vec2

Inputs
InputKind
a_invec2
b_invec2
Outputs
OutputKind
outVec2

Math: Sub: vec3

math_sub_vec3_image

Subtract: vec3 from another vec3

Inputs
InputKind
a_invec3
b_invec3
Outputs
OutputKind
outVec3

Math: Tan

math_tan_image

Tangent of the input

Inputs
InputKind
f32_inf32
Outputs
OutputKind
f32_outF32

Math: Tanh

math_tanh_image

Hyperbolic tangent

Inputs
InputKind
f32_inf32
Outputs
OutputKind
f32_outF32

New: IVec2

new_ivec2_image

Create new two dimensional integer vector (x, y), used for positions on canvas

Inputs
InputKind
i32_x_ini32
i32_y_ini32
Outputs
OutputKind
ivec2_outIVec2

New: Vec2

new_vec2_image

Create new two dimensional vector (x, y)

Inputs
InputKind
f32_x_inf32
f32_y_inf32
Outputs
OutputKind
vec2_outVec2

New: Vec3

new_vec3_image

Create new vector for colors (r, g, b)

Inputs
InputKind
f32_x_inf32
f32_y_inf32
f32_z_inf32
Outputs
OutputKind
vec3_outVec3

New: bool

new_bool_image

Create new bool (true, false)

Inputs
InputKind
bool_inbool
Outputs
OutputKind
bool_outBool

New: f32

new_f32_image

Create new float

Inputs
InputKind
f32_inf32
Outputs
OutputKind
f32_outF32

New: i32

new_i32_image

Create new signed integer

Inputs
InputKind
i32_ini32
Outputs
OutputKind
i32_outI32

New: sand

new_sand_image

Create new sand

Inputs
InputKind
sand_insand
Outputs
OutputKind
sand_outSand

New: sand id

new_sand_id_image

Create new sand id

Inputs
InputKind
sand_id_insand_id
Outputs
OutputKind
u32_outU32

New: u32

new_u32_image

Create new unsigned integer

Inputs
InputKind
u32_inu32
Outputs
OutputKind
u32_outU32

Physics: Add Force

physics_add_force_image

Write add force value at given position

Inputs
InputKind
connectionsand
is_onbool
pos_inivec2
force_invec2
Outputs
OutputKind
connection_outSand

Physics: Add Force In Radius

physics_add_force_in_radius_image

Write add force value within radius (clamped to 0..5.0) at given position

Inputs
InputKind
connectionsand
is_onbool
pos_inivec2
force_invec2
radius_inf32
Outputs
OutputKind
connection_outSand

Physics: Read Add Force

physics_read_add_force_image

Read added force value at given position

Inputs
InputKind
pos_inivec2
Outputs
OutputKind
force_outVec2

Physics: Read Density Pressure

physics_read_density_pressure_image

Read density and pressure (output as vec2(x, y)) at given position

Inputs
InputKind
pos_inivec2
Outputs
OutputKind
density_pressure_outVec2

Physics: Read Force

physics_read_force_image

Read force value at given position

Inputs
InputKind
pos_inivec2
Outputs
OutputKind
force_outVec2

Sand Utils: Check if pos neighbors another sand

sand_utils_check_if_pos_neighbors_another_sand_image

Check if sand neighbors another sand with given id

Inputs
InputKind
pos_inivec2
other_id_insand_id
Outputs
OutputKind
bool_outBool

Sand Utils: Check if sand touches another (radius considered)

sand_utils_check_if_sand_touches_another_radius_considered_image

Considering sand's and its neighbor's radius, check if sand touches another with given id

Inputs
InputKind
pos_inivec2
sand_insand
other_id_insand_id
Outputs
OutputKind
bool_outBool

Sand Utils: Check if sand touches another characteristic

sand_utils_check_if_sand_touches_another_characteristic_image

Considering sand's and its neighbor's radius, check if sand touches another sand with given characteristic

Inputs
InputKind
pos_inivec2
sand_insand
other_char_incharacteristic
Outputs
OutputKind
bool_outBool

Sand Utils: Count 3x3 grid of sand by id

sand_utils_count_3x3_grid_of_sand_by_id_image

Count 3x3 grid of sand by sand id at given position

Inputs
InputKind
pos_inivec2
id_insand_id
Outputs
OutputKind
i32_outI32

Sand Utils: Count Neighbors By Id

sand_utils_count_neighbors_by_id_image

Count neighboring sands by sand id, e.g. useful in Game of Life type of rules

Inputs
InputKind
sand_id_insand_id
Outputs
OutputKind
i32_outI32

Sand Utils: Count sand circle of size by id

sand_utils_count_sand_circle_of_size_by_id_image

Count circle of given size by sand id at given position (max radius of 6)

Inputs
InputKind
pos_inivec2
radius_ini32
id_insand_id
Outputs
OutputKind
i32_outI32

Sand Utils: Count sand grid of size by id

sand_utils_count_sand_grid_of_size_by_id_image

Count grid of given size by sand id at given position (max 12). Useful for more complex Game of Life type rules

Inputs
InputKind
pos_inivec2
size_ini32
id_insand_id
Outputs
OutputKind
i32_outI32

Sand Utils: Get Sand By Pos

sand_utils_get_sand_by_pos_image

Get another sand using a canvas position

Inputs
InputKind
pos_inivec2
Outputs
OutputKind
sand_outSand

Sand Utils: Get Step Four from Velocity

sand_utils_get_step_four_from_velocity_image

Given sand's current velocity, get its next direction step (offset) rounded to (Up, Down, Left, Right)

Inputs
InputKind
sand_insand
Outputs
OutputKind
step_outIVec2

Sand Utils: Get Step from Velocity

sand_utils_get_step_from_velocity_image

Given sand's velocity, get its next direction step (Offset for: UpLeft, Up, UpRight, Right, DownRight, Down, DownLeft, Left)

Inputs
InputKind
sand_insand
Outputs
OutputKind
step_outIVec2

Sand Utils: Transform on touch another characteristic

sand_utils_transform_on_touch_another_characteristic_image

Considering sand's and its neighbor's radius, determine how sand transforms based on nearby sand characteristics (touch). This function is not particularly fast, thus it is not recommended to use multiple of these.

Inputs
InputKind
pos_inivec2
sand_insand
char_1_incharacteristic
prob_1_inf32
becomes_1_insand
char_2_incharacteristic
prob_2_inf32
becomes_2_insand
char_3_incharacteristic
prob_3_inf32
becomes_3_insand
char_4_incharacteristic
prob_4_inf32
becomes_4_insand
Outputs
OutputKind
sand_outSand

Sand Utils: Transform on touch another id

sand_utils_transform_on_touch_another_id_image

Considering sand's and its neighbor's radius, determine how sand transforms based on nearby sand ids (touch). This function is not particularly fast, thus it is not recommended to use multiple of these.

Inputs
InputKind
pos_inivec2
sand_insand
id_1_insand_id
prob_1_inf32
becomes_1_insand
id_2_insand_id
prob_2_inf32
becomes_2_insand
id_3_insand_id
prob_3_inf32
becomes_3_insand
id_4_insand_id
prob_4_inf32
becomes_4_insand
Outputs
OutputKind
sand_outSand

Set: Color

set_color_image

Set color of sand

Inputs
InputKind
sand_insand
vec3_invec3
Outputs
OutputKind
sand_outSand

Set: Extra Bit

set_extra_bit_image

Set extra bit of sand, you can use this for anything. For example, initialization of sand.

Inputs
InputKind
sand_insand
bool_inbool
Outputs
OutputKind
sand_outSand

Set: Id

set_id_image

Set id of sand

Inputs
InputKind
sand_insand
sand_id_insand_id
Outputs
OutputKind
sand_outSand

Set: Velocity

set_velocity_image

Set velocity of sand

Inputs
InputKind
sand_insand
vec2_invec2
Outputs
OutputKind
sand_outSand

Util: Dir by Offset (Step)

util_dir_by_offset_step_image

Given input offset ivec, return direction

Inputs
InputKind
offset_inivec2
Outputs
OutputKind
dir_outU32

Util: Edge Normal

util_edge_normal_image

Get edge normal. Edge refers to a sand bordering other than that sand. Sand is edge if it has at least one non-that-sand neighbor. The normal is the normalized negation of (3x3 mass average - center). If the mass average == center or the position is not considered edge, zero vec2 is returned

Inputs
InputKind
pos_inivec2
sand_id_insand_id
Outputs
OutputKind
normal_outVec2

Util: Is Inside

util_is_inside_image

Check if an ivec is inside the simulation canvas

Inputs
InputKind
pos_inivec2
Outputs
OutputKind
bool_outBool

Util: Offset (Step) by Dir

util_offset_step_by_dir_image

Given input direction, return offset ivec

Inputs
InputKind
dir_indirection
Outputs
OutputKind
offset_outIVec2

Util: Pos at Dir

util_pos_at_dir_image

Return another position in given direction

Inputs
InputKind
pos_inivec2
dir_indirection
Outputs
OutputKind
pos_outIVec2

Was this page helpful?