Dvorak wrote:GoatFoam wrote:Are you requesting samples asynchronously or calling the ray tracer from the controller and waiting for results?
Are you thinking of a distributed system? :)
Might be....
There is also the issue of interactivity, which may help even on a single CPU.
My thinking is that you could structure the system thusly:
reconstructor + UI <-> sample_farmer <-> ray tracer(s).
So the reconstructor runs in 1 thread, the sample_farmer runs in another.
The interface between the sample_farmer and the reconstructor could be as simple as 2 thread safe queues and a query function.
So the reconstructor queries the farmer and asks it how much work it can take on. It then prepares some jobs (presumably a number of rays per job) and pushes them to the sample farmer. Samples come back on the other queue when they are finished.
I'm thinking that a job would have to consist of a set of ray definitions and a time stamp so the reconstructor can put them in the right place in the deep buffer.
That way you keep things running smoothly even on slow processors, because the ray tracer doesn't request any more work than it can actually do, and you can scale it to any number of cpus or a distributed system by rewriting the back end of the sample farmer.
It might even be better to have the sample farmer object explicitly demand work from the reconstructor. If I remember correctly it is a matter of randomly sampling your kd tree or quadtree, so there is no problem with asking for a number of samples at once.