From: strauss@Aero.org (Daryll Strauss)
Subject: Re: Renderman surface mapping problem
Organization: The Aerospace Corporation
Date: Thu, 30 Jul 1992 19:39:23 GMT

In article <1992Jul30.084334.9893@reed.edu>, lydgate@reed.edu (Chris Lydgate) writes:
|>... 
|> Basically, I'm wondering:
|> 
|> 1) How do I map a texture file onto a surface using the 3DKit?

First off, realize that QuickRenderMan only understands a few simple
shaders. Any of this fancy stuff will only be visible if you render the
picture. With that said:

I don't know what all the shaders are on the NeXT. I assume that NeXT
will provide the interface to all the shaders in the finally release
(although source to them would be great guys!!!) I do know one
particular shader from another RenderMan implementation, which should get
you started. Try using paintedplastic. Here's the interface:

surface
paintedplastic(float Ks=.5, Kd=.5, Ka=1, roughness=.1, color specularcolor=1,
        string texturename = "";)

Ks is the specular reflection.
Kd is the diffuse reflection.
Ka is the ambient reflection.
roughness is a measure of the roughness of the surface (for reflections)
specularcolor is the color of the specular reflection
texturename is the name of the texture map.

So create a shader with the right parameters and apply it to an object
and it should work. This should be enough to let you take a plastic
object and apply a texture. Assuming you already have a texture.

|> 2) If there's no standard shader for doing this, how could I write
|> one?

No need. I think there are other types of texture mapping shaders in
there, but I don't know anything about them.

|> 3) How can I create a texture file from, say, a TIFF file?  (I know
|> about RiMakeTexture(), but the documentation is vague about file 
|> formats.)

You are right on both counts; RiMakeTexture is the right way and they are
vague on the formats. Pixar was trying to make the specification
independent of the hardware it is running on, so they didn't say "make
a file in this format" they just assumed you had an appropriate format.
TIFF had better be an appropriate format on the NeXT.

What you do in normal RenderMan is first create a texture file from your
standard file. This is done by rendering a simple RenderMan file with
this one line:

MakeTexture "original.tiff" "result.tx" "periodic" "periodic" "box" 1 1 

What this says is that I'm taking my TIFF file original.tiff and
converting it to a texture file called result.tx, I want the texture
to be periodic (repeating both vertically and horizontally) The
resulting texture should be smoothed with a 1 by 1 box filter. In other
words, no smoothing.

I think all the Ri Functions really do is make a text rib file, they
don't do any real rendering. So if you put this at the beginning of your
object structure, you'll recreate the texture file each time your render
the object which is kind of dumb. I don't know if your application can
check to see if "whatever.tx" already exists and if not, force a
rendering like the one line shown above. Otherwise, you might just want
to create the texture by hand once and not worry about it later.

Hope this helps, and feel free to send questions. I'll see what I can answer.

							- |Daryll