Udim

Udim is an abbreviation of U-Dimension. It’s a tile-indexing system that converts a 2d (UV) coordinate into a 1d (Udim) tile.

To convert UV coordinates into Udim.

$udim = floor(($v) * $maxu + ($u + 1) + $base);
$u = U coordinate.
$v = V coordinate.
$maxu = Maximum in U dimension, 10 is industry standard.
$base = The origin. 1000 is the industry standard.

To convert a Udim back into it’s UV coordinates.

$u = int($udim-base) % $maxu
$v = int(floor(($udim-$base) / $maxu))

Renderman Development On Windows

Windows development for CG is always a bit of hassle as much of the tools out there come from development inside studios using Linux – where it’s often being much simply to build source code from scratch.

Pixar provide source code and examples for much of their plugins as developer examples. You won’t find source code for things like PxrSurface which contain Pixar’s secret sauces – but you will find quite a lot of useful ingredients to get you started.

The following is based on Renderman 22. Very specifically it’s worked for me on R22.2 and R22.3 – I’ve not tried earlier or later versions – but hopefully much of this applies to R21 and other points releases of R22.

To get the developer examples, run the Renderman Installer and when you get to the packages to install click on Show All. The Examples will be downloaded to your Downloads folder as a compressed archive (use 7zip to extract it)

Image showing dialog box from Renderman Installer application.
Click the Show All box when running the Installer application.

I’ve been using Visual Studio 2017 Community Edition to do this.

In order to compile the examples on Windows using Visual Studio, the easiest way I’ve found is to use the Visual Studio Command Prompt.

>cd D:\scenes\rman\dev\PixarRenderMan-Examples-22.2_1903500-windows10_vc14icc170.x86_64\plugins\pattern\color
>cl -c "-I%RMANTREE%\include"  /D "WIN32" /D "_WINDLL"  /EHsc  PxrMix.cpp
>link /out:PxrMix.dll /dll "/libpath:%RMANTREE%\lib" "PxrMix.obj" libprman.lib

This should give you a DLL file, you can copy this into your Documents/rfm folder in order to use in Renderman, however in order to use it in RfM you’ll need to have a Args file which defines it’s parameters. Args files come from Katana and Pixar uses them to define the UI of plugins in both Katana and Maya.

The easiest way to create an Args file is just modify an existing one. For example, if you look in the $RMANTREE/lib/plugins/Args you’ll find the current ones (including PxrMix from the above example).

OSL – BlackBody Colour

This node outputs a normalised colour given an input temperature in degrees Kelvin. This can be used as an input for lights to give the effect of different colour temperatures.

Download Here

BlackBodyColour Controls
BlackBodyColour Controls

  • Temperature: Temperature in degrees Kelvin.

 

OSL – Constant Surface

This shading node acts as a constant surface shader. It can be used to output flat colour without any shading (diffuse, specular, etc) on an object.

Download Here

Constant Controls
Constant Controls

  • EmissionOn: When set to 0 it will only compute the InColour for Camera rays. This prevents it from bleeding light onto surrounding surfaces. When set to 1 it will behave as OSL intended it as act as an emissive light, which bleeds light onto surrounding surfaces.
  • InColour: The input colour. Can be constant or texture.

Note that when EmissionOn is set to 1 it will take a lot longer to compute than when EmissionOn is set to 0.

OSL – ColourSwitch

This shading node does a binary switch between two input colours. Potentially useful if you want to test out two different textures or colour settings and don’t wish to rewire your shading network.

Download Here

ColourSwitch Controls
ColourSwitch Controls

  • Which: Which colour input to use. 0 = InColour0 and 1 = InColour1.
  • InColour0: Input Colour 0
  • InColour1: Input Colour 1

 

OSL – Exposure

This shading node applies an exposure adjustment to the input colour. This allows you to manipulate the colour using photographic stops.

Download Here

Exposure Controls
Exposure Controls

  • Active: Disable the effect by setting this to 0. This allows you to disable the adjustment without having to rewire your shading network.
  • InColour: The input colour. This can be any type of colour (texture, constant, etc)
  • Exposure: Measured in stops. Each stop will increase (double) or decrease (halve) the brightness.