[SOLVED] Karma spherical uv projection

   5337   17   6
User Avatar
Member
200 posts
Joined: Jan. 2014
Offline
Hi,

We have "UV project" nodes for Arnold and Redshift, but is there a karma alternative for that?

https://docs.arnoldrenderer.com/display/A5AFHUG/UV+Projection [docs.arnoldrenderer.com]

https://docs.redshift3d.com/display/RSDOCS/UV+Projection [docs.redshift3d.com]


Thank you
Edited by Ivan L - March 31, 2021 11:31:18

Attachments:
NZhfc4YpGW.png (648.6 KB)
PXJgE5NLx9.png (535.1 KB)
Spherical_Project_v001_t01.hiplc (450.5 KB)

I contribute to the beauty of this world
https://houdininotes.ivanlarinin.com/ [houdininotes.ivanlarinin.com]
User Avatar
Member
1796 posts
Joined: May 2006
Online
UV Project in polar mode does that, but you need to add your own controls to translate/scale.

Attachments:
karma_project_ui.png (530.4 KB)
karma_polar_project.hip (276.3 KB)

http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
8038 posts
Joined: Sept. 2011
Offline
Why are the nodes out of order for Arnold? It's not like you can take a texture, find out the color for the current ray, then get a projection matrix and go "oh wait, lol not that pixel, I wanted this one over here." The only way it makes sense is if the types are all fake and the texture node is returning a texture sampler object that gets evaluated later. In that case calling it 'rgba' is a bit disingenuous.
User Avatar
Member
8780 posts
Joined: July 2007
Offline
jsmack
Why are the nodes out of order for Arnold? It's not like you can take a texture, find out the color for the current ray, then get a projection matrix and go "oh wait, lol not that pixel, I wanted this one over here." The only way it makes sense is if the types are all fake and the texture node is returning a texture sampler object that gets evaluated later. In that case calling it 'rgba' is a bit disingenuous.
at this point this is irrelevant, since Arnold is owned by AD so all logic goes out of the window

on the other hand RS screenshot is not any better
Edited by tamte - March 31, 2021 18:29:06
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
8038 posts
Joined: Sept. 2011
Offline
tamte
jsmack
Why are the nodes out of order for Arnold? It's not like you can take a texture, find out the color for the current ray, then get a projection matrix and go "oh wait, lol not that pixel, I wanted this one over here." The only way it makes sense is if the types are all fake and the texture node is returning a texture sampler object that gets evaluated later. In that case calling it 'rgba' is a bit disingenuous.
at this point this is irrelevant, since Arnold is owned by AD so all logic goes out of the window

on the other hand RS screenshot is not any better

The 'Red' is short for "Red-iculous"
User Avatar
Member
4 posts
Joined:
Offline
I took a quick look at your example file @mestela, but I'm unable to get a working render. It's coming up on a year since the post... perhaps something has changed in later versions of Karma that would break the setup? I've checked that my pathed texture is valid.
I'm using H19.0.383. Screenshot of my result attached. Thanks for any help!

Attachments:
karma_polar_project_debug.png (538.1 KB)

User Avatar
Member
8038 posts
Joined: Sept. 2011
Offline
celmer
I took a quick look at your example file @mestela, but I'm unable to get a working render. It's coming up on a year since the post... perhaps something has changed in later versions of Karma that would break the setup? I've checked that my pathed texture is valid.
I'm using H19.0.383. Screenshot of my result attached. Thanks for any help!

Your screenshot would indicate using XPU. VEX nodes don't(won't ever) work with XPU. XPU only works with materialX nodes. MtlX has a variety of trig and other math nodes which should make performing a polar projection trivial.
User Avatar
Member
4 posts
Joined:
Offline
That was it, thank you. Happy to disable XPU for now, although making my own polar projection with the existing mtlx nodes would be a fun challenge.
User Avatar
Member
11 posts
Joined: May 2014
Offline
@jack
jsmack
celmer
I took a quick look at your example file @mestela, but I'm unable to get a working render. It's coming up on a year since the post... perhaps something has changed in later versions of Karma that would break the setup? I've checked that my pathed texture is valid.
I'm using H19.0.383. Screenshot of my result attached. Thanks for any help!

Your screenshot would indicate using XPU. VEX nodes don't(won't ever) work with XPU. XPU only works with materialX nodes. MtlX has a variety of trig and other math nodes which should make performing a polar projection trivial.

Would you be able to help making a mtlx polar projection? Having difficulties creating one... Thank you.
User Avatar
Member
11 posts
Joined: May 2014
Offline
Here my poor attempt to get the spherical projection to work with mtlx.
It kinda works but something is still not right with the node hookups.

As reference you can see the principled shader behave correctly in my video. Check below out.

@jsmack would you be able to lend a hand and seeing how I can fix the mtlx nodes to behave correctly?
Edited by pete4d - April 9, 2024 19:19:34

