Cycles: remove min bounces, modify RR to terminate less.
Differential Revision: https://developer.blender.org/D2766
This commit is contained in:
@@ -32,12 +32,10 @@ class AddPresetIntegrator(AddPresetBase, Operator):
|
||||
|
||||
preset_values = [
|
||||
"cycles.max_bounces",
|
||||
"cycles.min_bounces",
|
||||
"cycles.diffuse_bounces",
|
||||
"cycles.glossy_bounces",
|
||||
"cycles.transmission_bounces",
|
||||
"cycles.volume_bounces",
|
||||
"cycles.transparent_min_bounces",
|
||||
"cycles.transparent_max_bounces",
|
||||
"cycles.use_transparent_shadows",
|
||||
"cycles.caustics_reflective",
|
||||
|
@@ -311,14 +311,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
default=0.0,
|
||||
)
|
||||
|
||||
cls.min_bounces = IntProperty(
|
||||
name="Min Bounces",
|
||||
description="Minimum number of bounces, setting this lower "
|
||||
"than the maximum enables probabilistic path "
|
||||
"termination (faster but noisier)",
|
||||
min=0, max=1024,
|
||||
default=3,
|
||||
)
|
||||
cls.max_bounces = IntProperty(
|
||||
name="Max Bounces",
|
||||
description="Total maximum number of bounces",
|
||||
@@ -351,15 +343,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
default=0,
|
||||
)
|
||||
|
||||
cls.transparent_min_bounces = IntProperty(
|
||||
name="Transparent Min Bounces",
|
||||
description="Minimum number of transparent bounces, setting "
|
||||
"this lower than the maximum enables "
|
||||
"probabilistic path termination (faster but "
|
||||
"noisier)",
|
||||
min=0, max=1024,
|
||||
default=8,
|
||||
)
|
||||
cls.transparent_max_bounces = IntProperty(
|
||||
name="Transparent Max Bounces",
|
||||
description="Maximum number of transparent bounces",
|
||||
|
@@ -292,7 +292,6 @@ class CyclesRender_PT_light_paths(CyclesButtonsPanel, Panel):
|
||||
sub = col.column(align=True)
|
||||
sub.label("Transparency:")
|
||||
sub.prop(cscene, "transparent_max_bounces", text="Max")
|
||||
sub.prop(cscene, "transparent_min_bounces", text="Min")
|
||||
sub.prop(cscene, "use_transparent_shadows", text="Shadows")
|
||||
|
||||
col.separator()
|
||||
@@ -306,7 +305,6 @@ class CyclesRender_PT_light_paths(CyclesButtonsPanel, Panel):
|
||||
sub = col.column(align=True)
|
||||
sub.label(text="Bounces:")
|
||||
sub.prop(cscene, "max_bounces", text="Max")
|
||||
sub.prop(cscene, "min_bounces", text="Min")
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.prop(cscene, "diffuse_bounces", text="Diffuse")
|
||||
|
@@ -234,7 +234,6 @@ void BlenderSync::sync_integrator()
|
||||
Integrator *integrator = scene->integrator;
|
||||
Integrator previntegrator = *integrator;
|
||||
|
||||
integrator->min_bounce = get_int(cscene, "min_bounces");
|
||||
integrator->max_bounce = get_int(cscene, "max_bounces");
|
||||
|
||||
integrator->max_diffuse_bounce = get_int(cscene, "diffuse_bounces");
|
||||
@@ -243,7 +242,6 @@ void BlenderSync::sync_integrator()
|
||||
integrator->max_volume_bounce = get_int(cscene, "volume_bounces");
|
||||
|
||||
integrator->transparent_max_bounce = get_int(cscene, "transparent_max_bounces");
|
||||
integrator->transparent_min_bounce = get_int(cscene, "transparent_min_bounces");
|
||||
integrator->transparent_shadows = get_boolean(cscene, "use_transparent_shadows");
|
||||
|
||||
integrator->volume_max_steps = get_int(cscene, "volume_max_steps");
|
||||
|
@@ -163,14 +163,23 @@ ccl_device_inline uint path_state_ray_visibility(KernelGlobals *kg, PathState *s
|
||||
ccl_device_inline float path_state_terminate_probability(KernelGlobals *kg, ccl_addr_space PathState *state, const float3 throughput)
|
||||
{
|
||||
if(state->flag & PATH_RAY_TRANSPARENT) {
|
||||
/* transparent rays treated separately */
|
||||
if(state->transparent_bounce >= kernel_data.integrator.transparent_max_bounce)
|
||||
/* Transparent rays are treated separately with own max bounces. */
|
||||
if(state->transparent_bounce >= kernel_data.integrator.transparent_max_bounce) {
|
||||
return 0.0f;
|
||||
else if(state->transparent_bounce <= kernel_data.integrator.transparent_min_bounce)
|
||||
}
|
||||
/* Do at least one bounce without RR. */
|
||||
else if(state->transparent_bounce <= 1) {
|
||||
return 1.0f;
|
||||
}
|
||||
#ifdef __SHADOW_TRICKS__
|
||||
/* Exception for shadow catcher not working correctly with RR. */
|
||||
else if ((state->flag & PATH_RAY_SHADOW_CATCHER) && (state->transparent_bounce <= 8)) {
|
||||
return 1.0f;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
/* other rays */
|
||||
/* Test max bounces for various ray types. */
|
||||
if((state->bounce >= kernel_data.integrator.max_bounce) ||
|
||||
(state->diffuse_bounce >= kernel_data.integrator.max_diffuse_bounce) ||
|
||||
(state->glossy_bounce >= kernel_data.integrator.max_glossy_bounce) ||
|
||||
@@ -181,13 +190,21 @@ ccl_device_inline float path_state_terminate_probability(KernelGlobals *kg, ccl_
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
else if(state->bounce <= kernel_data.integrator.min_bounce) {
|
||||
/* Do at least one bounce without RR. */
|
||||
else if(state->bounce <= 1) {
|
||||
return 1.0f;
|
||||
}
|
||||
#ifdef __SHADOW_TRICKS__
|
||||
/* Exception for shadow catcher not working correctly with RR. */
|
||||
else if ((state->flag & PATH_RAY_SHADOW_CATCHER) && (state->bounce <= 3)) {
|
||||
return 1.0f;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* probalistic termination */
|
||||
return average(throughput); /* todo: try using max here */
|
||||
/* Probalistic termination: use sqrt() to roughly match typical view
|
||||
* transform and do path termination a bit later on average. */
|
||||
return sqrtf(max3(fabs(throughput)));
|
||||
}
|
||||
|
||||
/* TODO(DingTo): Find more meaningful name for this */
|
||||
|
@@ -1236,7 +1236,6 @@ typedef struct KernelIntegrator {
|
||||
int portal_offset;
|
||||
|
||||
/* bounces */
|
||||
int min_bounce;
|
||||
int max_bounce;
|
||||
|
||||
int max_diffuse_bounce;
|
||||
@@ -1247,7 +1246,6 @@ typedef struct KernelIntegrator {
|
||||
int ao_bounces;
|
||||
|
||||
/* transparent */
|
||||
int transparent_min_bounce;
|
||||
int transparent_max_bounce;
|
||||
int transparent_shadows;
|
||||
|
||||
@@ -1290,7 +1288,7 @@ typedef struct KernelIntegrator {
|
||||
float light_inv_rr_threshold;
|
||||
|
||||
int start_sample;
|
||||
int pad1, pad2, pad3;
|
||||
int pad1;
|
||||
} KernelIntegrator;
|
||||
static_assert_align(KernelIntegrator, 16);
|
||||
|
||||
|
@@ -31,7 +31,6 @@ NODE_DEFINE(Integrator)
|
||||
{
|
||||
NodeType *type = NodeType::add("integrator", create);
|
||||
|
||||
SOCKET_INT(min_bounce, "Min Bounce", 2);
|
||||
SOCKET_INT(max_bounce, "Max Bounce", 7);
|
||||
|
||||
SOCKET_INT(max_diffuse_bounce, "Max Diffuse Bounce", 7);
|
||||
@@ -39,7 +38,6 @@ NODE_DEFINE(Integrator)
|
||||
SOCKET_INT(max_transmission_bounce, "Max Transmission Bounce", 7);
|
||||
SOCKET_INT(max_volume_bounce, "Max Volume Bounce", 7);
|
||||
|
||||
SOCKET_INT(transparent_min_bounce, "Transparent Min Bounce", 2);
|
||||
SOCKET_INT(transparent_max_bounce, "Transparent Max Bounce", 7);
|
||||
SOCKET_BOOLEAN(transparent_shadows, "Transparent Shadows", false);
|
||||
|
||||
@@ -104,7 +102,6 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
|
||||
|
||||
/* integrator parameters */
|
||||
kintegrator->max_bounce = max_bounce + 1;
|
||||
kintegrator->min_bounce = min_bounce + 1;
|
||||
|
||||
kintegrator->max_diffuse_bounce = max_diffuse_bounce + 1;
|
||||
kintegrator->max_glossy_bounce = max_glossy_bounce + 1;
|
||||
@@ -112,7 +109,6 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
|
||||
kintegrator->max_volume_bounce = max_volume_bounce + 1;
|
||||
|
||||
kintegrator->transparent_max_bounce = transparent_max_bounce + 1;
|
||||
kintegrator->transparent_min_bounce = transparent_min_bounce + 1;
|
||||
|
||||
if(ao_bounces == 0) {
|
||||
kintegrator->ao_bounces = INT_MAX;
|
||||
|
@@ -31,7 +31,6 @@ class Integrator : public Node {
|
||||
public:
|
||||
NODE_DECLARE
|
||||
|
||||
int min_bounce;
|
||||
int max_bounce;
|
||||
|
||||
int max_diffuse_bounce;
|
||||
@@ -39,7 +38,6 @@ public:
|
||||
int max_transmission_bounce;
|
||||
int max_volume_bounce;
|
||||
|
||||
int transparent_min_bounce;
|
||||
int transparent_max_bounce;
|
||||
bool transparent_shadows;
|
||||
|
||||
|
Reference in New Issue
Block a user