PointFlattenMod : Modifier

PointFlattenMod - superclass: modifier; super-superclass:MAXWrapper - classID: #(403142307L, 799239576L)

The Point Flatten modifier (shown in the modifier list as Point Flatten, in the Points category) turns nested instances into individual points. The modifier only accepts point objects as input.

Each point in a point object can display an instance of a scene node (see PointInstanceMod : Modifier). Usually that instance is a single object, such as one mesh. However, the instanced node can also stand for several objects at once:

In these cases one point represents many objects, but only as a single point: you cannot select, edit or color the individual objects inside it. Point Flatten resolves this. Each point whose instance stands for more than one object is deleted and replaced by one new point for each object it contains, after all nesting has been resolved. In the example above, each point of the Point Grid is replaced by one point per tree. Points whose instance is a single object are left unchanged. Gaussian Splat objects are never expanded.

Each new point is placed at the world position of the object it replaces, relative to the point object. All of the source point's other channel values (for example color, scale or selection) are copied to it. Only the object's position is used: its rotation and scale within the group, hierarchy or nested point object are not transferred to the new point. After flattening, every point refers to exactly one object, so it can be edited individually, for example with EditPointMod : Modifier.

NOTE

In 3ds Max 2027.3, Point Instance data is flattened only for points that have an instance assigned, such as geometry, a spline or a light. Otherwise, point data instanced to other points is not propagated through this modifier.

The .flattenMethod property (below) controls whether the new points keep their objects as instances.

Available in 3ds Max 2027.3 and higher.

Constructor

PointFlattenMod...

Properties

<PointFlattenMod>.flattenMethod     Integer    default: 1   --  integer

Gets/sets how the members of each assembly are turned into points:

A third UI option, "Mesh", is defined in PointFlattenWidget.ui but is removed at runtime and is outside the valid range (0-1).

Example

-- Build a nested instance setup: a 3 x 3 Point Grid whose points each instance
-- a 5-point Point Sphere, whose points each instance a teapot
tree = Teapot radius:2 name:"FlatTree"
inner = PointSphere radius:10 count:5 name:"FlatInner"
pimInner = PointInstanceMod()
addModifier inner pimInner
classof inner
idx = 0
pimInner.AddNode tree &idx
outer = PointGrid countX:3 countY:3 countZ:1 name:"FlatOuter"
pimOuter = PointInstanceMod()
addModifier outer pimOuter
classof outer
pimOuter.AddNode inner &idx

-- Add Point Flatten: each grid point is replaced by one point per teapot
pf = PointFlattenMod()
pf.flattenMethod = 1   -- Point Cloud with Instances (the default)
addModifier outer pf

-- Count the points before and after flattening, using a temporary Edit Point modifier
em = EditPointMod()
addModifier outer em
classof outer
count = 0
pf.enabled = false
classof outer
em.GetPointCount outer &count
count
pf.enabled = true
classof outer
em.GetPointCount outer &count
count
deleteModifier outer em

OUTPUT:

9    -- without Point Flatten: one point per grid position
45   -- with Point Flatten: 9 grid points x 5 teapots each