Documente online.
Zona de administrare documente. Fisierele tale
Am uitat parola x Creaza cont nou
 HomeExploreaza
upload
Upload




PIXAR - 'The RenderMan Companion' 1st Edition by Steve Upstill

computers


Mark Henne
RenderMan Team
Pixar
9/13/89

Errata Sheet version 1
"The RenderMan Companion" 1st Edition
by Steve Upstill


INTRODUCTION:

    The corrections presented in this document point out mistakes in the book,
such as syntax errors.  These mistakes make the code listings incorrect as
they appear in the RenderMan Companion.  Extra code required to make the
examples run, such as camera setup for the geometry chapters, is not discussed
here.


CORRECTIONS:

  Chapter 2
    p. 25 - Listing 2.3
          There are two problems with the initialization of the array
          Cube[6][4].  First, commas are missing between the second and
          third points and also between the third and fourth points in
          the bottom face definition.  Second, the polygons' normals all
          face towards the center of the cube.  This is a somewhat subtle
          error, but an error nonetheless.  Note that the second and fourth
          columns of data are switched.
          The cube's definition should be as follows:

            static RtPoint Cube[6][4] = , , , },  /* Bottom face */
                , , , },  /* Left face   */
                , , , },  /* Top  face   */
                , , , },  /* Right face  */
                { , , , },  /* Far face    */
                { , , , }   /* Near face   */
            };

    p. 34 - Listing 2.8
          The picture files produced by the animation sequence have
          names which are too long for MS-DOS filenames.  These should
          be changed to "anim#.pic" where # is a number from 1 to 10.
          Do this by changing the call to sprintf() to read:

            sprintf( filename, "anim%d.pic", frame);

  Chapter 4
    p. 62 - "parameters to RiSphere() are illustrated at left"
          should read
          "... illustrated at right".

    p. 64 - "... points in the x,z plane of three-dimensional gspace, then
            calls RiHyperboloid() ..."
          should read
          "... three-dimensional space, ...".

    p. 67 - Listing 4.3
          The call to RiSphere() in the middle of TorusWave() has an
          incorrect argument 10310t199k list.  As the comment indicates, a
          downward-opening hemisphere is desired, but downward-opening
          from the perspective of the viewer, not the object coordinate
          space.  Because of the 90 degree rotation about the X axis, an
          upward-opening is needed for the hemisphere's creation.  The
          comment and code should read as follows:

            /* Create the cap for the center of the wave */
            RiSphere( innerrad, -innerrad, 0.0, thetamax, RI_NULL);

  Chapter 5
    p. 76 - Listing 5.2
            The #include reference to surfor.h should not be there.
          Note that the other #include file pin.hyper.h is not presented.

            The /* comment */ in PolySurfOR() refers to "the goblet
          description".  This should read "the surface profile".

              PolyBoid() is supposed to be provided as a triangular
          polygon approximation to hyperboloids, with the addition of
          suitable surface normals.  It is meant as an improvement to
          the PolyBoid() function in Listing 5.1.
            What is provided instead is a function called PolyBand(),
          which is semantically identical to the PolyBoid() function
          presented in Listing 5.3.  This function illustrates the
          RiPointsPolygons() interface call.  Replace PolyBand() with
          the PolyBoid() function shown below:


/* ================================================================ */

#define SWAP(a,b,temp) temp = a; a = b; b = temp;
#define COPY_POINT(d, s)          

PolyBoid(point0, point1, normal0, normal1, ndivs, parity)
RtFloat *point0, *point1, *normal0, *normal1; int ndivs, parity;

}

