Tutorial One
Use of the translucency script, for R3 and R4.

Typical workflow:
1. create geometry and lightsource(s).
2. assign a white material to the geometry and use the 'assign vertex colors' utility
3. collapse mesh, select vertices that shouldn't be lit and use the 'Assign selected verts as black'. This saves trying to light it correctly...
4. run script, play with parameters, hit the 'collapse + generate trans.' button and wait.
5. assign a material with a vertex map in the self illum slot, render.
6. if you don't like result hit the 'restore vertex colors' play with parameters and rebuild transparency.
7. when happy with transparency, play with material until desired result.

Important: translucency data can only be generated from actual mesh vertices. The ideal mesh has evenly spaced vertices - even in the flat areas, if they are directly/indirectly lit. Adding more geometry in specific areas can give good control over the solution. Meshes with modified vertex data subdivide extremely well, so the lowest resolution mesh you can manage is ideal in terms of speed.


Lets start with a simple model, the one that was used to create the image in the header. Download the max3 file here. This scene consists of a single mesh object and a single omni light.

1. open transStarter.max

2. Select Pot01, and change it's diffuse colour to white:
First step is simply to generate the vertex lighting data, and since we will be using it as a greyscale to drive the channels then white makes sense. Coloured lights and colour in the vertex colour produced matters little.

3. Go to the Utility panel and use the 'Asign Vertex Colors' utility on the Pot01. Make sure 'Mix vertex colors' is on. Shadows and use maps is up to you. Note that shadowing is slow, and self-shadowing doesn't work; duplicate and offset geom to simulate self-shadowing.

4. Next, bring up the properties of Pot01, and turn on both the 'vertex colours' checkbox and the 'shaded' button next to it.
The display may change a little, but not much. This enables display of vertex colours in the viewport. In OGL the vertex colours are not displayed.

5. turn off the light to remove it's effect from the scene.

6. Assign a material to the pot that is fully self illuminated, and has a vertex colour map in the diffuse slot.
This is effectively a standin material to help us tweak the tranlucency; we will build a more complex (and useful) material later.
You can find the scene at this stage here.

Note that if you need to return to the 'Assign vertex colors' utility at any stage you will need to temporarily ressign your plain white material while the vertex colours are re-assigned.

We are now ready to work on the translucency. First thing to fix is the handles of the pot being illuminated when they shouldn't be.

7. Run the Translucency script to bring up the dialog. Collapse Pot01 to an editable mesh, and go 'SubObject Polygon' mode on Pot01, and select all faces but the inside ones. Then convert that face selection to a vertex selection, since we need vertices to work on. If you want to save time, use LSoft's 'SelectVert' script that converts face selections to vertex selections:
a. SO polygon mode,
turn on 'ignore visible edges' leaving the angle at 45, and select any of the outside polygons. This will select all outer faces. Then
b. Use the 'SelectVert' script.

(The same result can be quickly met with a temporary MeshSelect).

Now, with all the outer vertices selected, hit the 'Assign selected vertices as black' button. That should clear up the lighting problems around the handles.

8. Next step is to assign the translucency by running the script. The first couple of times you run it will be to get a feel for the parameters you want, so use the 'nth Vertex (skip verts) spinner to speed up this end of the calculations:
Set the 'nth Vertex' parameter to 20, the radius to 80 and hit the 'Collapse + Generate trans.' button.

After a while (13.5 secs on my dual p2 450) the calculations are finished, and time taken is reported in the maxscript feedback field. Render a test frame:

That doesn't look to bad in terms of the 'depth' of the tranlucency, so I'll do a more accurate solution: hit the 'Restore vertex colours' button to go back to our starting point, set the 'nth Vertex' to 2 (1 is more accurate but of course slower) and Generate the solution again. 2 compared to 20 nth vertices is 10 times the calculations, and so takes about 2 mins 20 seconds. No speed demon, but you can work it out based on the larger nth value test. The result is:

(click for larger image)

9. Now for the materials, this is where you make it look good:
First thing is to use the vertex colour data to control self illumination via a vertex colour map. Since we want to be able to still add any scene lighting and self illuminated materials don't allow that, we want the object to not be self-illuminated where lit: so set the SelfIllumination channel to a falloff map, and put a Vertex Color map in the 'shaded' (top) slot.

Next, diffuse colour. Perfect for this is the Gradient ramp using the Mapped gradient type, and the vertex colour in the mapped slot, using this we can control what colours different values of the tranlucency are: Add a Gradient Ramp map to the diffuse slot; set the Gradient Type to 'Mapped, and add a Vertex Color map to the 'Source Map:' slot that becomes available with the Mapped type. Since this object has no mapping data set the Gradient Ramp to Environ/Screen. The screen environ does not affect the use of the vertex color map. (If you prefer, simply add a UVWMapping modifier to avoid the error when rendering.)

An important consideration worth mentioning at this point is how to control the translucency data: do this by adding an Output Map as parent to the vertex color map - then use the Output/Color Map curve to control it. This works very well, and mostly removes the need to get the initial solution perfect.

After that, simply add bump, reflection, specular highlights, etc until you are happy.

Final step is to add a Meshsmooth to the model, and render (there is a blown-out light inside this one):

You can find the scene used to create the pot image below here (a bit slow to render with the raytracing).

This is not the only material technique using the vertex color data: the scene here (of the iceblock below) uses a fully self illuminated material.

Miscellaneous info:
The 'falloff' parameter in the interface controls how vertices contribute to a vertex (so to speak) as their distance increases.
The 'Scale Solution' scales the result so that the brightest vertex color is 255 255 255.
'Selected Vertices' does just that, but you lose the abililty to scale the solution. It still analyses all vertices within the radius for light contribution, but only for the selected vertices.

Some images: