Karma (XPU) camera projection

   2215   11   6
User Avatar
Member
91 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
8037 posts
Joined: 9月 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
91 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
8037 posts
Joined: 9月 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 - 2024年3月20日 22:57:39
User Avatar
Member
8773 posts
Joined: 7月 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
スタッフ
497 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
39 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.
User Avatar
Member
56 posts
Joined: 10月 2019
Offline
I can't get this to work, and I even thing I've done exactly as the sample scene in the docs.

I've attached a screenshot which I hope describes it well. I'm using a single image which I'm trying to project from the camera shown in the viewport. But I must be doing something wrong as all attempts as failed

I'm using Houdini 20.0.724 ( linux )

We have hoped to put Karma in production soon, but this is a big stopper for us as we do a lot of camera projections. But I'm sure I'm doing something wrong.

regadrs
stefan

Attachments:
coordsys.jpg (276.0 KB)

CG Supervisor - Important Looking Pirates
http://www.ilpvfx.com/ [www.ilpvfx.com]
User Avatar
Member
56 posts
Joined: 10月 2019
Offline
Solved, I just needed it to part of the root of the asset. Took me a while to understand the whole "rootless" comments. And attached a screenshot where it's illustrated.

The main issue now is that it's projecting also to the backfaces, and that it doesn't match the aspect of the camera. I've set the aspect to 1:1 but it seems to use something else and doesn't really react to change any of the paramters.
It only matches if the projection is 16:9

I hope the camera projection tools will be updated in the near future. It's really a must for DMP/environment and shot refinements.

regards
stefan
Edited by StefanA - 2024年7月8日 04:46:31

Attachments:
coordsys2.jpg (254.9 KB)

CG Supervisor - Important Looking Pirates
http://www.ilpvfx.com/ [www.ilpvfx.com]
User Avatar
スタッフ
497 posts
Joined: 6月 2020
Offline
Hi Stefan, can you share your problematic scene? Have a look at the attached and scrub the timeline (I've linked the camera aspect ratio to the frame).

Attachments:
coordsys_aspect.hip (261.1 KB)

User Avatar
Member
56 posts
Joined: 10月 2019
Offline
With the swift help from support I found that the issue is solved in a later production build. The problem I had is that we are locked to and earlier build due to some plugins. So in the latest build it’s not a problem.

Thanks for the example scene though!

Regards
Stefan
CG Supervisor - Important Looking Pirates
http://www.ilpvfx.com/ [www.ilpvfx.com]
User Avatar
Member
3 posts
Joined: 6月 2014
Offline
robp_sidefx
Hi Stefan, can you share your problematic scene? Have a look at the attached and scrub the timeline (I've linked the camera aspect ratio to the frame).


hey rob,

i set up a projection scene too with some old aproach via script. now i see this, which is a little nicer but does the same via ndc. my question is, how to get UVs from this, to be able to view the projection shader in Vulkan. because only working in karma has downsides. in vulkan you can see edges of geometry, no loading times and its way faster.

thx
  • Quick Links