/* ================================================================ */


  Chapter 6
    p. 94 - Listing 6.2
          The call to RiBasis() is missing a comma after the first
          RI_CATMULLROMSTEP argument.  It should read:

            RiBasis( RiCatmullRomBasis, RI_CATMULLROMSTEP,
                   RiCatmullRomBasis, RI_CATMULLROMSTEP);

    p. 101 - Listing 6.3
          There is a problem in consistency between this listing and the
          other surface of revolution listings; this listing revolves about
          the y-axis, everything else revolves about the z-axis.  To make
          this example also revolve about the z-axis, change the assignments
          of the mesh[][][] to read as follows:
          
             mesh[v][u][0] = points[v].x * coeff[u][0];
             mesh[v][u][1] = points[v].x * coeff[u][1];
             mesh[v][u][2] = points[v].y;

          The comments refering to "XY plane" and "Y axis" should also be
          changed to "XZ plane" and "Z axis", respectively.

          All references to wrap and surfaces should be changed
          to periodic and nonperiodic.  The text in this section of the
          book should be updated to reflect this fact: the term RI_NOWRAP
          should be changed to RI_NONPERIODIC, and RI_WRAP should be
          changed to RI_PERIODIC.

    p. 102 - Listing 6.4
          All references to wrap and surfaces should be changed
          to periodic and nonperiodic.  The text in this section of the
          book should be updated to reflect this fact: the term RI_NOWRAP
          should be changed to RI_NONPERIODIC, and RI_WRAP should be
          changed to RI_PERIODIC.

         
  Chapter 7
    p. 128 - Listing 7.2
          #include <math.h> should be at the top of this listing to support
          the calls to sqrt().

    p. 135 - Listing 7.4
          The parameter list to PlacePins() should be changed so that the
          first parameter reads "xseparation", rather than "separation". 
          Of course the following RtFloat declaration should also be updated.

  Chapter 8
    p. 154 - Listing 8.4
          The function min() does not exist in the math library, but can
          be #defined with:

          #define min(a,b) ((a)<(b)?(a):(b))

          The fov parameter in RiProjection() should be in degrees,
          not radians.  This can be done with the following change:

            fov = 2 * atan((min(framewidth,frameheight)*.5)/focallength);

          should read

            fov = 2 * atan((min(framewidth,frameheight)*.5)/focallength)
                *180.0/3.14159;

    p. 168 - Listing 8.5
          The call to RiProjection() should not be done; it is being
          done in the call to FrameCamera().

          Casting PICXRES and PICYRES to RtInt in the #define section
          causes parameter passing problems when calling FrameCamera().
            To fix this, change the call to FrameCamera() to read:

            FrameCamera((float)PICXRES*CAMZOOM, (float)PICXRES,
                  (float)PICYRES);

  Chapter 10
    p. 205 - Listing 10.3
          In addition to <ri.h>, <math.h> and <stdio.h> should be
          #included.

          There is no presentation of RiProcedural() in this example.
          The following code should be inserted between the typedef
          of FractalTriangle and the #definition of MOVEPT.


/* ================================================================ */

Go()


/* ================================================================ */


          The call to RiProcedural() in TriangleSplit() is missing a
          semicolon (;) at the end of the line.  Also, "data" should be
          of type "RtPointer", not "char *".  Actually, this doesn't
          matter much, because TriangleSplit() needs to be fixed, as
          noted below.

          FractalDiv() does not correctly split a triangle and render its
          children; FractalDiv() and TriangleSplit() should be modified
          to read as follows:


/* ================================================================ */

#define MAXLEVELS 5
/*
 * FractalDiv(): RenderMan refinement procedure for subdividing a fractal
 *    triangle.
 */
FractalDiv( data, levelofdetail )
RtPointer data;              
RtFloat levelofdetail;
else
    }
}

TriangleSplit( pFT )
FractalTriangle *pFT;

    for( childnum = 0; childnum < 3; childnum++ )
    for( childnum = 0; childnum < 3; childnum++ )
}

/* ================================================================ */

          A FractalFree() function is not provided in the RenderMan
          Companion.  Append the following code to Listing 10.3.


/* ================================================================ */

FractalFree( data )
RtPointer data;


FreeChildren( pFTChildren )
FractalTriangle *pFTChildren;

}

