I want to create a material network of callable programs to use for shading in a raytracer, similar to what is shown in the Pixar Flow demo, and I’m wondering what the best way to go about it is.
I’ve had two separate general ideas for how to go about it but I’m not sure of the efficiency of either.
User struct for node values and input connections.
Use a struct containing the default values, and possible input connections using an buffer location for the next node in the network, and it’s type to know in what buffer to look in. These struct would form the network and passed to the callable program as an arg to drive the actual shader math.
This is kind of similar to how the advanced sample single shader works, just with more driving structs and programs.
Use instances of the callable program and bind custom variables.
The callable program itself would have no arguments, a single instance for use in a network would be generated and variables set for both the defalt values or programIDs representing connections to unique nodes.
There however have been several warnings about too many variables in scoped mode on an object, does that also apply to bindless callable programs. The docs say they only can see their own scope.
Anyone have an idea between these, or a better way altogether?