Genome
RSS< Twitter< etc

<< Back To Mapping Deformation Modifiers

Planar Mapping Swirl

Similarly to applying a rotation to mesh vertices to produce a Twist modifier, applying a rotation to the map vertices will rotate the mapping coordinates and with them the assigned texture map.

If the amount of rotation is proportional to the distance of the map vertex to the center of rotation, the result would be a swirl.

Creating the Base Scene

  • Create a Plane with Length and Width of 120.0x120.0 units.
  • Assign a Standard Material with a Checker map in the Diffuse slot, change the black color to blue.
  • Enable Show Map In Viewport to see the checker on the plane and visualize the deformations of the mapping coordinates. 

Rotating And Offsetting the Mapping Coordinates (UV XForm)

First, we will shift the origin of the mapping (which is by default at the lower left corner of the plane) to the center of the plane and will rotate all mapping vertices equally. 

  • Add a Genome modifier and set to "Face Corners" iteration mode.
  • Open the Magma editor and press Ctrl+[O] to create an Output node. Set it to TextureCoord channel (but the same approach applies to all mapping channels!)
  • Select the Output node and press SHIFT+[M] to create and connect a TextureCoord InputChannel.
  • Press [T] and [Q] to insert a Transfor > ByTransformByQuat operator, press Ctrl+[W] to swap the input sockets.
  • Press Ctrl+[1] to connect a Float InputValue, select it and set it to 45.0.
  • Rename the node to "Angle" and check the "Exposed" option.
  • Select the wire connecting the Float and the TransformByQuat nodes, press [B] and select the QuatFromAngleAndAxis BLOP operator from the menu.
  • Press SHIFT+[3] to create and connect a Vector InputValue of [0,0,1] as the Axis.

RESULT: The texture is rotated at 45 degrees about the bottom left corner of the Plane:

  • Select the TextureCoord node again and press [-] to insert a Subtract operator.
  • Press SHIFT+[1] to connect a Vector InputValue node to the second socket of the Subtract operator.
  • Set the Vector InputValue to [0.5,0.5,0]

RESULT: The map is now rotated at 45 degrees around the center of the Plane. 

Rotating Proportionally To Distance From Center

Now that we have the texture rotating about the center of the Plane, let's make the rotation proportional to the distance of the vertex from the center:

  • Select the "Angle" InputValue node and press [*] to insert a Multiply operator.
  • Press SHIFT+[P] to create a Position InputChannel node.
  • Press [-] to create a Subtract operator.
  • With the Subtract node selected, press [I] and [B] to create and connect an InputBoundBox node.
  • Drag a wire from the Center output socket and connect to the Right Value second socket of the Subtract to replace the Min connection.
  • Select the Subtract and press [V] and [M] to create a Vector > Magnitude operator.

RESULT: The Mapping Vertex Rotation Angle is now affected by the distance of the Mesh Vertex from the Center of the Bounding Box:

Controlling the Swirl Exponent and Scale

Now let's add some controls over the size and exponent of the effect. 

  • Select the Magnitude node and press [/] key on the Numeric Keypad to insert a Divide operator.
  • Press Ctrl+[1] to create and connect a Float InputValue. Rename it to "Scale" and check the "Exposed" option. 
  • Select the Magnitude node again and press the [6] key on the top row (the one containing the ^ symbol on US keyboard) to insert a Power operator.
  • Press Ctrl+[1] to connect a Float InputValue. Rename it to "Exponent" and check the "Exposed" option.

RESULT: Changing the Angle to 1.0 with Exponent of 1.0 and Scale of 1.0 produces the image on the left. Changing the Angle to 45.0 and the Scale to 10.0 produces the image on the right:

 

Increasing the Scale to 1000.0 and the Exponent to 3.0 produces the following image:

Note that some of the effects seen in this image are actually caused by interference patterns due to the limited resolution of the mesh (100x100 segments).

Increasing the mesh resolution resolves more detail and produces a different image. The following two images were created using 1000 Length x 100 Width segments and 1000x1000 segments:

Making The Swirl Optional

Since we started with simple rotation about the center of the Plane, we could make the additional code that changes the effect by the distance from the center optional using a Switch operator. 

  • Select the Divide operator going into the Angle Multiply node and press [L] and [W] to insert a Switch operator.
  • Press Ctrl+[1] to connect a Float InputValue to the second (If False) socket of the Switch.
  • Press [1] to connect an Integer InputValue to the third (Boolean) socket of the Switch.
  • Rename the Integer InputValue to "Enable Swirl" and check the "Exposed" option. 

RESULT: A new Checkbutton will appear in the 3ds Max Command Panel. When checked, the Mapping will be rotated in a swirl depending on the distance to the center. When unchecked, the Mapping will be simply rotated.

 

Related Video: