XYZ Position To Color

The 3ds Max UVW Map modifier provides an “XYZ to UVW” mode which can copy the vertex coordinates into a Mapping or the Vertex Color channel. Implementing the same in Genome is a matter of two nodes - Input Position and Output Color (or TextureCoord/MappingN) channel.

But the 3ds Max modifier does not provide a normalized XYZ to UVW conversion. It is somewhat possible using the Tile properties when using static meshes, but not with dynamicly deforming geometry.

Let’s see how Genome can solve this case and produce perfectly normalized mapping or color values from vertex positions:

  • Create a GeoSphere primitive with 32 Segments and Radius of 50.0.
  • Add a Genome modifier and switch it to “Face Corners” iteration mode.
  • Press Ctrl+[O] to add a new Output node. Set it to Color channel.
  • With the Output node selected, press SHIFT+[P] to connect a Position Input channel.

RESULT: At this point, you should have the same result as XYZ to UVW mode of the UVW Map.

../../../../_images/gnm_xyz2uvw_unnormalized_viewport.png
  • With the Position channel node selected, press [-] (minus key on Numeric Keypad) to insert a Subtract operator.
  • With the Subtract operator selected, press [I] and [B] to create an InputBoundBox input node. This will subtract the Min. value of the Bounding Box from the Position.
  • Select the Subtract operator and press [/] (divide key on Numeric Keypad) to insert a Divide operator.
  • Drag a connection from the Max. output socket of the InputBoundBox to the Divisor input socket of the Divide operator.
  • Select the newly created wire and press [-] (minus key on Numeric Keypad) to insert another Subtract operator.
  • Drag a connection from the Min. output socket to the Right Value input socket of the Subtract operator.
  • Right-click the GeoSphere in the scene and select “Object Properties” from the QuadMenu.
  • Check “Vertex Channel Display” and make sure Vertex Color is selected and the Shaded button is checked.
  • Press OK on the Object Properties dialog.
../../../../_images/gnm_xyz2uvw_normalized_magma.png

RESULT: Now the Position value is normalized within the Bounding Box of the modifier, and the result is written into the Vertex Color channel.

Adding a Bend modifier to top of the stack with a value of 260 degrees will deform the vertices while preserving the color since it is calculated before the Bend,

../../../../_images/gnm_xyz2uvw_normalized_viewport.png ../../../../_images/gnm_xyz2uvw_normalized_bend_viewport.png

Moving the Genome above the Bend will assign colors based on the new bounding box affected by the deformation:

../../../../_images/gnm_xyz2uvw_bend_normalized_viewport.png