PDA

View Full Version : MentalRay Threads Shader


lumiere
03-12-2005, 01:09 PM
Hello, I need to convert a shader from RenderMan to MentalRay.
The shader is "Threads", I put here the RenderMan code. Please can anyone help me? I'm not a programmer.

Thanks in advance to all
Enrico



/* Copyrighted Pixar 1989 */
/* From the RenderMan Companion p.367 */
/* Listing 16.24 Displacement shader providing light-bulb threads to cylinder */

/*
* threads(): wrap threads around a cylinder
*/
displacement
threads (
float Km = .1,
frequency = 5.0,
phase = .0,
offset = .0,
dampzone = .05 )
{
float magnitude;

/* Calculate the undamped displacement */
magnitude = (sin( PI*2*(t*frequency + s + phase))+offset) * Km;

/* Damp the displacement to 0 at each end */
if( t > (1-dampzone))
magnitude *= (1.0-t) / dampzone;
else if( t < dampzone )
magnitude *= t / dampzone;

/* Do the displacement */
P += normalize(N) * magnitude;
N = calculatenormal(P);
}

SenDep7
03-13-2005, 01:53 PM
you could prolly do this yourself with a basic maya/MR shade tree. Create a ramp with alternating black and white stripes, and connect it to the displacement channel of your shader and use a cylindrical mapping.

Thats all that fancy Shader Language code is doing anyways.

CGTalk Moderation
03-13-2005, 01:53 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.