🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.software
Article #1253

Re: Photorealistic RenderMan documentation

#1253
From: Daryll J. Strauss
Date: Sat, 03 Oct 1992 18:59
139 lines
6156 bytes
In article <1992Oct3.160630.14608@athena.mit.edu> shanega@athena.mit.edu (Shane G. Artis) writes:
>Hi,
>
>I'm looking for documentation on the RenderMan shading language and
>the format of .RIB files that are passed to RenderMan for display.
>The version of RenderMan supplied with the NeXT comes with a bunch of
>shaders and textures, but no documentation on them (I can get simple
>ones to work, but can't pass parameters to them succesfully even when I
>can figure out what the parameters are, so texture mapping and such
>are out).  In addition, though I can determine that .RIB files are
>quite similar to the RenderMan language itself (documented in The
>RenderMan Companion which I already have), there is no document
>describing its syntax explicitly.  Same is actually true for the
>shading language which is well documented but lacks information such
>as the exact output of functions like noise().  Anyway, I'm seeking
>any documents on RenderMan, whether for the NeXT or for any other
>platform that might be similar in its implementation.  Is there a
>repository of documents on-line anywhere, or that can be purchased?
>Does a newsgroup exist that is more or less dedicated to RenderMan?
>Any help would be appreciated greatly.  

First, I have to suggest that if you are serious about working with
RenderMan that you buy The RenderMan Interface version 3.1 specification
from Pixar's "RenderMan Sales Department" at (510) 258-8100 [I believe
that's the correct number, but I don't have any recent literature handy
at the moment. The whole concept of Pixar having a "RenderMan Sales
Department" is rather amusing, because they are a small informal
company. Mentioning that will get you to someone who can sell you the
documentation anyway.] It should cost you about $25. It will give
you a complete description of RIB format and the shader language.

The shaders you get in compiled form are a little tougher to deal with.
Whoever provides the shaders really should provide the documentation, in
our case NeXT. Many of the shaders from NeXT are considered standard
shaders and are defined (source code included) in the RenderMan specs.
A few of them aren't. In that case you have to guess what the args mean,
but the following piece of code will tell you their names, types, and
default values.

Use this code as you want. Please don't take credit for it as your own.
If you make a million dollars with it, consider sending a few my way. ;-)

Daryll Strauss          			     f	The Aerospace Corp.
strauss@aero.org		      		     n	Mail Stop: M1-102
...!uunet!aero.org!strauss			     o	P.O. Box 92957
NeXTMail: daryll@harlot.rb.ca.us                     r  Los Angeles, Ca. 90009
"It's my reality and I'll warp it if I want to!"     d	(213) 336-9358

----------------

/*
    File: dumpshader.m
    
    This code will dump the parameters for a given shader to standard out.
    It demonstrates how to read the arguments from an NXShader object.
    To compile the code: cc -o dumpshader dumpshader.m -lMedia_S -lNeXT_s
    To run the program pass the name of a shader as the only argument to
    dumpshader.
    
    (C) 1992 Daryll Strauss  -- Oct. 4, 1992
    
    You may use any part of this code as you see fit as long as this
    comment is included in human readable form with any copy of the
    source or binary.  
*/

#import <stdio.h>
#import <3Dkit/N3DShader.h>

char *Slo_TypeToStr(SLO_TYPE type)
{
    switch (type) {
    case SLO_TYPE_POINT: return("point");
    case SLO_TYPE_COLOR: return("color");
    case SLO_TYPE_SCALAR: return("float");
    case SLO_TYPE_STRING: return("string");
    case SLO_TYPE_SURFACE: return("surface");
    case SLO_TYPE_LIGHT: return("light");
    case SLO_TYPE_DISPLACEMENT: return("displacement");
    case SLO_TYPE_VOLUME: return("volume");
    case SLO_TYPE_TRANSFORMATION: return("transformation");
    case SLO_TYPE_IMAGER: return("imager");
    default: {
        fprintf(stderr, "Unknown shader type %d\n", type);
        return("UNKOWN");
    }
    }
}

int main(int argc, char *argv[])
{
    N3DShader *shader;
    SLO_TYPE type;
    char *argname;
    char *sval;
    float fval;
    NXColor cval;
    RtPoint pval;
    int i;
    
    if (argc!=2) {
        fprintf(stderr, "Usage: %s shader\n");
        return(1);
    }
    shader=[[N3DShader alloc] initWithShader:argv[1]];
    if (!(type=[shader shaderType])) {
        fprintf(stderr, "%s is not a legal shader\n", argv[1]);
        return(1);
    }
    printf("%s %s(\n", Slo_TypeToStr(type), argv[1]);
    for (i=0; i<[shader shaderArgCount]; i++) {
        argname=(char*)[shader shaderArgNameAt:i];
        type=[shader shaderArgType:argname];
        printf("\t%s %s = ", Slo_TypeToStr(type), argname);
        switch (type) {
        case SLO_TYPE_POINT:
            [shader getShaderArg:argname pointValue:&pval];
            printf("(%f,%f,%f);\n", pval[0], pval[1], pval[2]);
            break;
        case SLO_TYPE_COLOR:
            [shader getShaderArg:argname colorValue:&cval];
            printf("[%f,%f,%f];\n", NXRedComponent(cval),
                NXGreenComponent(cval), NXBlueComponent(cval));
            break;
        case SLO_TYPE_SCALAR:
            [shader getShaderArg:argname floatValue:&fval];
            printf("%f;\n", fval);
            break;
        case SLO_TYPE_STRING:
            [shader getShaderArg:argname stringValue:&sval];
            printf("%s;\n", sval);
            break;
        default:
            printf("Unknown argument type???\n");
        }
    }
    printf(");\n");
    return(0);
}
Technical Details
Message-ID: <1akqj2INNpdt@news.aero.org>
Path: arc1-ca.pugleaf.net!sparky!uunet!snorkelwacker.mit.edu!tamsun.tamu.edu!cs.utexas.edu!usc!news.aero.org!strauss
References: <1992Oct3.160630.14608@athena.mit.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!snorkelwacker.mit.edu!tamsun.tamu.edu!cs.utexas.edu!usc!news.aero.org!strauss
From: strauss@aero.org (Daryll J. Strauss)
Newsgroups: comp.sys.next.software
Subject: Re: Photorealistic RenderMan documentation
Date: 3 Oct 1992 18:59:46 GMT
Organization: The Aerospace Corporation
Lines: 141
Message-ID: <1akqj2INNpdt@news.aero.org>
References: <1992Oct3.160630.14608@athena.mit.edu>
NNTP-Posting-Host: altair.aero.org