PxrSeExpr
Cellnoise


return to main index



Introduction

This tutorial is a brief introduction to the use of the cellnoise() function. Unfortunately, editing an expression directly in a PxrSeExpr node can be frustrating because of the limited size of its text area. Using Cutter to "send" text to Maya is a convenient way of editing a PxrSeExpr node, saving the script as an external text file and seeing it's effect during a re-rendering (IPR) session.


Getting Started
Maya

1   Launch Maya and ensure the RenderMan_for_Maya plugin is loaded.
2   Create a surface, say, a poly plane with 1 by 1 divisions.
3   From the RenderMan menu assign PxrConstant to the surface.
4   Use the connection button of "Emit Color" and link to a PxrSeExpr node.
5   Make a note of the name of the node - probably "PxrSeExpr1".
6   Enter this Mel command in the script editor,
      commandPort -n ":2222";


Cutter

1   Launch Cutter and open a new document window.
2   Save the document as "ccellnoise.see" - the location is not important.
3   Enter the following text,

----snip----snip----snip----
# node: "PxrSeExpr1"
  
result = ccellnoise([s * 4, t * 4, 1]);
result
----snip----snip----snip----

4   Open the network panel (1) and click the "Connect" (2) checkbox,



Figure 1


5   Maya will confirm the connection with a harmless error message.



Figure 2


Send the expression to Maya using either the "Send" (3) button, or the keyboard shortcut Alt + e, Control + e or Apple + e. The expression should be seen in the PxrSeExpr node.



Figure 3


For information about Cutter and the Disney SeExpr language refer to,
    PxrSeExpr Node Scripting: Cutter

This setup may seem somewhat convoluted but in my experience it is very worthwhile because it removes any doubts about visual effects of editing an expression.


The Basic Expression

The basic expression produces a 4 by 4 grid of randomly colored squares.

    result = ccellnoise([s * 4, t * 4, 1]);
    result


Figure 4


Extending the Expression

The pattern can be easily controlled by using the first two float sliders of the PxrSeExpr node to scale 's' and 't' and the the third float slider to offset the XYZ values of the input vector - hence the use of '[' and ']'.

    result = ccellnoise( [ s * floatInput1, t * floatInput2, floatInput3 ] );
    result

Wiring PxrFractal into the forth float slider and modifying the expression generates some "interesting" effects - figure 6.

    result = ccellnoise([s * floatInput1, t * floatInput2, floatInput3 * floatInput4]);
    result


Figure 5



Figure 6


Using the pattern to drive a displacement can also result in some interesting effects.



Figure 7 - image rollover








© 2002- Malcolm Kesson. All rights reserved.