Yes exactly! If you have a kernel in a graph whose parameters and inputs are unchanging, it's results will be caches from frame to frame, so in your case, the normals would only be computed once and you should see a good speed-up. If the kernels are wired serially, the second will not execute until the first is completed. This may change in the future if your kernels are point-wise (another reason to make sure your region-reasoning logic is correct!) in that case pixels will only be processed by the second kernel after the first kernel has processed those pixels, but the serialism will be at a much finer grain. Kevin
On a related note, is it possible to have two outputs from a kernel? For each pixel I would like to be able to output a 3 component position vector and 2 element normal vector to a second kernel in the graph that will shade the surface and apply basic screen space ambient occlusion.
Kernels support "fan out" in Pixel Bender Graphs (multiple inputs can be connected to the same output), but not multiple outputs right now. To do this in a Pixel Bender graph normally, you would have two nodes that would execute in parallel one and their results would be passed as inputs to the next nodes.
would that work for you?
Thanks Kevin. In my case the position and normal vectors are dependent on each other and so would have to be calculated in the same kernel.
I was thinking about another approach. Is it possible to change the route through multiple nodes using a parameter control? For instance I would have an initial kernel setting up the camera view vector for each pixel then the next node would be one of a selection in parallel that would render out different types of fractal. The parameter option would select which of the parallel nodes should be used.
I've found that trying to put too much in one kernel and using conditional statements can really slow things down, which is why I'd like to split them out.