Fix T41693: Volumes get brightened with extra volume samples on GPU + BPT
This commit is contained in:
@@ -154,7 +154,7 @@ ccl_device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, Ray ray,
|
|||||||
#ifdef __VOLUME_SCATTER__
|
#ifdef __VOLUME_SCATTER__
|
||||||
if(result == VOLUME_PATH_SCATTERED) {
|
if(result == VOLUME_PATH_SCATTERED) {
|
||||||
/* direct lighting */
|
/* direct lighting */
|
||||||
kernel_path_volume_connect_light(kg, rng, &volume_sd, throughput, &state, L, 1.0f);
|
kernel_path_volume_connect_light(kg, rng, &volume_sd, throughput, &state, L);
|
||||||
|
|
||||||
/* indirect light bounce */
|
/* indirect light bounce */
|
||||||
if(kernel_path_volume_bounce(kg, rng, &volume_sd, &throughput, &state, L, &ray))
|
if(kernel_path_volume_bounce(kg, rng, &volume_sd, &throughput, &state, L, &ray))
|
||||||
@@ -541,7 +541,7 @@ ccl_device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample,
|
|||||||
#ifdef __VOLUME_SCATTER__
|
#ifdef __VOLUME_SCATTER__
|
||||||
if(result == VOLUME_PATH_SCATTERED) {
|
if(result == VOLUME_PATH_SCATTERED) {
|
||||||
/* direct lighting */
|
/* direct lighting */
|
||||||
kernel_path_volume_connect_light(kg, rng, &volume_sd, throughput, &state, &L, 1.0f);
|
kernel_path_volume_connect_light(kg, rng, &volume_sd, throughput, &state, &L);
|
||||||
|
|
||||||
/* indirect light bounce */
|
/* indirect light bounce */
|
||||||
if(kernel_path_volume_bounce(kg, rng, &volume_sd, &throughput, &state, &L, &ray))
|
if(kernel_path_volume_bounce(kg, rng, &volume_sd, &throughput, &state, &L, &ray))
|
||||||
@@ -897,7 +897,7 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in
|
|||||||
PathState ps = state;
|
PathState ps = state;
|
||||||
Ray pray = ray;
|
Ray pray = ray;
|
||||||
ShaderData volume_sd;
|
ShaderData volume_sd;
|
||||||
float3 tp = throughput;
|
float3 tp = throughput * num_samples_inv;
|
||||||
|
|
||||||
/* branch RNG state */
|
/* branch RNG state */
|
||||||
path_state_branch(&ps, j, num_samples);
|
path_state_branch(&ps, j, num_samples);
|
||||||
@@ -909,10 +909,10 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in
|
|||||||
if(result == VOLUME_PATH_SCATTERED) {
|
if(result == VOLUME_PATH_SCATTERED) {
|
||||||
/* todo: support equiangular, MIS and all light sampling.
|
/* todo: support equiangular, MIS and all light sampling.
|
||||||
* alternatively get decoupled ray marching working on the GPU */
|
* alternatively get decoupled ray marching working on the GPU */
|
||||||
kernel_path_volume_connect_light(kg, rng, &volume_sd, tp, &state, &L, num_samples_inv);
|
kernel_path_volume_connect_light(kg, rng, &volume_sd, tp, &state, &L);
|
||||||
|
|
||||||
if(kernel_path_volume_bounce(kg, rng, &volume_sd, &tp, &ps, &L, &pray)) {
|
if(kernel_path_volume_bounce(kg, rng, &volume_sd, &tp, &ps, &L, &pray)) {
|
||||||
kernel_path_indirect(kg, rng, pray, tp*num_samples_inv, num_samples, ps, &L);
|
kernel_path_indirect(kg, rng, pray, tp, num_samples, ps, &L);
|
||||||
|
|
||||||
/* for render passes, sum and reset indirect light pass variables
|
/* for render passes, sum and reset indirect light pass variables
|
||||||
* for the next samples */
|
* for the next samples */
|
||||||
|
@@ -19,8 +19,7 @@ CCL_NAMESPACE_BEGIN
|
|||||||
#ifdef __VOLUME_SCATTER__
|
#ifdef __VOLUME_SCATTER__
|
||||||
|
|
||||||
ccl_device void kernel_path_volume_connect_light(KernelGlobals *kg, RNG *rng,
|
ccl_device void kernel_path_volume_connect_light(KernelGlobals *kg, RNG *rng,
|
||||||
ShaderData *sd, float3 throughput, PathState *state, PathRadiance *L,
|
ShaderData *sd, float3 throughput, PathState *state, PathRadiance *L)
|
||||||
float num_samples_adjust)
|
|
||||||
{
|
{
|
||||||
#ifdef __EMISSION__
|
#ifdef __EMISSION__
|
||||||
if(!kernel_data.integrator.use_direct_light)
|
if(!kernel_data.integrator.use_direct_light)
|
||||||
@@ -51,7 +50,7 @@ ccl_device void kernel_path_volume_connect_light(KernelGlobals *kg, RNG *rng,
|
|||||||
|
|
||||||
if(!shadow_blocked(kg, state, &light_ray, &shadow)) {
|
if(!shadow_blocked(kg, state, &light_ray, &shadow)) {
|
||||||
/* accumulate */
|
/* accumulate */
|
||||||
path_radiance_accum_light(L, throughput * num_samples_adjust, &L_light, shadow, 1.0f, state->bounce, is_lamp);
|
path_radiance_accum_light(L, throughput, &L_light, shadow, 1.0f, state->bounce, is_lamp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user