Hi.

I'm trying to use the texturebaking method mentioned in these slides...
http://www.cs.washington.edu/homes/dgoldman/ezbake/EZ_Bake_Oven.htm

It's the same method M. Baas uses in his cgkit tools.

Basically I render a flattened version of the mesh in an ortographic view.
Instead of supplying the vertex positions in P I supply the st coordinates and the real vertex positions in Pref.
I also add the same mesh with the real vertex positions in P so that the traced rays have something to hit, but this geomentry is hidden from the camera.

The problem is that when using ambient occlusion, the rays doesn't seem to detect the hidden mesh and thus all pixels end up white.

Here is the main rib.
Format 512 512 1
ShadingRate 1.0
Display "ao_map.tif" "file" "rgba"
Display "+ao_map.tif" "framebuffer" "rgba"

Projection "orthographic"
Scale 2 2 2
Translate -0.5 -0.5 -3.5

WorldBegin

AttributeBegin
Surface "bakeao" "float samples" 128 "varying point Pref" [0.0 0.0 0.0]
Translate 0 0 4.0
Declare "Pref" "vertex point"
Declare "N" "varying normal"
Declare "st" "varying float[2]"
ReadArchive "flattenedmesh.rib"
AttributeEnd

AttributeBegin
ConcatTransform [1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0]
Surface "matte"
Attribute "visibility" "int trace" [1]
Attribute "visibility" "int camera" [0]
ReadArchive "mesh.rib"
AttributeEnd

WorldEnd

And this is the bakeao shader
surface bake_ao(float samples=256; varying point Pref = point(0,0,0))
{
  varying point oldP = P;
  P = transform("camera","object",Pref);
  P = transform("world","current",P);

  normal Nshad = normalize(N);

  Ci = 1-occlusion(P, Nshad, samples);
  Oi = 1;

  P = oldP;
}

This works in 3delight, but I guess Pixie requires other settings?
Matthias Baas can confirm that this doesn't work with Pixie.

Any ideas?

Thanks for an excellent renderer though. :)

//Sweenie