MObject from 'objectId ' ? 2003-11-25 - By Rob Hughes
Back Hi,
I had this problem a couple of years ago and eventually came up with the following solution (which I am afraid is not very elegant). You will have to forgive me if I am little vague as it was a while ago now that I did it.
Basically you have to triangulize your whole scene and then store it into some format of your own, ordered in primitive id order. There is some code from an archive thread about this. Now when rendering you can look up the primitive id in each of your shape structures and can compare the vertex positions of the triangle being rendered with the vertex positions you have previously stored. Now if you have a match, you can associate the object id with the shape. Next time you get an object id which has already been found you obiously don't need to go through the search process again.
Nurbs surfaces will need to be triangulized first, there is a mel command (although I can not remember off the top of my head what it is) which will triangulize them the same way as they are going to be rendered. I never got as far as doing subd's!
So there you go, not very clean, but it works.
Rob
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --- List-help: <mailto:listar@(protected)?Subject=help> List-archive: <http://www.highend3d.com/maya/devarchive/>
|
|