2023-06-14 16:52:36 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0 */
|
2011-04-27 11:58:34 +00:00
|
|
|
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
#pragma once
|
2013-12-28 01:54:44 +01:00
|
|
|
|
2024-10-02 11:05:28 +02:00
|
|
|
#include "kernel/closure/volume_util.h"
|
|
|
|
|
|
|
|
|
|
#include "kernel/closure/volume_draine.h"
|
|
|
|
|
#include "kernel/closure/volume_fournier_forand.h"
|
|
|
|
|
#include "kernel/closure/volume_henyey_greenstein.h"
|
|
|
|
|
#include "kernel/closure/volume_rayleigh.h"
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
2017-11-01 21:07:15 +01:00
|
|
|
/* VOLUME EXTINCTION */
|
|
|
|
|
|
2022-07-29 13:41:37 +02:00
|
|
|
ccl_device void volume_extinction_setup(ccl_private ShaderData *sd, Spectrum weight)
|
2017-11-01 21:07:15 +01:00
|
|
|
{
|
|
|
|
|
if (sd->flag & SD_EXTINCTION) {
|
|
|
|
|
sd->closure_transparent_extinction += weight;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
sd->flag |= SD_EXTINCTION;
|
|
|
|
|
sd->closure_transparent_extinction = weight;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-02 11:05:28 +02:00
|
|
|
/* VOLUME SCATTERING */
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2022-07-29 13:41:37 +02:00
|
|
|
ccl_device Spectrum volume_phase_eval(ccl_private const ShaderData *sd,
|
|
|
|
|
ccl_private const ShaderVolumeClosure *svc,
|
2023-01-17 17:19:20 +01:00
|
|
|
float3 wo,
|
2022-07-29 13:41:37 +02:00
|
|
|
ccl_private float *pdf)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
2024-10-02 11:05:28 +02:00
|
|
|
switch (svc->type) {
|
|
|
|
|
case CLOSURE_VOLUME_FOURNIER_FORAND_ID:
|
|
|
|
|
return volume_fournier_forand_eval(sd, svc, wo, pdf);
|
|
|
|
|
case CLOSURE_VOLUME_RAYLEIGH_ID:
|
|
|
|
|
return volume_rayleigh_eval(sd, wo, pdf);
|
|
|
|
|
case CLOSURE_VOLUME_DRAINE_ID:
|
|
|
|
|
return volume_draine_eval(sd, svc, wo, pdf);
|
|
|
|
|
case CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID:
|
|
|
|
|
return volume_henyey_greenstein_eval(sd, svc, wo, pdf);
|
|
|
|
|
default:
|
|
|
|
|
kernel_assert(false);
|
|
|
|
|
*pdf = 0.0f;
|
|
|
|
|
return zero_spectrum();
|
|
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
|
Cycles: Kernel address space changes for MSL
This is the first of a sequence of changes to support compiling Cycles kernels as MSL (Metal Shading Language) in preparation for a Metal GPU device implementation.
MSL requires that all pointer types be declared with explicit address space attributes (device, thread, etc...). There is already precedent for this with Cycles' address space macros (ccl_global, ccl_private, etc...), therefore the first step of MSL-enablement is to apply these consistently. Line-for-line this represents the largest change required to enable MSL. Applying this change first will simplify future patches as well as offering the emergent benefit of enhanced descriptiveness.
The vast majority of deltas in this patch fall into one of two cases:
- Ensuring ccl_private is specified for thread-local pointer types
- Ensuring ccl_global is specified for device-wide pointer types
Additionally, the ccl_addr_space qualifier can be removed. Prior to Cycles X, ccl_addr_space was used as a context-dependent address space qualifier, but now it is either redundant (e.g. in struct typedefs), or can be replaced by ccl_global in the case of pointer types. Associated function variants (e.g. lcg_step_float_addrspace) are also redundant.
In cases where address space qualifiers are chained with "const", this patch places the address space qualifier first. The rationale for this is that the choice of address space is likely to have the greater impact on runtime performance and overall architecture.
The final part of this patch is the addition of a metal/compat.h header. This is partially complete and will be extended in future patches, paving the way for the full Metal implementation.
Ref T92212
Reviewed By: brecht
Maniphest Tasks: T92212
Differential Revision: https://developer.blender.org/D12864
2021-10-14 13:53:40 +01:00
|
|
|
ccl_device int volume_phase_sample(ccl_private const ShaderData *sd,
|
|
|
|
|
ccl_private const ShaderVolumeClosure *svc,
|
2023-05-24 18:56:58 +02:00
|
|
|
float2 rand,
|
2022-07-29 13:41:37 +02:00
|
|
|
ccl_private Spectrum *eval,
|
2023-01-17 17:19:20 +01:00
|
|
|
ccl_private float3 *wo,
|
Cycles: Kernel address space changes for MSL
This is the first of a sequence of changes to support compiling Cycles kernels as MSL (Metal Shading Language) in preparation for a Metal GPU device implementation.
MSL requires that all pointer types be declared with explicit address space attributes (device, thread, etc...). There is already precedent for this with Cycles' address space macros (ccl_global, ccl_private, etc...), therefore the first step of MSL-enablement is to apply these consistently. Line-for-line this represents the largest change required to enable MSL. Applying this change first will simplify future patches as well as offering the emergent benefit of enhanced descriptiveness.
The vast majority of deltas in this patch fall into one of two cases:
- Ensuring ccl_private is specified for thread-local pointer types
- Ensuring ccl_global is specified for device-wide pointer types
Additionally, the ccl_addr_space qualifier can be removed. Prior to Cycles X, ccl_addr_space was used as a context-dependent address space qualifier, but now it is either redundant (e.g. in struct typedefs), or can be replaced by ccl_global in the case of pointer types. Associated function variants (e.g. lcg_step_float_addrspace) are also redundant.
In cases where address space qualifiers are chained with "const", this patch places the address space qualifier first. The rationale for this is that the choice of address space is likely to have the greater impact on runtime performance and overall architecture.
The final part of this patch is the addition of a metal/compat.h header. This is partially complete and will be extended in future patches, paving the way for the full Metal implementation.
Ref T92212
Reviewed By: brecht
Maniphest Tasks: T92212
Differential Revision: https://developer.blender.org/D12864
2021-10-14 13:53:40 +01:00
|
|
|
ccl_private float *pdf)
|
2013-12-28 01:54:44 +01:00
|
|
|
{
|
2024-10-02 11:05:28 +02:00
|
|
|
switch (svc->type) {
|
|
|
|
|
case CLOSURE_VOLUME_FOURNIER_FORAND_ID:
|
|
|
|
|
return volume_fournier_forand_sample(sd, svc, rand, eval, wo, pdf);
|
|
|
|
|
case CLOSURE_VOLUME_RAYLEIGH_ID:
|
|
|
|
|
return volume_rayleigh_sample(sd, rand, eval, wo, pdf);
|
|
|
|
|
case CLOSURE_VOLUME_DRAINE_ID:
|
|
|
|
|
return volume_draine_sample(sd, svc, rand, eval, wo, pdf);
|
|
|
|
|
case CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID:
|
|
|
|
|
return volume_henyey_greenstein_sample(sd, svc, rand, eval, wo, pdf);
|
|
|
|
|
default:
|
|
|
|
|
kernel_assert(false);
|
|
|
|
|
*pdf = 0.0f;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ccl_device bool volume_phase_equal(ccl_private const ShaderClosure *c1,
|
|
|
|
|
ccl_private const ShaderClosure *c2)
|
|
|
|
|
{
|
|
|
|
|
if (c1->type != c2->type) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
switch (c1->type) {
|
|
|
|
|
case CLOSURE_VOLUME_FOURNIER_FORAND_ID: {
|
|
|
|
|
ccl_private FournierForandVolume *v1 = (ccl_private FournierForandVolume *)c1;
|
|
|
|
|
ccl_private FournierForandVolume *v2 = (ccl_private FournierForandVolume *)c2;
|
|
|
|
|
return v1->c1 == v2->c1 && v1->c2 == v2->c2 && v1->c3 == v2->c3;
|
|
|
|
|
}
|
|
|
|
|
case CLOSURE_VOLUME_RAYLEIGH_ID:
|
|
|
|
|
return true;
|
|
|
|
|
case CLOSURE_VOLUME_DRAINE_ID: {
|
|
|
|
|
ccl_private DraineVolume *v1 = (ccl_private DraineVolume *)c1;
|
|
|
|
|
ccl_private DraineVolume *v2 = (ccl_private DraineVolume *)c2;
|
|
|
|
|
return v1->g == v2->g && v1->alpha == v2->alpha;
|
|
|
|
|
}
|
|
|
|
|
case CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID: {
|
|
|
|
|
ccl_private HenyeyGreensteinVolume *v1 = (ccl_private HenyeyGreensteinVolume *)c1;
|
|
|
|
|
ccl_private HenyeyGreensteinVolume *v2 = (ccl_private HenyeyGreensteinVolume *)c2;
|
|
|
|
|
return v1->g == v2->g;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Approximate phase functions as Henyey-Greenstein for volume guiding.
|
|
|
|
|
* TODO: This is not ideal, we should use RIS guiding for non-HG phase functions. */
|
|
|
|
|
ccl_device float volume_phase_get_g(ccl_private const ShaderVolumeClosure *svc)
|
|
|
|
|
{
|
|
|
|
|
switch (svc->type) {
|
|
|
|
|
case CLOSURE_VOLUME_FOURNIER_FORAND_ID:
|
|
|
|
|
/* TODO */
|
|
|
|
|
return 1.0f;
|
|
|
|
|
case CLOSURE_VOLUME_RAYLEIGH_ID:
|
|
|
|
|
/* Approximate as isotropic */
|
|
|
|
|
return 0.0f;
|
|
|
|
|
case CLOSURE_VOLUME_DRAINE_ID:
|
|
|
|
|
/* Approximate as HG, TODO */
|
|
|
|
|
return ((ccl_private DraineVolume *)svc)->g;
|
|
|
|
|
case CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID:
|
|
|
|
|
return ((ccl_private HenyeyGreensteinVolume *)svc)->g;
|
|
|
|
|
default:
|
|
|
|
|
return 0.0f;
|
|
|
|
|
}
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Volume sampling utilities. */
|
|
|
|
|
|
|
|
|
|
/* todo: this value could be tweaked or turned into a probability to avoid
|
|
|
|
|
* unnecessary work in volumes and subsurface scattering. */
|
|
|
|
|
#define VOLUME_THROUGHPUT_EPSILON 1e-6f
|
|
|
|
|
|
2022-07-29 13:41:37 +02:00
|
|
|
ccl_device Spectrum volume_color_transmittance(Spectrum sigma, float t)
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
{
|
2022-06-23 14:29:17 +02:00
|
|
|
return exp(-sigma * t);
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
}
|
|
|
|
|
|
2022-07-29 13:41:37 +02:00
|
|
|
ccl_device float volume_channel_get(Spectrum value, int channel)
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
{
|
2022-07-29 13:41:37 +02:00
|
|
|
return GET_SPECTRUM_CHANNEL(value, channel);
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
}
|
|
|
|
|
|
2022-07-29 13:41:37 +02:00
|
|
|
ccl_device int volume_sample_channel(Spectrum albedo,
|
|
|
|
|
Spectrum throughput,
|
2024-09-12 14:27:56 +02:00
|
|
|
ccl_private float *rand,
|
2022-07-29 13:41:37 +02:00
|
|
|
ccl_private Spectrum *pdf)
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
{
|
|
|
|
|
/* Sample color channel proportional to throughput and single scattering
|
|
|
|
|
* albedo, to significantly reduce noise with many bounce, following:
|
|
|
|
|
*
|
|
|
|
|
* "Practical and Controllable Subsurface Scattering for Production Path
|
|
|
|
|
* Tracing". Matt Jen-Yuan Chiang, Peter Kutz, Brent Burley. SIGGRAPH 2016. */
|
2022-07-29 13:41:37 +02:00
|
|
|
Spectrum weights = fabs(throughput * albedo);
|
|
|
|
|
float sum_weights = reduce_add(weights);
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
|
|
|
|
|
if (sum_weights > 0.0f) {
|
2022-01-20 17:01:14 +01:00
|
|
|
*pdf = weights / sum_weights;
|
2013-12-28 01:54:44 +01:00
|
|
|
}
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
else {
|
2022-07-29 13:41:37 +02:00
|
|
|
*pdf = make_spectrum(1.0f / SPECTRUM_CHANNELS);
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
}
|
|
|
|
|
|
2022-07-29 13:41:37 +02:00
|
|
|
float pdf_sum = 0.0f;
|
|
|
|
|
FOREACH_SPECTRUM_CHANNEL (i) {
|
2024-09-12 14:27:56 +02:00
|
|
|
const float channel_pdf = GET_SPECTRUM_CHANNEL(*pdf, i);
|
|
|
|
|
if (*rand < pdf_sum + channel_pdf) {
|
|
|
|
|
/* Rescale to reuse. */
|
|
|
|
|
*rand = (*rand - pdf_sum) / channel_pdf;
|
2022-07-29 13:41:37 +02:00
|
|
|
return i;
|
|
|
|
|
}
|
2024-09-12 14:27:56 +02:00
|
|
|
pdf_sum += channel_pdf;
|
Cycles: merge of cycles-x branch, a major update to the renderer
This includes much improved GPU rendering performance, viewport interactivity,
new shadow catcher, revamped sampling settings, subsurface scattering anisotropy,
new GPU volume sampling, improved PMJ sampling pattern, and more.
Some features have also been removed or changed, breaking backwards compatibility.
Including the removal of the OpenCL backend, for which alternatives are under
development.
Release notes and code docs:
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Cycles
https://wiki.blender.org/wiki/Source/Render/Cycles
Credits:
* Sergey Sharybin
* Brecht Van Lommel
* Patrick Mours (OptiX backend)
* Christophe Hery (subsurface scattering anisotropy)
* William Leeson (PMJ sampling pattern)
* Alaska (various fixes and tweaks)
* Thomas Dinges (various fixes)
For the full commit history, see the cycles-x branch. This squashes together
all the changes since intermediate changes would often fail building or tests.
Ref T87839, T87837, T87836
Fixes T90734, T89353, T80267, T80267, T77185, T69800
2021-09-20 17:59:20 +02:00
|
|
|
}
|
2022-07-29 13:41:37 +02:00
|
|
|
return SPECTRUM_CHANNELS - 1;
|
2013-12-28 01:54:44 +01:00
|
|
|
}
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
CCL_NAMESPACE_END
|