While rendering a showcase of one of my sculpts, I noticed that while rendering the animation, the BVH rebuilt between frames, even though the only moving object was the camera. This happened even with “persistent images” checked(although I’m not really sure what that is supposed to do, and actually I was using spatial splits, not the standard BVH). I was wondering if there was any code currently that checked for this case, and if it would be something interesting to implement in Blender(I’ve been thinking for some time about getting to know the Blender codebase, and I would be very interested to explore things related to the BVH). I was also wondering if any sort of animated BVH optimization like http://www.cs.utah.edu/~thiago/papers/rotations.pdf was used in Blender, and I would be interested in working on implementing something like that as well.
This is expected currently. To optimize it, this patch would need to be made to work in the 2.8 design.
Thanks for the quick reply. I’m not sure what exactly is meant by “BlenderSync”, but do you think it would be simpler just to keep the scene/bvh around between frames for the special case that only the camera moves? This seems like a useful simple but special case.
Also, does Cycles have any optimized BVH updating like in the paper I linked?
@Animaniac888 maybe you can collaborate with @mathieu he was going to look Persistent Data now, he had to delay it because he was adapting some other things, but he may be able to guide you and save you a bit of time
It’s a super needed feature for animation, right now I have an overhead of 4 to 6 minutes per frame in a scene that uses 22Gb of RAM, and the actual render time is around 1 to 2 minutes… you can imagine how much time could be saved with this!
The general case is not that much more complicated than the special case, updating just the camera correctly is not trivial.
We do basic BVH refitting, but not tree rotations as described in that paper.
I see, thanks. I guess I’ll start poking my head around the code base and examining the above pull request.
I’m very happy if @Animaniac888 does it. Then it will be available quickly to all users. My ToDo list is big enough, so I will still have things to do I think already porting the existing patch to 2.8x will be a good start. Then a way to have quick updates in the viewport when doing uniform scaling, rotation or translations of objects would be awesome.
Do you think I could chat with you a bit for some guidance on how to get started with this? I haven’t yet delved into the codebase and I think some direction could save me a lot of time.
I’m a bit busy right now, but you can PM me on Blenderartists if you want next week.
Awesome! Count with me to test this as soon as you have something on the works, I have a big scene for animation so it’s the perfect candidate to test this for stability and performance
I implemented that tree rotations paper in my c# bvh. It’s really effective. It’s also simple to code, especially if a bvh node only holds one object. Hit me up if you have questions.
We are moving to Embree so are not likely to do these kinds of changes to our own BVH building implementation anymore, instead we’ll rely on whatever is available in Embree.
@brecht is Embree actually worth having as the standard? I mean, we loose quite a bit of control that way, right? Is Embree noticably faster?