Python for 3ds max – Select objects of type

Software:
3ds max 2020

Continuing this example,
If you need to select objects (nodes) of a certain type i.e. lights, cameras etc.
You can use the INode class’s GetObject() method to get a reference to the node’s object, or “modified object” in 3ds max terms, and use the object’s GetSuperClassID() method to get the integer id representing the object’s superclass.

In addition, the MaxPlus SuperClassIds class contains convenient constants that can be used to avoid having to check and remember the superclasses numeric ids.
See reference here:
https://help.autodesk.com/view/3DSMAX/2017/ENU/?guid=__py_ref_class_max_plus_1_1_super_class_ids_html

An example of a script that selects all light objects in the scene:

from MaxPlus import SuperClassIds
from MaxPlus import SelectionManager

def scene_objects():
   def list_children(node):
      list = []
      for c in node.Children:
         list.append(c)
         list = list + list_children(c)
      return list
   return list_children(MaxPlus.Core.GetRootNode())

for o in scene_objects():
   obj = o.GetObject()
   if obj.GetSuperClassID() == SuperClassIds.Light:
      SelectionManager.SelectNode(o, False)

* note that when copying and pasting a script from this example, the indentation may not be pasted correctly.

Maya – Basic UV unwrapping

Software:
Maya 2018

Steps for basic UV unwrapping:

  1. Select all polygons.
  2. Apply planar UV projection just to get rid of all the current UV seams.
  3. Select the edges that that are intended to be UV seams.
  4. In the UV Editor menu choose Cut/Sew > Cut.
  5. Select all polygons.
  6. In the UV Editor menu choose Modify > Unfold.
  7. In the UV Editor menu choose Modify > Layout.
  8. Scale and rotate the UV layout to fit the UV space.

Related:
Multiple UV layouts

3ds max – Model a terrain from an Autocad topographical plan file

Software:
3ds max 2019

To model a terrain form an DWG (Autocad) file containing a topographical plan:

  1. Import the DWG file to into the 3ds max scene, and move the plan to the center of the 3ds max scene if necessary.
  2. Select the VIZBlock object and extract its linked geometry:
    Annotation 2019-12-12 181552.jpg
  3. Right click the Linked Geometry object and select:
    Convert To: Editable Spline
    Annotation-2019-12-12-181552b.jpg
  4. Enter Spline editing mode, select all the splines that are not part of the topography, and delete, or detach them so only the terrain ‘height lines’ will remain.
    Annotation 2019-12-12 182223.jpg
    Annotation 2019-12-12 182255.jpg
  5. With the topographical plan editable spline selected,
    Choose Create > Compound Objects > Terrain
    Annotation 2019-12-12 182640.jpg
  6. A Terrain object is now created:
    Annotation 2019-12-12 182716.jpg

To retopologize the terrain mesh to more usable quad polygon mesh:

  1. Create a new Plane primitive above the terrain mesh, slightly smaller at the sides, that has the wanted polygon resolution:
    Annotation 2019-12-12 183519.jpg
  2. From the Top view (important), with the new plane selected, choose:
    Create > Compound Objects > Conform:
    Annotation 2019-12-12 183607.jpg
  3. Set the creation method to ‘Move“, click Pick Wrap-To Object and than click the terrain mesh.
    It will now take some time for the new conformed mesh to be calculated..
    When the new object is ready, right click the viewport to exit the object picking mode.
    Annotation 2019-12-12 184044.jpg
  4. The Conform object is no ready, and contains both the terrain mesh and the new conformed quad polygon mesh:
    Right click it and choose:Convert To: Editable PolyAnnotation 2019-12-12 184552.jpg
  5. In Element editing mode, select the terrain mesh part and delete it to remain only with the new quad polygon mesh:
    Annotation 2019-12-12 184621.jpg
  6. Fix non conformed mesh parts by either moving or deleting them:
    Annotation 2019-12-12 184655Annotation 2019-12-12 184719
  7. The new retopologized terrain is ready:
    Annotation 2019-12-12 184752.jpg

 

The example demonstrated here is a DWG file by Jose Vega, free to download from Bibliocad.com

Arnold for 3ds max – Volumetric Fog and ‘God Rays’

Software:
3ds max 2019 | Arnold 5

a

Adding a ‘Volume Light’ effect in Arnold for 3ds max is fairly simple:

  1. In the Render Setup windows > Arnold Renderer tab, under Environment, Background & Atmosphere:
  2. Click the Scene Atmosphere material slot, add an Arnold Atmosphere Volume material to it,
    And drag it as an instance to the Material Editor to edit it’s parameters.
    Untitled-3
  3. Set the Density to a higher than 0.0 value, so the material will have an effect.
  4. You’ll probably need to significantly raise the number of samples in the Atmosphere Volume material, and also the number of Volume samples in the light settings in order to get a clean render.

