earlyworm portfolio for will earl

Udim Constant Shader

Using Multi-Tile shaders within 3Delight and Renderman

Here is a renderman compliant shader for applying udim based textures to a model. This is specifically designed for textures which have been painted in Mari, but it also works with textures that come from Cyslice and Zbrush. I’ve designed this particular shader for 3Delight, but it should work in other renderman compliant renderers as well – I have also tested it in Renderman For Maya.

This is just a constant shader, but it shouldn’t be terribly hard to use this in other shaders – either as a function within a custom SL shader or within an RSL Code (3Delight) or SLBOX (Renderman For Maya) node if your using the hypershade to build your shader with Maya.

DOWNLOAD SURFACE SHADER HERE

Looking at the UV layout for this plane you can see I’ve laid the UVs outside of the 0..1 range used as a default by Maya.  I’m using 9 x 2K texture maps here.

 

Settings…

The shader has the following settings.

  1. Gain: This is just a simply multiplier for the texture maps.
  2. Input Textures: The path and first part of the texture file name. So if for example your texture is called diffuse.1001.tdl you would enter just diffuse at the end of the path name. In the example above my textures are called test.1001.tdl
  3. File Extension: The file extension. Change this according to what type of file your using. TDL = 3Delight, TEX/TX = Renderman.
  4. Max UDimension: The maximum value in U. Mari uses a value of 10, Zbrush you can set it manually or have it set automatically.
  5. Reverse T: This flips the texture maps upside down. To understand why you need this you need to understand how various applications treat 2D image coordinate systems. (see below)
  6. Use Animated Maps: For when you have animated textures.
  7. Frame: Current frame. You can key this manually or link it to Maya’s time node.
  8. Use Variant: For texture variants.
  9. Variant Name: String name of the variant.
  10. Output Parameters: Ignore this. It’s the AOV attribute.

Naming conventions…

The shader uses the following naming conventions.

  • Standard texture = mytexture.$UDIM.tdl
  • Animated texture = mytexture.$FRAME.$UDIM.tdl
  • Variant texture = mytexture_$VARIANT.$UDIM.tdl
  • Animated Variant texture = mytexture_$VARIANT.$FRAME.$UDIM.tdl

Secondary Outputs…

The shader also has an AOV (secondary output) which is useful for debugging…

It may not be entirely obvious looking at the render itself, but if you look at the values in the image you’ll see that red and green correspond to the UV index and the blue channel corresponds to the UDIM number. Fairly easy to output this AOV in 3Delight…

  1. Open up the render globals for your pass. Go to the Displays option.
  2. Click Add Display.
  3. In the new display that appears right-click in the box where rgba is listed. Choose the Custom Output Variable option at the top.
  4. Enter color _ud where rgba used to be.
  5. Change it from 8 bit integer to 32 bit float.
  6. Make sure Render Secondary is on.

From the two displays listed above I was able to render out the blacksmith textures and the _ud AOV in one go.

Additional notes…

The diagram below shows how UV coordinates are defined inside your 3D application (Maya, Max, XSi, etc) with the origin (0, 0) at the bottom left corner. However most image editing programs use an XY coordinate system where the origin (0, 0) is at the top left corner. Renderman’s ST coordinate system uses one similar to the XY coordinate system – where the origin starts in the top left corner.  In order to render UV mapped textures correctly in Renderman for Maya you need to flip the ST coordinates upside down so the textures match your UV layout.

Comments are closed.