ambient occlusion data as a lightmap

madgodz

Newcomer
I'm having trouble saving my per-vertex ambient occlusion data as lightmaps.

Here's what I am doing:

1) tesselate low-poly mesh storing a map of control points
2) use D3DXUVAtlasCreate to unwrap the mesh and get a second set of UV coords
3) process tesselated mesh to get ambient occlusion data
4) create a texture map the size of the atlas

?) how do I write the per-vertex ao info into the texture?

I'm probably making this harder than it is. Thanks for any help.
 
If you're computing the ambient occlusion per-vertex, why don't you just send it as vertex data (i.e. a vertex attribute like position, texture coordinates, etc)?
 
If you're computing the ambient occlusion per-vertex, why don't you just send it as vertex data (i.e. a vertex attribute like position, texture coordinates, etc)?

I tesselate a low-poly mesh in order to get nice smooth shadowing. I keep a mapping back to the original control points so I can get new UV cooords that are generated. Basically, I'm using AO instead of radiosity to make lightmaps. If I simply used the per-vertex data, I get really bad streaking.
 
Ok I get it. Have you tried something like rendering the high poly mesh and using the (new) texture coordinates as vertex position outputs (suitably scaled and biased)? This will only work if there's a proper 1-1 mapping, but I think that's true of your technique in general if I understand it correctly. The DX atlas function probably promises this anyways.
 
Ok I get it. Have you tried something like rendering the high poly mesh and using the (new) texture coordinates as vertex position outputs (suitably scaled and biased)? This will only work if there's a proper 1-1 mapping, but I think that's true of your technique in general if I understand it correctly. The DX atlas function probably promises this anyways.

I think this is the hang-up. How do i get that 1:1 mapping?

so here's what i have so far:
1) unwrap the original mesh in order to get lightmap UV coords
1) tesselate original mesh storing a map of points to the new mesh
2) use D3DXUVAtlasCreate to unwrap the mesh and get a second set of UV coords
3) process tesselated mesh to get ambient occlusion data
4) create a light map the same size as the D3DXUVAtlasCreate atlas
5) for every cell in the lightmap
for every vertex (from tesselated mesh)
if the vertex (from tesselated mesh) UV equals the current cell
store the obscurance value

now I seem to have a disconnect...I have the original unwrapped atlas and the tesselated unwrapped atlas and they look completely different. How do I correlate the two? The atlas for my low-poly mesh looks different than the high-poly version. Seems the more tri's available the packing is more efficient and changes the control points position in the atlas (I haven't investigated the integrated metric tensor yet).
 
Back
Top