Genome
RSS< Twitter< etc

<<Back To Data Sampling Modifiers

UVs From A Plane

3ds Max provides a modifier for getting UV coordinates from a NURBS surface. Also, the Projection Mapping tools provide a rather convoluted way for stealing UV coordinates from another mesh, but it is not dynamic - it cannot acquire mapping coordinates on every frame while the source and target objects are changing. In production though, this is often quite useful to be able to acquire data continuously. Genome solves this problem by allowing any face, vertex or particle data accessible to its operators to be copied from one object to another.

In the following example, we will create a plane and a teapot and will assign the UV coordinates of the Plane to the Teapot, thus mimicking a Planar UV Map Gizmo in world space. The benefit of this approach is that any deformations applied to the plane would be applied to its UV coordinates and thus to the UVs of the teapot, and the teapot can be moved within the UV space, thus producing a kind of a "Predator" effect where the one object disappears on the background of the other when looked under the right angle. 

  • Start a new 3ds Max scene 
  • Create a Plane primitive with size 120x120, 4x4 segments.
  • Create a Teapot primitive with Radius 30.0 and 16 segments.
  • Assign a Standard Material to both objects
  • Assign a Checker Map to the Diffuse channel of the material, set its colors to blue and yellow and the UV Tiling to 4.0x4.0
  • Press the Show Map In Viewport icon to display in the viewports: 

  • Add a Genome modifier to the Teapot and set it to "Face Corners" iteration mode.
  • Press the "Open Magma Editor" button.
  • Press Ctrl+[O] to create a new output node and set it to TextureCoord channel.
  • Click anywhere in the editor to deselect the Output and press [O] and [N] for Object > NearestPoint operator.
  • Drag a wire from the Geometry input socket of the new node to automatically create an InputGeometry node.
  • Pick the Plane as the only InputGeometry object by pressing the "Pick in Scene..." button and clicking on the Plane.
  • Drag a wire from the Lookup Point input socket of the NearestPoint operator to automatically create a world space Position input.
  • Click anywhere to deselect all (or press Ctrl+[D]).
  • Press [O] and [Q] for a new FaceQuery operator and connect it to the Output node.
  • In the FaceQuery operator, type in TextureCoord in the "Expose Mesh Channels" text field and press ENTER to add to the list, then uncheck the >Expose Position - this will remove the Position socket and connect the new TextureCoord socket to the Output node.
  • Place the FaceQuery operator to the right of the NearestPoint, then select the InputGeometry node, hold Ctrl to add to the selection and select NearestPoint and FaceQuery, too.
  • With the three nodes selected, press [SPACE BAR] to connect all relevant sockets - InputGeometry to Geometry, ObjIndex to ObjIndex, FaceIndex to FaceIndex and Bary Coords to BaryCoords.

RESULT: At this point, the Teapot should acquire the Mapping Channel 1 coordinates from the Plane and show the texture projected in the XY plane. You can move or animate either object in world space - the Teapot will "swim" in the mapping of the plane. Note that if the Teapot leaves the Plane, the Nearest Point might become the same for multiple vertices, this producing less than optimal mapping.

 

Deforming UV Coordinates

As mentioned already, this setup allows us to deform the "mapping gizmo" to produce mapping effects not easily achievable using regular UV Map Gizmos. 

  • Select the Plane primitive and change it to 20x20 segments.
  • Add a Noise modifier to the Plane Primitive, enable the "Fractal" and "Animate Noise" options and enter X:50.0 and Y:50.0 for the Strength (leave Z at 0.0). 

RESULT: The Teapot will now acquire the deformed UV coordinates which move with the vertices of the Plane.