MAXScript Language Reference > 3ds Max Objects > Modifier : MAXWrapper and SpacewarpModifier : MAXWrapper > Modifier and SpacewarpModifier Types > Modifiers > UVW Modifiers > Unwrap_UVW : Modifier >

# UnwrapUVW Modifier - Mapping Operations

| Unwrap_UVW Modifier - Main Topic | Modifier Classes - Quick Navigation

The following methods expose the Flatten, Normal and Unfold Mapping to MAXScript:

## Flatten Mapping

Methods:

    <void><Unwrap_UVW>.flattenMap <float>angleThreshold <point3 array>normalList <float>spacing <boolean>normalize <integer>layOutType <boolean>rotateClusters <boolean>fillHoles

Flattens the UVW coordinates based on the supplied parameters without using the Flatten Mapping Dialog. This method exposes the same functionality directly to MAXScript and does not require the Edit UVWs Floater to be open.

Flatten Mapping uses an angle threshold to define the clusters and the clusters will always be contiguous faces. This type of mapping will generate mapping that does not overlap so it is useful for baking textures and lighting.

angleThreshold - when building contiguous faces this the angle used to determine whether a face is part of that cluster. The larger this angle the larger the cluster will be, but you will get more distortion since the texture faces area will start deviating from there geometric face area.

normalList specifies an array of normal vectors defining clusters. The clusters will still be built using the angle threshold, but the supplied vectors will be used as starting directions for building the clusters. To use no vectors, an empty array #() can be supplied. The default UI Flatten feature uses a list of 6 vectors aligned to the world axes: #([1,0,0], [-1,0,0], [0,1,0], [0,-1,0], [0,0,1], [0,0,-1])

spacing determines how much space there is between the clusters.

normalize will normalize the complete flattened mapping from 0 to 1

layOutType defines the layout type. 0 - sort clusters from bottom to top and from left to right. 1 - sort clusters from left to right and from bottom to top. Default type of the Flatten feature in the UI is 0.

rotateClusters will rotate the clusters so they take the least area.

fillHoles will fill clusters with holes. It places smaller cluster in the gaps of larger clusters.

Exposed via unwrap2 interface in 3ds Max 5 and higher.

    <void><Unwrap_UVW>.flattenMapDialog()

Open the Flatten dialog.

Exposed via unwrap2 interface in 3ds Max 5 and higher.

    <void><Unwrap_UVW>.flattenMapNoParams()

Execute the FlattenMap function using the current default.

Exposed via unwrap2 interface in 3ds Max 5 and higher.

    <float><Unwrap_UVW>.getFlattenAngle()

Returns the current default Flatten Angle threshold .

Exposed via unwrap2 interface in 3ds Max 5 and higher.

    <void><Unwrap_UVW>.setFlattenAngle <float>angle

Sets the current default Flatten Angle threshold .

Exposed via unwrap2 interface in 3ds Max 5 and higher.

    <float><Unwrap_UVW>.getFlattenSpacing()

Returns the current default Flatten Spacing value.

Exposed via unwrap2 interface in 3ds Max 5 and higher.

    <void><Unwrap_UVW>.setFlattenSpacing <float>spacing

Sets the current default Flatten Spacing value.

Exposed via unwrap2 interface in 3ds Max 5 and higher.

    <boolean>getFlattenNormalize()

Returns the current default Flatten Normalize option state.

Exposed via unwrap2 interface in 3ds Max 5 and higher.

    <void><Unwrap_UVW>.setFlattenNormalize <boolean>normalize

Sets the current default Flatten Normalize option state.

    <boolean><Unwrap_UVW>.getFlattenRotate()

Returns the current default Flatten Rotate option state.

Exposed via unwrap2 interface in 3ds Max 5 and higher.

    <void><Unwrap_UVW>.setFlattenRotate <boolean>rotate

Sets the current default Flatten Rotate option state.

Exposed via unwrap2 interface in 3ds Max 5 and higher.

    <boolean><Unwrap_UVW>.getFlattenFillHoles()

Returns the current default Flatten Fill Holes option state.

Exposed via unwrap2 interface in 3ds Max 5 and higher.

    <void><Unwrap_UVW>.setFlattenFillHoles <boolean>fillHoles

Sets the current default Flatten Fill Holes option state.

Exposed via unwrap2 interface in 3ds Max 5 and higher.

    <void><Unwrap_UVW>.flattenMapByMatID <float>angleThreshold <float>spacing <boolean>normalize <integer>layOutType <boolean>rotateClusters <boolean>fillHoles

Performs flatten by material ID.

Exposed via unwrap4 interface in 3ds Max 7 and higher.

    <void><Unwrap_UVW>.setMax5Flatten <boolean>like5

Sets whether Flatten is using the 3ds Max 5 algorithm (true) or the 3ds Max 7 algorithm (false).

Exposed via unwrap4 interface in 3ds Max 7 and higher.

## Normal Map

Methods:

    <void><Unwrap_UVW>.normalMap <point3 array>normalList <float>spacing <boolean>normalize <integer>layOutType <boolean>rotateClusters <boolean>alignWidth

Normal-map the UVW coordinates. For each normal vector in the normalList, a cluster of the faces with the corresponding normal vector will be created.

Normal Mapping is mapping based solely are the normals provided. This is identical to box mapping except you customize what normals you want to project on.

Parameters in the Normal Mapping dialog are:

spacing determines how much space there is between the clusters.

layOutType determines which of the 6 mapping types to use: Back/Front, Left/Right, Top/Bottom, Box Mapping No Top, Box Mapping, Diamond mapping

normalize will normalize the cluster from 0 to 1

rotateClusters will rotate the clusters so they take the least area.

alignWidth will sort the clusters by there width otherwise it will use their heights.

Exposed via unwrap2 interface in 3ds Max 5 and higher.

    <void><Unwrap_UVW>.normalMapNoParams()

Executes the NormalMap function using the current defaults.

Exposed via unwrap2 interface in 3ds Max 5 and higher.

    <void><Unwrap_UVW>.normalMapDialog()

Opens the NormalMap dialog.

Exposed via unwrap2 interface in 3ds Max 5 and higher.

## Unfold Mapping

Methods:

    <void><Unwrap_UVW>.unfoldMap <integer>unfoldMethod

Unfold the UVW coordinates using the specified unfold method:

0 - Walk to farthest face

1 - Walk to closest face (default)

These determine the order of which face gets unfolded. Under almost all conditions you want to walk to the closest face.

This is an actual unfolding algorithm. It guarantees that all texture faces will have the exact same proportions as their geometric equivalents, but you may get faces that overlap. This type of mapping is only good on meshes that are very regular, like cylinders etc.

Exposed via unwrap2 interface in 3ds Max 5 and higher.

    <void><Unwrap_UVW>.unfoldMapNoParams()

Executes the unfoldMap function using the current defaults.

Exposed via unwrap2 interface in 3ds Max 5 and higher.

    <void><Unwrap_UVW>.unfoldMapDialog()

Opens the UnfoldMap dialog.

Exposed via unwrap2 interface in 3ds Max 5 and higher.

    <void><Unwrap_UVW>.setSeedFace()

Takes the current selection and sets it as the seed face when unfolding. The seed face is where the unfolding starts from.

Exposed via unwrap2 interface in 3ds Max 5 and higher.