/* ================================================================ */


  Chapter 11
    p. 216 - RiMatte() has a boolean flag which enables/disables
          (RI_TRUE/RI_FALSE) the matte attribute.
          RiMatte(onoff)
            RtBoolean onoff;

    p. 222 - "It (Fconeangle) decays from 1 in the spotlight direction
          (to-from) to 0 coneangle radians away, and so is nonzero only
          inside a cone 2*coneangle degrees wide".  According to the
          RMIS, p. 25, coneangle is in radians, thus this passage should
          read "... 2*coneangle radians wide".

    p. 228 - Listing 11.2
          The order of the frames goes 3, 1, 2, 4.  It seems reasonable to
          change this to 1, 2, 3, 4.

  Chapter 12
    p. 253 - Listing 12.1
          The order of the points in textcoords[] does not agree with
          corners[].  The line:

            textcoords[] = , , , };

          should read:

            textcoords[] = , , , };

    p. 254 - Listing 12.2
          In addition to <ri.h>, <math.h> should be #included because of
          the call to sqrt().

          In MapSurfOR(), "npts" is an input parameter, but is later
          referred to as "npoints"; the same thing happens with "pts" and
          "points".  The declaration should be changed to:

            MapSurfOR(points, npoints)
            Point2D points;
            int npoints;

          Also, MAXNPOINTS is not defined.  NPOINTS can be used instead.

          In TextSurfOR(), "tmap" is used as an interface variable, but
          it is not declared.  The call to RiSurface() must be prefaced
          by the RiDeclare() call:

            RtToken RI_TMAP;
            ...
            RI_TMAP = RiDeclare("tmap", "uniform string");
            RiSurface("mytexture", RT_TMAP, (RtPointer)&tmap, RI_NULL);

    p. 270 - Listing 12.5
          A new RiDisplay() call must be made inside frame 2, to change to
          rgba rendering rather than z rendering.  The new call to
          RiDisplay() in frame 2 should be:

            RiFrameBegin(2);
                RiDisplay("ri.pic", RI_FILE, RI_RGBA, RI_NULL);

          "shadowfile" is not declared as an interface variable.  The
          following line should appear next to the char declaration at
          the top of the listing:

            RtToken  RI_SHADOWFILE;

          and the call to "RiLightsource" should have "source" capitalized
          and be preceded by RiDeclare():

            RI_SHADOWFILE = RiDeclare("shadowfile", "uniform string");
            RiLightSource("shadowspot", RI_SHADOWSPOT,
                (RtPointer)&shadowfile, RI_NULL);

  Chapter 13
    p. 282 - Listing 13.1

              An alternate "clouds" shader is presented than that in
          The RenderMan Companion.  The book's listing results in a
          dark image because the sum of the noise rarely exceeds 0.1.
          Although lighting can be used here, a more effective looking
          shader ignores the lights and scales the sum somewhat.  The
          color computation used is:

          1. Substitute line 9, the declaration of "refl", with the
             declaration of white:

            color white = color(1.0, 1.0, 1.0);

          2. Delete line 17, the assignment of "refl".

          3. Replace line 18, the assignment of "Ci" with:

              Ci = mix(Cs, white, sum*4.0);

          Notice that there is a numbering error in the book; 19 is applied
          to two lines in the listing.

  Chapter 14
    p. 298 - Table 14.4
          Logical AND is presented as "&".  It should be "&&", as
          presented on RMIS p. 94.

  Chapter 15
    p. 312 - Table 15.1
          The "Returns" colums for step() and smoothstep() is incorrect.
          They should both say:
            0 if val < min; 1 if val => max
                                  ^^^

  Chapter 16
    p. 335 - Listing 16.2:
          The normal, N, must be normalized in its use for light components.

            point Nf = faceforward(N, I);

          should read

            point Nf = faceforward( normalize(N), I);

    p. 336 - Listing 16.3:
          The normal must be normalized, as in Listing 16.2 above.  Also,
          the vector "-I" in the specular() call should be normalized.
          This is commonly done by adding the following line just after
          the declaration of Nf:

            point V = normalize(-I);

          Then use V in the specular() call instead of -I.

    p. 337 - Listing 16.4:
          The normal (N) and incident (I) vectors must be normalized,
          as in Listing 16.3 above.

    p. 338 - Listing 16.6:
          To mimic the standard shader, the default position should be in
          camera space.  Also, the shader parameter list has a semicolon (;)
          instead of a comma (,).

            point from   = point(0,0,0);  /* light position */
                  to     = point(0,0,1))

          should read

            point from   = point "camera" (0,0,0),  /* light position */
                  to     = point "camera" (0,0,1))
   
    p. 339 - Listing 16.7:
          To mimic the standard shader, the default position should be in
          camera space.  Also, the shader parameter list has an extra
          semicolon (;).

            point from   = point(0,0,0));  /* light position */

          should read

            point from   = point "camera" (0,0,0))   /* light position */

    p. 340 - Listing 16.8:
          To mimic the standard shader, the default position should be in
          camera space.

            point from   = point(0,0,0),  /* light position */
                  to     = point(0,0,1);  /* light direction */

          should read

            point from   = point "camera" (0,0,0),  /* light position */
                  to     = point "camera" (0,0,1);  /* light direction */

          The coneangle and conedeltaangle declarations have semicolons
          where there should be commas.

            float coneangle         = radians(30);
                  conedeltaangle    = radians(5);

          should read
   
            float coneangle         = radians(30),
                  conedeltaangle    = radians(5),

    p. 345 - Listing 16.12:
          The comment above the code says the shader is checker(), but
          it is declared as checks().  checker() seems more appropriate.
          N should be normalized inside the faceforward call.

            Kd*diffuse(faceforward(N,I)));

          should read

            Kd*diffuse(faceforward(normalize(N),I)));

    p. 349 - Listing 16.14:
          The normal (N) and incident (I) vectors must be normalized,
          as in Listing 16.3 above.

    p. 351 - Listing 16.15:
          This texture tends to alias near the quick jump from darkwood
          back to lightwood.  To fix this, change the 0.86 argument in the
          smoothstep() function should be changed to 1.0.  Also, the "* (1 -"
          stuff is not necessary.

            r = smoothstep(0, 0.8, r) - smoothstep(0.83, 1.0, r);

    p. 353 - Listing 16.17:
          The normal (N) and incident (I) vectors must be normalized,
          as in Listing 16.3 above.
   
    p. 354 - Listing 16.18:
          The normal (N) and incident (I) vectors must be normalized,
          as in Listing 16.3 above.
   
    p. 355 - Listing 16.19:
          The normal (N) and incident (I) vectors must be normalized,
          as in Listing 16.3 above.

    p. 357 - Listing 16.20:
          The normal, N, must be normalized in its use for light components.

            point Nf = faceforward(N, I);

          should read

            point Nf = faceforward( normalize(N), I);

    p. 363 - Listing 16.22:
          The "I" and "N" vectors must be normalized, as shown below:

            point II = normalize(I);
            point NN = normalize(N);

            diffuse = II.NN / (II.II * NN.NN);

    p. 365 - Listing 16.23:
          The last line in this shader, the assignment of N, should not
          be in the "if" block.
    
                  P = center + radius*normalize(P-center);
                  N = calculatenormal(P);
                }   
            }   

          should read

                  P = center + radius*normalize(P-center);
                }   
                N = calculatenormal(P);
            }   

    p. 373 - Listing 16.28:
          "spread" should be a uniform float, not a uniform point.

    p. 376 - Listing 16.31:
          There are some syntax errors in the parameter list. The semicolons
          after each of the float values (Ka, Kd, etc.) should be commas, as
          shown below:

            float   Ka              = .5,
                  Kd              = .5,
                  Ks              = .8,
                  roughness       = .1,
                  spin            =  0;

          In the assignment of Nf, N must be normalized.  It's also helpful
          to assign V = normalize(-I), for use in the specular call.
         
          The formulas for the red crown should use "u" instead of "v":

            else     

          All the texture names should be consistent in using the extension
          "txt", not "tx".  Thus "coated.tx" should be "coated.txt",
          "circle.tx" should be "circle.txt", and "b.tx" should be "b.txt".

          The formulas for the dirt and gouge texture are wrong.  Replace

            strength = 1 - float texture(texturename, t+spin, y);

          with the following:

            strength = 1 - float texture(texturename, s+spin, y/15.0);

          The specular() call at the end of the shader should use "V"
          instead of "-I" in its parameter list.

    p. 379 - Listing 16.32:
          The formulas for accessing the texture are wrong.  Replace

            P += (-Km * texture(texturename, t+spin, y))*normalize(N);

          with the following:

            P += (-Km * texture(texturename, s+spin, y/15.0))*normalize(N);

    p. 380 - Listing 16.33:
          Semicolon (;) should be a comma (,) in the declaration of
          coneangle, ie:

            float coneangle   = radians(30),
                         
          Declaration of string shadowname should be string shadowfile, as
          should the call inside the shadow() function.  Also, shadow()
          returns 1.0 for 100% shadow, so its inverse is needed.  The lines
          should read:

            string shadowfile = "";)
            ...
            attenuation *= (1.0 - shadow( shadowfile, Ps));

    p. 383 - Listing 16.36:
          There is a syntax error in the declaration of Km at the top of
          the shader.  The comma at the end of the line should be a
          semicolon.

    p. 384 - Listing 16.37:
          The normal (N) and incident (I) vectors must be normalized,
          as in Listing 16.3 above.

    p. 384 - Listing 16.38:
          The normal must be normalized, as in Listing 16.2 above.

Appendix D

    p. 412 - RiMatte() has a boolean flag.
          RiMatte(onoff)
            RtBoolean onoff;
 




Document Info


Accesari: 1504
Apreciat: hand-up

Comenteaza documentul:

Nu esti inregistrat
Trebuie sa fii utilizator inregistrat pentru a putea comenta


Creaza cont nou

A fost util?

Daca documentul a fost util si crezi ca merita
sa adaugi un link catre el la tine in site


in pagina web a site-ului tau.




eCoduri.com - coduri postale, contabile, CAEN sau bancare

Politica de confidentialitate | Termenii si conditii de utilizare




Copyright © Contact (SCRIGROUP Int. 2024 )