Attachments:
polar_projection_mtlx.mp4 (3.3 MB)
polar projection mtlx network.jpg (85.6 KB)
karma_polar_projecttion_mtlx.hip (565.6 KB)

User Avatar
Staff
530 posts
Joined: May 2019
Offline
Here is an example MaterialX implementation

Attachments:
polar_projection.hip (261.4 KB)
matx_proj.PNG (1.7 MB)

User Avatar
Member
11 posts
Joined: May 2014
Offline
brians
Here is an example MaterialX implementation
Thanks so much. This is really great brians.

Do you have an idea how I could achieve being able to transform the origin of the polar projection similar to how I managed it working with Arnolds shipped nodes? Have a look at my video.

The idea is to transform a chromeball HDR which I align with its manipulators and spherically project against a set geometry (lidar etc).

The mtlx polar seems to need some additoinal transform matrix logic so I can transform the projection against geometry.
Maybe you have some ideas how to extend your example further? Appreciate.
Edited by pete4d - April 10, 2024 08:21:46

Attachments:
mtlx_spherical_proj.mp4 (3.2 MB)
matrix.png (50.0 KB)

User Avatar
Member
8038 posts
Joined: Sept. 2011
Offline
pete4d
Do you have an idea how I could achieve being able to transform the origin of the polar projection similar to how I managed it working with Arnolds shipped nodes? Have a look at my video.

You could take advantage of the object space of the mesh. transform the meshe's vertices such that the projection center is at the origin, then transform the prim or a parent prim of the mesh back to the correct position (the inverse of the previous transform.) Then the space 'object' in the shader will refer to the un-transformed space.

To manually manipulate the space, the add and rotate nodes can be used. The transform matrix node was not implemented last time I tried to use it, but maybe that has changed. A matrix node requires a matrix though, so you're on your own for generating one using python or vex or something and then pasting the values in. materialX is missing the required nodes for actually manipulating or importing matrices.
User Avatar
Member
11 posts
Joined: May 2014
Offline
jsmack
pete4d
Do you have an idea how I could achieve being able to transform the origin of the polar projection similar to how I managed it working with Arnolds shipped nodes? Have a look at my video.

You could take advantage of the object space of the mesh. transform the meshe's vertices such that the projection center is at the origin, then transform the prim or a parent prim of the mesh back to the correct position (the inverse of the previous transform.) Then the space 'object' in the shader will refer to the un-transformed space.

To manually manipulate the space, the add and rotate nodes can be used. The transform matrix node was not implemented last time I tried to use it, but maybe that has changed. A matrix node requires a matrix though, so you're on your own for generating one using python or vex or something and then pasting the values in. materialX is missing the required nodes for actually manipulating or importing matrices.
The first suggestion seems to make sense to implement. I dont have experience with those kinda transformations - if you had some time to use @brians example and imitate the arnold example I posted that would be fab. cheers @jsmack
User Avatar
Member
32 posts
Joined: Aug. 2011
Online
This is a really naive way of doing it and probably breaks all proper usd / mtlx conventions but maybe it helps:

Attachments:
polar_projection_LIMITED.hiplc (438.6 KB)
2024-04-11.mp4 (5.2 MB)

User Avatar
Member
11 posts
Joined: May 2014
Offline
MR SMITH
This is a really naive way of doing it and probably breaks all proper usd / mtlx conventions but maybe it helps:
Fantastic!!!! Works perfectly
Great stuff Mr. Smith.
Edited by pete4d - April 12, 2024 16:59:22
User Avatar
Member
8038 posts
Joined: Sept. 2011
Offline
pete4d
Fantastic!!!! We just need to add scale now. With different scene scales of your lidar/set geometry you will want to scale the HDR sphercial projection up and down and overlay as close as possible.

You can reference another object's transform using a coordys. There are some minor scene hierarchy limitations to coordsys, however.

This will get a full transform from the object and can even do camera (perspective ndc) projections. Scale is applied, although polar projections are scale invariant so it will have no effect unless it's a non-uniform scale.

Attachments:
polar_projection_coordsys.hip (365.2 KB)

User Avatar
Member
2 posts
Joined: March 2024
Offline
jsmack
pete4d
Fantastic!!!! We just need to add scale now. With different scene scales of your lidar/set geometry you will want to scale the HDR sphercial projection up and down and overlay as close as possible.

You can reference another object's transform using a coordys. There are some minor scene hierarchy limitations to coordsys, however.

This will get a full transform from the object and can even do camera (perspective ndc) projections. Scale is applied, although polar projections are scale invariant so it will have no effect unless it's a non-uniform scale.


This is really great!

I've been looking for this exact thing for a while now.

Would you be able to recommend something to watch or read to learn more about how this all works jsmack?
  • Quick Links