diff options
Diffstat (limited to 'intern/cycles/kernel/film/passes.h')
-rw-r--r-- | intern/cycles/kernel/film/passes.h | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/intern/cycles/kernel/film/passes.h b/intern/cycles/kernel/film/passes.h index 1f5cf2048f1..bea23411000 100644 --- a/intern/cycles/kernel/film/passes.h +++ b/intern/cycles/kernel/film/passes.h @@ -40,7 +40,7 @@ ccl_device_forceinline void kernel_write_denoising_features_surface( ccl_global float *buffer = kernel_pass_pixel_render_buffer(kg, state, render_buffer); if (kernel_data.film.pass_denoising_depth != PASS_UNUSED) { - const float3 denoising_feature_throughput = INTEGRATOR_STATE( + const Spectrum denoising_feature_throughput = INTEGRATOR_STATE( state, path, denoising_feature_throughput); const float denoising_depth = ensure_finite(average(denoising_feature_throughput) * sd->ray_length); @@ -48,8 +48,8 @@ ccl_device_forceinline void kernel_write_denoising_features_surface( } float3 normal = zero_float3(); - float3 diffuse_albedo = zero_float3(); - float3 specular_albedo = zero_float3(); + Spectrum diffuse_albedo = zero_spectrum(); + Spectrum specular_albedo = zero_spectrum(); float sum_weight = 0.0f, sum_nonspecular_weight = 0.0f; for (int i = 0; i < sd->num_closure; i++) { @@ -63,7 +63,7 @@ ccl_device_forceinline void kernel_write_denoising_features_surface( normal += sc->N * sc->sample_weight; sum_weight += sc->sample_weight; - float3 closure_albedo = sc->weight; + Spectrum closure_albedo = sc->weight; /* Closures that include a Fresnel term typically have weights close to 1 even though their * actual contribution is significantly lower. * To account for this, we scale their weight by the average fresnel factor (the same is also @@ -113,10 +113,12 @@ ccl_device_forceinline void kernel_write_denoising_features_surface( } if (kernel_data.film.pass_denoising_albedo != PASS_UNUSED) { - const float3 denoising_feature_throughput = INTEGRATOR_STATE( + const Spectrum denoising_feature_throughput = INTEGRATOR_STATE( state, path, denoising_feature_throughput); - const float3 denoising_albedo = ensure_finite(denoising_feature_throughput * diffuse_albedo); - kernel_write_pass_float3(buffer + kernel_data.film.pass_denoising_albedo, denoising_albedo); + const Spectrum denoising_albedo = ensure_finite(denoising_feature_throughput * + diffuse_albedo); + kernel_write_pass_spectrum(buffer + kernel_data.film.pass_denoising_albedo, + denoising_albedo); } INTEGRATOR_STATE_WRITE(state, path, flag) &= ~PATH_RAY_DENOISING_FEATURES; @@ -128,13 +130,13 @@ ccl_device_forceinline void kernel_write_denoising_features_surface( ccl_device_forceinline void kernel_write_denoising_features_volume(KernelGlobals kg, IntegratorState state, - const float3 albedo, + const Spectrum albedo, const bool scatter, ccl_global float *ccl_restrict render_buffer) { ccl_global float *buffer = kernel_pass_pixel_render_buffer(kg, state, render_buffer); - const float3 denoising_feature_throughput = INTEGRATOR_STATE( + const Spectrum denoising_feature_throughput = INTEGRATOR_STATE( state, path, denoising_feature_throughput); if (scatter && kernel_data.film.pass_denoising_normal != PASS_UNUSED) { @@ -148,8 +150,8 @@ ccl_device_forceinline void kernel_write_denoising_features_volume(KernelGlobals if (kernel_data.film.pass_denoising_albedo != PASS_UNUSED) { /* Write albedo. */ - const float3 denoising_albedo = ensure_finite(denoising_feature_throughput * albedo); - kernel_write_pass_float3(buffer + kernel_data.film.pass_denoising_albedo, denoising_albedo); + const Spectrum denoising_albedo = ensure_finite(denoising_feature_throughput * albedo); + kernel_write_pass_spectrum(buffer + kernel_data.film.pass_denoising_albedo, denoising_albedo); } } #endif /* __DENOISING_FEATURES__ */ @@ -228,7 +230,7 @@ ccl_device_inline void kernel_write_data_passes(KernelGlobals kg, } if (kernel_data.film.cryptomatte_passes) { - const float3 throughput = INTEGRATOR_STATE(state, path, throughput); + const Spectrum throughput = INTEGRATOR_STATE(state, path, throughput); const float matte_weight = average(throughput) * (1.0f - average(shader_bsdf_transparency(kg, sd))); if (matte_weight > 0.0f) { @@ -252,19 +254,19 @@ ccl_device_inline void kernel_write_data_passes(KernelGlobals kg, } if (flag & PASSMASK(DIFFUSE_COLOR)) { - const float3 throughput = INTEGRATOR_STATE(state, path, throughput); - kernel_write_pass_float3(buffer + kernel_data.film.pass_diffuse_color, - shader_bsdf_diffuse(kg, sd) * throughput); + const Spectrum throughput = INTEGRATOR_STATE(state, path, throughput); + kernel_write_pass_spectrum(buffer + kernel_data.film.pass_diffuse_color, + shader_bsdf_diffuse(kg, sd) * throughput); } if (flag & PASSMASK(GLOSSY_COLOR)) { - const float3 throughput = INTEGRATOR_STATE(state, path, throughput); - kernel_write_pass_float3(buffer + kernel_data.film.pass_glossy_color, - shader_bsdf_glossy(kg, sd) * throughput); + const Spectrum throughput = INTEGRATOR_STATE(state, path, throughput); + kernel_write_pass_spectrum(buffer + kernel_data.film.pass_glossy_color, + shader_bsdf_glossy(kg, sd) * throughput); } if (flag & PASSMASK(TRANSMISSION_COLOR)) { - const float3 throughput = INTEGRATOR_STATE(state, path, throughput); - kernel_write_pass_float3(buffer + kernel_data.film.pass_transmission_color, - shader_bsdf_transmission(kg, sd) * throughput); + const Spectrum throughput = INTEGRATOR_STATE(state, path, throughput); + kernel_write_pass_spectrum(buffer + kernel_data.film.pass_transmission_color, + shader_bsdf_transmission(kg, sd) * throughput); } if (flag & PASSMASK(MIST)) { /* Bring depth into 0..1 range. */ @@ -287,8 +289,8 @@ ccl_device_inline void kernel_write_data_passes(KernelGlobals kg, mist = powf(mist, mist_falloff); /* Modulate by transparency */ - const float3 throughput = INTEGRATOR_STATE(state, path, throughput); - const float3 alpha = shader_bsdf_alpha(kg, sd); + const Spectrum throughput = INTEGRATOR_STATE(state, path, throughput); + const Spectrum alpha = shader_bsdf_alpha(kg, sd); const float mist_output = (1.0f - mist) * average(throughput * alpha); /* Note that the final value in the render buffer we want is 1 - mist_output, |