Untitled-1.jpg

Related:
Arnold for 3ds max Volume Shading

3ds max – Use the Particle-Flow Lock/Bond test to have particles move on a surface in

Software:
3ds max 2019

The Lock/Bond Particle Flow test can be used to have particle movement restricted to a surface.

lock_bond.gif

This example shows a simple setup in which the particle teapots have a Speed operator set to Random 3D mode that causes them to move in random directions,
While at the same time the Lock/Bond test forces them to ‘stick’ to the surface:

Untitled-1

 

Python for 3ds max – Animated Mesh

Software:
3ds max 2019

This is an example of procedurally animating a mesh’s vertices via Python script.

Vert_Anim.gif

Notes:
1. The model has to be converted to Editable Mesh before the script is run.
* unless the scrip will be extended to do it.
2. The model must be selected for the script to work.

import MaxPlus
import math
from MaxPlus import INode
from MaxPlus import TriObject
from MaxPlus import SelectionManager
from MaxPlus import Factory
from MaxPlus import Animation
from MaxPlus import Point3
from MaxPlus import Control

ticks_frame = 160

#Selection
sel = []
for n in SelectionManager.Nodes:
    sel.append(n)
node = sel[0]

#Setup Controllers
obj = node.GetObject()
Tri = TriObject._CastFrom(obj)
mesh = Tri.GetMesh()
num_verts = mesh.GetNumVertices()
mesh_anim = obj.GetSubAnim(0)
pnt_ctrl = Factory.CreateDefaultMasterPointController()
node.AssignController(pnt_ctrl,1)
for i in range(num_verts):
    bezp3 = Factory.CreateDefaultPoint3Controller()
    bezp3.SetPoint3Value(mesh.GetVertex(i))
    mesh_anim.AssignController(bezp3,i)

#Animation
Animation.SetAnimateButtonState(True)
for t in range(100):
    time = t * ticks_frame
    Animation.SetTime(time)
    mesh_anim.AddNewKey(time,0)
    for i in range(num_verts):
        vert_anim = mesh_anim.GetSubAnim(i)
        vert_ctrl = Control._CastFrom(vert_anim)
        vert_val = mesh.GetVertex(i)
        vert_val.SetZ(vert_val.GetZ() + math.sin(((Animation.GetTime()*0.5)/(ticks_frame))+i))
        vert_ctrl.SetPoint3Value(vert_val)
Animation.SetAnimateButtonState(False)

* note that when copying and pasting a script from this example, the indentation may not be pasted correctly.

Related:
Python for 3ds max – Mesh manipulation

Getting Maya 3D Paint to work

Software:
Maya 2018

Steps needed for Maya 3D Paint to work:

  1. Set a project folder and save your scene.
    * If your painting into an existing texture you can skip this step.
  2. Make sure your model has UV coordinates.
  3. Make sure your model has a basic Lambert material.
    * If you’re using a different material/shader on your model,
    Temporarily switch to Lambert just for the texture painting operation,
    And connect the original shader with the painted texture map to the surface shader input of the shading group after you’re done painting.
  4. In the Rendering tab toolbar, Double-Click the 3D Paint tool button to activate 3D Paint and also open its tool settings window.
  5. Make sure the object is selected.
  6. In the 3D Paint Settings window, go to the File Textures part,
    Choose a material attribute to paint to.
    * this would usually be Color because we are using Lambert temporarily anyway.
  7. Click Assign/Edit Textures to open the Assign/Edit Textures dialog,
    Choose a resolution and a file format for the new texture,
    And than click Assign/Edit Textures button at the bottom of the Assign/Edit Textures dialog to create the new texture and close the dialog.
    * If you already connected an existing texture file to the Lambert shader’s Color input you can skip this step.
  8. Check Update on stroke and Save texture on stroke.
  9. Set the viewport to Textured display mode.
  10. Set paint brush settings.
  11. Click the 3D Paint tool button to activate it and paint on the model surface.

Untitled-1

3ds max – Transform Gizmo disappearing

Software:
3ds max 2019

I’ve been operating 3ds max for 20 years and this always gets me by surprise again and again, especially when working with students 🙁

In the past, the option to hide/show the Transform Gizmo had a hot key X, and curiously, even though that way it would happen more frequently that the Gizmo would disappear by mistake, when it was X I actually remembered it, and remembered to tell my students to just press X.

The menu command:
VIews > Show Transform Gizmo

I never remember it,
And also, I can’t logically except that it’s a system setting that is kept even when resetting the scene or opening a new file.

Untitled-5