Stoke MX Field Magma Object
Available in Stoke MX 2.0 and higher. Last Edited on May 1, 2014.
It lets you define one or more scalar and/or vector fields using a single Magma flow.
While the bounds of the object can be defined using a bounding box and a voxel spacing value, the Magma can be evaluated at arbitrary points in space if needed. For example, both the Field Texmap, the Field Force and the Stoke MX Particle Simulator can evaluate the field values outside the original bounding box limits.
The Field Magma object is evaluated on the fly independently for each frame, similar to the way the Krakatoa MX Magma Modifier and the Genome MX Magma operate. In contrast, the Stoke Field Simulator is history-dependent - every frame can depend on the result of the previous one.
The Help rollout contains the About information, version and licensing data, as well as the following controls:
Open Online Help... button
- Pressing this button will open the Online documentation.
- Internet connection and a Web Browser are required to use this documentation.
Configure License... button
- Pressing this button will open the License Picker Dialog.
Log Level drop-down list
- Controls the type of information shown in the MAXScript Listener during simulation (applies mainly to the Stoke Particle Simulator and Stoke Field Simulator objects):
- None - nothing will be reported.
- Error - only errors will be reported.
- Warning - both warnings and errors will be reported.
- Progress - progress messages, warnings and errors will be reported.
- Stats - all reportes except for debug messages will be shown.
- Debug - full reporting including debug information will be performed.
Field Magma Parameters Rollout
This rollout contains the main controls of the object, including access to the Magma Editor and the settings of the World Space Grid.
Open Magma Editor... button
- Pressing this button will open the Magma Editor where you can define the Fields using all available operators and input nodes.
- The Stoke Field Magma Editor exposes an additional "Stoke" operators category containing nodes specific to the product.
- The color indicator to the left of the button will be green when the Magma flow is valid, and red when the Magma flow has reported an error.
[>] Preset Flows button
- Pressing this button will show a menu providing an option to explore the default Stoke Field Magma flows save directory, plus a list of all flows saved in that directory.
- Selecting a pre-saved flow from the list will automatically load it into the Magma Editor without opening it. This can be used to quickly switch the field to various presets.
- This option controls the >AUTO checkbutton exposed in the upper right corner of the Magma Editor.
- When checked, the Magma flow will be updated automatically on any changes including adding and removing nodes, changing parameters etc.
- When unchecked, the Magma flow will only be reevalated when the UPDATE button in the Editor is pressed manually. This is useful when designing very complex flows that might be slow to update interactively.
Mute All checkbox
- Checking this checkbox will first remember the current enabled state of all Output nodes in the Magma flow, then set all Outputs to disabled.
- Unchecking the checkbox will restore the original enabled/disabled settings of all Output nodes in the Magma flow.
- Use this option to suppress all calculations of the Magma flow, for example to speed up interactive changes to the Grid size.
>Enable Grid Manipulator checkbutton
- This checkbutton is a shortcut to the Select And Manipulate feature of 3ds Max.
- When a Stoke Field Magma object is created, this system feature will be activated automatically to allow the interactive resizing of the grid directly in the viewports by dragging the sphere handles at the 6 sides of the bounding box.
- Note that changing this option will update the 3ds Max Main toolbar, but changing the toolbar icon's state will not update the Field Magma's checkbutton in the Command Panel unless you reselect the object manually. In the latter case, the states of the system icon and the object's checkbox could get temporarily out of sync.
- The Grid Manipulator lets you resize each side individually by dragging the respective handle, resize both sizes symmatrically relative to the location of the object icon by holding down the SHIFT key while dragging, or resize all 6 sizes symmetrically relative to the object icon by holding down both SHIFT and CTRL keys while dragging.
X, Y and Z World Space Grid Size spinners
- The 6 value spinners define the Minimum and Maximum extents of the Field's Grid in World Space.
- The left column represents the Minimum values, the right column represents the Maximum values.
- The Min. and Max. values will "bump" each-other to ensure the Minimum is always below the Maximum by about two Voxel Spacing sizes. For example, if the Spacing value is 3.0, the Min. X is -50.0 and the Max.X is 50.0 and you enter 60.0 for Min.X, the Max.X will be automatically bumped up to 66.0. When using the Manipulator handles though, the Min.X will stop about two voxel sizes before the Max. X and won't bump it up.
- NOTE that the value spinners are in absolute world-space units and are NOT directly affected by the transformations of the object icon! (except when using the symmetrical options of the Grid Manipulator described above, or aligning to the icon explicitly using the buttons mentioned later on this page)
- The Field Grid will always be aligned to the world coordinate system and cannot be rotated or scaled. This was a conscious design decision to simplify the data flow inside Magma.
- The Spacing spinner defines the Grid spacing of the Field Magma object.
- The Spacing is used in two cases
- When displaying samples in the viewports, the Spacing will define the highest resolution to display (unless Reduction is performed automatically or manually to draw only every Nth row).
- When performing grid-based operations in the Magma flow, the Grid Spacing will provide the default voxel size unless overridden explicitly by the operator itself.
- The Spacing and Grid Size will be passed up the stack and will provide the default values for any relevant Field Modifiers like the SimpleFluid modifier, unless the Spacing is overridden explicitly in the modifier itself.
- As mentioned earlier, in most cases the Field Magma can be evaluated at arbitrary points since it tends to be fully procedural most of the time. In the cases when grid-based operations (for example SimpleFluid, Grid, ParticleSplat etc.) are performed, some of the data might be discretized, but the field can still be evaluated at arbitrary points by objects like Field Texmap, Field Force etc.
Grid Voxel Counts text field
- This text field displays the X, Y and Z voxel count of the current grid, as well as the total number of voxels in the grid based on the Size and Spacing values.
- The field is not editable, but its text can be copied to be pasted elsewhere.
Limit Field To Bounds checkbox
- This option is checked by default.
- When checked, the field will be evaluated only within the specified Grid. Any requests for evaluation outside of the grid will be ignored.
- When unchecked, queries outside of the Grid will produce valid results. In this mode, the Grid Size and Spacing will affect mainly the viewport display (no samples will be drawn outside the Grid in either mode).
Get Grid Size From Selection... button
- To use this button, first Pin the modifier stack to the Stoke Field Magma object so that deselecting it would not change the display in the Command Panel. (The Pin icon is the first on the left underneath the Stack View).
- With the Field Magma object Pinned in the Command Panel, select one or more scene objects and press the button to set the Grid Size to the combined world bounding box of the selection.
Grid To Icon button
- Pressing this button will center the Grid to the current icon position while ignoring its rotation and scale transforms.
- This feature can be used to move an existing Grid to a new location in world space without changing its size - simply move the icon first, then press the button to move the Grid to it.
Base To Icon button
- Pressing this button will center the Base (XY) of the Grid to the current icon position while ignoring its rotation and scale transforms.
- This feature can be used to move an existing Grid to a new location in world space without changing its size. Since the default creation mode of the Field Magma object is to have its base centered at the icon, this option lets you relocate the grid by moving the icon first, then moving the existing Grid to it without centering along the Z axis.
Icon To Grid button
- Pressing this button will center the icon to the World Space Grid's position.
- This is the reverse operation of the Grid To Icon button.
Icon To Base button
- Pressing this button will center the icon to the World Space Grid's Base (XY) position.
- This is the reverse operation of the Base To Icon button.
NOTE that you can combine these buttons to move the grid by half Z size up or down. For example pressing Icon To Base and Grid To Icon will move the grid half a height down, pressing Icon To Grid and Grid To Base will move half a height up. Repeatedly pressing these combinations can shift the grid multiples of the half height up or down...
Select Dependent Object... button
- Pressing this button will display a menu with Objects that use this Stoke Field Magma object as input, for example Stoke Particle Simulator, Stoke Field Force, Stoke Field Follow PFlow Operator, any object with a Material containing a Stoke Field Texmap etc.
- If no dependent objects have been found, the list will display one item stating that.
- Note that all objects exposing a pick button for a Field input provide a [>] button with the option to "Select Field Source", thus allowing you in turn to select the Stoke Field Magma if it was picked.
Viewport Display Rollout
The Viewport Display rollout contains the controls related to the visualization of the Field Magma data in the viewports.
- When checked (default), the fields defined by the Magma flow will be sampled according to the Grid Spacing and Size values and represented in the viewports according to the settings of the other controls in the rollout.
- When unchecked, no samples will be drawn regardless of the other relevant controls' values.
Reduce value spinner
- The Reduce value spinner defaults to 0.
- When set to 0, the Field Magma grid will draw all samples in the viewports, unless Auto-Reduce has kicked in to preserve reasonable performance.
- When set to a value higher than 0, and if Auto-Reduce has not enforced a higher reduction value, only every Nth sample will be drawn along each of the 3 axes.
Update Channels button
- Pressing this button will reevaluate the Fields defined in the Magma flow and repopulate the drop-down lists below with the currently available channels.
- This is useful when modifying the Output nodes in the Magma flow and attempring to use the new channels to control the viewport display.
Mask drop-down list
- This list provides the options "No Mask" as well as any Scalar Fields defined in the Magma flow.
- By default, a Density field is defined in a new Field Magma object, and the Density channel will be selected automatically.
- The Mask channel is used to determine where to display viewport samples.
- Samples (Dots or Vectors, depending on the Display list below) will only be drawn where the Mask channel has a positive value.
- When set to "No Mask", no Dots will be drawn when Display is set to "Large Dots", and all Vectors will be drawn when Display is set to a Vector channel.
Color drop-down list
- This list provides the options "Object Color" (default), as well as any Vector fields defined in the Magma flow.
- When "Object Color" is selected, the samples (Dots or Vectors) drawn in the viewports will use the object color of the Field Magma - either the wireframe color, or the Material color, if a material is assigned.
- When a Vector field is selected, the channel's values will be used to colorize the samples.
Display drop-down list
- This list provides the options "Large Dots" (default), as well as any Vector fields defined in the Magma flow.
- When "Large Dots" is selected, the samples will be drawn as dots in the viewports.
- When a Vector field is selected, the samples will be drawn as lines in the viewport according to the direction and magnitude of the field at the sample point, unless overridden by the controls below.
Norm. Length checkbox
- When unchecked, the Vector display will draw the samples as lines with length equal to the Magnitude acquired from the field, multiplied by the Scale value.
- When checked, the Vector Magnitude will be normalized to length of 1.0, then scaled by the Scale value before displaying.
Scale value (unlableled, to the right of the Norm.Length checkbox)
- Defaults to 1.0 and is used to scale the Vector magnitude of Vector Display samples in the viewports as described above.
- Note that Velocity fields are stored as World Units Per Second, so the Vector Display will draw lines that are N times longer than the per-frame velocity where N is equal to the FPS settings. Thus, at 30 fps, you need to use 1.0/30.0=0.03333 Scale to display Vectors with Magnitude in World Units Per Frame!
Display Grid Bounds checkbox
- When checked, the Grid Bounds will be drawn in the wireframe color of the object in the viewports.
- When unchecked, the Grid Bounds will not be drawn in the viewports.
- The Grid Bounds bounding box can be used to select the object instead of clicking on the Icon or the Samples.
Icon Size value spinner
- The Icon Size defaults to 30.0 units and controls the display size of the object's icon.
- There is no option to disable the Icon display to ensure the object is always easily selectable even if the On and Display Grid Bounds options are unchecked.
- The Icon Size can be set to 0.0 though if absolutely necessary to "hide" the icon.
Manipulator Handles Min. Size and Max. Size value spinners
- The Min.Size and Max.Size value spinners will clamp the size of the Grid Size Manipulator Handles (green spheres on the 6 sides of the Grid).
- Normally, the Handles will change size according to the size of the Grid, so larger Grids would provide larger handles to retain visibility and usability when zooming out a lot, while smaller Grids would provide smaller handles.
- Use these controls to adjust the size of the handles to avoid extremely small or extremely large display.
Object Creation Workflow
The Stoke Field Magma object can be created using several methods:
Using the Stoke Menu
- The Stoke Menu is installed automatically with the product and provides shortcuts to all major components.
- Click the Stoke menu entry in the 3ds Max Main Menu bar.
- Select the "Create Field MAGMA Object - hold SHIFT to create at World Origin" entry.
- If you are holding SHIFT while selecting the menu option and no other objects are selected in the scene, a Stoke Field Magma with extents -53.331 to +53.331 along X,Y and Z will be centered around the World Origin 0,0,0. If you want its base to be at the origin, simply press the Base To Icon button in the UI.
- If you are holding SHIFT while selecting the menu option and one or more objects are selected in the viewport, the Grid Bounds of the new Stoke Field Magma object will be set to match the combined world space bounding box of the selection, plus one voxel padding on each side. This is useful when intending to use the selected objects as inputs into the Field Magma.
- If you are NOT holding SHIFT while selecting the menu option, you will enter the standard creation mode of the Stoke Field Magma object:
- Click in the viewport on the current grid to define the one corner of the Grid and hold the Left Mouse Button pressed.
- Drag the mouse to define the extents of the Grid's Base and release the Left Mouse Button to define the second corner of the Grid's Base - note that the Min. and Max. values will be swapped as needed, so you can create both from Min. to Max. or from Max. to Min. along both X and Y axes.
- Move the mouse to define the height of the Grid and click to set it.
- At this point, the creation procedure will exit and the 3ds Max Command Panel will be switched from Create to Modify mode to let you start working on the object's settings.
- Right-clicking with the mouse at any point during this creation procedure will cancel the process AND leave any already created object in the scene.
Using A MacroScript On A Toolbar or Keyboard Shortcut
- Alternatively, you can customize the 3ds Max UI to place the same MacroScript used by the Stoke menu on a toolbar, QuadMenu or assign to a dedicated Keyboard Shortcut.
- Simply use the Main Menu > Customize > Customize User Interface dialog to locate the "Stoke" category and assign the MacroScript as needed.
- The actual creation procedure will be identical to the one described in the Stoke Menu section above.
Using the 3ds Max Create Tab in the Command Panel
- You can also use the regular 3ds Max workflow for object creation which is similar, but slightly different from the Stoke Menu / MacroScript approach.
- Activate the Create tab of the 3ds Max Command Panel
- Make sure you are in Geometry mode.
- Select "Stoke" from the Category drop-down list
- Click the "Field Magma" button to enter creation mode
- Click in the viewport to define the one corner of the Grid's Base, then hold the Left Mouse Button and move the mouse to define the second corner.
- Release the Left Mouse Button to set the Base and move the mouse to define the height.
- Click the Left Mouse Button a second time to set the height and finish the current object's creation.
- Note that 3ds Max will remain in Field Magma object creation mode and you can start creating another object immediately, or Right-Click to exit creation mode.
- Right-clicking at any point during the object creation steps outlined above will cancel the creation of the object AND delete any unfinished object (compare to the MacroScript workflow above where this is not the case).
- You can create a Stoke Field Magma object by executing the following code:
- The resulting object will have a Spacing of 2.0 and Grid Size of -2/2, -2/2, 0/4 unless specified explicitly via creation parameters.