RSL book example bad illum loop?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  03 March 2012
RSL book example bad illum loop?

Im on page 240 of Rudy Cortes' book The Renderman Shading Language Guide. The rest of the book has been really informative and every example has worked. However, I've been struggling with this one for the past week. And unfortunately, it doesnt work and the rest of the chapter seems to build on it. Im using 3delight studio pro 10.

I'm using an ambient light with a hdr hooked along with a provided teapot and the surface shader that the books specifies. The book also claims that you can use the parameter __nonspec to control the specularity from the light on the teapot surface shader. If I use another surface shader it works (but the nonspec doesnt work because i've been told that you need to make a custom illum loop)

Unfortunately, I just get a flat shaded image. Just reading the code I dont see any reference to diffuse like in the shaders before. However, they build on this shader a lot and the same exact code is given in the download section for the book.

If I cant get this to work within the next day Im going to probably switch books until I figure out more about illuminance loops and then switch back. I'm concerned with WHY this isnt working at all, if its a renderman versus 3delight thing?, and if it is broken, why does it appear in print and download and why do they build on it?

What I'm getting vs what I should be getting.


Option "searchpath" "shader"  "@:E:/Cutter/compiled stuff/shaders"
Option "searchpath" "texture" "@:E:/Cutter/compiled stuff/textures"
Option "searchpath" "archive" "@E:/Cutter/compiled stuff/archives"
Display "../images/chapter8/l_RP_enhambientlight2.tif" "framebuffer" "rgb"
Format 500 500 1
PixelSamples 3 3
Clipping 0.001 1000
Projection "perspective" "fov" 30
Translate -1 0 30
Rotate -22 1 0 0
Rotate 19 0 1 0
Translate 0 -3 0

# Rotate the current space to affect the environment map
Rotate -90 1 0 0
LightSource "l_RP_enhambientlight" 2 "float intensity" [.08] "string ambientMap" ["campus_probe.tdl"]
"float ambientMapBlur" [0.1] "float ambientMapFilterWidth" [1]
LightSource "distantlight" 1 "intensity" [1]

## Begin teapot object
Attribute "displacementbound" "float sphere" [0.15]
Displacement "d_simplenoise" "float noiFreq" [15] "float Km" [0.0075]
#Surface "s_plastic3dl"
Surface "s_RP_ambient"
ReadArchive "teapotArch.rib"

Surface shader

 #include "RP_illumloops.h"

surface s_RP_ambient(
					 float Ka = 1;
					 color surfaceColor = 0.75;
					 output varying float Cocc = 1;
  /*Variables */

  normal NN = normalize(N);

  Ci = rpAmbient(NN, P, Cocc) * surfaceColor;


The illumination loop header

color rpAmbient(varying normal NN; 
				varying point P;
				output varying float Cocc;
  /* Variables */
  color Cout = 0;
  Cocc = 1;

  illuminance("ambient", P){
	Cocc = 1 - Cocc;
	Cout += Cl;
  return Cout;

Light Shader

light l_enhancedAmbient(
	uniform float intensity = 1;
	uniform color lightcolor = 1;
	string ambientMap = "";
	string envSpace = "shader";
	uniform float ambientMapBlur = 0.1;
	uniform float ambientMapFilterWidth= 1;
	string ambientMapFilter = "gaussian";
	string __category = "ambient";
	float __nonspecular = 1;


normal Ns = normalize(N);
vector Nv;
color ambientMapColor = lightcolor;

illuminate (Ps + Ns) {
	Nv = vector (ntransform(envSpace, Ns));
	if (ambientMap !="")
		ambientMapColor = environment (ambientMap, Nv,
									"blur", ambientMapBlur,
									"filter", ambientMapFilter,
									"width", ambientMapFilterWidth);
Cl = intensity * lightcolor * ambientMapColor;

Last edited by bergj : 03 March 2012 at 01:25 AM.
  03 March 2012
The problem, basically, is that Pixar ignores their RenderMan spec, while 3Delight follows it. In PRMan, the predefined variable "N" is the same in both surface and light shaders. However, the RenderMan spec states that in a light source shader, "N" should return the shading normal of the emitting object (which is undefined except for area lights). 3Delight adds a predefined variable "Ns" to get the shading normal of the illuminated object.

So to fix your light shader, replace "Ns" with something else, and "N" with "Ns".
  03 March 2012
Ok thanks a lot.

I've started reading Advanced Renderman in addition to this book and thats filling in the gaps.

Last edited by bergj : 03 March 2012 at 05:38 PM.
  03 March 2012
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 04:21 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.