🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.next.programmer
2 messages
2 total messages Started by Chris Lydgate Thu, 30 Jul 1992 08:43
Renderman surface mapping problem
#341
Author: Chris Lydgate
Date: Thu, 30 Jul 1992 08:43
37 lines
1604 bytes
Help!

I've been soundly defeated in my effort to do surface mapping in the
3DKit.  The Renderman Companion (TRC) says this is done by using a
surface shader. But the shaders in /NextLibrary/Shaders which look
like candidates, ie "texmap.slo", I can't get them to work.

In general, I can successfully tell an N3DShader to read a .slo file,  
set its instance variables, and then associate that shader with an  
N3DShape.  For many shaders, this works perfectly.

The "texmap.slo" shader has a "texturemap" i-var, which (I guess) is  
supposed to be set to a texture file.  However, setting this i-var  
never seems to 
/NextLibrary/Textures..

TRC (p 253) lists a fragment for doing what I want (mapping an 
image file onto a surface) but it makes use of an imaginary shader 
called "mytexture".  It says that such shaders 
are easy to write, but  does not say how.  

Basically, I'm wondering:

1) How do I map a texture file onto a surface using the 3DKit?

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

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.)

Thanks in advance,

Chris Lydgate
chris@insight.com
Re: Renderman surface mapping problem
#362
Author: Daryll Strauss
Date: Thu, 30 Jul 1992 19:39
70 lines
3558 bytes
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads