Pixar
Pixar Home Feature Films Short Films The Theater How We Do It Artist's Corner Renderman Company Info

News Whats RenderMan Products Purchase Support


The RenderMan Interface Specification
Version 3.1

APPENDIX A - STANDARD RENDERMAN INTERFACE SHADERS

In this section the required RenderMan Interface shaders are defined.


Null Shader

This shader does nothing and is intended to be a placeholder if no action is to be performed. There is a null shader for every class of shader.

Surface Shaders

Constant surface

	surface
	constant()
	{
		Oi = Os;
		Ci = Os * Cs;
	}

Matte surface

	surface
	matte(
		float Ka = 1;
		float Kd = 1;)
	{
		normal Nf = faceforward(N, I);
		Oi = Os;
		Ci = Os * Cs * (Ka*ambient() + Kd*diffuse(Nf));
	}

Metal surface

	surface
	metal(
		float Ka = 1;
		float Ks = 1;
		float roughness =.1;)
	{
		normal Nf = faceforward(N, I);

		Oi = Os;
		Ci = Os * Cs * (Ka*ambient()+Ks*specular(Nf, -I, roughness));
	}

Shiny metal surface

	surface
	shinymetal(
		float Ka = 1;
		float Ks = 1;
		float Kr = 1;
		float roughness = .1;
		string texturename = ""; )
	{
		normal Nf = faceforward(N, I);
		point D;

		D = reflect(I, normalize(Nf));
		D = transform("world", point "world" (0, 0, 0) + D);

		Oi = Os;
		Ci = Os * Cs * (Ka*ambient() + Ks*specular(Nf, -I, roughness)
			+ Kr*color environment(texturename, D));
	}

If the Environment Mapping capability is not supported by a particular renderer implementation, the shinymetal surface shader operates identically to the metal shader.

Plastic surface

	surface
	plastic(
		float Ka = 1;
		float Kd =.5;
		float Ks =.5;
		float roughness =.1;
		color specularcolor = 1;)
	{
		normal Nf = faceforward(N, I);
		Oi = Os;
		Ci = Os * (Cs * (Ka*ambient() + Kd*diffuse(Nf)) +
			specularcolor * Ks*specular(Nf, -I, roughness) );
	}

Painted plastic surface

	surface
	paintedplastic(
		float Ka = 1;
		float Kd = .5;
		float Ks = .5;
		float roughness = .1;
		color specularcolor = 1;
		string texturename = "";)
	{
		normal Nf = faceforward(N, I);

		Oi = Os;
		Ci = Os * (Cs * color texture(texturename) *
			(Ka * ambient() + Kd * diffuse(Nf)) +
			specularcolor * Ks * specular(Nf, -I, roughness));
	}

If the Texture Mapping capability is not supported by a particular renderer implementation, the paintedplastic surface shader operates identically to the plastic shader.

Light Source Shaders

Ambient light source

	light
	ambientlight(
		float intensity = 1;
		color lightcolor = 1;)
	{
		Cl = intensity * lightcolor;
	}

Distant light source

	light
	distantlight(
		float intensity = 1;
		color lightcolor = 1;
		point from = point "shader" (0,0,0);
		point to   = point "shader" (0,0,1);
	{
		solar(to-from, 0.0)
			Cl = intensity * lightcolor;
	}

Point light source

	light
	pointlight(
		float intensity = 1;
		color lightcolor = 1;
		point from = point "shader" (0,0,0); )
	{
		illuminate(from)
			Cl = intensity * lightcolor / L.L;
	}

Spotlight source

	light
	spotlight(
		float intensity = 1;
		color lightcolor = 1;
		point from = point "shader" (0,0,0);
		point to = point "shader" (0,0,1);
		float coneangle = radians(30);
		float conedeltaangle = radians(5);
		float beamdistribution = 2;)
	{
		float atten, cosangle;
		uniform point A = (to - from)/length(to-from);
		illuminate(from, A, coneangle) {
			cosangle = L . A / length(L);
			atten =  pow(cosangle, beamdistribution) / L.L;
			atten *= smoothstep(cos(coneangle),
				cos(coneangle - conedeltaangle), cosangle);
			Cl = atten * intensity * lightcolor;
		}
	}

Volume Shaders

Depth cue shader

	volume

	depthcue(
		float mindistance = 0, maxdistance = 1;
		color background = 0;)
	{
		float d;
		d = clamp((depth(P) - mindistance) /
			(maxdistance - mindistance), 0.0, 1.0);

		Ci = mix(Ci, background, d);
		Oi = mix(Oi, color(1, 1, 1), d);
	}

Fog shader

	volume
	fog(float distance = 1; color background = 0;)
	{
		float d;
		d = 1 - exp(-length(I) / distance);
		Ci = mix(Ci, background, d);
		Oi = mix(Oi, color(1, 1, 1), d);
	}

Displacement Shaders

Bumpy shader

	displacement
	bumpy(
		float amplitude = 1;
		string texturename = "";)
	{
		N += bump(texturename, N, dPdu, dPdv) * amplitude;
	}

If the Bump Mapping capability is not supported by a particular renderer implementation, the bumpy surface shader is equivalent to a null displacement shader.

Transformation and Imager Shaders

There are no standard transformation or imager shaders required by the RenderMan Interface.

 


Terms of Use  |   Privacy Policy
TM & © 1986- Pixar. All Rights Reserved.