Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
/*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Copyright 2011-2013 Blender Foundation
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
/* BSDF Eval
|
|
|
|
*
|
|
|
|
* BSDF evaluation result, split per BSDF type. This is used to accumulate
|
|
|
|
* render passes separately. */
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline void bsdf_eval_init(BsdfEval *eval, ClosureType type, float3 value, int use_light_pass)
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
{
|
|
|
|
#ifdef __PASSES__
|
|
|
|
eval->use_light_pass = use_light_pass;
|
|
|
|
|
|
|
|
if(eval->use_light_pass) {
|
|
|
|
eval->diffuse = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
eval->glossy = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
eval->transmission = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
eval->transparent = make_float3(0.0f, 0.0f, 0.0f);
|
2013-08-03 13:12:09 +00:00
|
|
|
eval->subsurface = make_float3(0.0f, 0.0f, 0.0f);
|
2014-09-05 14:17:24 +00:00
|
|
|
eval->scatter = make_float3(0.0f, 0.0f, 0.0f);
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
|
|
|
|
if(type == CLOSURE_BSDF_TRANSPARENT_ID)
|
|
|
|
eval->transparent = value;
|
2013-12-29 14:40:43 +00:00
|
|
|
else if(CLOSURE_IS_BSDF_DIFFUSE(type) || CLOSURE_IS_PHASE(type))
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
eval->diffuse = value;
|
|
|
|
else if(CLOSURE_IS_BSDF_GLOSSY(type))
|
|
|
|
eval->glossy = value;
|
2013-08-03 13:12:09 +00:00
|
|
|
else if(CLOSURE_IS_BSDF_TRANSMISSION(type))
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
eval->transmission = value;
|
2013-08-03 13:12:09 +00:00
|
|
|
else if(CLOSURE_IS_BSDF_BSSRDF(type))
|
|
|
|
eval->subsurface = value;
|
2014-09-05 14:17:24 +00:00
|
|
|
else if(CLOSURE_IS_PHASE(type))
|
|
|
|
eval->scatter = value;
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
eval->diffuse = value;
|
|
|
|
#else
|
|
|
|
*eval = value;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline void bsdf_eval_accum(BsdfEval *eval, ClosureType type, float3 value)
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
{
|
|
|
|
#ifdef __PASSES__
|
|
|
|
if(eval->use_light_pass) {
|
2014-09-05 14:17:24 +00:00
|
|
|
if(CLOSURE_IS_BSDF_DIFFUSE(type))
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
eval->diffuse += value;
|
|
|
|
else if(CLOSURE_IS_BSDF_GLOSSY(type))
|
|
|
|
eval->glossy += value;
|
2013-08-03 13:12:09 +00:00
|
|
|
else if(CLOSURE_IS_BSDF_TRANSMISSION(type))
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
eval->transmission += value;
|
2013-08-03 13:12:09 +00:00
|
|
|
else if(CLOSURE_IS_BSDF_BSSRDF(type))
|
|
|
|
eval->subsurface += value;
|
2014-09-05 14:17:24 +00:00
|
|
|
else if(CLOSURE_IS_PHASE(type))
|
|
|
|
eval->scatter += value;
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
|
|
|
|
/* skipping transparent, this function is used by for eval(), will be zero then */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
eval->diffuse += value;
|
|
|
|
#else
|
|
|
|
*eval += value;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline bool bsdf_eval_is_zero(BsdfEval *eval)
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
{
|
|
|
|
#ifdef __PASSES__
|
|
|
|
if(eval->use_light_pass) {
|
|
|
|
return is_zero(eval->diffuse)
|
|
|
|
&& is_zero(eval->glossy)
|
|
|
|
&& is_zero(eval->transmission)
|
2013-08-03 13:12:09 +00:00
|
|
|
&& is_zero(eval->transparent)
|
2014-09-05 14:17:24 +00:00
|
|
|
&& is_zero(eval->subsurface)
|
|
|
|
&& is_zero(eval->scatter);
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
return is_zero(eval->diffuse);
|
|
|
|
#else
|
|
|
|
return is_zero(*eval);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline void bsdf_eval_mul(BsdfEval *eval, float3 value)
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
{
|
|
|
|
#ifdef __PASSES__
|
|
|
|
if(eval->use_light_pass) {
|
|
|
|
eval->diffuse *= value;
|
|
|
|
eval->glossy *= value;
|
|
|
|
eval->transmission *= value;
|
2013-08-03 13:12:09 +00:00
|
|
|
eval->subsurface *= value;
|
2014-09-05 14:17:24 +00:00
|
|
|
eval->scatter *= value;
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
|
|
|
|
/* skipping transparent, this function is used by for eval(), will be zero then */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
eval->diffuse *= value;
|
|
|
|
#else
|
|
|
|
*eval *= value;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Path Radiance
|
|
|
|
*
|
|
|
|
* We accumulate different render passes separately. After summing at the end
|
2014-08-02 06:53:52 +00:00
|
|
|
* to get the combined result, it should be identical. We definite directly
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
* visible as the first non-transparent hit, while indirectly visible are the
|
|
|
|
* bounces after that. */
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline void path_radiance_init(PathRadiance *L, int use_light_pass)
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
{
|
|
|
|
/* clear all */
|
|
|
|
#ifdef __PASSES__
|
|
|
|
L->use_light_pass = use_light_pass;
|
|
|
|
|
|
|
|
if(use_light_pass) {
|
|
|
|
L->indirect = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
L->direct_throughput = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
L->direct_emission = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
|
|
|
|
L->color_diffuse = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
L->color_glossy = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
L->color_transmission = make_float3(0.0f, 0.0f, 0.0f);
|
2013-08-03 13:12:09 +00:00
|
|
|
L->color_subsurface = make_float3(0.0f, 0.0f, 0.0f);
|
2014-09-05 14:17:24 +00:00
|
|
|
L->color_scatter = make_float3(0.0f, 0.0f, 0.0f);
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
|
|
|
|
L->direct_diffuse = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
L->direct_glossy = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
L->direct_transmission = make_float3(0.0f, 0.0f, 0.0f);
|
2013-08-03 13:12:09 +00:00
|
|
|
L->direct_subsurface = make_float3(0.0f, 0.0f, 0.0f);
|
2014-09-05 14:17:24 +00:00
|
|
|
L->direct_scatter = make_float3(0.0f, 0.0f, 0.0f);
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
|
|
|
|
L->indirect_diffuse = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
L->indirect_glossy = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
L->indirect_transmission = make_float3(0.0f, 0.0f, 0.0f);
|
2013-08-03 13:12:09 +00:00
|
|
|
L->indirect_subsurface = make_float3(0.0f, 0.0f, 0.0f);
|
2014-09-05 14:17:24 +00:00
|
|
|
L->indirect_scatter = make_float3(0.0f, 0.0f, 0.0f);
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
|
2013-01-15 19:17:51 +00:00
|
|
|
L->path_diffuse = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
L->path_glossy = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
L->path_transmission = make_float3(0.0f, 0.0f, 0.0f);
|
2013-08-03 13:12:09 +00:00
|
|
|
L->path_subsurface = make_float3(0.0f, 0.0f, 0.0f);
|
2014-09-05 14:17:24 +00:00
|
|
|
L->path_scatter = make_float3(0.0f, 0.0f, 0.0f);
|
2013-01-15 19:17:51 +00:00
|
|
|
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
L->emission = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
L->background = make_float3(0.0f, 0.0f, 0.0f);
|
2012-02-28 16:45:08 +00:00
|
|
|
L->ao = make_float3(0.0f, 0.0f, 0.0f);
|
2012-03-28 10:39:21 +00:00
|
|
|
L->shadow = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
|
2013-06-07 12:45:26 +00:00
|
|
|
L->mist = 0.0f;
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
L->emission = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
#else
|
|
|
|
*L = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline void path_radiance_bsdf_bounce(PathRadiance *L, float3 *throughput,
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
BsdfEval *bsdf_eval, float bsdf_pdf, int bounce, int bsdf_label)
|
|
|
|
{
|
|
|
|
float inverse_pdf = 1.0f/bsdf_pdf;
|
|
|
|
|
|
|
|
#ifdef __PASSES__
|
|
|
|
if(L->use_light_pass) {
|
2012-03-20 16:16:17 +00:00
|
|
|
if(bounce == 0 && !(bsdf_label & LABEL_TRANSPARENT)) {
|
|
|
|
/* first on directly visible surface */
|
|
|
|
float3 value = *throughput*inverse_pdf;
|
|
|
|
|
2013-01-15 19:17:51 +00:00
|
|
|
L->path_diffuse = bsdf_eval->diffuse*value;
|
|
|
|
L->path_glossy = bsdf_eval->glossy*value;
|
|
|
|
L->path_transmission = bsdf_eval->transmission*value;
|
2013-08-03 13:12:09 +00:00
|
|
|
L->path_subsurface = bsdf_eval->subsurface*value;
|
2014-09-05 14:17:24 +00:00
|
|
|
L->path_scatter = bsdf_eval->scatter*value;
|
2012-03-20 16:16:17 +00:00
|
|
|
|
2014-09-05 14:17:24 +00:00
|
|
|
*throughput = L->path_diffuse + L->path_glossy + L->path_transmission + L->path_subsurface + L->path_scatter;
|
2012-03-20 16:16:17 +00:00
|
|
|
|
|
|
|
L->direct_throughput = *throughput;
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-03-20 16:16:17 +00:00
|
|
|
/* transparent bounce before first hit, or indirectly visible through BSDF */
|
2014-09-05 14:17:24 +00:00
|
|
|
float3 sum = (bsdf_eval->diffuse + bsdf_eval->glossy + bsdf_eval->transmission + bsdf_eval->transparent +
|
|
|
|
bsdf_eval->subsurface + bsdf_eval->scatter) * inverse_pdf;
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
*throughput *= sum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*throughput *= bsdf_eval->diffuse*inverse_pdf;
|
|
|
|
#else
|
|
|
|
*throughput *= *bsdf_eval*inverse_pdf;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline void path_radiance_accum_emission(PathRadiance *L, float3 throughput, float3 value, int bounce)
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
{
|
|
|
|
#ifdef __PASSES__
|
|
|
|
if(L->use_light_pass) {
|
|
|
|
if(bounce == 0)
|
|
|
|
L->emission += throughput*value;
|
|
|
|
else if(bounce == 1)
|
|
|
|
L->direct_emission += throughput*value;
|
|
|
|
else
|
|
|
|
L->indirect += throughput*value;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
L->emission += throughput*value;
|
|
|
|
#else
|
|
|
|
*L += throughput*value;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline void path_radiance_accum_ao(PathRadiance *L, float3 throughput, float3 alpha, float3 bsdf, float3 ao, int bounce)
|
2012-02-28 16:45:08 +00:00
|
|
|
{
|
|
|
|
#ifdef __PASSES__
|
|
|
|
if(L->use_light_pass) {
|
|
|
|
if(bounce == 0) {
|
|
|
|
/* directly visible lighting */
|
|
|
|
L->direct_diffuse += throughput*bsdf*ao;
|
2013-09-17 13:22:42 +00:00
|
|
|
L->ao += alpha*throughput*ao;
|
2012-02-28 16:45:08 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* indirectly visible lighting after BSDF bounce */
|
|
|
|
L->indirect += throughput*bsdf*ao;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
L->emission += throughput*bsdf*ao;
|
|
|
|
#else
|
|
|
|
*L += throughput*bsdf*ao;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline void path_radiance_accum_light(PathRadiance *L, float3 throughput, BsdfEval *bsdf_eval, float3 shadow, float shadow_fac, int bounce, bool is_lamp)
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
{
|
|
|
|
#ifdef __PASSES__
|
|
|
|
if(L->use_light_pass) {
|
|
|
|
if(bounce == 0) {
|
|
|
|
/* directly visible lighting */
|
2012-03-28 10:39:21 +00:00
|
|
|
L->direct_diffuse += throughput*bsdf_eval->diffuse*shadow;
|
|
|
|
L->direct_glossy += throughput*bsdf_eval->glossy*shadow;
|
|
|
|
L->direct_transmission += throughput*bsdf_eval->transmission*shadow;
|
2013-08-03 13:12:09 +00:00
|
|
|
L->direct_subsurface += throughput*bsdf_eval->subsurface*shadow;
|
2014-09-05 14:17:24 +00:00
|
|
|
L->direct_scatter += throughput*bsdf_eval->scatter*shadow;
|
2012-03-28 10:39:21 +00:00
|
|
|
|
|
|
|
if(is_lamp) {
|
2013-02-05 13:33:24 +00:00
|
|
|
L->shadow.x += shadow.x*shadow_fac;
|
|
|
|
L->shadow.y += shadow.y*shadow_fac;
|
|
|
|
L->shadow.z += shadow.z*shadow_fac;
|
2012-03-28 10:39:21 +00:00
|
|
|
}
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* indirectly visible lighting after BSDF bounce */
|
2014-09-05 14:17:24 +00:00
|
|
|
float3 sum = bsdf_eval->diffuse + bsdf_eval->glossy + bsdf_eval->transmission + bsdf_eval->subsurface + bsdf_eval->scatter;
|
2012-03-28 10:39:21 +00:00
|
|
|
L->indirect += throughput*sum*shadow;
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2012-03-28 10:39:21 +00:00
|
|
|
L->emission += throughput*bsdf_eval->diffuse*shadow;
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
#else
|
2012-03-28 10:39:21 +00:00
|
|
|
*L += throughput*(*bsdf_eval)*shadow;
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline void path_radiance_accum_background(PathRadiance *L, float3 throughput, float3 value, int bounce)
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
{
|
|
|
|
#ifdef __PASSES__
|
|
|
|
if(L->use_light_pass) {
|
|
|
|
if(bounce == 0)
|
|
|
|
L->background += throughput*value;
|
|
|
|
else if(bounce == 1)
|
|
|
|
L->direct_emission += throughput*value;
|
|
|
|
else
|
|
|
|
L->indirect += throughput*value;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
L->emission += throughput*value;
|
|
|
|
#else
|
|
|
|
*L += throughput*value;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline void path_radiance_sum_indirect(PathRadiance *L)
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
{
|
2013-01-15 20:13:19 +00:00
|
|
|
#ifdef __PASSES__
|
2013-01-15 19:17:51 +00:00
|
|
|
/* this division is a bit ugly, but means we only have to keep track of
|
|
|
|
* only a single throughput further along the path, here we recover just
|
2013-08-03 21:45:57 +00:00
|
|
|
* the indirect path that is not influenced by any particular BSDF type */
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
if(L->use_light_pass) {
|
|
|
|
L->direct_emission = safe_divide_color(L->direct_emission, L->direct_throughput);
|
2013-01-15 19:17:51 +00:00
|
|
|
L->direct_diffuse += L->path_diffuse*L->direct_emission;
|
|
|
|
L->direct_glossy += L->path_glossy*L->direct_emission;
|
|
|
|
L->direct_transmission += L->path_transmission*L->direct_emission;
|
2013-08-03 13:12:09 +00:00
|
|
|
L->direct_subsurface += L->path_subsurface*L->direct_emission;
|
2014-09-05 14:17:24 +00:00
|
|
|
L->direct_scatter += L->path_scatter*L->direct_emission;
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
|
|
|
|
L->indirect = safe_divide_color(L->indirect, L->direct_throughput);
|
2013-01-15 19:17:51 +00:00
|
|
|
L->indirect_diffuse += L->path_diffuse*L->indirect;
|
|
|
|
L->indirect_glossy += L->path_glossy*L->indirect;
|
|
|
|
L->indirect_transmission += L->path_transmission*L->indirect;
|
2013-08-03 13:12:09 +00:00
|
|
|
L->indirect_subsurface += L->path_subsurface*L->indirect;
|
2014-09-05 14:17:24 +00:00
|
|
|
L->indirect_scatter += L->path_scatter*L->indirect;
|
2013-01-15 19:17:51 +00:00
|
|
|
}
|
2013-01-15 20:13:19 +00:00
|
|
|
#endif
|
2013-01-15 19:17:51 +00:00
|
|
|
}
|
|
|
|
|
2013-11-15 23:17:10 +00:00
|
|
|
ccl_device_inline void path_radiance_reset_indirect(PathRadiance *L)
|
2013-01-15 19:17:51 +00:00
|
|
|
{
|
2013-01-15 20:13:19 +00:00
|
|
|
#ifdef __PASSES__
|
2013-01-15 19:17:51 +00:00
|
|
|
if(L->use_light_pass) {
|
|
|
|
L->path_diffuse = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
L->path_glossy = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
L->path_transmission = make_float3(0.0f, 0.0f, 0.0f);
|
2013-08-03 13:12:09 +00:00
|
|
|
L->path_subsurface = make_float3(0.0f, 0.0f, 0.0f);
|
2014-09-05 14:17:24 +00:00
|
|
|
L->path_scatter = make_float3(0.0f, 0.0f, 0.0f);
|
2013-01-15 19:17:51 +00:00
|
|
|
|
|
|
|
L->direct_emission = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
L->indirect = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
}
|
2013-01-15 20:13:19 +00:00
|
|
|
#endif
|
2013-01-15 19:17:51 +00:00
|
|
|
}
|
|
|
|
|
2014-02-10 20:44:49 +00:00
|
|
|
ccl_device_inline float3 path_radiance_clamp_and_sum(KernelGlobals *kg, PathRadiance *L)
|
2013-01-15 19:17:51 +00:00
|
|
|
{
|
2014-02-11 16:44:21 +00:00
|
|
|
float3 L_sum, L_direct, L_indirect;
|
|
|
|
float clamp_direct = kernel_data.integrator.sample_clamp_direct;
|
|
|
|
float clamp_indirect = kernel_data.integrator.sample_clamp_indirect;
|
|
|
|
|
|
|
|
/* Light Passes are used */
|
2013-01-15 19:17:51 +00:00
|
|
|
#ifdef __PASSES__
|
|
|
|
if(L->use_light_pass) {
|
|
|
|
path_radiance_sum_indirect(L);
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
|
2014-09-05 14:17:24 +00:00
|
|
|
L_direct = L->direct_diffuse + L->direct_glossy + L->direct_transmission + L->direct_subsurface + L->direct_scatter + L->emission;
|
|
|
|
L_indirect = L->indirect_diffuse + L->indirect_glossy + L->indirect_transmission + L->indirect_subsurface + L->indirect_scatter;
|
2014-02-11 16:44:21 +00:00
|
|
|
|
2014-02-11 11:18:10 +00:00
|
|
|
if(!kernel_data.background.transparent)
|
|
|
|
L_direct += L->background;
|
2014-02-10 20:44:49 +00:00
|
|
|
|
2014-02-11 16:44:21 +00:00
|
|
|
L_sum = L_direct + L_indirect;
|
|
|
|
float sum = fabsf((L_sum).x) + fabsf((L_sum).y) + fabsf((L_sum).z);
|
|
|
|
|
|
|
|
/* Reject invalid value */
|
|
|
|
if(!isfinite(sum)) {
|
|
|
|
L_sum = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
|
|
|
|
L->direct_diffuse = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
L->direct_glossy = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
L->direct_transmission = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
L->direct_subsurface = make_float3(0.0f, 0.0f, 0.0f);
|
2014-09-05 14:17:24 +00:00
|
|
|
L->direct_scatter = make_float3(0.0f, 0.0f, 0.0f);
|
2014-02-11 16:44:21 +00:00
|
|
|
|
|
|
|
L->indirect_diffuse = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
L->indirect_glossy = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
L->indirect_transmission = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
L->indirect_subsurface = make_float3(0.0f, 0.0f, 0.0f);
|
2014-09-05 14:17:24 +00:00
|
|
|
L->indirect_scatter = make_float3(0.0f, 0.0f, 0.0f);
|
2014-02-10 20:44:49 +00:00
|
|
|
|
2014-02-11 16:44:21 +00:00
|
|
|
L->emission = make_float3(0.0f, 0.0f, 0.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Clamp direct and indirect samples */
|
|
|
|
#ifdef __CLAMP_SAMPLE__
|
|
|
|
else if(sum > clamp_direct || sum > clamp_indirect) {
|
2014-02-10 20:44:49 +00:00
|
|
|
float scale;
|
|
|
|
|
|
|
|
/* Direct */
|
|
|
|
float sum_direct = fabsf(L_direct.x) + fabsf(L_direct.y) + fabsf(L_direct.z);
|
|
|
|
if(sum_direct > clamp_direct) {
|
|
|
|
scale = clamp_direct/sum_direct;
|
|
|
|
L_direct *= scale;
|
|
|
|
|
|
|
|
L->direct_diffuse *= scale;
|
|
|
|
L->direct_glossy *= scale;
|
|
|
|
L->direct_transmission *= scale;
|
|
|
|
L->direct_subsurface *= scale;
|
2014-09-05 14:17:24 +00:00
|
|
|
L->direct_scatter *= scale;
|
2014-02-10 20:44:49 +00:00
|
|
|
L->emission *= scale;
|
2014-02-11 11:18:10 +00:00
|
|
|
L->background *= scale;
|
2014-02-10 20:44:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Indirect */
|
|
|
|
float sum_indirect = fabsf(L_indirect.x) + fabsf(L_indirect.y) + fabsf(L_indirect.z);
|
|
|
|
if(sum_indirect > clamp_indirect) {
|
|
|
|
scale = clamp_indirect/sum_indirect;
|
|
|
|
L_indirect *= scale;
|
|
|
|
|
|
|
|
L->indirect_diffuse *= scale;
|
|
|
|
L->indirect_glossy *= scale;
|
|
|
|
L->indirect_transmission *= scale;
|
|
|
|
L->indirect_subsurface *= scale;
|
2014-09-05 14:17:24 +00:00
|
|
|
L->indirect_scatter *= scale;
|
2014-02-10 20:44:49 +00:00
|
|
|
}
|
2014-02-11 16:44:21 +00:00
|
|
|
|
|
|
|
/* Sum again, after clamping */
|
|
|
|
L_sum = L_direct + L_indirect;
|
2014-02-10 20:44:49 +00:00
|
|
|
}
|
|
|
|
#endif
|
Cycles: merging features from tomato branch.
=== BVH build time optimizations ===
* BVH building was multithreaded. Not all building is multithreaded, packing
and the initial bounding/splitting is still single threaded, but recursive
splitting is, which was the main bottleneck.
* Object splitting now uses binning rather than sorting of all elements, using
code from the Embree raytracer from Intel.
http://software.intel.com/en-us/articles/embree-photo-realistic-ray-tracing-kernels/
* Other small changes to avoid allocations, pack memory more tightly, avoid
some unnecessary operations, ...
These optimizations do not work yet when Spatial Splits are enabled, for that
more work is needed. There's also other optimizations still needed, in
particular for the case of many low poly objects, the packing step and node
memory allocation.
BVH raytracing time should remain about the same, but BVH build time should be
significantly reduced, test here show speedup of about 5x to 10x on a dual core
and 5x to 25x on an 8-core machine, depending on the scene.
=== Threads ===
Centralized task scheduler for multithreading, which is basically the
CPU device threading code wrapped into something reusable.
Basic idea is that there is a single TaskScheduler that keeps a pool of threads,
one for each core. Other places in the code can then create a TaskPool that they
can drop Tasks in to be executed by the scheduler, and wait for them to complete
or cancel them early.
=== Normal ====
Added a Normal output to the texture coordinate node. This currently
gives the object space normal, which is the same under object animation.
In the future this might become a "generated" normal so it's also stable for
deforming objects, but for now it's already useful for non-deforming objects.
=== Render Layers ===
Per render layer Samples control, leaving it to 0 will use the common scene
setting.
Environment pass will now render environment even if film is set to transparent.
Exclude Layers" added. Scene layers (all object that influence the render,
directly or indirectly) are shared between all render layers. However sometimes
it's useful to leave out some object influence for a particular render layer.
That's what this option allows you to do.
=== Filter Glossy ===
When using a value higher than 0.0, this will blur glossy reflections after
blurry bounces, to reduce noise at the cost of accuracy. 1.0 is a good
starting value to tweak.
Some light paths have a low probability of being found while contributing much
light to the pixel. As a result these light paths will be found in some pixels
and not in others, causing fireflies. An example of such a difficult path might
be a small light that is causing a small specular highlight on a sharp glossy
material, which we are seeing through a rough glossy material. With path tracing
it is difficult to find the specular highlight, but if we increase the roughness
on the material the highlight gets bigger and softer, and so easier to find.
Often this blurring will be hardly noticeable, because we are seeing it through
a blurry material anyway, but there are also cases where this will lead to a
loss of detail in lighting.
2012-04-28 08:53:59 +00:00
|
|
|
|
|
|
|
return L_sum;
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
}
|
2014-02-11 16:44:21 +00:00
|
|
|
|
|
|
|
/* No Light Passes */
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
else
|
2014-02-11 16:44:21 +00:00
|
|
|
L_sum = L->emission;
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
#else
|
2014-02-11 16:44:21 +00:00
|
|
|
L_sum = *L;
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
#endif
|
2012-04-05 15:17:45 +00:00
|
|
|
|
2014-02-11 16:44:21 +00:00
|
|
|
/* Reject invalid value */
|
|
|
|
float sum = fabsf((L_sum).x) + fabsf((L_sum).y) + fabsf((L_sum).z);
|
|
|
|
if(!isfinite(sum))
|
|
|
|
L_sum = make_float3(0.0f, 0.0f, 0.0f);
|
2012-04-05 15:17:45 +00:00
|
|
|
|
2014-02-11 16:44:21 +00:00
|
|
|
return L_sum;
|
2012-04-05 15:17:45 +00:00
|
|
|
}
|
|
|
|
|
2014-01-02 21:05:07 +00:00
|
|
|
ccl_device_inline void path_radiance_accum_sample(PathRadiance *L, PathRadiance *L_sample, int num_samples)
|
|
|
|
{
|
|
|
|
float fac = 1.0f/num_samples;
|
|
|
|
|
2014-05-11 14:36:18 +00:00
|
|
|
#ifdef __PASSES__
|
2014-01-02 21:05:07 +00:00
|
|
|
L->direct_diffuse += L_sample->direct_diffuse*fac;
|
|
|
|
L->direct_glossy += L_sample->direct_glossy*fac;
|
|
|
|
L->direct_transmission += L_sample->direct_transmission*fac;
|
|
|
|
L->direct_subsurface += L_sample->direct_subsurface*fac;
|
2014-09-05 14:17:24 +00:00
|
|
|
L->direct_scatter += L_sample->direct_scatter*fac;
|
2014-01-02 21:05:07 +00:00
|
|
|
|
|
|
|
L->indirect_diffuse += L_sample->indirect_diffuse*fac;
|
|
|
|
L->indirect_glossy += L_sample->indirect_glossy*fac;
|
|
|
|
L->indirect_transmission += L_sample->indirect_transmission*fac;
|
|
|
|
L->indirect_subsurface += L_sample->indirect_subsurface*fac;
|
2014-09-05 14:17:24 +00:00
|
|
|
L->indirect_scatter += L_sample->indirect_scatter*fac;
|
2014-01-02 21:05:07 +00:00
|
|
|
|
|
|
|
L->emission += L_sample->emission*fac;
|
|
|
|
L->background += L_sample->background*fac;
|
|
|
|
L->ao += L_sample->ao*fac;
|
|
|
|
L->shadow += L_sample->shadow*fac;
|
|
|
|
L->mist += L_sample->mist*fac;
|
2014-05-11 14:36:18 +00:00
|
|
|
#else
|
|
|
|
*L += *L_sample * fac;
|
|
|
|
#endif
|
2014-01-02 21:05:07 +00:00
|
|
|
}
|
|
|
|
|
Cycles: Render Passes
Currently supported passes:
* Combined, Z, Normal, Object Index, Material Index, Emission, Environment,
Diffuse/Glossy/Transmission x Direct/Indirect/Color
Not supported yet:
* UV, Vector, Mist
Only enabled for CPU devices at the moment, will do GPU tweaks tommorrow,
also for environment importance sampling.
Documentation:
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Passes
2012-01-25 17:23:52 +00:00
|
|
|
CCL_NAMESPACE_END
|
|
|
|
|