Table of Contents
Objects List Input Functions
The Objects List input of the ExpressionME-L Node allows for the retrieval of various data about 3ds Max meshes or objects. The functions provided enable you to retrieve information about the number of faces and vertices on an object, the mapping channel used, the surface area and volume of the object, the center and axes of the object's transformation matrix, and various data about faces and vertices on the object.
You can also iterate through objects, faces, vertices, or points on a surface in parallel using the “objects_in_parallel” function. This input can be useful for manipulating objects or using their data to feed particles or other effects.
Global Variables
Parameter | Description |
---|---|
objects_in_count | Number of objects in the list, returns directly count. |
objects_in_id | returns the index of the input you created (starting with 0 excluding Time and On). |
objects_in_surface_point
This function returns a point on the surface of an object, specified by the object_id
parameter.
If the object_id
parameter is set to -1, the function will return a point on the surface derived from of all objects merged as a single object.
The surface_pos
parameter specifies the position on the surface to return, with a value between 0 and 1. The material_id
parameter specifies that the function should only return points on faces with the specified material id. Use objects_in_point
to access the point data.
Calls:
objects_in_surface_point(object_id, surface_pos)
objects_in_surface_point(object_id, surface_pos, material_id)
Input:
Parameter | Description |
---|---|
object_id | object id (integer) |
surface_pos | surface position (float) |
material_id | material id (integer) |
Output:
Return | Description |
---|---|
scalar | 0: failed, 1: success |
objects_in_closest_point
This function returns the closest point on the surface of an object, specified by the in_object_id
parameter, to the specified in_position
. If the in_object_id
parameter is set to -1, the function will search for the closest point on the surface of all objects, merged into one single object. The in_material_id
parameter specifies that the function should only search for points on faces with the specified material id. Use objects_in_point
to access the point data.
Calls:
objects_in_closest_point(in_object_id, in_position)
objects_in_closest_point(in_object_id, in_position, in_material_id)
Input:
Parameter | Description |
---|---|
in_object_id | object id (integer) |
in_position | world position (vector[3]) |
in_material_id | material id (integer) |
Output:
Return | Description |
---|---|
scalar | 0: failed, 1: success |
objects_in_isect
This function intersects all objects shapes in a object list. Use objects_in_point
to access the point data created by the intersect function.
Call:
objects_in_isect(in_object_id,in_position[3], in_direction[3], in_max_length, optional skip_oid, optional optional skip_faceid)
Parameters:
Parameter | Description |
---|---|
in_object_id | object ID (the object we want to intersect, -1 will use all objects in the list) |
in_position | intersect ray start point (vector) |
in_direction | intersect ray direction (normalized or with length) (vector) |
in_max_length | intersect max ray length (scalar) |
skip_oid | optional object ID to skip (scalar) |
skip_faceid | optional face of the object to skip (scalar) |
Output:
Return | Description |
---|---|
scalar | 0: not intersected, 1: frontside, -1: backside hit |
objects_in_point
This function retrieves data about a point on an object's surface. The in_point_data
parameter specifies the data type to get (e.g., point_pos). The out_scalar
parameter is used to output a scalar value (e.g., face id). The out_vector[3]
parameter is used to output 3D values (e.g., point_pos). The in_channel
parameter specifies the uvw channel to retrieve data from. The out_uvw[3]
parameter is used to output uvw coordinates.
Note: Get point datas is only valid if objects_in_surface_point
or objects_in_closest_point
and objects_in_isect
returns 1
Calls:
objects_in_point(in_point_data, out_scalar)
objects_in_point(in_point_data, out_vector[3])
objects_in_point(in_point_uvw , in_channel, out_uvw[3])
Input:
Parameter | Description |
---|---|
in_point_data | data type to get (point_pos as sample see point_data) (integer). A list of point data types can be found HERE |
out_scalar | scalar output for face id as sample (float) |
out_vector[3] | vector output for 3d values point_pos or so (vector[3]) |
in_channel | uvw channel (integer) |
out_uvw[3] | output uvw coordinates (vector[3]) |
Output:
Return | Description |
---|---|
scalar | 0: failed, 1: success |
objects_in_geom
This function is used to retrieve various data from a 3ds Max mesh or object. The specific data that is retrieved depends on the value of the geom_data
parameter. This parameter can be set to retrieve information such as the number of faces and vertices on the object, the mapping channel used, the surface area and volume of the object, the center and axes of the object's transformation matrix, and various data about faces and vertices on the object. The function takes an object id
as an input parameter to specify which object to retrieve data for, and it outputs either a scalar or vector value depending on the value of the geom_data
parameter. It may be used to access information about an object in order to manipulate it or to use it to feed particle data or other effects.
Calls:
objects_in_geom(in_object_id, geom_data, out_scalar) objects_in_geom(in_object_id, geom_data, out_vector[3]) objects_in_geom(in_object_id, geom_data, out_vector[4]) //for align axis plus scale objects_in_geom(in_object_id, geom_map_used, in_channel, out_used) objects_in_geom(in_object_id, geomt_ntverts, in_channel, out_num) objects_in_geom(in_object_id, face_data, in_face_id, out_scalar) objects_in_geom(in_object_id, face_data, in_face_id, out_vector) objects_in_geom(in_object_id, face_data, in_face_id, in_barrycoord[3], out_vector) objects_in_geom(in_object_id, face_data, in_face_id, in_fvertex_id, out_vector) objects_in_geom(in_object_id, vertex_data, vertex_id, out_vector) objects_in_geom(in_object_id, tface_data, in_map_channnel, in_tface_id, out_scalar) objects_in_geom(in_object_id, tface_data, in_map_channnel, in_tface_id, out_vector) objects_in_geom(in_object_id, tface_data, in_map_channnel, in_tface_id, in_barycentric, out_vector) objects_in_geom(in_object_id, tface_uvw, in_map_channnel, in_tface_id, in_barycentric, out_uvw) objects_in_geom(in_object_id, tvert_data, in_map_channel, in_tvertex_id, out_uvw) objects_in_geom(in_object_id,edge_data, edge_id, scalar_out) objects_in_geom(in_object_id,edge_data, edge_id, vector_out) //this is the velocity of the object center point objects_in_geom(in_oid, geom_vel, out_velocity[3]); //this is the velocity of the object in relation to a world position including spin (rotation) objects_in_geom(in_oid, geom_vel, in_world_position[3], out_velocity[3]); //get the two edge face index //the index range is 0 >= id < nfaces, value of -1 mean undefined objects_in_geom(in_object_id,edge_fid, edge_id, vector[2]_out); //is edge selected, returns 0 if not selected 1 if selected. return = objects_in_geom(in_object_id,edge_selected, edge_id); //is edge visible, returns 0 if not visible 1 if visible. return = objects_in_geom(in_object_id,edge_visible, edge_id); //is edge open, returns 0 if not open 1 if open. return = objects_in_geom(in_object_id,edge_open, edge_id); //the supplied material id, defines the open edge status (a change of mat id = open) //mtl_id, range 1 - max material id of 3ds Max. return = objects_in_geom(in_object_id,edge_open, edge_id, mtl_id); //get an interpolated position on the edge //rel_pos, range between 0 - 1 objects_in_geom(in_object_id,edge_pos, edge_id, rel_pos, pos[3]_out); //get an interpolated normal on the edge //rel_pos, range between 0 - 1 objects_in_geom(in_object_id,edge_norm, edge_id, rel_pos, norm[3]_out); //get the interpolated face vertex color objects_geom(in_object_id, face_vcol, in_face_id, in_barrycoord[3], out_vertex_color) // get the interpolated Edge Vertex Color objects_geom(in_object_id, edge_vcol, in_edge_id, rel_pos, out_vertex_color); // copy alignment from an object in the list to a particle objects_in_geom(in_object_id,geom_palign,in_to_pid);
Function Call for Geom Data
Parameter | Description |
---|---|
in_object_id | An object id counted from 0, where id must be less than the count. |
geom_data | The data to retrieve. For information about geom_data types click HERE. |
out_scalar | A scalar value to get. |
out_vector | A vector value to get. The size of the vector depends on the specific use case (either 3 or 4 elements). |
in_channel | A mapping channel. Only applicable when geom_data is set to geom_map_used or geomt_ntverts . |
in_to_pid | the particle ID recieving the alignment information |
Function Call for Face Data
parameter | description |
---|---|
in_object_id | An object id counted from 0, where id must be less than the count. |
face_data | For information about face_data click HERE |
in_face_id | from a specific face ID |
out_scalar | used to get scalar values |
out_vector | used to get vector[3] values |
Function Call for Texture Face Data
parameter | description |
---|---|
in_object_id | An object id counted from 0, where id must be less than the count. |
tface_data | For information about tface_data click HERE |
in_tface_id | from a specific texture face ID |
in_map_channel | form a specific mapping channel |
out_scalar | used to get scalar values |
out_vector | used to get vector[3] values |
Function Call for Vertex Data
parameter | description |
---|---|
in_object_id | An object id counted from 0, where id must be less than the count. |
vert_data | For information about vert_data click HERE |
in_vertex_id | from a specific vertex ID |
in_map_channel | form a specific mapping channel |
out_vector | used to get vector[3] values |
Function Call for Texture Vertex Data
parameter | description |
---|---|
in_object_id | An object id counted from 0, where id must be less than the count. |
tvert_data | For information about vert_data click HERE |
in_tvertex_id | from a specific texture vertex ID |
in_map_channel | from a specific mapping channel |
out_vector | used to get vector[3] values |
Function Call for Edge Data
parameter | description |
---|---|
in_object_id | An object id counted from 0, where id must be less than the count. |
edge_data | For information about edge_data click HERE |
edge_id | from a specific edge ID |
out_scalar | used to get a scalar value |
out_vector | used to get vector[2] or vector[3] values (see samples above) |
Output:
Return | Description |
---|---|
scalar | 0: failed, 1: success |
Example:
To go through all faces of object 0 and retrieve the center of each face and the position of each vertex:
- Declare variables to store the number of faces in the object, the center of each face, and the position of each vertex.
- Use the
objects_in_geom
function to retrieve the number of faces in object 0 and store the result in a variable. - Iterate through all faces in the object using a loop.
- Inside the loop, use the
objects_in_geom
function to retrieve the center of the current face and store the result in a variable. - Use the
objects_in_geom
function to retrieve the position of each vertex in the current face, either by its index within the face or by its id. Store the results in variables. - Do any additional processing or operations that you need to do with the retrieved data.
- Repeat the above steps for each face in the object.
var nfaces; var center[3]; var vpos0[3]; var vpos1[3]; var vpos2[3]; var vids[3]; objects_in_geom(0, geom_nfaces, nfaces); for(var i = 0; i < nfaces; i += 1) { objects_in_geom(0, face_center,i, center); objects_in_geom(0, face_vpos,i, 0, vpos0); objects_in_geom(0, face_vpos,i, 1, vpos1); objects_in_geom(0, face_vpos,i, 2, vpos2); // or get position over the vertex ids objects_in_geom(0, face_vid,i, vids); objects_in_geom(0, vert_pos, vids[0], vpos0); objects_in_geom(0, vert_pos vids[1], vpos1); objects_in_geom(0, vert_pos, vids[2], vpos2); \ ...do anything };
objects_in_parallel
The “ObjectList” input specifies a list of objects that the expression will be applied to. If the ObjectList is the first input created for the ExpressionME-L Node, the expression will iterate over all vertices (by default) of all selected objects in parallel (using multi-threading).
To iterate through other components (faces,edges …) of an object, you can use the “objects_in_parallel” function to control the behavior of the expression and iterate through objects, faces, vertices, edges or points on a surface in parallel.This function takes in two or three parameters, which allow you to specify the type of data to iterate through and the order in which to process it. This input can be useful for efficiently applying the expression to multiple objects at once.
This function should only be called with constants and no animation of the input values is allowed. The function transmits the parameter at compile time, so that the expression has this information before it runs.
Calls:
objects_in_parallel(in_object_id, in_parallel_type) objects_in_parallel(in_object_id, surface_, scalar_in_id) objects_in_parallel(in_object_id, surface_, scalar_in_id, rate_type )
Parameters:
Parameter | Description |
---|---|
in_object_id | The object ID in the list, with a 0-based index. A value of -1 indicates that all objects should be treated as one. |
in_parallel_type | Specifies what component to iterate in parallel. Valid options can be found HERE |
scalar_in_id | (Optional) If surface_ is specified for in_parallel_type , this parameter specifies the Scalar input index to use to get the number of random points. |
rate_type | This parameter is only valid when surface_ or esurface_ is used. Without specifying a rate_type the default is to use every subsample the specified amount of points. Possible options for rate_type can be found HERE |
Output:
Return | Description |
---|---|
scalar | -1: fail, or the particle id |
Example 1: Go through all faces of all objects and create a particle on each center point of a face.
objects_in_parallel(-1, face_); // Iterate over all faces of all objects in parallel var norm[3]; // Declare a variable to store the normal of the current face objects_in_geom(oid_, face_norm, fid_, fbc_, norm); // Get the interpolated normal of the current face norm *= 10; // Use the normal as the velocity of the particle group_in_create(wp, norm); // Create a particle in group_in at the position of the current face, with the specified velocity
Example 2: The same as example 1, but using vertices instead of faces.
objects_in_parallel(-1, vertex_); // Iterate over all vertices of all objects in parallel var norm[3]; // Declare a variable to store the normal of the current vertex objects_in_geom(oid_, vert_norm, vid_, norm); // Get the normal of the current vertex norm *= 10; // Use the normal as the velocity of the particle group_in_create(wp, norm); // Create a particle in group_in at the position of the current vertex, with the specified velocity
Example 3: Generate 1000 random surface points. The number 1000 is specified by the Scalar input created with the name numberparticles.
objects_in_parallel(-1, surface_, numberparticles_in_id); // Iterate over X-ammount of random surface points set by numberparticles input, all objects in parallel var norm[3]; // Declare a variable to store the normal of the current surface point objects_in_geom(oid_, face_norm, fid_, fbc_, norm); // Get the interpolated normal of the current surface point norm *= 10; // Use the normal as the velocity of the particle group_in_create(wp, norm); // Create a particle in group_in at the position of the current surface point, with the specified velocity
Example 4: Simple, one call per object in the list.
objects_in_parallel(-1, object_); // Iterate over all objects in the list in parallel group_in_create(wp); // Create a particle in group_in at the position of the current object
In all examples, objects_in_parallel()
is used to iterate over the objects, faces, vertices, or surface points in parallel. The function objects_in_geom()
is used to retrieve information about the current object, face, vertex, or surface point (e.g. the normal, in examples 1-3). The function group_in_create()
is used to create a particle in the group_in
group at a specific position and with a specific velocity (in examples 1-3)
objects_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 transforms represent a full transform including rotation, scale and translation.
Calls:
objects_in_transform(in_object_id,transform_point, in_fromto_type, in_vector[3], out_vector[3]);\\ objects_in_transform(in_object_id,transform_vector, in_fromto_type, in_vector[3], out_vector[3]);\\ objects_in_transform(in_object_id,transform_point,in_fromto_type, in_out_vector[3]);\\ objects_in_transform(in_object_id,transform_vector,in_fromto_type, in_out_vector[3]); //transform a vector without scale and translation, rotation is computed, only //the vector keeps its length direction changes, only object_in_transform(oid_in, transform_direction, object2world, vector_in_out); object_in_transform(oid_in, transform_direction, object2world, vector_in, vector_out); //special transformation for normals, no translation is being computed //a normal is orthogonal to a face and therefore a special transformation to keep its direction is needed object_in_transform(oid_in, transform_normal, object2world, vector_in_out); object_in_transform(oid_in, transform_normal, object2world, vector_in, vector_out);
Parameters:
Name | Description |
---|---|
in_object_id | specifies the object id to use for the transformation |
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_point | will do a full transformation (Rotation,Scale,Translation) |
transform_vector | will do a transformation (Rotation,Scale) |
transform_direction | will do a rotatioon transformation, only |
transform_normal | will do a transformation (Rotation,Scale) |
transform_transrot | will do a transformation (Rotation,Translation) |
fromto_types:
Name | Description |
---|---|
object2world | will convert the vector from object to world coordinates |
world2object | will 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 |
voxel2object | will convert the vector from voxel to object coordinates |
object2voxel | will convert the vector from object to voxel coordinates |
Return:
0; Fail, 1; Succed
©2024, cebas Visual Technology Inc.