Here's a thing:
For point-cloud-based computations, I need to render an image in two passes:
All the shaders are very simple, representing only approximate amount of light that each surface emits. But very important step here is that after surface color is computed, shader bakes it into point cloud file.
Primary pass uses full-featured shaders with all the beauties like reflections/refractions etc. But it also reads point-cloud file from previous step and uses it to compute AO, color bleeding, blurry reflections etc.
How it's done in RSL itself (as I guess):
RSL uses 2 additional nodes - Environment Light and Radiosity Pass node.
Environment Light contains all the parameters related to the baking process. It also has an attribute which links this Environment Light node to Radiosity Pass node.
Radiosity Pass node has some additional parameters related to baking process (like culling settings). But the most important of them is point-cloud file. This is where the data is stored to during this pass and is read from during final beauty pass.
When rendering, RFM first compiles 2 RSL shaders from each Maya material: one for baking pass and one for beauty pass. It sets all the baking parameters getting them from Environment Light node, which gets path for point-cloud file from Radiosity Pass node, which, in turn, generates it from specified template.
So, this way user even doesn't know that baking settings are actually set per-shader because he specifies it only once in Environment Light and Radiosity Pass nodes. He also may not know that point cloud is actually stored on the disk. All this technical stuff is done automatically and silently.
Now, here's a problem:
If I use my own RSL shader, it's not compiled during the render. So I can't automatically assign another shader for Radiosity Pass. Instead, I need to make my shader evaluate differently depending on the pass that's currently rendering.
And, finally, the question itself:
How can I get data from pass system?
How can I get currently rendering pass name right in RSL? This will allow me to make my shader evaluate completely different code for Radiosity pass by comparing current pass name to Radiosity pass name with simple if() statement.
How can I get parameters from Radiosity pass? At least I need to get a path for point-cloud file. This can be done in two ways:
Integrate my shader with RFM's Environment Light node.
This is better solution. 'Cause this way I can use all it's capabilities like object sets and keeping all the baking settings in same place. The problem here is that I can't simply add one more attribute to my shader which will allow me to link it to Environment Light node. Because there may be multiple Environment Light nodes in the scene. So, instead, I need to:
Get current pass name (the name of a pass that's currently rendering).
Get the list of all the Env Lights in the scene. If at least one of them is connected to the current pass then it is Radiosity pass.
If it's Radiosity pass then look for all the environment lights that are connected to it (yes, multiple Environment Lights may be connected to the same Radiosity pass. This may be used to create point clouds in parts).
For each found Environment Light evaluate shader calculation with all the settings taken from it.
If current pass is beauty pass (it has no Env Lights connected to it), then I need to get the list of all the passes that are connected to any Env Light. Then get a list of all the point-cloud files generated by them. And use all these files to calculate my indirect lightness.
If the previous variant is impossible with RSL only then at least I need to...
Integrate my shader with pass node itself.
So that at least I can link my shader to some pass and get filepath that it generates.
I'll have to manually link my shader to Radiosity pass and I'll need to specify baking settings for each shader instance individually. But at least I'll be able to automatically generate filepath and use culling settings.
I already have an idea of how setting baking parameters can be automated using mel. But the previous variant is better though.
1. Sorry for disturbing all you guys again with my lamer questions. As always, I have read all the related docs (http://penguin.ewu.edu/RenderMan/RMS_2.0/pointbased.html), but it didn't help. And looks like this forum is the only place where I can find the solution. (Pixar's RenderMan forums (https://renderman.pixar.com/forum/index.php) are almost empty :-( )
I'd like to find solution by myself, but I have RFM (not RMS/RPS) and it doeasn't output any ribs. And this complicates shader development significantly.
2. Sorry for such a big post. I just can't explain the problem with fewer words.