Commit Graph

6 Commits

Author SHA1 Message Date
Sergey Sharybin
7778f0ff20 Cycles: Fix MSVC which desn't like condition to be split by preprocessor 2014-12-29 21:10:37 +05:00
Sergey Sharybin
4088fad6dd Cycles: Add asserts around BVH stack pushes
This way we're kind of safer to troubleshoot possible stack overflow issues.
2014-12-29 14:02:15 +05:00
Sergey Sharybin
40517283ca Cycles: Bump stack size for QBVH traversal code
Traversal now can push up to 2x of nodes to the stack, so need some tweaks
to the stack size.
2014-12-29 13:37:18 +05:00
Sergey Sharybin
91bbaaa271 Cycles: Fix visibility check for instanced nodes
The issue is that only instance node contains proper visibility flags,
nodes from instanced BVH are not correct.
2014-12-27 23:33:50 +05:00
Sergey Sharybin
cd095aae13 Cycles: Distance optimization for QBVH
This commit implements heuristic which allows to skip nodes pushed to the stack
from intersection if distance to them is larger than the distance to the current
intersection.

This should solve speed regression which i didn't notice in the original QBVH
commit (which could have because i had WIP version of this patch applied in my
local branch).

From quick tests speed seems to be much closer to what is was with regular BVH.

There's still some possible code cleanup, but they'll need a bit of assembly
code check and now i want to make it so artists can happily use Cycles over the
holidays.
2014-12-25 22:40:02 +05:00
Sergey Sharybin
03f28553ff Cycles: Implement QBVH tree traversal
This commit implements traversal for QBVH tree, which is based on the old loop
code for traversal itself and Embree for node intersection.

This commit also does some changes to the loop inspired by Embree:

- Visibility flags are only checked for primitives.

  Doing visibility check for every node cost quite reasonable amount of time
  and in most cases those checks are true-positive.

  Other idea here would be to do visibility checks for leaf nodes only, but
  this would need to be investigated further.

- For minimum hair width we extend all the nodes' bounding boxes.

  Again doing curve visibility check is quite costly for each of the nodes and
  those checks returns truth for most of the hierarchy anyway.

There are number of possible optimization still, but current state is good
enough in terms it makes rendering faster a little bit after recent watertight
commit.

Currently QBVH is only implemented for CPU with SSE2 support at least. All
other devices would need to be supported later (if that'd make sense from
performance point of view).

The code is enabled for compilation in kernel. but blender wouldn't use it
still.
2014-12-25 02:50:49 +05:00