Rendering point clouds

First, in case you are working on the same scene you wrote the cloud from, remove the lens shader or mute it.

We start by adding a couple of dummy spheres to show the color bleeding feature.
In fact, the scene represents the touching drama of the creature not being able to pick one M&M or the other.
The green sphere is tagged 4, the read 5.
We assign an occlusion as the color of the monster body, which is tagged 0.
We raise the oversample to 3 to have some more density, pan the camera back to enclose the whole scene, and render the frame.

This is how the cloud looks like

We'll now render the body, the floor and the horns separately in order to understand how the reading works.

For all the objects you want the read the cloud for, apply sj_pc_read as surface shader, or as part of the surface shader subtree.

The parameters are:

Mute: if on, do nothing and return black.

mrmap File, Frame: the mrmap to read. Give a valid full path. Also in this case, Frame is replaced automatically to the file path along animation.

Radius, Max Number of Points: like in fg, they define the search radius and the maximum number of points that must be searched around the rendering point and interpolated.

Use, Tag: as described in the write stage, a mrmap can host points with different tags. You can use the Tag string to filter the points by their tag. Also in this case, we use the "page to print" syntax. For instance, 2-4 means to use only the points tagged 2,3 or 4.

Mode, Min Angle, Max Angle: can be either Interpolation, Color Bleeding or Translucency. No rocket science here. Each point in the cloud has an associated normal (let's call it the point normal). The angle between the point normal and the current rendering point is tested against Min Angle and Max Angle. If the normal is not in that range, it's skipped. The points whose normal instead falls in the range, are used for interpolating the output color.

Selecting a different Mode causes the Min and Max Angle to be changed automatically. Fowever, the suggested values are

Interpolation: Min Angle = 0, Max Angle = 90
Color Bleeding: Min Angle = 90, Max Angle = 180
Translucency: Min Angle = 80, Max Angle = 180

Beside setting the angles, the three modes have slightly different behaviours. Also, with a given Mode, you can further tune the angles to get different results.
For instance, in Color Bleeding mode, as said the default range is 90-180. This can be understood since in bleeding mode, the point act like tiny color emitters, and they are collected only if their normal ranges between being orthogonal (angle=90) and opposite (angle=180) to the surface normal.
By using a larger Min Angle (say 100), the color will not bleed from points whose normal is orthogonal or almost (by 10 degrees) orthogonal to the surface normal.

Falloff: the falloff for the r, g and b. 0 (black) means no falloff, so the points are simply averaged. This is the case when you want to have a plain interpolation of the cloud color, for instance in the occlusion case. 1 means smoothstep falloff, higher values make each point contribute less and less to the interpolation.

Color: a global multiplier of the output color.

Multiply by Opacity: since the mrmap also hosts the alpha of the points, you can multiply each point color by its alpha before being averaged with the others.

Note that the shader also outputs outPoints, which is the number of points that were found around Radius . If all went perfectly, this output equals Max Number of Points. However, some areas of a surface may not have in the cloud enough points, because when the cloud was generated such areas had a small incidence when viewed from the camera. So, you can use the outPoints port to check such cases. Particularly if outPoints is 0, it means that for that sample no points were found at all. What you can do in this case is
1. Render a second point cloud, after moving the camera in order to see the before-hidden areas.
2. Apply a second sj_pc_read, with this new mrmap as input.
3. Elaborate a bit the rendertree so that if outPoints of the primary sj_pc_read is small (0 or 1), the second sj_pc_read kicks in.

Let's start from the occlusion case.

As you see, we use plain Interpolation , with no filtering (so, the points colors are simply averaged).
Note that you also have some color coming from the eyes and the horns (remember that we're using a unique mrpam for all objects).
Since we know that the body was tagged 0, we just have to enable Tag Use and set the Tag string to 0.

For the grid, we want to get color bleeding from the two spheres.
So, we set its sj_pc_read Mode to Color Bleeding with a large Radius , to reach the spheres location. The falloff is set to 1, and we scale the multiplier color a lot, just to see it clearly.

Also in this case, we have some unwanted contribution from the monster body, so again, since the spheres were tagged 4 and 5 at writing time, I just have to enable the Tag usage.

Finally, for the horns, we use the Translucency mode, also in this case with the right Tag string set. 

And this is whole frame, rendering in a few seconds.