Uber Point Cloud Based Atmosphere Shader

UPDATE:10/19/2010
Added SSS to the PTC usage section
Glossy Reflections now composite on top, so you can control the reflectivity amount.
Should now work with all 3Delight materials AND mia materials.

UPDATE:11/2/2010
SSS fixed for the newest version
Numerous bug fixes

UPDATE:11/9/2010
Added directional occlusion, a tweak on occlusion that makes it kind of like a soft directional light
Fixed some hints on the Max Variation parameter
IBL may not have been working before
Samplebase isn’t a PTC option, oops

UPDATE:11/22/2010
Added the ability to rebake and reuse PTC data to save rendertime when multiple renders are needed

UPDATE:4/22/2011
Added a texture mapping ability to all the effects. The texture acts as a mask for the effect.

UPDATE:1/4/2012
Added SSS presets

NOTE: I’ve shrunk the code box for the two scripts. Instead of copying them, when you hover your mouse over them you should get a little box at the top right with icons. The far left icon will open the script itself in a new window. Use that to copy the script.

This is a shader I’ve been working on for a week or so at work. I’ve tested it in a few scenes and so far it’s all working correctly. This is a .sl shader for use with 3Delight, a RenderMan compliant renderer. Although, with some tweaking, it can work with any RenderMan compliant renderer. It’s been tested using 3Delight 9.0.69

What it is, is a shader which can do really anything you want it to with a point cloud (now referred to as PTC).

It’s an atmosphere shader that you can set as an override to encompass everything, or set on a per object basis.

Functionality:
• Baking PTC, whether just the points or points with shading information as well
• Ambient Occlusion
• Reflection Occlusion
• Glossy reflections
• Glossy refractions
• Image based lighting
• Global Illumination / Color Bleeding
• SSS
• Directional Occlusion

I have pragma annotations for just about everything. So, everything is grouped into categories. In each category of functionality, you have the values at your control for the effect. The values are given “nice” names and have tooltip descriptions of what the value does, and in some cases, the best and/or default value.

The shader includes AOVs for each pass. Each pass will render out the normal image with the effect you’ve chosen on top of it. You can also use AOVs to render out the image before the effects and the bare effect for compositing. The specific AOVs are documented inside of the shader, but I’ll also list them here.

1) aov_GI - The diffuse lighting and color bleeding from the GI pass
2) aov_AO - The occlusion part of either the OC pass or the occlusion from the GI pass
3) aov_RO - The reflection occlusion
4) aov_GRefl - The blurred reflections
5) aov_GRefr - The blurred refractions
6) aov_envcolor - The environment color from the GI pass if you're using it for lighting from a texture
7) aov_IBL - The lighting from the image in the IBL pass
8) aov_pre - The scene before the effects

PTC based effects are a two passed approach. First, you bake out the PTC, then you use the PTC. When baking, you need the two following attributes under PreWorldMEL:

RiAttribute -n "cull" -p "hidden" "integer" "0" -p "backfacing" "integer" "0";
RiAttribute -n "dice" -p "rasterorient" "integer" "0";

Also, under Advanced in the Render Pass settings of all the passes utilizing this shader, you must turn the AOVs to ALL AOVs and enable Standard Atmosphere Shader.

Because of the way the script works and the AOVs, each image you render contains a normal render and the effect. So, by rendering AO, you’re also rendering the image to composite AO on top of with it. This makes the rendertime hit seem MUCH less. Also, if you’re using GI and plan to use AO as well, it’s best to turn on the AO for GI. They’ll both be calulated at the same time and it will save a lot of rendertime. For instance:

Rendertimes
Normal: 120 seconds
Baking: 160 seconds
AO: 180 seconds
GI: 192 seconds
GI & AO: 247 seconds

The baking pass also included the normal image, so really it was +40 seconds.
The AO also included the normal image, so AO added 60 seconds. GI added 72 seconds.
Rendering those separately would give you two sets of normal images and GI and AO, at 372 seconds.
Rendering them together also gives you the normal image, thus adding 127 seconds on top of the normal render, saving you much more time.

I’ve tested this on Maya 8.5 and 2010, Mac and Windows.

Future ideas for added functionality:
• Subsurface Scattering
• Converting to a light shader so we can also use atmosphere effects
• Figuring out how to get it to work with area lights

Finally, here’s the shader.
Download cl_ptc_uber.sl

8 Replies to “Uber Point Cloud Based Atmosphere Shader”

  1. Hi, I want to try your shader, looks interesting and comlex, I compiled shader via shaderdl
    everythings goes allright, but when I want load sdl to 3delight in maya its not visible in the folder.. So I cant load it.. Im new to renderman… And I didnt have this problem yet. I looked into sdl, but its look all right, tryed rename… nothing helps… I have 3delight 9.5 and 3delight for maya 5.5
    Any idea? Thanks.

    Casper

    1. No Im loading it from a C:\ where I compiled it… It have to be in 3Delight/shaders??
      Normaly when I doing a shader and comile it, Its working loading it from there. Or wherever I navigate to… Thanks for reply.

  2. hi.
    first : thank you
    second : I don’t speak english well, sorry
    third : any question.
    I compiled your shader to 3delight 9.0.84 version.
    It’s successful
    but I could not compile your shader to 3delight 9.0.0 version.
    Is this a normal reaction?
    I want to use your shader to 3delight 9.0.0 version.
    Is it impossible?
    I know how to use, please.

  3. Hi, could you please explain how to use it?
    I attached the shader to my geometry but no AO or GI.
    What was going wrong?
    thanx

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.