RenderMan & RISpec >> help-more shaders on the same object

by Manuel » Tue, 01 Nov 2005 20:00:35 GMT

Hi,
english is not my navite language, so please, excuse me for
grammatical errors and poor phrases.

I'm working on a opensource sw that make 3d humans, and export them in
various formats. The rendering is done by AQSIS or PIXIE (or other
renderman compliant).

These are some (old)
screenshot of next version we are developing (not out yet):

http://www.dedalo-3d.com/index.php?filename=SXCOL/makehuman/screenshots.php

I've tried some experiments with renderman engines modifying the famous
Pharr skin shader:

http://www.dedalo-3d.com/index.php?filename=SXCOL/docs/archive/05-05-15_ss_scattering_renderman.html

As you seen in the last image in the page above, when I use the shader,
it, of course, is applyed on all mesh, so the model has skin eyelashes,
skin eyes, skin teeth, skin nails, skin tongue etc...

A way to fix this is export the mesh as differents pieces, and assign a
different shader to each piece. But I think this is a brutal way, and
probably renderman language has a better method to assign different
shaders to same object.

The same problem is, in example, to use UVmaps. I like to use two
different resolutions, in istance 2000 x 2000 px for face texture and
2000 x 2000 px texture for the rest of body.
In this case I must split the original mesh in two parts too? Surely
there is a better way that I don't know...

Besides, splitting the mesh in two parts, and applying the subsurface, I
think will be some problems in joint zones...

Again, sorry for my poor english.

thanks,

Manuel



RenderMan & RISpec >> help-more shaders on the same object

by Paul Gregory » Thu, 10 Nov 2005 00:12:45 GMT


Manuel,

There is no way to assign multiple surface shaders to a single
primitive in RenderMan.

You have two ways of doing this, firstly, you can do as you suggest and
split the mesh into multiple meshes.

The alternative involves using custom "primitive variables". You can
assign custom values to a primitive and the shader can query them. So
you could attach a new "primitive variable" to the mesh, make it
"uniform" which means each face will have a value, then for each face,
assign an id. In the shader, you would check the id value and shade
accordingly, i.e. one id for eyebrows, one for skin, one for nails etc.


A simple example...

--------------------------------
RIB:

version 3.03

Display "test.tif" "file" "rgba"
Format 200 150 1
Projection "perspective" "fov" 50
Translate 0 0 5

WorldBegin
AttributeBegin
Surface "skin"
PointsPolygons [3 3] [0 1 2 0 2 3]
"P" [
0 0 0
0 2 0
1 2 0
1 0 0
]
"uniform float skinID" [
1
2
]
AttributeEnd
WorldEnd

--------------------------------
SL:

surface skin (uniform float skinID=0)
{
printf("%f\n", skinID);
if(skinID == 1)
{
// Do skin
}
else if(skinID == 2)
{
// Do eyebrows
}
}

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


Hope this helps. (Note: I've only tried this with Aqsis)

Paul Gregory

Similar Threads

1. clarification of specification on shader objects and program objects

The OpenGL 2.0 specification (glspec20.pdf) has section 2.15 Vertex Shaders. 
The third paragraph contains the statement:  "One or more vertex shader 
objects are then attached to a program object."  I interpret this to mean 
that you are allowed to attach two vertex shader objects to the same program 
object.  At the end of the third paragraph:  "... the executable code for 
the vertex shaders it contains is used to process the vertices."  This also 
implies you can have two vertex shader objects attached to the same program 
object.

At the end of section 2.15:  "When the program object currently in use 
includes a vertex shader, *its vertex shader* is considered active and used 
to process vertices."  The *...* emphasis is mine.  This sentence makes it 
appear as if the program object can have at most one vertex shader object 
attached.

Section 2.15.2 Program Objects has:  "Multiple shader objects of the same 
type may be attached to a single program..."
which once again implies you can have two vertex shaders attached to a 
program object.

Section 2.15.4 Shader Execution has:  "If a successfully linked program 
object that contains a vertex shader is made current by calling useProgram, 
*the* executable version of the vertex shader is used... ."  The *...* 
emphasis is mine.   This statement appears also to imply that at most one 
vertex shader can be attached to a program object.

I must be missing something when reading the specifications.  Are two vertex 
shaders really allowed to be attached to the same program.  And if so, how 
do I select *which* vertex shader it uses?


2. HELP: How to convert a Region object to a GraphicsPath object - .Net Framework

3. Distinguish objects in the shader

Hello people,
I was wandering if it's possible to distinguish objects from a shader.
I would like to be able to obtain this behavior from it:

If (the object has this tag/flag/ID) 
   {
   do this
   }
else 
   {
   do this
   }

I looked in to object ID but It seems they only work to separate the
scene in multiple images.
Thank you in advance and happy holiday!
Boris

4. Multiple surface Shaders on a single object?? - RenderMan & RISpec

5. Multiple surface Shaders on a single object???

Luis M, Morales S. wrote:
> how do i apply multiple shaders to a single object in maya using
> Rat?

Use a 'Layer' node in SLIM with two Surface Appearances.

.mm

6. Object disappears when rendered with any shader! - RenderMan & RISpec

7. two different shaders in the same geometry object??

It is possible to create a sphere with one half "metal shader" and the
other half with "matte shader"?

8. Proffesional help with a Cg shader