papsphilip Posted May 1, 2022 Share Posted May 1, 2022 (edited) i have a library of packed primitives with a unique name attribute that i import, copy and transform, and mirror. I need to extract these final transforms to export a json. Is there a way to do that? Usually i have the orient attribute that helps me to generate a 3x3 transform but in this case i don't have any other attributes other than the position. extract_transform.hip Edited May 1, 2022 by papsphilip Quote Link to comment Share on other sites More sharing options...
davpe Posted May 2, 2022 Share Posted May 2, 2022 i think there is no out of the box solution for this as it is a very specific request. however, if you have packed prims, it should have it's transform matrix stored as intrinsic primitive (pos, rot, scale). you can then use a python script i suppose, to read individual packed transforms and write it into a text file with json syntax. If packed prim transform is not there in packed intrinsics (i.e. it's zero), it's been either discarded somehow in the prior processes, or haven't been generated at all. In that case you have to find a workflow that generates and retains this attribute for you. (not 100% sure if this is generated by "copy and transform SOP", but it's definitely generated by "copy to points SOP") this is of course just a rough workflow on how would I try to approach it. Detailed steps will vary depending on how you've built your scene, and how u wanna use the data next. cheers, D. Quote Link to comment Share on other sites More sharing options...
papsphilip Posted May 2, 2022 Author Share Posted May 2, 2022 yeah i am using the "packedfulltransform" intrinsic attribute right now. seems to still be there after the mirror sop or the copy and transform. i want to copy my named primitives to the points with the transform just to verify that it is working but i haven't managed to do that yet. is there a way to use copy to points but instead of pscale and orient use a transform? Quote Link to comment Share on other sites More sharing options...
davpe Posted May 2, 2022 Share Posted May 2, 2022 again, depends on your specific setup. But for example, "transform by attribute SOP", "transform pieces SOP", and "getpackedtransform" and "setpackedtransform" VEX functions are the good candidates to look at. also this article might come in handy: https://vfxbrain.wordpress.com/2020/07/09/how-to-re-apply-packed-transform/ Quote Link to comment Share on other sites More sharing options...
dleonhardt Posted May 2, 2022 Share Posted May 2, 2022 1 hour ago, papsphilip said: yeah i am using the "packedfulltransform" intrinsic attribute right now. seems to still be there after the mirror sop or the copy and transform. i want to copy my named primitives to the points with the transform just to verify that it is working but i haven't managed to do that yet. is there a way to use copy to points but instead of pscale and orient use a transform? Copy to Points will look for "transform" attribute on Points if it can't find "N" and "up" or "orient". Quote Link to comment Share on other sites More sharing options...
papsphilip Posted May 2, 2022 Author Share Posted May 2, 2022 packinject SOP seems to be applying the transformation correctly first input is a my packed primitive library with name attribute, the second input is for my already placed and named packed primitives. Injection method set to collate packed sources using the name attribute. So at least i know that the intrinsic transform is correct after copy and transform or mirror operations and can be applied to other geo. i haven't figured out how to apply that transform myself yet 1 hour ago, dleonhardt said: Copy to Points will look for "transform" attribute on Points if it can't find "N" and "up" or "orient" copy to points output for some reason is not correct 4@transform = primintrinsic(0,"packedfulltransform",@primnum); This is what i used to extract the transform extract_transform.hip Quote Link to comment Share on other sites More sharing options...
dleonhardt Posted May 2, 2022 Share Posted May 2, 2022 dl_extract_transform.hipnc Quote Link to comment Share on other sites More sharing options...
papsphilip Posted May 2, 2022 Author Share Posted May 2, 2022 27 minutes ago, dleonhardt said: dl_extract_transform.hipnc thank you! didn't think to use a 3x3.. 4x4 contains the position as well but i guess copy to points uses directly the position of the incoming geo points. Quote Link to comment Share on other sites More sharing options...
dleonhardt Posted May 2, 2022 Share Posted May 2, 2022 1 minute ago, papsphilip said: thank you! didn't think to use a 3x3.. 4x4 contains the position as well but i guess copy to points uses directly the position of the incoming geo points. You can use a 4x4 matrix too, if all your points are at the origin. 1 Quote Link to comment Share on other sites More sharing options...
papsphilip Posted May 2, 2022 Author Share Posted May 2, 2022 a bit of clean up for anyone interested extract_transform.hip 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.