reference_guide:math_expression_language:functions_variables:input_functions:field_input_mel

Field Input Functions

OpenVDB grids, also known as Fields, are a powerful method for creating advanced visual effects. ME-L was designed to efficiently handle large amounts of volumetric data, and as such, it is optimized for processing 3D Field data. Most ME-L functions are able to utilize multiple processor cores through the use of multi-threading and parallel processing. When working with OpenVDB Fields in ME-L, it is recommended to create the Field input as the first connection input, as this allows all voxel data to be accessed in parallel.

Find below a list of functions specifically designed to handle Field data.

Global Variables

Variable Description
field_in Scalar or vector value of the current voxel, Note this is only valid when the first input is a Field (parallel processing).
field_in_voxelsize World voxel size
field_in_ovoxelsizevoxel size in object space
field_in_pid TP particle id of the field
field_in_id returns the index of the input you created (starting with 0 excluding Time and On). 

 

field_in_isample

Used to gather an interpolated value from within a field either in voxel space or world space

Calls:

field_in_isample(in_vposition)
field_in_isample(in_world_position, out_vector)

Parameters for Scalar fields:

Name Description
in_vpositionPosition in voxel space to sample.

Return for Scalar fields:

Sampled Scalar value  

Parameters for Vector fields:

Name Description
in_world_positionfield Position in Worldspace 
out_vector Specify a Vector[3] variable to receive the content of the field

Return for Vector fields:

Length of Vector

field_in_wsample

Used to gather an interpolated valueof a scalar field in world space

Calls:

field_in_wsample(in_world_position)
field_in_wsample(in_world_position, out_vector) 

Parameters for Scalar fields:

Name Description
in_world_positionWorld position to sample.

Return for Scalar fields:

Sampled Scalar value from World Position

Parameters for Vector fields:

Name Description
in_world_positionfield Position in Worldspace 
out_vector Specify a Vector[3] variable to receive the content of the field

Return for Vector fields:

Length of Vector

 

field_in_transform

This function transforms a vector or point from one space into various other coordinate spaces. Vector transform represents only rotate/scale and NO translation. Point rtransforms represent a full transform including rotation, scale and translation.
  Calls:

field_in_transform(transform_point, in_fromto_type, in_vector[3], out_vector[3]);\\
field_in_transform(transform_vector, in_fromto_type, in_vector[3], out_vector[3]);\\
field_in_transform(transform_point,in_fromto_type, in_out_vector[3]);\\
field_in_transform(transform_vector,in_fromto_type, in_out_vector[3]);

Parameters:

Name Description
transform_type sets the transformation type to either vector or point(complete transform). 
in_fromto_type specifies the transformation space to use see below table for possibel options.
in_vector[3] specifies the input 3D vector to transform
out_vector[3] stores the transformed result of this function
in_out_vector[3]the passed in vector will be overwritten with the result of the transformation

transform_types:

Name Description
transform_pointwill do a full transformation (Rotation,Scale,Translation)
transform_vectorwill do a transformation (Rotation,Scale)
transform_directionwill do a rotatioon transformation, only
transform_normalwill do a transformation (Rotation,Scale)
transform_transrotwill do a transformation (Rotation,Translation)

fromto_types:

Name Description
object2worldwill convert the vector from object to world coordinates
world2objectwill convert the vector from world to object coordinates
voxel2world will convert the vector from voxel to world coordinates
world2voxel will convert the vector from world to voxel coordinates
voxel2objectwill convert the vector from voxel to object coordinates
object2voxelwill convert the vector from object to voxel coordinates

Return:

0; Fail, 1; Succed

 

field_in_distance

This function calculates the world-nearest distance between a point and surface (ISO value 0). This only works with SDF fields.

Calls:

distancefield_in_distance(in_world_pos[3], out_world_dist, out_world_normal[3]);
distancefield_in_distance(in_world_pos[3], out_world_dist);
out_world_dist = distancefield_in_distance(in_world_pos[3]);

Parameters for Scalar fields:

Name Description
in_world_pos[3] the point to sample in world-coordinates
out_world_dist returns nearest world distance to the SDF (iso value 0) surface, negative values are inside positiv values are outside
out_world_normal[3]returns the surface normal at the nearest SDF surface point.

Return:

0; Fail, 1; Succeed. There is a special case when there is a position supplied, only. In this case, the  function directly returns a distance (scalar).

 

©2024, cebas Visual Technology Inc.

reference_guide/math_expression_language/functions_variables/input_functions/field_input_mel.txt · Last modified: 2024/02/26 23:28 by edwin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki