Raytrace modifications from the Render Branch.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 5 Feb 2011 13:41:29 +0000 (13:41 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sat, 5 Feb 2011 13:41:29 +0000 (13:41 +0000)
commit04299657a7eaee212b983b27bed6b66793f7a985
tree02dc6e965d8ef08135234da893a85ece7ef7ac2c
parent90cf78eb5409a77c912b90fb812a4391e31897ae
Raytrace modifications from the Render Branch.

These should not have any effect on render results, except in some cases with
you have overlapping faces, where the noise seems to be slightly reduced.

There are some performance improvements, for simple scenes I wouldn't expect
more than 5-10% to be cut off the render time, for sintel scenes we got about
50% on average, that's with millions of polygons on intel quad cores. This
because memory access / cache misses were the main bottleneck for those scenes,
and the optimizations improve that.

Interal changes:

* Remove RE_raytrace.h, raytracer is now only used by render engine again.
* Split non-public parts rayobject.h into rayobject_internal.h, hopefully
 makes it clearer how the API is used.
* Added rayintersection.h to contain some of the stuff from RE_raytrace.h
* Change Isect.vec/labda to Isect.dir/dist, previously vec was sometimes
  normalized and sometimes not, confusing... now dir is always normalized
  and dist contains the distance.
* Change VECCOPY and similar to BLI_math functions.
* Force inlining of auxiliary functions for ray-triangle/quad intersection,
  helps a few percentages.
* Reorganize svbvh code so all the traversal functions are in one file
* Don't do test for root so that push_childs can be inlined
* Make shadow a template parameter so it doesn't need to be runtime checked
* Optimization in raytree building, was computing bounding boxes more often
  than necessary.
* Leave out logf() factor in SAH, makes tree build quicker with no
  noticeable influence on raytracing on performance?
* Set max childs to 4, simplifies traversal code a bit, but also seems
  to help slightly in general.
* Store child pointers and child bb just as fixed arrays of size 4 in nodes,
  nearly all nodes have this many children, so overall it actually reduces
  memory usage a bit and avoids a pointer indirection.
32 files changed:
source/blender/blenkernel/intern/scene.c
source/blender/render/CMakeLists.txt
source/blender/render/extern/include/RE_raytrace.h [deleted file]
source/blender/render/extern/include/RE_shader_ext.h
source/blender/render/intern/include/raycounter.h
source/blender/render/intern/include/rayintersection.h [new file with mode: 0644]
source/blender/render/intern/include/rayobject.h
source/blender/render/intern/include/render_types.h
source/blender/render/intern/include/rendercore.h
source/blender/render/intern/include/volumetric.h
source/blender/render/intern/raytrace/bvh.h
source/blender/render/intern/raytrace/rayobject.cpp
source/blender/render/intern/raytrace/rayobject_blibvh.cpp [moved from source/blender/render/intern/source/rayobject_blibvh.c with 91% similarity]
source/blender/render/intern/raytrace/rayobject_empty.cpp [new file with mode: 0644]
source/blender/render/intern/raytrace/rayobject_hint.h
source/blender/render/intern/raytrace/rayobject_instance.cpp [moved from source/blender/render/intern/source/rayobject_instance.c with 79% similarity]
source/blender/render/intern/raytrace/rayobject_internal.h [new file with mode: 0644]
source/blender/render/intern/raytrace/rayobject_octree.cpp [moved from source/blender/render/intern/source/rayobject_octree.c with 95% similarity]
source/blender/render/intern/raytrace/rayobject_qbvh.cpp
source/blender/render/intern/raytrace/rayobject_raycounter.cpp [moved from source/blender/render/intern/source/rayobject_raycounter.c with 97% similarity]
source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
source/blender/render/intern/raytrace/rayobject_svbvh.cpp
source/blender/render/intern/raytrace/rayobject_vbvh.cpp
source/blender/render/intern/raytrace/reorganize.h
source/blender/render/intern/raytrace/svbvh.h
source/blender/render/intern/raytrace/vbvh.h
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/rayshade.c
source/blender/render/intern/source/rendercore.c
source/blender/render/intern/source/renderdatabase.c
source/blender/render/intern/source/volume_precache.c
source/blender/render/intern/source/volumetric.c