Page MenuHome

Cycles: Record all possible volume intersections for SSS and camera checks
ClosedPublic

Authored by Thomas Dinges (dingto) on Apr 27 2015, 6:37 PM.

Details

Summary

This replaces sequential ray moving followed with scene intersection with single BVH traversal, which gives us all possible intersections.
Original patch by Sergey.

What I changed:

  • Update for latest master
  • Implemented code in kernel_path_subsurface_update_volume_stack()
  • Compile fix for GPU (geom_bvh_volume.h, line 105)

CPU works as expected, checked with 3 scenes:

  • Default cube with volume shader and camera inside. ~same rendertime as unpatched.
  • bmps.blend with volume shader on the mesh, camera inside. ~10% faster (58s -> 52s).
  • Also tested with blend file from T39823, that still works ok too. Did not compare performance here.

GPU should compile in theory, but CUDA 6.5 gives me a ACCESS_VIOLATION error and dies.

Diff Detail

Repository
rB Blender

Event Timeline

Thomas Dinges (dingto) retitled this revision from to Cycles: Record all possible volume intersections for SSS and camera checks.
Thomas Dinges (dingto) updated this object.
Thomas Dinges (dingto) added a project: Cycles.

benchmarks

loewe2

master
02:20.90

patch
02:19.19

volume emission

master
01.50.07

patch
01.44.82

zuggawood

master
01.43.24

patch
01.36.54

tonkinois

master
02.49.21

patch
02.47.39

head

master
03:53.58

patch
03.51.28

Refactored code to have different intersection functions for CPU / GPU.
GPU uses the existing volume intersection, CPU the new record all. New flag VOLUME_RECORD_ALL was added.

Issues: SSS / Volume code doesn't work for some reason, need to double check.

There's one missing crucial bit in this patch actually. The thing is, scene_intersect_volume_all() is not guaranteed to give intersections sorted by t. This could cause volume stack to be filled in the wrong order which depending on exact configuration of SSS/volume scene indeed could cause shading artifacts.

I've been trying to preserve isect array sorted by t in order to avoid calling qsort() but it ended up in some creepy code and it's probably simplier to use qsort. Number of intersections is not really huge, so there's chance expanded version of sorting will be used (similar to QBVH stack sort). That's easy to check tho.

In any case, i'd start with making sure intesrections are handled in proper order before looking further into SSS issues.

Pedantic: Don't use more tabs than on parent line when indenting wrapped lines ;)

/* Don't: */
<tab>some_long_function_name(bar,
<tab><tab><tab><tab>         thing);

/* Do: */
<tab>some_long_function_name(bar,
<tab>                        thing);

That will ensure good looking indentation in all editors.

Thomas Dinges (dingto) edited edge metadata.
  • Not sure about qsort, added it now, but still seems to not render the SSS / Fire test file from that bug report correctly.
  • Fixed indentation.

Updates for review.

This revision is now accepted and ready to land.Apr 29 2015, 11:03 PM
This revision was automatically updated to reflect the committed changes.