Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  for (int i = 0; i < numPts; i++)
  {
    P[i] += amplitude[i] * Nn[i];
  }

Figure ... This figure shows a small grid of surface points before and after displacement.:  TO DO: scale images and put them side by side !!


View file
nameoriginalgrid.pdf
height250

View file
namedisplacedgrid.pdf
height250



LeftTO DO: figure of 5x4 pt grid similar to figure 8.3 of ARM book.  But with points P and normals Nn shown(?).  Left: original surface points and normals, along with displacement amounts.  Right: displaced points.

The surface positions and normals are in object space, which is convenient since the displacements scale and rotate along with the object.  In the rare cases where displacements in world space are preferred, the amplitude simply needs to be scaled by the length of the normal transformed to world space.  (If the master object is instanced instantiated to more than one instanced object, then the world transform of the first instance is used.)

...

In order to ray trace a scene efficiently, RenderMan needs to know where the objects are.  Objects are organized into a ray acceleration data structure: a bounding volume hierarchy (BVH) where each node in the hierarchy is a bounding box for the objects below it in the hierarchy.  For displaced surfaces computing  Computing these bounding boxes is a bit tricky for displaced surfaces because we don't know where the surface points actually are will end up until the displacement shader has run.  But we don't want to run the displacement shader on all displaced surfaces before tracing the first rays – if we did, the time-to-first-pixel would suffer.  What we need is a rough indication of how large the the displacement might be, without the expense of running the displacement shader to determine the exact displacement.  Such an indication must be provided with a displacement bound for each displaced object; the displacement bound is an upper limit on the displacement on that object.  For example, if we know that the maximum magnitude of displacement on a given object is 0.5 units, then we can specify the displacement bound like this:

...

The seasoned RenderMan user will notice this is all very similar to how displacement was done in the classic RenderMan Shading Language (RSL) – see for example Apodaca and Gritz, 2000 section 8.2.  One notable difference is that the displacement calculations used to be in camera space, but in RenderMan 22 they are in object space.