Hi,
I'd like to be able to create some data for each bucket that renders and to clean it up when it's done. I'd prefer it to be at that level of granularity rather than per thread (though if there's an option for that, it'd be better than nothing) as I know it won't be needed within other buckets and each bucket is single threaded with a shorter lifetime. (Though, of course, just clearing and reusing would be even nicer if it's made per thread, but reset at the start of each bucket).
It's in a camera shader, if that's relevant. Are there APIs around that would facilitate this? I've not managed to find anything obvious. Couldn't find documentation on how calls to node_initialize etc relate to threads. Do any of those happen to be done per thread?
As a worst case, even been able to get the number of threads and bucket size would be enough for me to use. Perhaps just number of threads would be enough, but for that I would need to know if pixels are completed one at a time (i.e. whether all samples within a given pixel are made sequentially or if all samples within a bucket are randomly processed within a thread)
EDIT: Now, I've gotten to the point where querying bucket size would be enough for me to get what I want. So, turns out it's in options, but only when it's non-default of 64. So I can access that, combined with using thread_local, I can get something that'll do the trick for me here.
EDIT2: Hmmm, okay, I've noticed that a single thread can have more than one bucket going at once. Is that hard coded? (if so how many) Or is it variable, if so, how can I access it?
EDIT3: the best thing for my particular case would be if I can get an index per sample within a pixel. Is that available anywhere? That's all I'm trying to generate with all this.
Cheers,
Alan.
Solved! Go to Solution.
Solved by Stephen.Blair. Go to Solution.
An answer to the original question, before the three edits:
You could write a dummy driver. You'll get callbacks for each bucket at different stages, and from 6.1 you can connect the driver to the next one using something like this
custom_driver { name my_custom_driver } driver_exr # or any other { input my_custom_driver ... }
Thanks, Max. I don't have AtShaderGlobals because this is in a camera node and create_camera_ray has no shader globals. Is there a way to access a shader globals in a camera shader I've missed somewhere? That would be awesome news.
Thanks, Stephen. This would need to be added in manually to each render pass, correct? There's no mtoa callbacks or (even better, at Arnold level) for it to register itself for all of them?
Not sure if notifications for replies to comments go out, so just writing here, hoping it'll trigger notifications.
It would have to be manual.
This is actually how the new imager nodes are hooked up. The user adds imagers, and we set the input parameters to chain them together.