PDA

View Full Version : Renderman bake3D shader


Blot12345
10-21-2009, 04:28 AM
Hi everyone,

I just started getting into renderman shader writing. I am trying to figure out how the bake3d function works. I used the shader below to try to bake out a .ptc file, however I don't think the ptc file is being baked correctly. I only get black images when I use the ptrender utility, and no data shows up when I open the .ptc file in 3Delight's ptcviewer utility. Is there any easy way to verify the contents of a ptc file? Can anyone see an error in the shader below? (I am using Renderman for Maya 3.0.1 in Maya 2009)

Edit: I think my problem may have to do with assigning "DisplayChannels" in maya. I know in an RIB file the syntax is: DisplayChannel(channel name). Is there a maya equivalant?

Any help would be greatly appreciated.

surface
bake_radiance_t(string filename = ""; color Kdt = 1)
{
color irrad, rad_t;
normal Nn = normalize(N);
float a = area(P,"dicing"); //micropolygon area

/* Compute direct illumination (A and D) */
irrad = ambient() + diffuse(Nn);

/* Compute the radiance diffusely transmitted through the surface, Kdt is the surface color */
rad_t = Kdt * irrad;

/*Store in ptc file */
bake3d(filename, "_area,_radiance_t", P, Nn, "interpolate", 1, "_area", a,"_radiance_t",rad_t);


Ci = rad_t *Cs *Os;
Oi = Os;
}


Thanks,
-Alex

ndeboar
10-21-2009, 09:47 AM
Try adding your display channels in the RiAttributes (in your render globals)

RiDisplayChannel "variabletype(eg float,color) channelname";

The escape courseware has loads of good tips of this if you have access to it

Blot12345
10-21-2009, 02:43 PM
Thanks!
I had read about using RiAttributes in another tutorial, but I couldn't find where it was in the render globals. However I found it now, I am excited to try this out after work!

I have looked into the courseware and it looks like an amazing place for renderman knowledge. I wish I knew about it when I was a student so I could have picked it up with the student discount.

Blot12345
10-22-2009, 06:15 AM
After a bit of fiddling I got SSS to work. I've attached an image to show my progress. So to get this far I made a shader that baked out a point cloud file, used "ptfilter" on the point cloud file. then used the filtered file in a shader to render the image below.

Now that I've got this far, I have a few more questions:



I understand what happens when the lighting gets baked into a ptc file. However I'm not sure what happens when I use the ptfilter utility. For example, if I run "ptfilter -filter ssdiffusion input.ptc output.ptc" what happens inside the ptc file? Does it diffuse the lighting in 3D, or does it just diffuse the light along the object surface?


I've been using this website (http://sfdm.ca.scad.edu/faculty/mkesson/vsfx755/wip/best/spring2007/sungman_pyun/final/final.html) as a guide for setting this up. That website appears to go a step further and create a brickmap to use in the shader. Is this necessay? What are the advantages to using a brickmap over a point cloud file?
I know there are a lot of questions here, and I'd appreciate any help I can get. Until I can save up enough money to get the pixar courseware I am having a hard time finding good information.


Thanks again for any help! I'll keep posting my progress here, hopefully I can drum up a little interest in Renderman talk on these forums.

ndeboar
10-22-2009, 09:36 AM
Do you have access to the rps documentation? It'll answer loads of this for you.

what happens when I use the ptfilter utility

It calculates subsurface scattering.

What are the advantages to using a brickmap over a point cloud file?

They are more effiecent to render (pretty sure that's the only reason?)

burgess3D
10-27-2009, 09:55 PM
I understand what happens when the lighting gets baked into a ptc file. However I'm not sure what happens when I use the ptfilter utility. For example, if I run "ptfilter -filter ssdiffusion input.ptc output.ptc" what happens inside the ptc file? Does it diffuse the lighting in 3D, or does it just diffuse the light along the object surface?


I've been using this website (http://sfdm.ca.scad.edu/faculty/mkesson/vsfx755/wip/best/spring2007/sungman_pyun/final/final.html) as a guide for setting this up. That website appears to go a step further and create a brickmap to use in the shader. Is this necessay? What are the advantages to using a brickmap over a point cloud file?


As ndeboar said the ptfilter utility takes your radiance data combined with the scattering properties, e.g. albedo and diffuse mean free path and calculates subsurface scattering for each point

Brickmaps are like mip mapped point clouds so you get the benefits of level of detail. The improvements I see when using them are much faster render times

CGTalk Moderation
10-27-2009, 09:55 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.