26.01.2015 Views

The RenderMan Interface - Paul Bourke

The RenderMan Interface - Paul Bourke

The RenderMan Interface - Paul Bourke

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>The</strong> code array is a sequence of machine language-like instructions describing the<br />

object’s primitive blob fields and the operations that combine them. Floating point<br />

parameters of the primitive fields are stored in the floats array. File names of the<br />

depth files of repellers are in the strings array. <strong>The</strong> integer nleaf is the number of<br />

primitive blobs in object, also the number of items in each varying or vertex parameter.<br />

Parameters with storage class constant or uniform have exactly one data value<br />

for the entire RiBlobby primitive.<br />

Each instruction has a numeric opcode followed by a number of operands. Instructions<br />

specifying primitive fields start at 1000 and are listed in Table 5.2.<br />

Opcode Operands Operation<br />

1000 float constant<br />

1001 float ellipsoid<br />

1002 float segment blob<br />

1003 float, string repelling plane<br />

1004-1099 reserved<br />

Table 5.2: RiBlobby opcodes for primitive fields.<br />

For all four of these operators, the operands are indices into the appropriate arrays.<br />

For opcode 1000 (constant) the operand indexes a single floating-point number<br />

in the floats array. <strong>The</strong> index of the first item in the array is zero.<br />

• For opcode 1001 (ellipsoid) the operand indexes the first of 16 floats describing<br />

a 4x4 matrix that transforms the unit sphere into the ellipsoidal bump in object<br />

space.<br />

• <strong>The</strong> operand of opcode 1002 (segment blob) indexes 23 floats that give the endpoints<br />

and radius of the segment and a 4x4 matrix that transforms the segment<br />

into object space.<br />

• Opcode 1003 (repelling ground plane) takes two indices. <strong>The</strong> first gives the index<br />

of the name of a depth map in the strings array. <strong>The</strong> second indexes the first<br />

of 4 float parameters of the repeller’s repulsion contour. <strong>The</strong> value of the field<br />

generated by a repeller is a function of the vertical distance from the evaluation<br />

point to the z-file, in the view direction in which the z-file was generated. <strong>The</strong><br />

four float parameters control the shape of the repelling field. Let’s call the four<br />

parameters A, B, C and D. A controls the overall height of the repeller. <strong>The</strong><br />

field value is zero whenever the height above the ground plane is larger than A.<br />

B controls the sharpness of the repeller. <strong>The</strong> field looks a lot like −B/z (except<br />

that it fades to zero at z = A, and remains at a large negative value when z < 0),<br />

so smaller values of B place the knee in the curve closer to z = 0. Added to<br />

this negative-going barrier field is a bump that has its peak at z = C, and whose<br />

maximum value is D. <strong>The</strong> bump component is exactly zero outside the range<br />

0 ≤ z ≤ 2C.<br />

<strong>The</strong>re are several more opcodes that compute composite fields by combining the results<br />

of previous instructions in various ways. Every instruction in the code array has<br />

a number, starting with zero for the first instruction, that when used as an operand<br />

refers to its result. <strong>The</strong> combining opcodes are given in Table 5.3.<br />

86

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!