Merge branch 'blender-v3.0-release'
This commit is contained in:
commit
1b55b911f2
|
@ -606,6 +606,19 @@ void BlenderSession::bake(BL::Depsgraph &b_depsgraph_,
|
||||||
pass->set_type(bake_type_to_pass(bake_type, bake_filter));
|
pass->set_type(bake_type_to_pass(bake_type, bake_filter));
|
||||||
pass->set_include_albedo((bake_filter & BL::BakeSettings::pass_filter_COLOR));
|
pass->set_include_albedo((bake_filter & BL::BakeSettings::pass_filter_COLOR));
|
||||||
|
|
||||||
|
if (pass->get_type() == PASS_COMBINED) {
|
||||||
|
/* Filtering settings for combined pass. */
|
||||||
|
Integrator *integrator = scene->integrator;
|
||||||
|
integrator->set_use_direct_light((bake_filter & BL::BakeSettings::pass_filter_DIRECT) != 0);
|
||||||
|
integrator->set_use_indirect_light((bake_filter & BL::BakeSettings::pass_filter_INDIRECT) !=
|
||||||
|
0);
|
||||||
|
integrator->set_use_diffuse((bake_filter & BL::BakeSettings::pass_filter_DIFFUSE) != 0);
|
||||||
|
integrator->set_use_glossy((bake_filter & BL::BakeSettings::pass_filter_GLOSSY) != 0);
|
||||||
|
integrator->set_use_transmission((bake_filter & BL::BakeSettings::pass_filter_TRANSMISSION) !=
|
||||||
|
0);
|
||||||
|
integrator->set_use_emission((bake_filter & BL::BakeSettings::pass_filter_EMIT) != 0);
|
||||||
|
}
|
||||||
|
|
||||||
session->set_display_driver(nullptr);
|
session->set_display_driver(nullptr);
|
||||||
session->set_output_driver(make_unique<BlenderOutputDriver>(b_engine));
|
session->set_output_driver(make_unique<BlenderOutputDriver>(b_engine));
|
||||||
|
|
||||||
|
|
|
@ -33,62 +33,72 @@ CCL_NAMESPACE_BEGIN
|
||||||
* them separately. */
|
* them separately. */
|
||||||
|
|
||||||
ccl_device_inline void bsdf_eval_init(ccl_private BsdfEval *eval,
|
ccl_device_inline void bsdf_eval_init(ccl_private BsdfEval *eval,
|
||||||
const bool is_diffuse,
|
const ClosureType closure_type,
|
||||||
float3 value)
|
float3 value)
|
||||||
{
|
{
|
||||||
eval->diffuse = zero_float3();
|
eval->diffuse = zero_float3();
|
||||||
eval->glossy = zero_float3();
|
eval->glossy = zero_float3();
|
||||||
|
|
||||||
if (is_diffuse) {
|
if (CLOSURE_IS_BSDF_DIFFUSE(closure_type)) {
|
||||||
eval->diffuse = value;
|
eval->diffuse = value;
|
||||||
}
|
}
|
||||||
else {
|
else if (CLOSURE_IS_BSDF_GLOSSY(closure_type)) {
|
||||||
eval->glossy = value;
|
eval->glossy = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eval->sum = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
ccl_device_inline void bsdf_eval_accum(ccl_private BsdfEval *eval,
|
ccl_device_inline void bsdf_eval_accum(ccl_private BsdfEval *eval,
|
||||||
const bool is_diffuse,
|
const ClosureType closure_type,
|
||||||
float3 value,
|
float3 value)
|
||||||
float mis_weight)
|
|
||||||
{
|
{
|
||||||
value *= mis_weight;
|
if (CLOSURE_IS_BSDF_DIFFUSE(closure_type)) {
|
||||||
|
|
||||||
if (is_diffuse) {
|
|
||||||
eval->diffuse += value;
|
eval->diffuse += value;
|
||||||
}
|
}
|
||||||
else {
|
else if (CLOSURE_IS_BSDF_GLOSSY(closure_type)) {
|
||||||
eval->glossy += value;
|
eval->glossy += value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eval->sum += value;
|
||||||
}
|
}
|
||||||
|
|
||||||
ccl_device_inline bool bsdf_eval_is_zero(ccl_private BsdfEval *eval)
|
ccl_device_inline bool bsdf_eval_is_zero(ccl_private BsdfEval *eval)
|
||||||
{
|
{
|
||||||
return is_zero(eval->diffuse) && is_zero(eval->glossy);
|
return is_zero(eval->sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
ccl_device_inline void bsdf_eval_mul(ccl_private BsdfEval *eval, float value)
|
ccl_device_inline void bsdf_eval_mul(ccl_private BsdfEval *eval, float value)
|
||||||
{
|
{
|
||||||
eval->diffuse *= value;
|
eval->diffuse *= value;
|
||||||
eval->glossy *= value;
|
eval->glossy *= value;
|
||||||
|
eval->sum *= value;
|
||||||
}
|
}
|
||||||
|
|
||||||
ccl_device_inline void bsdf_eval_mul3(ccl_private BsdfEval *eval, float3 value)
|
ccl_device_inline void bsdf_eval_mul3(ccl_private BsdfEval *eval, float3 value)
|
||||||
{
|
{
|
||||||
eval->diffuse *= value;
|
eval->diffuse *= value;
|
||||||
eval->glossy *= value;
|
eval->glossy *= value;
|
||||||
|
eval->sum *= value;
|
||||||
}
|
}
|
||||||
|
|
||||||
ccl_device_inline float3 bsdf_eval_sum(ccl_private const BsdfEval *eval)
|
ccl_device_inline float3 bsdf_eval_sum(ccl_private const BsdfEval *eval)
|
||||||
{
|
{
|
||||||
return eval->diffuse + eval->glossy;
|
return eval->sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
ccl_device_inline float3 bsdf_eval_diffuse_glossy_ratio(ccl_private const BsdfEval *eval)
|
ccl_device_inline float3 bsdf_eval_pass_diffuse_weight(ccl_private const BsdfEval *eval)
|
||||||
{
|
{
|
||||||
/* Ratio of diffuse and glossy to recover proportions for writing to render pass.
|
/* Ratio of diffuse weight to recover proportions for writing to render pass.
|
||||||
* We assume reflection, transmission and volume scatter to be exclusive. */
|
* We assume reflection, transmission and volume scatter to be exclusive. */
|
||||||
return safe_divide_float3_float3(eval->diffuse, eval->diffuse + eval->glossy);
|
return safe_divide_float3_float3(eval->diffuse, eval->sum);
|
||||||
|
}
|
||||||
|
|
||||||
|
ccl_device_inline float3 bsdf_eval_pass_glossy_weight(ccl_private const BsdfEval *eval)
|
||||||
|
{
|
||||||
|
/* Ratio of glossy weight to recover proportions for writing to render pass.
|
||||||
|
* We assume reflection, transmission and volume scatter to be exclusive. */
|
||||||
|
return safe_divide_float3_float3(eval->glossy, eval->sum);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------
|
/* --------------------------------------------------------------------
|
||||||
|
@ -353,37 +363,47 @@ ccl_device_inline void kernel_accum_emission_or_background_pass(KernelGlobals kg
|
||||||
/* Directly visible, write to emission or background pass. */
|
/* Directly visible, write to emission or background pass. */
|
||||||
pass_offset = pass;
|
pass_offset = pass;
|
||||||
}
|
}
|
||||||
else if (path_flag & (PATH_RAY_REFLECT_PASS | PATH_RAY_TRANSMISSION_PASS)) {
|
else if (kernel_data.kernel_features & KERNEL_FEATURE_LIGHT_PASSES) {
|
||||||
/* Indirectly visible through reflection. */
|
if (path_flag & PATH_RAY_SURFACE_PASS) {
|
||||||
const int glossy_pass_offset = (path_flag & PATH_RAY_REFLECT_PASS) ?
|
/* Indirectly visible through reflection. */
|
||||||
((INTEGRATOR_STATE(state, path, bounce) == 1) ?
|
const float3 diffuse_weight = INTEGRATOR_STATE(state, path, pass_diffuse_weight);
|
||||||
kernel_data.film.pass_glossy_direct :
|
const float3 glossy_weight = INTEGRATOR_STATE(state, path, pass_glossy_weight);
|
||||||
kernel_data.film.pass_glossy_indirect) :
|
|
||||||
((INTEGRATOR_STATE(state, path, bounce) == 1) ?
|
|
||||||
kernel_data.film.pass_transmission_direct :
|
|
||||||
kernel_data.film.pass_transmission_indirect);
|
|
||||||
|
|
||||||
if (glossy_pass_offset != PASS_UNUSED) {
|
/* Glossy */
|
||||||
/* Glossy is a subset of the throughput, reconstruct it here using the
|
const int glossy_pass_offset = ((INTEGRATOR_STATE(state, path, bounce) == 1) ?
|
||||||
* diffuse-glossy ratio. */
|
kernel_data.film.pass_glossy_direct :
|
||||||
const float3 ratio = INTEGRATOR_STATE(state, path, diffuse_glossy_ratio);
|
kernel_data.film.pass_glossy_indirect);
|
||||||
const float3 glossy_contribution = (one_float3() - ratio) * contribution;
|
if (glossy_pass_offset != PASS_UNUSED) {
|
||||||
kernel_write_pass_float3(buffer + glossy_pass_offset, glossy_contribution);
|
kernel_write_pass_float3(buffer + glossy_pass_offset, glossy_weight * contribution);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reconstruct diffuse subset of throughput. */
|
/* Transmission */
|
||||||
pass_offset = (INTEGRATOR_STATE(state, path, bounce) == 1) ?
|
const int transmission_pass_offset = ((INTEGRATOR_STATE(state, path, bounce) == 1) ?
|
||||||
kernel_data.film.pass_diffuse_direct :
|
kernel_data.film.pass_transmission_direct :
|
||||||
kernel_data.film.pass_diffuse_indirect;
|
kernel_data.film.pass_transmission_indirect);
|
||||||
if (pass_offset != PASS_UNUSED) {
|
|
||||||
contribution *= INTEGRATOR_STATE(state, path, diffuse_glossy_ratio);
|
if (transmission_pass_offset != PASS_UNUSED) {
|
||||||
|
/* Transmission is what remains if not diffuse and glossy, not stored explicitly to save
|
||||||
|
* GPU memory. */
|
||||||
|
const float3 transmission_weight = one_float3() - diffuse_weight - glossy_weight;
|
||||||
|
kernel_write_pass_float3(buffer + transmission_pass_offset,
|
||||||
|
transmission_weight * contribution);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reconstruct diffuse subset of throughput. */
|
||||||
|
pass_offset = (INTEGRATOR_STATE(state, path, bounce) == 1) ?
|
||||||
|
kernel_data.film.pass_diffuse_direct :
|
||||||
|
kernel_data.film.pass_diffuse_indirect;
|
||||||
|
if (pass_offset != PASS_UNUSED) {
|
||||||
|
contribution *= diffuse_weight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (path_flag & PATH_RAY_VOLUME_PASS) {
|
||||||
|
/* Indirectly visible through volume. */
|
||||||
|
pass_offset = (INTEGRATOR_STATE(state, path, bounce) == 1) ?
|
||||||
|
kernel_data.film.pass_volume_direct :
|
||||||
|
kernel_data.film.pass_volume_indirect;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (path_flag & PATH_RAY_VOLUME_PASS) {
|
|
||||||
/* Indirectly visible through volume. */
|
|
||||||
pass_offset = (INTEGRATOR_STATE(state, path, bounce) == 1) ?
|
|
||||||
kernel_data.film.pass_volume_direct :
|
|
||||||
kernel_data.film.pass_volume_indirect;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Single write call for GPU coherence. */
|
/* Single write call for GPU coherence. */
|
||||||
|
@ -428,45 +448,56 @@ ccl_device_inline void kernel_accum_light(KernelGlobals kg,
|
||||||
#ifdef __PASSES__
|
#ifdef __PASSES__
|
||||||
if (kernel_data.film.light_pass_flag & PASS_ANY) {
|
if (kernel_data.film.light_pass_flag & PASS_ANY) {
|
||||||
const uint32_t path_flag = INTEGRATOR_STATE(state, shadow_path, flag);
|
const uint32_t path_flag = INTEGRATOR_STATE(state, shadow_path, flag);
|
||||||
int pass_offset = PASS_UNUSED;
|
|
||||||
|
|
||||||
if (path_flag & (PATH_RAY_REFLECT_PASS | PATH_RAY_TRANSMISSION_PASS)) {
|
if (kernel_data.kernel_features & KERNEL_FEATURE_LIGHT_PASSES) {
|
||||||
/* Indirectly visible through reflection. */
|
int pass_offset = PASS_UNUSED;
|
||||||
const int glossy_pass_offset = (path_flag & PATH_RAY_REFLECT_PASS) ?
|
|
||||||
((INTEGRATOR_STATE(state, shadow_path, bounce) == 0) ?
|
|
||||||
kernel_data.film.pass_glossy_direct :
|
|
||||||
kernel_data.film.pass_glossy_indirect) :
|
|
||||||
((INTEGRATOR_STATE(state, shadow_path, bounce) == 0) ?
|
|
||||||
kernel_data.film.pass_transmission_direct :
|
|
||||||
kernel_data.film.pass_transmission_indirect);
|
|
||||||
|
|
||||||
if (glossy_pass_offset != PASS_UNUSED) {
|
if (path_flag & PATH_RAY_SURFACE_PASS) {
|
||||||
/* Glossy is a subset of the throughput, reconstruct it here using the
|
/* Indirectly visible through reflection. */
|
||||||
* diffuse-glossy ratio. */
|
const float3 diffuse_weight = INTEGRATOR_STATE(state, shadow_path, pass_diffuse_weight);
|
||||||
const float3 ratio = INTEGRATOR_STATE(state, shadow_path, diffuse_glossy_ratio);
|
const float3 glossy_weight = INTEGRATOR_STATE(state, shadow_path, pass_glossy_weight);
|
||||||
const float3 glossy_contribution = (one_float3() - ratio) * contribution;
|
|
||||||
kernel_write_pass_float3(buffer + glossy_pass_offset, glossy_contribution);
|
/* Glossy */
|
||||||
|
const int glossy_pass_offset = ((INTEGRATOR_STATE(state, shadow_path, bounce) == 0) ?
|
||||||
|
kernel_data.film.pass_glossy_direct :
|
||||||
|
kernel_data.film.pass_glossy_indirect);
|
||||||
|
if (glossy_pass_offset != PASS_UNUSED) {
|
||||||
|
kernel_write_pass_float3(buffer + glossy_pass_offset, glossy_weight * contribution);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Transmission */
|
||||||
|
const int transmission_pass_offset = ((INTEGRATOR_STATE(state, shadow_path, bounce) == 0) ?
|
||||||
|
kernel_data.film.pass_transmission_direct :
|
||||||
|
kernel_data.film.pass_transmission_indirect);
|
||||||
|
|
||||||
|
if (transmission_pass_offset != PASS_UNUSED) {
|
||||||
|
/* Transmission is what remains if not diffuse and glossy, not stored explicitly to save
|
||||||
|
* GPU memory. */
|
||||||
|
const float3 transmission_weight = one_float3() - diffuse_weight - glossy_weight;
|
||||||
|
kernel_write_pass_float3(buffer + transmission_pass_offset,
|
||||||
|
transmission_weight * contribution);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reconstruct diffuse subset of throughput. */
|
||||||
|
pass_offset = (INTEGRATOR_STATE(state, shadow_path, bounce) == 0) ?
|
||||||
|
kernel_data.film.pass_diffuse_direct :
|
||||||
|
kernel_data.film.pass_diffuse_indirect;
|
||||||
|
if (pass_offset != PASS_UNUSED) {
|
||||||
|
contribution *= diffuse_weight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (path_flag & PATH_RAY_VOLUME_PASS) {
|
||||||
|
/* Indirectly visible through volume. */
|
||||||
|
pass_offset = (INTEGRATOR_STATE(state, shadow_path, bounce) == 0) ?
|
||||||
|
kernel_data.film.pass_volume_direct :
|
||||||
|
kernel_data.film.pass_volume_indirect;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reconstruct diffuse subset of throughput. */
|
/* Single write call for GPU coherence. */
|
||||||
pass_offset = (INTEGRATOR_STATE(state, shadow_path, bounce) == 0) ?
|
|
||||||
kernel_data.film.pass_diffuse_direct :
|
|
||||||
kernel_data.film.pass_diffuse_indirect;
|
|
||||||
if (pass_offset != PASS_UNUSED) {
|
if (pass_offset != PASS_UNUSED) {
|
||||||
contribution *= INTEGRATOR_STATE(state, shadow_path, diffuse_glossy_ratio);
|
kernel_write_pass_float3(buffer + pass_offset, contribution);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (path_flag & PATH_RAY_VOLUME_PASS) {
|
|
||||||
/* Indirectly visible through volume. */
|
|
||||||
pass_offset = (INTEGRATOR_STATE(state, shadow_path, bounce) == 0) ?
|
|
||||||
kernel_data.film.pass_volume_direct :
|
|
||||||
kernel_data.film.pass_volume_indirect;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Single write call for GPU coherence. */
|
|
||||||
if (pass_offset != PASS_UNUSED) {
|
|
||||||
kernel_write_pass_float3(buffer + pass_offset, contribution);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Write shadow pass. */
|
/* Write shadow pass. */
|
||||||
if (kernel_data.film.pass_shadow != PASS_UNUSED && (path_flag & PATH_RAY_SHADOW_FOR_LIGHT) &&
|
if (kernel_data.film.pass_shadow != PASS_UNUSED && (path_flag & PATH_RAY_SHADOW_FOR_LIGHT) &&
|
||||||
|
|
|
@ -185,7 +185,7 @@ ccl_device_inline void path_state_next(KernelGlobals kg, IntegratorState state,
|
||||||
|
|
||||||
/* Render pass categories. */
|
/* Render pass categories. */
|
||||||
if (bounce == 1) {
|
if (bounce == 1) {
|
||||||
flag |= (label & LABEL_TRANSMIT) ? PATH_RAY_TRANSMISSION_PASS : PATH_RAY_REFLECT_PASS;
|
flag |= PATH_RAY_SURFACE_PASS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -191,14 +191,18 @@ ccl_device_forceinline void integrate_surface_direct_light(KernelGlobals kg,
|
||||||
const uint16_t transparent_bounce = INTEGRATOR_STATE(state, path, transparent_bounce);
|
const uint16_t transparent_bounce = INTEGRATOR_STATE(state, path, transparent_bounce);
|
||||||
uint32_t shadow_flag = INTEGRATOR_STATE(state, path, flag);
|
uint32_t shadow_flag = INTEGRATOR_STATE(state, path, flag);
|
||||||
shadow_flag |= (is_light) ? PATH_RAY_SHADOW_FOR_LIGHT : 0;
|
shadow_flag |= (is_light) ? PATH_RAY_SHADOW_FOR_LIGHT : 0;
|
||||||
shadow_flag |= (is_transmission) ? PATH_RAY_TRANSMISSION_PASS : PATH_RAY_REFLECT_PASS;
|
shadow_flag |= PATH_RAY_SURFACE_PASS;
|
||||||
const float3 throughput = INTEGRATOR_STATE(state, path, throughput) * bsdf_eval_sum(&bsdf_eval);
|
const float3 throughput = INTEGRATOR_STATE(state, path, throughput) * bsdf_eval_sum(&bsdf_eval);
|
||||||
|
|
||||||
if (kernel_data.kernel_features & KERNEL_FEATURE_LIGHT_PASSES) {
|
if (kernel_data.kernel_features & KERNEL_FEATURE_LIGHT_PASSES) {
|
||||||
const float3 diffuse_glossy_ratio = (bounce == 0) ?
|
const float3 pass_diffuse_weight = (bounce == 0) ?
|
||||||
bsdf_eval_diffuse_glossy_ratio(&bsdf_eval) :
|
bsdf_eval_pass_diffuse_weight(&bsdf_eval) :
|
||||||
INTEGRATOR_STATE(state, path, diffuse_glossy_ratio);
|
INTEGRATOR_STATE(state, path, pass_diffuse_weight);
|
||||||
INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, diffuse_glossy_ratio) = diffuse_glossy_ratio;
|
const float3 pass_glossy_weight = (bounce == 0) ?
|
||||||
|
bsdf_eval_pass_glossy_weight(&bsdf_eval) :
|
||||||
|
INTEGRATOR_STATE(state, path, pass_glossy_weight);
|
||||||
|
INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, pass_diffuse_weight) = pass_diffuse_weight;
|
||||||
|
INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, pass_glossy_weight) = pass_glossy_weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, render_pixel_index) = INTEGRATOR_STATE(
|
INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, render_pixel_index) = INTEGRATOR_STATE(
|
||||||
|
@ -283,7 +287,9 @@ ccl_device_forceinline int integrate_surface_bsdf_bssrdf_bounce(
|
||||||
|
|
||||||
if (kernel_data.kernel_features & KERNEL_FEATURE_LIGHT_PASSES) {
|
if (kernel_data.kernel_features & KERNEL_FEATURE_LIGHT_PASSES) {
|
||||||
if (INTEGRATOR_STATE(state, path, bounce) == 0) {
|
if (INTEGRATOR_STATE(state, path, bounce) == 0) {
|
||||||
INTEGRATOR_STATE_WRITE(state, path, diffuse_glossy_ratio) = bsdf_eval_diffuse_glossy_ratio(
|
INTEGRATOR_STATE_WRITE(state, path, pass_diffuse_weight) = bsdf_eval_pass_diffuse_weight(
|
||||||
|
&bsdf_eval);
|
||||||
|
INTEGRATOR_STATE_WRITE(state, path, pass_glossy_weight) = bsdf_eval_pass_glossy_weight(
|
||||||
&bsdf_eval);
|
&bsdf_eval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -445,7 +451,7 @@ ccl_device bool integrate_surface(KernelGlobals kg,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
shader_prepare_surface_closures(kg, state, &sd);
|
shader_prepare_surface_closures(kg, state, &sd, path_flag);
|
||||||
|
|
||||||
#ifdef __HOLDOUT__
|
#ifdef __HOLDOUT__
|
||||||
/* Evaluate holdout. */
|
/* Evaluate holdout. */
|
||||||
|
|
|
@ -794,10 +794,11 @@ ccl_device_forceinline void integrate_volume_direct_light(
|
||||||
const float3 throughput_phase = throughput * bsdf_eval_sum(&phase_eval);
|
const float3 throughput_phase = throughput * bsdf_eval_sum(&phase_eval);
|
||||||
|
|
||||||
if (kernel_data.kernel_features & KERNEL_FEATURE_LIGHT_PASSES) {
|
if (kernel_data.kernel_features & KERNEL_FEATURE_LIGHT_PASSES) {
|
||||||
const float3 diffuse_glossy_ratio = (bounce == 0) ?
|
const float3 pass_diffuse_weight = (bounce == 0) ?
|
||||||
one_float3() :
|
one_float3() :
|
||||||
INTEGRATOR_STATE(state, path, diffuse_glossy_ratio);
|
INTEGRATOR_STATE(state, path, pass_diffuse_weight);
|
||||||
INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, diffuse_glossy_ratio) = diffuse_glossy_ratio;
|
INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, pass_diffuse_weight) = pass_diffuse_weight;
|
||||||
|
INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, pass_glossy_weight) = zero_float3();
|
||||||
}
|
}
|
||||||
|
|
||||||
INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, render_pixel_index) = INTEGRATOR_STATE(
|
INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, render_pixel_index) = INTEGRATOR_STATE(
|
||||||
|
@ -876,7 +877,8 @@ ccl_device_forceinline bool integrate_volume_phase_scatter(
|
||||||
INTEGRATOR_STATE_WRITE(state, path, throughput) = throughput_phase;
|
INTEGRATOR_STATE_WRITE(state, path, throughput) = throughput_phase;
|
||||||
|
|
||||||
if (kernel_data.kernel_features & KERNEL_FEATURE_LIGHT_PASSES) {
|
if (kernel_data.kernel_features & KERNEL_FEATURE_LIGHT_PASSES) {
|
||||||
INTEGRATOR_STATE_WRITE(state, path, diffuse_glossy_ratio) = one_float3();
|
INTEGRATOR_STATE_WRITE(state, path, pass_diffuse_weight) = one_float3();
|
||||||
|
INTEGRATOR_STATE_WRITE(state, path, pass_glossy_weight) = zero_float3();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update path state */
|
/* Update path state */
|
||||||
|
|
|
@ -105,8 +105,45 @@ ccl_device_inline void shader_copy_volume_phases(ccl_private ShaderVolumePhases
|
||||||
|
|
||||||
ccl_device_inline void shader_prepare_surface_closures(KernelGlobals kg,
|
ccl_device_inline void shader_prepare_surface_closures(KernelGlobals kg,
|
||||||
ConstIntegratorState state,
|
ConstIntegratorState state,
|
||||||
ccl_private ShaderData *sd)
|
ccl_private ShaderData *sd,
|
||||||
|
const uint32_t path_flag)
|
||||||
{
|
{
|
||||||
|
/* Filter out closures. */
|
||||||
|
if (kernel_data.integrator.filter_closures) {
|
||||||
|
if (kernel_data.integrator.filter_closures & FILTER_CLOSURE_EMISSION) {
|
||||||
|
sd->closure_emission_background = zero_float3();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kernel_data.integrator.filter_closures & FILTER_CLOSURE_DIRECT_LIGHT) {
|
||||||
|
sd->flag &= ~SD_BSDF_HAS_EVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (path_flag & PATH_RAY_CAMERA) {
|
||||||
|
for (int i = 0; i < sd->num_closure; i++) {
|
||||||
|
ccl_private ShaderClosure *sc = &sd->closure[i];
|
||||||
|
|
||||||
|
if (CLOSURE_IS_BSDF_DIFFUSE(sc->type)) {
|
||||||
|
if (kernel_data.integrator.filter_closures & FILTER_CLOSURE_DIFFUSE) {
|
||||||
|
sc->type = CLOSURE_NONE_ID;
|
||||||
|
sc->sample_weight = 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (CLOSURE_IS_BSDF_GLOSSY(sc->type)) {
|
||||||
|
if (kernel_data.integrator.filter_closures & FILTER_CLOSURE_GLOSSY) {
|
||||||
|
sc->type = CLOSURE_NONE_ID;
|
||||||
|
sc->sample_weight = 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (CLOSURE_IS_BSDF_TRANSMISSION(sc->type)) {
|
||||||
|
if (kernel_data.integrator.filter_closures & FILTER_CLOSURE_TRANSMISSION) {
|
||||||
|
sc->type = CLOSURE_NONE_ID;
|
||||||
|
sc->sample_weight = 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Defensive sampling.
|
/* Defensive sampling.
|
||||||
*
|
*
|
||||||
* We can likely also do defensive sampling at deeper bounces, particularly
|
* We can likely also do defensive sampling at deeper bounces, particularly
|
||||||
|
@ -209,8 +246,7 @@ ccl_device_inline float _shader_bsdf_multi_eval(KernelGlobals kg,
|
||||||
float3 eval = bsdf_eval(kg, sd, sc, omega_in, is_transmission, &bsdf_pdf);
|
float3 eval = bsdf_eval(kg, sd, sc, omega_in, is_transmission, &bsdf_pdf);
|
||||||
|
|
||||||
if (bsdf_pdf != 0.0f) {
|
if (bsdf_pdf != 0.0f) {
|
||||||
const bool is_diffuse = CLOSURE_IS_BSDF_DIFFUSE(sc->type);
|
bsdf_eval_accum(result_eval, sc->type, eval * sc->weight);
|
||||||
bsdf_eval_accum(result_eval, is_diffuse, eval * sc->weight, 1.0f);
|
|
||||||
sum_pdf += bsdf_pdf * sc->sample_weight;
|
sum_pdf += bsdf_pdf * sc->sample_weight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,7 +271,7 @@ ccl_device_inline
|
||||||
ccl_private BsdfEval *bsdf_eval,
|
ccl_private BsdfEval *bsdf_eval,
|
||||||
const uint light_shader_flags)
|
const uint light_shader_flags)
|
||||||
{
|
{
|
||||||
bsdf_eval_init(bsdf_eval, false, zero_float3());
|
bsdf_eval_init(bsdf_eval, CLOSURE_NONE_ID, zero_float3());
|
||||||
|
|
||||||
return _shader_bsdf_multi_eval(
|
return _shader_bsdf_multi_eval(
|
||||||
kg, sd, omega_in, is_transmission, NULL, bsdf_eval, 0.0f, 0.0f, light_shader_flags);
|
kg, sd, omega_in, is_transmission, NULL, bsdf_eval, 0.0f, 0.0f, light_shader_flags);
|
||||||
|
@ -328,8 +364,7 @@ ccl_device int shader_bsdf_sample_closure(KernelGlobals kg,
|
||||||
label = bsdf_sample(kg, sd, sc, randu, randv, &eval, omega_in, domega_in, pdf);
|
label = bsdf_sample(kg, sd, sc, randu, randv, &eval, omega_in, domega_in, pdf);
|
||||||
|
|
||||||
if (*pdf != 0.0f) {
|
if (*pdf != 0.0f) {
|
||||||
const bool is_diffuse = CLOSURE_IS_BSDF_DIFFUSE(sc->type);
|
bsdf_eval_init(bsdf_eval, sc->type, eval * sc->weight);
|
||||||
bsdf_eval_init(bsdf_eval, is_diffuse, eval * sc->weight);
|
|
||||||
|
|
||||||
if (sd->num_closure > 1) {
|
if (sd->num_closure > 1) {
|
||||||
const bool is_transmission = shader_bsdf_is_transmission(sd, *omega_in);
|
const bool is_transmission = shader_bsdf_is_transmission(sd, *omega_in);
|
||||||
|
@ -655,7 +690,7 @@ ccl_device_inline float _shader_volume_phase_multi_eval(
|
||||||
float3 eval = volume_phase_eval(sd, svc, omega_in, &phase_pdf);
|
float3 eval = volume_phase_eval(sd, svc, omega_in, &phase_pdf);
|
||||||
|
|
||||||
if (phase_pdf != 0.0f) {
|
if (phase_pdf != 0.0f) {
|
||||||
bsdf_eval_accum(result_eval, false, eval, 1.0f);
|
bsdf_eval_accum(result_eval, CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID, eval);
|
||||||
sum_pdf += phase_pdf * svc->sample_weight;
|
sum_pdf += phase_pdf * svc->sample_weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -671,7 +706,7 @@ ccl_device float shader_volume_phase_eval(KernelGlobals kg,
|
||||||
const float3 omega_in,
|
const float3 omega_in,
|
||||||
ccl_private BsdfEval *phase_eval)
|
ccl_private BsdfEval *phase_eval)
|
||||||
{
|
{
|
||||||
bsdf_eval_init(phase_eval, false, zero_float3());
|
bsdf_eval_init(phase_eval, CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID, zero_float3());
|
||||||
|
|
||||||
return _shader_volume_phase_multi_eval(sd, phases, omega_in, -1, phase_eval, 0.0f, 0.0f);
|
return _shader_volume_phase_multi_eval(sd, phases, omega_in, -1, phase_eval, 0.0f, 0.0f);
|
||||||
}
|
}
|
||||||
|
@ -729,7 +764,7 @@ ccl_device int shader_volume_phase_sample(KernelGlobals kg,
|
||||||
label = volume_phase_sample(sd, svc, randu, randv, &eval, omega_in, domega_in, pdf);
|
label = volume_phase_sample(sd, svc, randu, randv, &eval, omega_in, domega_in, pdf);
|
||||||
|
|
||||||
if (*pdf != 0.0f) {
|
if (*pdf != 0.0f) {
|
||||||
bsdf_eval_init(phase_eval, false, eval);
|
bsdf_eval_init(phase_eval, CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID, eval);
|
||||||
}
|
}
|
||||||
|
|
||||||
return label;
|
return label;
|
||||||
|
@ -752,7 +787,7 @@ ccl_device int shader_phase_sample_closure(KernelGlobals kg,
|
||||||
label = volume_phase_sample(sd, sc, randu, randv, &eval, omega_in, domega_in, pdf);
|
label = volume_phase_sample(sd, sc, randu, randv, &eval, omega_in, domega_in, pdf);
|
||||||
|
|
||||||
if (*pdf != 0.0f)
|
if (*pdf != 0.0f)
|
||||||
bsdf_eval_init(phase_eval, false, eval);
|
bsdf_eval_init(phase_eval, CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID, eval);
|
||||||
|
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,9 @@ KERNEL_STRUCT_MEMBER(shadow_path,
|
||||||
float3,
|
float3,
|
||||||
unshadowed_throughput,
|
unshadowed_throughput,
|
||||||
KERNEL_FEATURE_SHADOW_PASS | KERNEL_FEATURE_AO_ADDITIVE)
|
KERNEL_FEATURE_SHADOW_PASS | KERNEL_FEATURE_AO_ADDITIVE)
|
||||||
/* Ratio of throughput to distinguish diffuse and glossy render passes. */
|
/* Ratio of throughput to distinguish diffuse / glossy / transmission render passes. */
|
||||||
KERNEL_STRUCT_MEMBER(shadow_path, float3, diffuse_glossy_ratio, KERNEL_FEATURE_LIGHT_PASSES)
|
KERNEL_STRUCT_MEMBER(shadow_path, float3, pass_diffuse_weight, KERNEL_FEATURE_LIGHT_PASSES)
|
||||||
|
KERNEL_STRUCT_MEMBER(shadow_path, float3, pass_glossy_weight, KERNEL_FEATURE_LIGHT_PASSES)
|
||||||
/* Number of intersections found by ray-tracing. */
|
/* Number of intersections found by ray-tracing. */
|
||||||
KERNEL_STRUCT_MEMBER(shadow_path, uint16_t, num_hits, KERNEL_FEATURE_PATH_TRACING)
|
KERNEL_STRUCT_MEMBER(shadow_path, uint16_t, num_hits, KERNEL_FEATURE_PATH_TRACING)
|
||||||
KERNEL_STRUCT_END(shadow_path)
|
KERNEL_STRUCT_END(shadow_path)
|
||||||
|
|
|
@ -60,8 +60,9 @@ KERNEL_STRUCT_MEMBER(path, float, min_ray_pdf, KERNEL_FEATURE_PATH_TRACING)
|
||||||
KERNEL_STRUCT_MEMBER(path, float, continuation_probability, KERNEL_FEATURE_PATH_TRACING)
|
KERNEL_STRUCT_MEMBER(path, float, continuation_probability, KERNEL_FEATURE_PATH_TRACING)
|
||||||
/* Throughput. */
|
/* Throughput. */
|
||||||
KERNEL_STRUCT_MEMBER(path, float3, throughput, KERNEL_FEATURE_PATH_TRACING)
|
KERNEL_STRUCT_MEMBER(path, float3, throughput, KERNEL_FEATURE_PATH_TRACING)
|
||||||
/* Ratio of throughput to distinguish diffuse and glossy render passes. */
|
/* Ratio of throughput to distinguish diffuse / glossy / transmission render passes. */
|
||||||
KERNEL_STRUCT_MEMBER(path, float3, diffuse_glossy_ratio, KERNEL_FEATURE_LIGHT_PASSES)
|
KERNEL_STRUCT_MEMBER(path, float3, pass_diffuse_weight, KERNEL_FEATURE_LIGHT_PASSES)
|
||||||
|
KERNEL_STRUCT_MEMBER(path, float3, pass_glossy_weight, KERNEL_FEATURE_LIGHT_PASSES)
|
||||||
/* Denoising. */
|
/* Denoising. */
|
||||||
KERNEL_STRUCT_MEMBER(path, float3, denoising_feature_throughput, KERNEL_FEATURE_DENOISING)
|
KERNEL_STRUCT_MEMBER(path, float3, denoising_feature_throughput, KERNEL_FEATURE_DENOISING)
|
||||||
/* Shader sorting. */
|
/* Shader sorting. */
|
||||||
|
|
|
@ -79,7 +79,8 @@ ccl_device int subsurface_bounce(KernelGlobals kg,
|
||||||
|
|
||||||
if (kernel_data.kernel_features & KERNEL_FEATURE_LIGHT_PASSES) {
|
if (kernel_data.kernel_features & KERNEL_FEATURE_LIGHT_PASSES) {
|
||||||
if (INTEGRATOR_STATE(state, path, bounce) == 0) {
|
if (INTEGRATOR_STATE(state, path, bounce) == 0) {
|
||||||
INTEGRATOR_STATE_WRITE(state, path, diffuse_glossy_ratio) = one_float3();
|
INTEGRATOR_STATE_WRITE(state, path, pass_diffuse_weight) = one_float3();
|
||||||
|
INTEGRATOR_STATE_WRITE(state, path, pass_glossy_weight) = zero_float3();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -286,27 +286,26 @@ enum PathRayFlag {
|
||||||
PATH_RAY_DENOISING_FEATURES = (1U << 23U),
|
PATH_RAY_DENOISING_FEATURES = (1U << 23U),
|
||||||
|
|
||||||
/* Render pass categories. */
|
/* Render pass categories. */
|
||||||
PATH_RAY_REFLECT_PASS = (1U << 24U),
|
PATH_RAY_SURFACE_PASS = (1U << 24U),
|
||||||
PATH_RAY_TRANSMISSION_PASS = (1U << 25U),
|
PATH_RAY_VOLUME_PASS = (1U << 25U),
|
||||||
PATH_RAY_VOLUME_PASS = (1U << 26U),
|
PATH_RAY_ANY_PASS = (PATH_RAY_SURFACE_PASS | PATH_RAY_VOLUME_PASS),
|
||||||
PATH_RAY_ANY_PASS = (PATH_RAY_REFLECT_PASS | PATH_RAY_TRANSMISSION_PASS | PATH_RAY_VOLUME_PASS),
|
|
||||||
|
|
||||||
/* Shadow ray is for a light or surface, or AO. */
|
/* Shadow ray is for a light or surface, or AO. */
|
||||||
PATH_RAY_SHADOW_FOR_LIGHT = (1U << 27U),
|
PATH_RAY_SHADOW_FOR_LIGHT = (1U << 26U),
|
||||||
PATH_RAY_SHADOW_FOR_AO = (1U << 28U),
|
PATH_RAY_SHADOW_FOR_AO = (1U << 27U),
|
||||||
|
|
||||||
/* A shadow catcher object was hit and the path was split into two. */
|
/* A shadow catcher object was hit and the path was split into two. */
|
||||||
PATH_RAY_SHADOW_CATCHER_HIT = (1U << 29U),
|
PATH_RAY_SHADOW_CATCHER_HIT = (1U << 28U),
|
||||||
|
|
||||||
/* A shadow catcher object was hit and this path traces only shadow catchers, writing them into
|
/* A shadow catcher object was hit and this path traces only shadow catchers, writing them into
|
||||||
* their dedicated pass for later division.
|
* their dedicated pass for later division.
|
||||||
*
|
*
|
||||||
* NOTE: Is not covered with `PATH_RAY_ANY_PASS` because shadow catcher does special handling
|
* NOTE: Is not covered with `PATH_RAY_ANY_PASS` because shadow catcher does special handling
|
||||||
* which is separate from the light passes. */
|
* which is separate from the light passes. */
|
||||||
PATH_RAY_SHADOW_CATCHER_PASS = (1U << 30U),
|
PATH_RAY_SHADOW_CATCHER_PASS = (1U << 29U),
|
||||||
|
|
||||||
/* Path is evaluating background for an approximate shadow catcher with non-transparent film. */
|
/* Path is evaluating background for an approximate shadow catcher with non-transparent film. */
|
||||||
PATH_RAY_SHADOW_CATCHER_BACKGROUND = (1U << 31U),
|
PATH_RAY_SHADOW_CATCHER_BACKGROUND = (1U << 30U),
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Configure ray visibility bits for rays and objects respectively,
|
/* Configure ray visibility bits for rays and objects respectively,
|
||||||
|
@ -428,8 +427,19 @@ typedef enum CryptomatteType {
|
||||||
typedef struct BsdfEval {
|
typedef struct BsdfEval {
|
||||||
float3 diffuse;
|
float3 diffuse;
|
||||||
float3 glossy;
|
float3 glossy;
|
||||||
|
float3 sum;
|
||||||
} BsdfEval;
|
} BsdfEval;
|
||||||
|
|
||||||
|
/* Closure Filter */
|
||||||
|
|
||||||
|
typedef enum FilterClosures {
|
||||||
|
FILTER_CLOSURE_EMISSION = (1 << 0),
|
||||||
|
FILTER_CLOSURE_DIFFUSE = (1 << 1),
|
||||||
|
FILTER_CLOSURE_GLOSSY = (1 << 2),
|
||||||
|
FILTER_CLOSURE_TRANSMISSION = (1 << 3),
|
||||||
|
FILTER_CLOSURE_DIRECT_LIGHT = (1 << 4),
|
||||||
|
} FilterClosures;
|
||||||
|
|
||||||
/* Shader Flag */
|
/* Shader Flag */
|
||||||
|
|
||||||
typedef enum ShaderFlag {
|
typedef enum ShaderFlag {
|
||||||
|
@ -1186,7 +1196,11 @@ typedef struct KernelIntegrator {
|
||||||
int has_shadow_catcher;
|
int has_shadow_catcher;
|
||||||
float scrambling_distance;
|
float scrambling_distance;
|
||||||
|
|
||||||
|
/* Closure filter. */
|
||||||
|
int filter_closures;
|
||||||
|
|
||||||
/* padding */
|
/* padding */
|
||||||
|
int pad1, pad2, pad3;
|
||||||
} KernelIntegrator;
|
} KernelIntegrator;
|
||||||
static_assert_align(KernelIntegrator, 16);
|
static_assert_align(KernelIntegrator, 16);
|
||||||
|
|
||||||
|
|
|
@ -187,8 +187,6 @@ void Film::device_update(Device *device, DeviceScene *dscene, Scene *scene)
|
||||||
kfilm->pass_transmission_indirect = PASS_UNUSED;
|
kfilm->pass_transmission_indirect = PASS_UNUSED;
|
||||||
kfilm->pass_volume_direct = PASS_UNUSED;
|
kfilm->pass_volume_direct = PASS_UNUSED;
|
||||||
kfilm->pass_volume_indirect = PASS_UNUSED;
|
kfilm->pass_volume_indirect = PASS_UNUSED;
|
||||||
kfilm->pass_volume_direct = PASS_UNUSED;
|
|
||||||
kfilm->pass_volume_indirect = PASS_UNUSED;
|
|
||||||
kfilm->pass_shadow = PASS_UNUSED;
|
kfilm->pass_shadow = PASS_UNUSED;
|
||||||
|
|
||||||
/* Mark passes as unused so that the kernel knows the pass is inaccessible. */
|
/* Mark passes as unused so that the kernel knows the pass is inaccessible. */
|
||||||
|
@ -673,13 +671,12 @@ uint Film::get_kernel_features(const Scene *scene) const
|
||||||
kernel_features |= KERNEL_FEATURE_DENOISING;
|
kernel_features |= KERNEL_FEATURE_DENOISING;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pass_type != PASS_NONE && pass_type != PASS_COMBINED &&
|
if (pass_type >= PASS_DIFFUSE && pass_type <= PASS_VOLUME_INDIRECT) {
|
||||||
pass_type <= PASS_CATEGORY_LIGHT_END) {
|
|
||||||
kernel_features |= KERNEL_FEATURE_LIGHT_PASSES;
|
kernel_features |= KERNEL_FEATURE_LIGHT_PASSES;
|
||||||
|
}
|
||||||
|
|
||||||
if (pass_type == PASS_SHADOW) {
|
if (pass_type == PASS_SHADOW) {
|
||||||
kernel_features |= KERNEL_FEATURE_SHADOW_PASS;
|
kernel_features |= KERNEL_FEATURE_SHADOW_PASS;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pass_type == PASS_AO) {
|
if (pass_type == PASS_AO) {
|
||||||
|
|
|
@ -63,6 +63,14 @@ NODE_DEFINE(Integrator)
|
||||||
SOCKET_BOOLEAN(caustics_reflective, "Reflective Caustics", true);
|
SOCKET_BOOLEAN(caustics_reflective, "Reflective Caustics", true);
|
||||||
SOCKET_BOOLEAN(caustics_refractive, "Refractive Caustics", true);
|
SOCKET_BOOLEAN(caustics_refractive, "Refractive Caustics", true);
|
||||||
SOCKET_FLOAT(filter_glossy, "Filter Glossy", 0.0f);
|
SOCKET_FLOAT(filter_glossy, "Filter Glossy", 0.0f);
|
||||||
|
|
||||||
|
SOCKET_BOOLEAN(use_direct_light, "Use Direct Light", true);
|
||||||
|
SOCKET_BOOLEAN(use_indirect_light, "Use Indirect Light", true);
|
||||||
|
SOCKET_BOOLEAN(use_diffuse, "Use Diffuse", true);
|
||||||
|
SOCKET_BOOLEAN(use_glossy, "Use Glossy", true);
|
||||||
|
SOCKET_BOOLEAN(use_transmission, "Use Transmission", true);
|
||||||
|
SOCKET_BOOLEAN(use_emission, "Use Emission", true);
|
||||||
|
|
||||||
SOCKET_INT(seed, "Seed", 0);
|
SOCKET_INT(seed, "Seed", 0);
|
||||||
SOCKET_FLOAT(sample_clamp_direct, "Sample Clamp Direct", 0.0f);
|
SOCKET_FLOAT(sample_clamp_direct, "Sample Clamp Direct", 0.0f);
|
||||||
SOCKET_FLOAT(sample_clamp_indirect, "Sample Clamp Indirect", 0.0f);
|
SOCKET_FLOAT(sample_clamp_indirect, "Sample Clamp Indirect", 0.0f);
|
||||||
|
@ -184,6 +192,27 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
|
||||||
kintegrator->caustics_refractive = caustics_refractive;
|
kintegrator->caustics_refractive = caustics_refractive;
|
||||||
kintegrator->filter_glossy = (filter_glossy == 0.0f) ? FLT_MAX : 1.0f / filter_glossy;
|
kintegrator->filter_glossy = (filter_glossy == 0.0f) ? FLT_MAX : 1.0f / filter_glossy;
|
||||||
|
|
||||||
|
kintegrator->filter_closures = 0;
|
||||||
|
if (!use_direct_light) {
|
||||||
|
kintegrator->filter_closures |= FILTER_CLOSURE_DIRECT_LIGHT;
|
||||||
|
}
|
||||||
|
if (!use_indirect_light) {
|
||||||
|
kintegrator->min_bounce = 1;
|
||||||
|
kintegrator->max_bounce = 1;
|
||||||
|
}
|
||||||
|
if (!use_diffuse) {
|
||||||
|
kintegrator->filter_closures |= FILTER_CLOSURE_DIFFUSE;
|
||||||
|
}
|
||||||
|
if (!use_glossy) {
|
||||||
|
kintegrator->filter_closures |= FILTER_CLOSURE_GLOSSY;
|
||||||
|
}
|
||||||
|
if (!use_transmission) {
|
||||||
|
kintegrator->filter_closures |= FILTER_CLOSURE_TRANSMISSION;
|
||||||
|
}
|
||||||
|
if (!use_emission) {
|
||||||
|
kintegrator->filter_closures |= FILTER_CLOSURE_EMISSION;
|
||||||
|
}
|
||||||
|
|
||||||
kintegrator->seed = seed;
|
kintegrator->seed = seed;
|
||||||
|
|
||||||
kintegrator->sample_clamp_direct = (sample_clamp_direct == 0.0f) ? FLT_MAX :
|
kintegrator->sample_clamp_direct = (sample_clamp_direct == 0.0f) ? FLT_MAX :
|
||||||
|
|
|
@ -56,6 +56,13 @@ class Integrator : public Node {
|
||||||
NODE_SOCKET_API(bool, caustics_refractive)
|
NODE_SOCKET_API(bool, caustics_refractive)
|
||||||
NODE_SOCKET_API(float, filter_glossy)
|
NODE_SOCKET_API(float, filter_glossy)
|
||||||
|
|
||||||
|
NODE_SOCKET_API(bool, use_direct_light);
|
||||||
|
NODE_SOCKET_API(bool, use_indirect_light);
|
||||||
|
NODE_SOCKET_API(bool, use_diffuse);
|
||||||
|
NODE_SOCKET_API(bool, use_glossy);
|
||||||
|
NODE_SOCKET_API(bool, use_transmission);
|
||||||
|
NODE_SOCKET_API(bool, use_emission);
|
||||||
|
|
||||||
NODE_SOCKET_API(int, seed)
|
NODE_SOCKET_API(int, seed)
|
||||||
|
|
||||||
NODE_SOCKET_API(float, sample_clamp_direct)
|
NODE_SOCKET_API(float, sample_clamp_direct)
|
||||||
|
|
|
@ -274,19 +274,26 @@ void OSLShaderManager::shading_system_init()
|
||||||
|
|
||||||
"diffuse_ancestor", /* PATH_RAY_DIFFUSE_ANCESTOR */
|
"diffuse_ancestor", /* PATH_RAY_DIFFUSE_ANCESTOR */
|
||||||
|
|
||||||
"__unused__", /* PATH_RAY_SINGLE_PASS_DONE */
|
/* Remaining irrelevant bits up to 32. */
|
||||||
"__unused__", /* PATH_RAY_TRANSPARENT_BACKGROUND */
|
"__unused__",
|
||||||
"__unused__", /* PATH_RAY_TERMINATE_IMMEDIATE */
|
"__unused__",
|
||||||
"__unused__", /* PATH_RAY_TERMINATE_AFTER_TRANSPARENT */
|
"__unused__",
|
||||||
"__unused__", /* PATH_RAY_EMISSION */
|
"__unused__",
|
||||||
"__unused__", /* PATH_RAY_SUBSURFACE */
|
"__unused__",
|
||||||
"__unused__", /* PATH_RAY_DENOISING_FEATURES */
|
"__unused__",
|
||||||
"__unused__", /* PATH_RAY_REFLECT_PASS */
|
"__unused__",
|
||||||
"__unused__", /* PATH_RAY_TRANSMISSION_PASS */
|
"__unused__",
|
||||||
"__unused__", /* PATH_RAY_VOLUME_PASS */
|
"__unused__",
|
||||||
"__unused__", /* PATH_RAY_SHADOW_FOR_LIGHT */
|
"__unused__",
|
||||||
"__unused__", /* PATH_RAY_SHADOW_CATCHER_HIT */
|
"__unused__",
|
||||||
"__unused__", /* PATH_RAY_SHADOW_CATCHER_PASS */
|
"__unused__",
|
||||||
|
"__unused__",
|
||||||
|
"__unused__",
|
||||||
|
"__unused__",
|
||||||
|
"__unused__",
|
||||||
|
"__unused__",
|
||||||
|
"__unused__",
|
||||||
|
"__unused__",
|
||||||
};
|
};
|
||||||
|
|
||||||
const int nraytypes = sizeof(raytypes) / sizeof(raytypes[0]);
|
const int nraytypes = sizeof(raytypes) / sizeof(raytypes[0]);
|
||||||
|
|
|
@ -208,7 +208,7 @@ class TestEnvironment:
|
||||||
|
|
||||||
def call_blender(self, args: List[str], foreground=False) -> List[str]:
|
def call_blender(self, args: List[str], foreground=False) -> List[str]:
|
||||||
# Execute Blender command with arguments.
|
# Execute Blender command with arguments.
|
||||||
common_args = ['--factory-startup', '--enable-autoexec', '--python-exit-code', '1']
|
common_args = ['--factory-startup', '-noaudio', '--enable-autoexec', '--python-exit-code', '1']
|
||||||
if foreground:
|
if foreground:
|
||||||
common_args += ['--no-window-focus', '--window-geometry', '0', '0', '1024', '768']
|
common_args += ['--no-window-focus', '--window-geometry', '0', '0', '1024', '768']
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue