Re: Cycles in the shader graph
bbannayan@...
This definitely can be handled on the DCC end but it's cumbersome to do so since I'm working in a context where I will be making continuous edits and these "utility" nodes may or may not exist or have different types/parameters depending on the context. I was hoping to find a way to output the graph once but interact with the parameters in only one place (the OSL node that is one-to-one with a Maya node, in this case) and let the OSL graph sort out the rest. What I really want to do is to be able to call my little utility shaders from inside another shader and have the oso loaded and executed at that time. The big difference with what I'm doing vs what Zap was proposing is that that there's no need of "globals".. everything needed by the shader/function is passed in. (though maybe I'm making undue assumptions about what happens behind the scenes in a "texture()" call?).
So my earlier example could be reduced to something like this. surface A(float diff = 1, { float diff_value; Ci = diff_value * diffuse(N); } shader B(float value = 1, string tex = "", output float out = 1, float st[2] = { 0.0, 0.0 }) { out = value * texture(tex, st[0], st[1]); } Basically a callable shader that's outside the node graph. Just loaded and executed right there with only the data that's passed in. The main downside is that now my choice of the "B.oso" to execute is hard coded in my shader rather than my being able to select it at scene translation time, though there are definitely ways around this too.
I'm not sure that this side steps any of the technical issues you outline.. but it's definitely a different working method that takes the problem away from the scene graph. On Tue, Aug 17, 2021 at 11:21 PM, Larry Gritz wrote: So, underneath, it's really all flattened to just a simple list of shaders in the group (that's why we sometimes call them "layers"). Connections can only go from outputs of earlier numbered layers to inputs of later numbered layers. Thus, there are no cycles in the graph. |
|