1. Select geometry. Assign custom attributes and new instance of bake_occlusion shader to each selected part. Ensure ‘cull Hidden’ and ‘Cullbacking surfaces’ are deselected under the geometry attribute. When rendering make sure all the geometry is viewable in the resolution gate.
Ensure that geometry attribute has Visibility – Diffuse Raya(Occlusion) – Shader Color and Opacity
2. Bake to unique map that derives name from object name.So under the bake_occlusion shader parameters put in e.g /Users/Username/box.bake in the bake_file address
3. do tdlmake to convert .bake to .tdl
4. In Maya, assign the .tdl file to geometry. Important enable the culling attributes again. The defaultshader can be used.
You don’t need an occLight, since the occlusion shadeop is present in the surface shader.
example AO shader
string bake_file = “”;
float maxtDist = 1;
float samples = 64;
float bias = 0.05;
extern point P;
extern normal N;
normal Nf = normalize(N);
color ao = occlusion ( P, Nf, samples, “maxdist”, maxtDist, “bias”, bias );
ao = 1 – ao;
bake ( bake_file, s, t, ao );
Ci = ao;
Oi = 1;
The conversion of the .bake file to a .tdl has to be done on the command line. e.g tdlmake -bakeres 640 /Users/Username/baketest.bake /Users/Username/baketest.tdl.
With multiple pieces of geometry – select the geometry and and set Automatic UVs Then go into edit layout UVs – layout UVs options and enable Layout multiple objects to Non-overlapping.