GSoC 2019: Embree BVH for GPU

Hi! I’m Alex, and I’m very interested in working on leveraging the Embree BVH for GPU rendering for Google Summer of Code. I’ll copy the project description from the ideas page verbatim for reference:

Benefits: Faster motion blur and GPU rendering, simpler code.

Description: We want to replace our own BVH builder with the one from Embree, and use it for both CPU and GPU. Embree already has CPU BVH traversal, but for GPU we need to copy the BVH to our own data structures. For faster motion blur the Cycles kernel also needs modified BVH traversal.

Tasks:

Implement converter from Embree BVH to Cycles BVH data structures.

Verify if Embree can export oriented bounding boxes and motion steps, and if needed improve Embree API.

Adjust Cycles kernel BVH traversal for faster motion blur.

Test performance and memory usage to compare to existing BVH, and fix any issues if needed.

Also, this seems to be the diff where Embree support was originally introduced and where it was originally suggested that Blender could leverage Embree’s BVH for non-Embree ray tracing.

Questions

I’m trying to understand as much as possible so that my proposal is as technically focused and direct as possible. At this stage, one clarification I would like is: what does it mean to adjust Cycles’ BVH traversal for faster motion blur?

Also, I’m wondering if I should contact Sergey Sharybin directly to ask questions regarding this as I believe he was the author of the original Embree integration and is listed as a potential mentor for this project. Would that be appropriate?

Best, Alex

4 Likes

NB Whilst I have done some work with cycles, I havent touched any of the BVH code, so my understanding may be totally incorrect!

What does it mean to adjust Cycles’ BVH traversal for faster motion blur?
IIRC, the code that Cycles uses to traverse the BVH, is currently custom code, not Embree based. This means adjusting the Cycles Code, to optimize the traversal for faster motion blur.

Also, I’m wondering if I should contact Sergey Sharybin directly to ask questions regarding this as I believe he was the author of the original Embree integration and is listed as a potential mentor for this project. Would that be appropriate?

I would post any questions / clarifications to the mailing list. Alternatively, Brecht visits these pages quite often and may pop his head in and reply.

1 Like

Stefan Werner is the author of the Embree integration.

Regarding motion blur, this might clarify it:
https://lists.blender.org/pipermail/bf-committers/2019-April/049923.html
https://lists.blender.org/pipermail/bf-committers/2019-April/049924.html

Posting questions here or on bf-committers is fine.

1 Like

I have a small question. I’ve been told OBBs are used in Cycles / BVH for hair, but I can’t seem to find where the OBB-related code is in Cycles. Where could I look?

EDIT: I believe Cycles BVH nodes have a transform matrix for this; I think this answers my question.

Also for anyone interested, I have a draft proposal here: https://docs.google.com/document/d/1VMPGCv9TpQvCjpQOCn0VLbIlsB0_9tTPLpF14Y_qTWA/edit?usp=sharing

I’m not expecting complete feedback as we’re just a few days from the submission deadline, but any feedback would still be very appreciated :slight_smile:

EDIT: obsoleted this link as working on a new final revision

1 Like

This is a really good quality proposal, I don’t have any comments on it.

2 Likes

Hi all, I’m Abhilash from India. I came across by way of gsoc summer projects and had a questions regarding the fastest motion blur. I had studied about the motion blur SAH heuristic and since fastest blur depended in the splits in bvh to produce optimal spatial and temporal primitives based on the reward function, I wanted to know if my concept is right methodically? Plus I have sent a proposal based on my studies and codes if anyone is interested. Thanks

BVH builders indeed decide where to split based on some cost (reward) function. For best performance splitting across time is needed, that’s part of what the Embree code has which Cycles itself doesn’t.

I’m not sure I understood the question though.

Yes that was the question. I tried a motion blur SAH heuristic based on probabilistic distribution to find optimal temporal splits. I wanted to confirm the validity of the idea. Thanks
I have submitted the proposal with detailed codebase for evaluation. Thanks for the response.

1 Like