2023-06-14 16:52:36 +10:00
|
|
|
/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0 */
|
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
|
|
|
|
2021-11-05 21:01:23 +01:00
|
|
|
#include "device/device.h"
|
|
|
|
|
|
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
|
|
|
#include "integrator/pass_accessor_cpu.h"
|
|
|
|
|
|
2021-10-24 14:19:19 +02:00
|
|
|
#include "session/buffers.h"
|
2021-11-05 21:01:23 +01:00
|
|
|
|
2021-10-24 14:19:19 +02:00
|
|
|
#include "util/tbb.h"
|
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
|
|
|
|
2021-10-24 14:19:19 +02:00
|
|
|
#include "kernel/types.h"
|
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
|
|
|
|
|
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------
|
|
|
|
|
* Kernel processing.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
inline void PassAccessorCPU::run_get_pass_kernel_processor_float(
|
|
|
|
|
const KernelFilmConvert *kfilm_convert,
|
|
|
|
|
const RenderBuffers *render_buffers,
|
|
|
|
|
const BufferParams &buffer_params,
|
|
|
|
|
const Destination &destination,
|
2021-11-05 21:01:23 +01:00
|
|
|
const CPUKernels::FilmConvertFunction func) const
|
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
|
|
|
{
|
2021-11-05 21:01:23 +01:00
|
|
|
/* NOTE: No overlays are applied since they are not used for final renders.
|
|
|
|
|
* Can be supported via some sort of specialization to avoid code duplication. */
|
|
|
|
|
|
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
|
|
|
DCHECK_EQ(destination.stride, 0) << "Custom stride for float destination is not implemented.";
|
|
|
|
|
|
2021-09-21 17:03:22 +02:00
|
|
|
const int64_t pass_stride = buffer_params.pass_stride;
|
|
|
|
|
const int64_t buffer_row_stride = buffer_params.stride * buffer_params.pass_stride;
|
|
|
|
|
|
|
|
|
|
const float *window_data = render_buffers->buffer.data() + buffer_params.window_x * pass_stride +
|
|
|
|
|
buffer_params.window_y * buffer_row_stride;
|
|
|
|
|
|
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
|
|
|
const int pixel_stride = destination.pixel_stride ? destination.pixel_stride :
|
|
|
|
|
destination.num_components;
|
|
|
|
|
|
2022-04-18 18:32:56 +02:00
|
|
|
parallel_for(0, buffer_params.window_height, [&](int64_t y) {
|
2021-09-21 17:03:22 +02:00
|
|
|
const float *buffer = window_data + y * buffer_row_stride;
|
2024-02-06 21:13:23 +01:00
|
|
|
float *pixel = destination.pixels + destination.pixel_offset +
|
2021-09-21 17:03:22 +02:00
|
|
|
(y * buffer_params.width + destination.offset) * pixel_stride;
|
2021-11-05 21:01:23 +01:00
|
|
|
func(kfilm_convert, buffer, pixel, buffer_params.window_width, pass_stride, pixel_stride);
|
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
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void PassAccessorCPU::run_get_pass_kernel_processor_half_rgba(
|
|
|
|
|
const KernelFilmConvert *kfilm_convert,
|
|
|
|
|
const RenderBuffers *render_buffers,
|
|
|
|
|
const BufferParams &buffer_params,
|
|
|
|
|
const Destination &destination,
|
2021-11-05 21:01:23 +01:00
|
|
|
const CPUKernels::FilmConvertHalfRGBAFunction func) const
|
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
|
|
|
{
|
2021-09-21 17:03:22 +02:00
|
|
|
const int64_t pass_stride = buffer_params.pass_stride;
|
|
|
|
|
const int64_t buffer_row_stride = buffer_params.stride * buffer_params.pass_stride;
|
|
|
|
|
|
|
|
|
|
const float *window_data = render_buffers->buffer.data() + buffer_params.window_x * pass_stride +
|
|
|
|
|
buffer_params.window_y * buffer_row_stride;
|
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
|
|
|
|
|
|
|
|
half4 *dst_start = destination.pixels_half_rgba + destination.offset;
|
|
|
|
|
const int destination_stride = destination.stride != 0 ? destination.stride :
|
|
|
|
|
buffer_params.width;
|
|
|
|
|
|
2022-04-18 18:32:56 +02:00
|
|
|
parallel_for(0, buffer_params.window_height, [&](int64_t y) {
|
2021-09-21 17:03:22 +02:00
|
|
|
const float *buffer = window_data + y * buffer_row_stride;
|
|
|
|
|
half4 *pixel = dst_start + y * destination_stride;
|
2021-11-05 21:01:23 +01:00
|
|
|
func(kfilm_convert, buffer, pixel, buffer_params.window_width, pass_stride);
|
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
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------
|
|
|
|
|
* Pass accessors.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#define DEFINE_PASS_ACCESSOR(pass) \
|
|
|
|
|
void PassAccessorCPU::get_pass_##pass(const RenderBuffers *render_buffers, \
|
|
|
|
|
const BufferParams &buffer_params, \
|
|
|
|
|
const Destination &destination) const \
|
|
|
|
|
{ \
|
2021-11-05 21:01:23 +01:00
|
|
|
const CPUKernels &kernels = Device::get_cpu_kernels(); \
|
|
|
|
|
KernelFilmConvert kfilm_convert; \
|
|
|
|
|
init_kernel_film_convert(&kfilm_convert, buffer_params, destination); \
|
|
|
|
|
\
|
|
|
|
|
if (destination.pixels) { \
|
|
|
|
|
run_get_pass_kernel_processor_float(&kfilm_convert, \
|
|
|
|
|
render_buffers, \
|
|
|
|
|
buffer_params, \
|
|
|
|
|
destination, \
|
|
|
|
|
kernels.film_convert_##pass); \
|
|
|
|
|
} \
|
|
|
|
|
\
|
|
|
|
|
if (destination.pixels_half_rgba) { \
|
|
|
|
|
run_get_pass_kernel_processor_half_rgba(&kfilm_convert, \
|
|
|
|
|
render_buffers, \
|
|
|
|
|
buffer_params, \
|
|
|
|
|
destination, \
|
|
|
|
|
kernels.film_convert_half_rgba_##pass); \
|
|
|
|
|
} \
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Float (scalar) passes. */
|
|
|
|
|
DEFINE_PASS_ACCESSOR(depth)
|
|
|
|
|
DEFINE_PASS_ACCESSOR(mist)
|
|
|
|
|
DEFINE_PASS_ACCESSOR(sample_count)
|
|
|
|
|
DEFINE_PASS_ACCESSOR(float)
|
|
|
|
|
|
|
|
|
|
/* Float3 passes. */
|
|
|
|
|
DEFINE_PASS_ACCESSOR(light_path)
|
|
|
|
|
DEFINE_PASS_ACCESSOR(shadow_catcher)
|
|
|
|
|
DEFINE_PASS_ACCESSOR(float3)
|
|
|
|
|
|
|
|
|
|
/* Float4 passes. */
|
|
|
|
|
DEFINE_PASS_ACCESSOR(motion)
|
|
|
|
|
DEFINE_PASS_ACCESSOR(cryptomatte)
|
|
|
|
|
DEFINE_PASS_ACCESSOR(shadow_catcher_matte_with_shadow)
|
|
|
|
|
DEFINE_PASS_ACCESSOR(combined)
|
|
|
|
|
DEFINE_PASS_ACCESSOR(float4)
|
|
|
|
|
|
|
|
|
|
#undef DEFINE_PASS_ACCESSOR
|
|
|
|
|
|
|
|
|
|
CCL_NAMESPACE_END
|