Karma Get Surface Position Pre-Displacement?
2166 4 0- jkunz07
- Member
- 76 posts
- Joined: 9月 2011
- Offline
Is it possible to retrieve the pre-displacement surface position in a Karma surface shader?
The only way I've been able to do this at the moment is by copying P to rest or another extra attribute and then reading that attribute in the surface shader.
I'm hoping there's a way to access the P attribute directly or before the displacement shader has run without relying on extra attributes being stored on the geometry.
The only way I've been able to do this at the moment is by copying P to rest or another extra attribute and then reading that attribute in the surface shader.
I'm hoping there's a way to access the P attribute directly or before the displacement shader has run without relying on extra attributes being stored on the geometry.
Edited by jkunz07 - 2022年9月28日 05:48:43
- jkunz07
- Member
- 76 posts
- Joined: 9月 2011
- Offline
Here's an example showing what I'm hoping to achieve, I'd like to have the pattern in the surface shader and the displacement noise line up. If I use the mtlxposition node it only grabs the position of the surface being shaded (after it's been displaced). If I read the rest attribute, it gives me the result I'm hoping for but it seems redundant to copy P to rest just to do this. Is it possible to directly read the P attribute or get the pre-displacement surface position in some other way?
- willh
- Member
- 134 posts
- Joined: 12月 2006
- Offline
- jkunz07
- Member
- 76 posts
- Joined: 9月 2011
- Offline
Thanks! Yes, I've been looking into this a bit more and it seems to be the case.
https://www.sidefx.com/docs/houdini/render/understanding.html [www.sidefx.com] is a good explanation of Mantra's shading process, and using dimport to grab variables from the displacement shader in the surface shader.
I've been looking for similar info on Karma and MaterialX but believe using rest is a good solution for now but was hoping there might be some secret rayimport [www.sidefx.com] or renderstate [www.sidefx.com] type of trick
https://www.sidefx.com/docs/houdini/render/understanding.html [www.sidefx.com] is a good explanation of Mantra's shading process, and using dimport to grab variables from the displacement shader in the surface shader.
I've been looking for similar info on Karma and MaterialX but believe using rest is a good solution for now but was hoping there might be some secret rayimport [www.sidefx.com] or renderstate [www.sidefx.com] type of trick
- NicTanghe
- Member
- 210 posts
- Joined: 12月 2016
- Offline
-
- Quick Links