MaterialX - direction to eye vector
4069 9 1- rangi
- Member
- 306 posts
- Joined: July 2005
- Offline
- jsmack
- Member
- 7659 posts
- Joined: Sept. 2011
- Offline
- rangi
- Member
- 306 posts
- Joined: July 2005
- Offline
- rangi
- Member
- 306 posts
- Joined: July 2005
- Offline
- rafal
- Staff
- 1440 posts
- Joined: July 2005
- Offline
There was some talk about fresnel in MaterialX on ASWF Slack:
Yes, the fresnel node was removed in 1.38 in an effort to limit the support for view-dependency in MaterialX shader graphs. When view-dependent nodes are allowed to be used anywhere in a shader graph it makes it hard to support for bidirectional rendering techniques, where reciprocity is a strict requirement. So in order to keep MaterialX as portable as possible to all different renderers we decided to remove the nodes: fresnel, viewdirection and backfacing.
In practice this restriction was introduced in MaterialX 1.38 by the MDL back-end, because MDL has no support for general view dependency, because of its requirement to support bidirectional path tracing. So fresnel, viewdirection and backfacing was not possible to implement in MDL, and any shading graph containing them would not be portable.
But I think it's a fair point to say that something like a facing-ratio node would be very useful. I think we need to discuss how something like that could be introduced without breaking portability.
- jsmack
- Member
- 7659 posts
- Joined: Sept. 2011
- Offline
- Siavash Tehrani
- Member
- 710 posts
- Joined: July 2005
- Offline
- jason_iversen
- Member
- 12397 posts
- Joined: July 2005
- Offline
It would seem a bit self-limiting if the MaterialX guys scoped Mtlx to one style of rendering (bidirectional pathtracing) rather than allowing a broader implementation and potentially supporting more styles of render engines. Perhaps they could consider adding some sort of tag schema to Mtlx nodes with properties that an implementation could correlate with the abilities of their supported renderers.
Edited by jason_iversen - Nov. 30, 2021 02:33:25
Jason Iversen, Technology Supervisor & FX Pipeline/R+D Lead @ Weta FX
also, http://www.odforce.net [www.odforce.net]
also, http://www.odforce.net [www.odforce.net]
- brians
- Staff
- 450 posts
- Joined: May 2019
- Offline
jsmack
Use the mtlx position to get I, and the mtlx normal for N, both in camera space ("space:camera")
"space:camera" is not part of the MaterialX specification.
https://www.materialx.org/assets/MaterialX.v1.38.Spec.pdf [www.materialx.org] (page 29)
I'll have a chat with others at SideFX to see if XPU should support it or not.
jsmack
I found using the geompropvalue to get 'I' also works, and works correctly in reflections.
'I' is not really a property of the geometry, so I don't think it would really be valid to have it come through via the geompropvalue. (again I'll chat to others at SideFX to see if XPU should support it)
IMO a better way to get the incoming ray direction is via the MtlxDot ray-import stuff (that works in both KarmaCPU and KarmaXPU).
https://www.sidefx.com/docs/houdini/solaris/karma_xpu.html#summary [www.sidefx.com]
So to do what you're asking, I would suggest...
- have a MtlxNormal node (set space to "world")
- have a MtlxDot node (put
ray:D
as the note), and multiply by -1, which will produce the equivalent of "I"See attached example + screenshot
Cheers
Edited by brians - Dec. 7, 2021 18:43:51
- brians
- Staff
- 450 posts
- Joined: May 2019
- Offline
-
- Quick Links