Precomputed Radiance Transfer/Lightmapping Per Vertex Data back into Maya

Hey,
I’m new to developing Mental Ray shaders and have been looking for a way to implement Precomputed Radiance Transfer/Spherical Harmonic lighting inside of Mental Ray & Maya.

It’s very similar to lightmapping. I basically need to be able to sample the hemisphere around each vertex, and project that onto the SH functions, and then export the co-efficients back into Maya as per vertex custom attributes.

I’m stuck at the part on how/where to extend Mental Ray so that I can run this sampling function. The other parts I have figured out.

I’ve scoured the Maya documentation but I can’t seem to make any headway (especially about the part in returning data back from mental ray)

The documentation for Mental Ray shaders is really sparse. Here’s a site that helped clear up some of what is going on:
http://www.writingshaders.com/shader_catalog.html

Then, looking in the official documentation or searching for specific function calls seemed to work:
http://download.autodesk.com/global/docs/maya2012/en_us/Shaders/index.html

So I think I made a lot of headway after going through that 400 page book.

The part that’s tricky for me now is figuring out how to get data from mental ray back into maya. Any thoughts?

If nothing else, I guess I can always write out to a temporary file and somehow wire a custom node to pipe that into Maya. Still no clue on how to wire it back in that way either

I haven’t done anything with taking the data from MR and doing anything except displaying the rendered result, so I can’t be of much use. But, the RenderToTexture window is just a big old MAXScript, so you might be able to take some parts of that and get what you need. Assuming that the data you are trying to get can be encoded into a texture, that would be the first avenue I would pursue.