Tangents in Optix

I would like to compute the ambient occlusion in tangent space using normal maps. For this, besides the normal, I need the tangent in the closest_hit_radiance program. How can I access it there? Also, how can I set up the tangents buffer inside the geometry because there is no name for the tangent_index_buffer that I know.

Btw, would it help at all to use normals maps for ambient occlusion?

To implement your tangent buffer, I would suggest you take a look at triangle_mesh.cu in the SDK samples. It’s used by many of the sample projects. You could implement a tangent buffer and tangent index buffer in much the same way that it is done for the vertices, normals, and texture coordinates, and then declare your own attribute to pass to your closest_hit program. All of the names are custom, so you do not need to worry about whether the name already exists.

Thanks for the fast reply. Would the use of normal maps increase the realism of ambient occlusion anyway?