forked from bartvdbraak/blender
Fix T41784, Re-enabling transparent shadows in Cycles doesn't work correctly
This commit is contained in:
parent
149ca1320b
commit
61e58c378a
@ -92,11 +92,20 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
|
|||||||
kintegrator->transparent_max_bounce = transparent_max_bounce + 1;
|
kintegrator->transparent_max_bounce = transparent_max_bounce + 1;
|
||||||
kintegrator->transparent_min_bounce = transparent_min_bounce + 1;
|
kintegrator->transparent_min_bounce = transparent_min_bounce + 1;
|
||||||
|
|
||||||
/* At this point kintegrator->transparent_shadows is set automatically
|
/* Transparent Shadows
|
||||||
* based on whether shaders use transparent shadows (see shader.cpp).
|
* We only need to enable transparent shadows, if we actually have
|
||||||
* If user doesn't want transparent shadows, force them off. */
|
* transparent shaders in the scene. Otherwise we can disable it
|
||||||
if(!transparent_shadows)
|
* to improve performance a bit. */
|
||||||
|
if(transparent_shadows) {
|
||||||
|
foreach(Shader *shader, scene->shaders) {
|
||||||
|
/* keep this in sync with SD_HAS_TRANSPARENT_SHADOW in shader.cpp */
|
||||||
|
if((shader->has_surface_transparent && shader->use_transparent_shadow) || shader->has_volume)
|
||||||
|
kintegrator->transparent_shadows = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
kintegrator->transparent_shadows = false;
|
kintegrator->transparent_shadows = false;
|
||||||
|
}
|
||||||
|
|
||||||
kintegrator->volume_max_steps = volume_max_steps;
|
kintegrator->volume_max_steps = volume_max_steps;
|
||||||
kintegrator->volume_step_size = volume_step_size;
|
kintegrator->volume_step_size = volume_step_size;
|
||||||
|
@ -325,7 +325,6 @@ void ShaderManager::device_update_common(Device *device, DeviceScene *dscene, Sc
|
|||||||
uint i = 0;
|
uint i = 0;
|
||||||
bool has_converter_blackbody = false;
|
bool has_converter_blackbody = false;
|
||||||
bool has_volumes = false;
|
bool has_volumes = false;
|
||||||
bool has_transparent_shadows = false;
|
|
||||||
|
|
||||||
foreach(Shader *shader, scene->shaders) {
|
foreach(Shader *shader, scene->shaders) {
|
||||||
uint flag = 0;
|
uint flag = 0;
|
||||||
@ -368,10 +367,6 @@ void ShaderManager::device_update_common(Device *device, DeviceScene *dscene, Sc
|
|||||||
|
|
||||||
shader_flag[i++] = flag;
|
shader_flag[i++] = flag;
|
||||||
shader_flag[i++] = shader->pass_id;
|
shader_flag[i++] = shader->pass_id;
|
||||||
|
|
||||||
/* Check if we need transparent shadows */
|
|
||||||
if(flag & SD_HAS_TRANSPARENT_SHADOW)
|
|
||||||
has_transparent_shadows = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
device->tex_alloc("__shader_flag", dscene->shader_flag);
|
device->tex_alloc("__shader_flag", dscene->shader_flag);
|
||||||
@ -402,7 +397,6 @@ void ShaderManager::device_update_common(Device *device, DeviceScene *dscene, Sc
|
|||||||
/* integrator */
|
/* integrator */
|
||||||
KernelIntegrator *kintegrator = &dscene->data.integrator;
|
KernelIntegrator *kintegrator = &dscene->data.integrator;
|
||||||
kintegrator->use_volumes = has_volumes;
|
kintegrator->use_volumes = has_volumes;
|
||||||
kintegrator->transparent_shadows = has_transparent_shadows;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShaderManager::device_free_common(Device *device, DeviceScene *dscene, Scene *scene)
|
void ShaderManager::device_free_common(Device *device, DeviceScene *dscene, Scene *scene)
|
||||||
|
Loading…
Reference in New Issue
Block a user