Karma (XPU) camera projection

   565   5   1
User Avatar
Member
33 posts
Joined: Aug. 2017
Offline
Is there a way in Karma to do cameraprojection in shader (or for that matter any kind of projection)?
User Avatar
Member
7770 posts
Joined: Sept. 2011
Offline
Yes, use a USDCoordsys to create a reference coordinate system, then in the shader use that coordsys' name in a space parameter on one of the mtlx transform nodes or on the mtlx position directly.
User Avatar
Member
33 posts
Joined: Aug. 2017
Offline
Thanks for the pointer. I also found an example in the docs but boy do I not understand how that works and why it needs to be setup in that way. For example why does it only work if the material is parented under the "World" primitive?
User Avatar
Member
7770 posts
Joined: Sept. 2011
Offline
ronald_a
For example why does it only work if the material is parented under the "World" primitive?

yeah, it's kind of annoying that the hierarchy is restricted this way due to some USD reasons. The material, camera, and target need to be able to find the coordsys, and they can't find it if they don't share a common ancestor. USD is 'rootless' so without creating a true root, for example the 'world' primitive, the prims won't share a common ancestor.
Edited by jsmack - March 20, 2024 22:57:39
User Avatar
Member
8554 posts
Joined: July 2007
Offline
jsmack
USD is 'rootless'
I believe it's spelled ruthless, at least from my experience
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Staff
451 posts
Joined: June 2020
Offline
jsmack
The material, camera, and target need to be able to find the coordsys, and they can't find it if they don't share a common ancestor

The camera doesn't need to live in the same hierarchy. As for the rest of that, we're looking into a possible implementation issue in Karma. For *now*, yes, the coordsys binding should be applied on a parent prim common to the geometry & material.
  • Quick Links