Object Category¶
- The following list shows the Logic Category Magma nodes available in Krakatoa MX 2.x.
- These nodes are used to perform logical operations using Boolean values, and control data flow using conditional operators.
FaceQuery¶
- The FaceQuery operator has four inputs and a variable number of outputs.
Input 1: Geometry
- The first input must be connected directly to an InputGeometry operator with at least one geometry object picked.
Input 2: ObjIndex (Integer)
- The second input is the zero-based object index (Integer) corresponding to the order of geometry objects on the InputGeometry’s list. It defaults to 0 when unconnected.
Input 3: FaceIndex (Integer)
- The third input is the zero-based face index (Integer) within the specified geometry object. It defaults to 0 when unconnected.
Input 4: BaryCoords (Vector)
- The fourth input is the barycentric coordinate (Vector) within the specified face.
- It defaults to [0.3333,0.3333,0.3333] when unconnected, representing the face center.
Output 1:
- The default output is Position. It can be disabled via the operator’s UI.
Output X
- Additional outputs can be added to access other face-related values, including
- the Interpolated (Smooth) Normal,
- the Selection channel,
- all 99 mapping channels
- the Vertex Color channel etc.
InVolume¶
- The InVolume operator has two inputs and one output.
- The first input must be connected directly to an Input Geometry operator with at least one geometry object picked.
- The second input provides the world space position to check against the provided geometry volumes.
- The output is a Boolean which will be 1 (True) if the point is in at least one of the specified volumes, or 0 (False) if it is outside.
- See the “Using the InVolume Magma Operator” topic for a practical demonstration.
IntersectRay¶
- The IntersectRay operator has three inputs and seven outputs.
- The first input must be connected directly to an InputGeometry operator with at least one geometry object picked.
- Dragging a wire into an empty area of the Editor will create an InputGeometry operator automatically.
- Holding Ctrl while releasing the mouse the the above case will pop up the full operators menu
- The second input must provide the ray origin in world space.
- Dragging a wire into an empty area of the Editor will create a Position InputChannel node connected via a ToWorld Transform opertator.
- Holding Ctrl while releasing the mouse the the above case will pop up the full operators menu
- The third input must provide the ray direction in world space.
- Dragging a wire into an empty area of the Editor will create a Vector InputValue node set to [0,0,-1].
- Holding Ctrl while releasing the mouse the the above case will pop up the full operators menu
- The first output returns the Position of the intersection, or [0,0,0] if no intersection was found.
- The second output returns an Integer with a value of 1 (TRUE) if the intersection is valid, 0 (FALSE) if not valid.
- The third output returns the zero-based Object Index, matching the order of objects on the InputGeometry node’s list.
- The fourth output returns the zero-based index of the face that was hit.
- The fifth output returns the signed distance to the intersection point - positive if the point is seeing the front side of the face (outside), negative if seeing the backside (inside)
- The sixth output returns the face (unsmoothed) normal at the intersection point.
- The seventh output returns the barycentric coordinates of the intersection point within the face.
- NOTE: Using the ObjectIndex, FaceIndex and Barycentric Coordinates together with the same InputGeometry operator as inputs into a FaceQuery operator, you can access additional surface data.
MeshQuery¶
- The MeshQuery operator has two inputs and one output.
- The first input must be connected directly to an InputGeometry operator with at least one geometry object picked.
- The second input is the zero-based object index (Integer) corresponding to the order of geometry objects on the InputGeometry’s list. It defaults to 0 when unconnected.
- The output is the Face Count of the specified mesh.
- NOTE: More outputs might be added in the future to access other geometry object properties.
NearestParticle¶
- The NearestParticle operator has two inputs and three outputs.
- The first input must be connected to an InputParticles operator.
- The second input must provide the world space position to check for neatest particles from.
- A control in the operator’s UI defines which particle to return. It defaults to 1 (meaning the closest), but it can be set to return the second-closest, third-closest and so on.
- The first output returns the Position of the closest particle.
- The second output returns Integer 1 (TRUE) if a closest particle was found, 0 (FALSE) if not.
- The third output returns the Particle Index within the particle system.
- NOTE: Using the Particle Index and the same InputParticles node, a ParticleQuery operator could be used to acquire additonal information about the particle like Velocity, Color etc.
NearestPoint¶
- The NearestPoint operator has two inputs and seven outputs.
- The first input must be connected directly to an InputGeometry operator with at least one geometry object picked.
- Dragging a wire into an empty area of the Editor will create an InputGeometry operator automatically.
- Holding Ctrl while releasing the mouse the the above case will pop up the full operators menu
- The second input must provide the lookup point in world space.
- Dragging a wire into an empty area of the Editor will create a Position InputChannel node connected via a ToWorld Transform opertator.
- Holding Ctrl while releasing the mouse the the above case will pop up the full operators menu
- The first output returns the Position of the nearest point, or [0,0,0] if no valid nearest point could be found.
- The second output returns an Integer with a value of 1 (TRUE) if the point is valid, 0 (FALSE) if not valid.
- The third output returns the zero-based Object Index, matching the order of objects on the InputGeometry node’s list.
- The fourth output returns the zero-based index of the face the point belongs to.
- The fifth output returns the signed distance to the nearest point - positive if the point is seeing the front side of the face (outside), negative if seeing the backside (inside)
- The sixth output returns the face (unsmoothed) normal at the nearest point.
- The seventh output returns the barycentric coordinates of the nearest point within the face.
- NOTE: Using the ObjectIndex, FaceIndex and Barycentric Coordinates together with the same InputGeometry operator as inputs into a FaceQuery operator, you can access additional surface data.
ParticleQuery¶
- The ParticleQuery operator has two inputs and an arbitrary number of outputs.
- The first input must be connected directly to an InputParticles operator with a PRT object selected.
- The second input defines the particle index within the particle system. It has no default value when unconnected and is typically connected to the Particle Index output of a NeatestParticle operator.
- The outputs are defined via the UI of the operator.
- By default, the Position channel is exposed as the only output, but any number of particle channels can be added as outputs to query any data available in the stream.
ParticleSumCount¶
- The ParticleSumCount operator has two inputs and at least two outputs.
- The first input must be connected directly to an InputParticles operator with a PRT object selected.
- The second input must provide the world space lookup position to search particles from.
- The operator’s UI provides a Num.Neighbors property which defaults to 2 but can be set to another value and defines how many particles to look for.
- The Falloff Power property in the UI controls how the distance to the particle affects its accumulation into the final value.
- The first output is the Max. Distance (the distance to the farthest particle found)
- The second output is the Total Weight which can be used to divide the resulting channel values by to get an Average value.
- Any number of particle channels can be added as outputs and their channels will be accumulated by the operator, outputting their sum. The sum can be then divided by the Total Weight to produce an Average.
ParticleSumRadius¶
- The ParticleSumRadius operator has two inputs and at least two outputs.
- The first input must be connected directly to an InputParticles operator with a PRT object selected.
- The second input must provide the world space lookup position to search particles from.
- The operator’s UI provides a Radius property which defaults to 1.0 and defines the radius of the spherical region to search within.
- The Falloff Power property in the UI controls how the distance to the particle affects its accumulation into the final value.
- The first output returns the number of particles found inside the spherical region.
- The second output is the Total Weight which can be used to divide the resulting channel values by to get an Average value.
- Any number of particle channels can be added as outputs and their channels will be accumulated by the operator, outputting their sum. The sum can be then divided by the Total Weight to produce an Average.
PropertyQuery¶
- The PropertyQuery operator has one input and an arbitrary number of outputs.
- The input must be connected to an InputObject operator.
- By default, the Pos property (alias of Position) is exposed as the only output.
- Any number of outputs can be added to the operator via its UI by entering any valid MAXScript Expressions that access properties inside the object.
- Examples include “material.diffusemap.coords.blur” to access the blur value of a bitmap texture in the diffuse slot of the object’s material, “bend.angle” to access the angle of a bend modifier applied to the object and so on.
