Karma (XPU) camera projection

   683   6   2
User Avatar
Member
37 posts
Joined: 8月 2017
Offline
Is there a way in Karma to do cameraprojection in shader (or for that matter any kind of projection)?
User Avatar
Member
7803 posts
Joined: 9月 2011
Online
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
37 posts
Joined: 8月 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
7803 posts
Joined: 9月 2011
Online
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 - 2024年3月20日 22:57:39
User Avatar
Member
8595 posts
Joined: 7月 2007
Online
jsmack
USD is 'rootless'
I believe it's spelled ruthless, at least from my experience
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
スタッフ
453 posts
Joined: 6月 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.
User Avatar
Member
31 posts
Joined: 6月 2017
Offline
jsmack
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.

May I ask how to assemble this USDCoordsys in materialx shader builder?
I need to project a displacement map on geo.
  • Quick Links