OSL Delayed UV

 

The OSL Delayed UV node is a scriptable node where users can write OSL (Open Shader LanguageA shading language developed by Sony Pictures Imageworks. There are multiple render engines that utilize OSL as it is particularly suited for physically-based renderers.) scripts. This node can be used to more efficiently handle large amounts of texture tiles. The OSL Delayed UV node can be accessed from the Projection category in the Nodegraph Editor window.

 

Using the OSL Delayed UV node

Consider a simple use case: a texture shader which randomly picks one of four input textures for each UV tile.

OSL_Delayed_UV_Fig02_Nuke_v4_0

Figure 2: Code sample for randomly picking one of four input textures.

 

OSL_Delayed_UV_Fig03_Nuke_v4_0

Figure 3: The resulting random distribution of input textures.

 

Prior to evaluating this texture, the 4 texture inputs col1 to col4 are evaluated, but only one of them is needed to calculate the output value. This is inefficient if there is a large amount of different tiles. The OSL Delayed UV node can used to get around this issue. Using this node will suppress the evaluation of those inputs before the shader runs. Instead the inputs are evaluated on demand. Now only 1 input is evaluated.