diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-11-28 17:30:35 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-11-28 18:07:34 +0300 |
commit | 1e43f0d74216cc936e6a708be321ba2c05b66ca1 (patch) | |
tree | 203cfcc239df6543980580c12c70773073e37f0d /intern/cycles/kernel/kernel_types.h | |
parent | 8919ed3a62137259f5c94d7ebd7cfdce452371b8 (diff) |
Cycles: Set of fixes for delayed SSS ray tracing
There were multiple issues which are solved now:
- It was possible that ray wouldn't be bounced off the BSSRDF, for example
when PDF or shader eval is zero. In this case PathState might have been
left in pre-bounced state which would have been gave incorrect shading
results.
This is solved by having separate PathState for each of the hits.
- Path radiance summing wasn't happening correct as well, indirect rays
were using wrong path radiance in the case when there were more than
one hit recorded.
This is now using a bit trickier state machine which calculates path
radiance for just SSS (both direct and indirect) and then sums it back
to the final radiance.
- Previous commit wasn't totally correct either and was an induced bug
due to wrong path state left from the "un-happened" ray bounce.
There should be no special case happening here, BSSRDFs will be replaced
with diffuse ones due to PATH_RAY_DIFFUSE_ANCESTOR flag.
- Merged back codebases for "delayed" and "immediate" indirect SSS ray
tracing, hopefully making it easier to maintain the codebase.
Sure this changes brings memory usage back by about 4-5%, but overall
it's still about 2x memory reduction for the experimental kernel here.
Thanks Brecht for the review!
Diffstat (limited to 'intern/cycles/kernel/kernel_types.h')
-rw-r--r-- | intern/cycles/kernel/kernel_types.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index b9869886a8f..017126d05e3 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -87,7 +87,6 @@ CCL_NAMESPACE_BEGIN /* Experimental on GPU */ #ifdef __KERNEL_EXPERIMENTAL__ #define __SUBSURFACE__ -#define __SUBSURFACE_DELAYED_INDIRECT__ #define __CMJ__ #endif @@ -770,11 +769,14 @@ struct SubsurfaceIntersection struct SubsurfaceIndirectRays { bool need_update_volume_stack; - PathState state; + bool tracing; + PathState state[BSSRDF_MAX_HITS]; + PathRadiance direct_L; int num_rays; Ray rays[BSSRDF_MAX_HITS]; float3 throughputs[BSSRDF_MAX_HITS]; + PathRadiance L[BSSRDF_MAX_HITS]; }; /* Constant Kernel Data |