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
|
|
|
|
|
|
|
|
#include "integrator/pass_accessor.h"
|
|
|
|
|
|
2021-10-24 14:19:19 +02:00
|
|
|
#include "session/buffers.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
|
|
|
|
2024-12-26 17:53:59 +01:00
|
|
|
#include "util/log.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
|
|
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------
|
|
|
|
|
* Pass input information.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
PassAccessor::PassAccessInfo::PassAccessInfo(const BufferPass &pass)
|
2022-04-02 00:11:11 +02:00
|
|
|
: type(pass.type),
|
|
|
|
|
mode(pass.mode),
|
|
|
|
|
include_albedo(pass.include_albedo),
|
|
|
|
|
is_lightgroup(!pass.lightgroup.empty()),
|
|
|
|
|
offset(pass.offset)
|
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 destination.
|
|
|
|
|
*/
|
|
|
|
|
|
2025-01-01 18:15:54 +01:00
|
|
|
PassAccessor::Destination::Destination(float *pixels, const int num_components)
|
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
|
|
|
: pixels(pixels), num_components(num_components)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PassAccessor::Destination::Destination(const PassType pass_type, half4 *pixels)
|
|
|
|
|
: Destination(pass_type)
|
|
|
|
|
{
|
|
|
|
|
pixels_half_rgba = pixels;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PassAccessor::Destination::Destination(const PassType pass_type)
|
|
|
|
|
{
|
|
|
|
|
const PassInfo pass_info = Pass::get_info(pass_type);
|
|
|
|
|
num_components = pass_info.num_components;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------
|
|
|
|
|
* Pass source.
|
|
|
|
|
*/
|
|
|
|
|
|
2025-01-01 18:15:54 +01:00
|
|
|
PassAccessor::Source::Source(const float *pixels, const int num_components)
|
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
|
|
|
: pixels(pixels), num_components(num_components)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------
|
|
|
|
|
* Pass accessor.
|
|
|
|
|
*/
|
|
|
|
|
|
2025-01-01 18:15:54 +01:00
|
|
|
PassAccessor::PassAccessor(const PassAccessInfo &pass_access_info,
|
|
|
|
|
const float exposure,
|
|
|
|
|
const int num_samples)
|
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_access_info_(pass_access_info), exposure_(exposure), num_samples_(num_samples)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool PassAccessor::get_render_tile_pixels(const RenderBuffers *render_buffers,
|
|
|
|
|
const Destination &destination) const
|
|
|
|
|
{
|
|
|
|
|
if (render_buffers == nullptr || render_buffers->buffer.data() == nullptr) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return get_render_tile_pixels(render_buffers, render_buffers->params, destination);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void pad_pixels(const BufferParams &buffer_params,
|
|
|
|
|
const PassAccessor::Destination &destination,
|
|
|
|
|
const int src_num_components)
|
|
|
|
|
{
|
|
|
|
|
/* When requesting a single channel pass as RGBA, or RGB pass as RGBA,
|
|
|
|
|
* fill in the additional components for convenience. */
|
|
|
|
|
const int dest_num_components = destination.num_components;
|
|
|
|
|
|
|
|
|
|
if (src_num_components >= dest_num_components) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-13 10:06:30 +02:00
|
|
|
const size_t size = static_cast<size_t>(buffer_params.width) * buffer_params.height;
|
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 (destination.pixels) {
|
2021-10-13 10:34:17 +02:00
|
|
|
const size_t pixel_stride = destination.pixel_stride ? destination.pixel_stride :
|
|
|
|
|
destination.num_components;
|
|
|
|
|
|
|
|
|
|
float *pixel = destination.pixels + pixel_stride * destination.offset;
|
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
|
|
|
|
|
|
|
|
for (size_t i = 0; i < size; i++, pixel += dest_num_components) {
|
|
|
|
|
if (dest_num_components >= 3 && src_num_components == 1) {
|
|
|
|
|
pixel[1] = pixel[0];
|
|
|
|
|
pixel[2] = pixel[0];
|
|
|
|
|
}
|
|
|
|
|
if (dest_num_components >= 4) {
|
|
|
|
|
pixel[3] = 1.0f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (destination.pixels_half_rgba) {
|
2021-10-21 19:25:38 +02:00
|
|
|
const half one = float_to_half_display(1.0f);
|
2021-10-13 10:34:17 +02:00
|
|
|
half4 *pixel = destination.pixels_half_rgba + destination.offset;
|
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
|
|
|
|
|
|
|
|
for (size_t i = 0; i < size; i++, pixel++) {
|
|
|
|
|
if (dest_num_components >= 3 && src_num_components == 1) {
|
|
|
|
|
pixel[0].y = pixel[0].x;
|
|
|
|
|
pixel[0].z = pixel[0].x;
|
|
|
|
|
}
|
|
|
|
|
if (dest_num_components >= 4) {
|
|
|
|
|
pixel[0].w = one;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool PassAccessor::get_render_tile_pixels(const RenderBuffers *render_buffers,
|
|
|
|
|
const BufferParams &buffer_params,
|
|
|
|
|
const Destination &destination) const
|
|
|
|
|
{
|
|
|
|
|
if (render_buffers == nullptr || render_buffers->buffer.data() == nullptr) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const PassType type = pass_access_info_.type;
|
|
|
|
|
const PassMode mode = pass_access_info_.mode;
|
2022-04-02 00:11:11 +02:00
|
|
|
const PassInfo pass_info = Pass::get_info(
|
|
|
|
|
type, pass_access_info_.include_albedo, pass_access_info_.is_lightgroup);
|
2022-01-20 22:31:21 +01:00
|
|
|
int num_written_components = pass_info.num_components;
|
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 (pass_info.num_components == 1) {
|
|
|
|
|
/* Single channel passes. */
|
|
|
|
|
if (mode == PassMode::DENOISED) {
|
|
|
|
|
/* Denoised passes store their final pixels, no need in special calculation. */
|
|
|
|
|
get_pass_float(render_buffers, buffer_params, destination);
|
|
|
|
|
}
|
|
|
|
|
else if (type == PASS_DEPTH) {
|
|
|
|
|
get_pass_depth(render_buffers, buffer_params, destination);
|
|
|
|
|
}
|
|
|
|
|
else if (type == PASS_MIST) {
|
|
|
|
|
get_pass_mist(render_buffers, buffer_params, destination);
|
|
|
|
|
}
|
|
|
|
|
else if (type == PASS_SAMPLE_COUNT) {
|
|
|
|
|
get_pass_sample_count(render_buffers, buffer_params, destination);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
get_pass_float(render_buffers, buffer_params, destination);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (type == PASS_MOTION) {
|
|
|
|
|
/* Motion pass. */
|
|
|
|
|
DCHECK_EQ(destination.num_components, 4) << "Motion pass must have 4 components";
|
|
|
|
|
get_pass_motion(render_buffers, buffer_params, destination);
|
|
|
|
|
}
|
|
|
|
|
else if (type == PASS_CRYPTOMATTE) {
|
|
|
|
|
/* Cryptomatte pass. */
|
|
|
|
|
DCHECK_EQ(destination.num_components, 4) << "Cryptomatte pass must have 4 components";
|
|
|
|
|
get_pass_cryptomatte(render_buffers, buffer_params, destination);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* RGB, RGBA and vector passes. */
|
|
|
|
|
DCHECK(destination.num_components == 3 || destination.num_components == 4)
|
|
|
|
|
<< pass_type_as_string(type) << " pass must have 3 or 4 components";
|
|
|
|
|
|
|
|
|
|
if (type == PASS_SHADOW_CATCHER_MATTE && pass_access_info_.use_approximate_shadow_catcher) {
|
|
|
|
|
/* Denoised matte with shadow needs to do calculation (will use denoised shadow catcher pass
|
|
|
|
|
* to approximate shadow with). */
|
|
|
|
|
get_pass_shadow_catcher_matte_with_shadow(render_buffers, buffer_params, destination);
|
|
|
|
|
}
|
|
|
|
|
else if (type == PASS_SHADOW_CATCHER && mode != PassMode::DENOISED) {
|
|
|
|
|
/* Shadow catcher pass. */
|
|
|
|
|
get_pass_shadow_catcher(render_buffers, buffer_params, destination);
|
|
|
|
|
}
|
|
|
|
|
else if ((pass_info.divide_type != PASS_NONE || pass_info.direct_type != PASS_NONE ||
|
|
|
|
|
pass_info.indirect_type != PASS_NONE) &&
|
|
|
|
|
mode != PassMode::DENOISED)
|
|
|
|
|
{
|
2022-01-20 22:31:21 +01:00
|
|
|
/* RGB lighting passes that need to divide out color and/or sum direct and indirect.
|
|
|
|
|
* These can also optionally write alpha like the combined 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
|
|
|
get_pass_light_path(render_buffers, buffer_params, destination);
|
2022-01-20 22:31:21 +01:00
|
|
|
num_written_components = 4;
|
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 {
|
|
|
|
|
/* Passes that need no special computation, or denoised passes that already
|
|
|
|
|
* had the computation done. */
|
|
|
|
|
if (pass_info.num_components == 3) {
|
|
|
|
|
get_pass_float3(render_buffers, buffer_params, destination);
|
2022-08-31 20:09:12 +02:00
|
|
|
|
|
|
|
|
/* Use alpha for colors passes. */
|
|
|
|
|
if (type == PASS_DIFFUSE_COLOR || type == PASS_GLOSSY_COLOR ||
|
2024-01-02 18:12:54 +01:00
|
|
|
type == PASS_TRANSMISSION_COLOR)
|
|
|
|
|
{
|
2022-08-31 20:09:12 +02:00
|
|
|
num_written_components = destination.num_components;
|
|
|
|
|
}
|
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 if (pass_info.num_components == 4) {
|
|
|
|
|
if (destination.num_components == 3) {
|
|
|
|
|
/* Special case for denoiser access of RGBA passes ignoring alpha channel. */
|
|
|
|
|
get_pass_float3(render_buffers, buffer_params, destination);
|
|
|
|
|
}
|
|
|
|
|
else if (type == PASS_COMBINED || type == PASS_SHADOW_CATCHER ||
|
2024-01-02 18:12:54 +01:00
|
|
|
type == PASS_SHADOW_CATCHER_MATTE)
|
|
|
|
|
{
|
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
|
|
|
/* Passes with transparency as 4th component. */
|
|
|
|
|
get_pass_combined(render_buffers, buffer_params, destination);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* Passes with alpha as 4th component. */
|
|
|
|
|
get_pass_float4(render_buffers, buffer_params, destination);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-20 22:31:21 +01:00
|
|
|
pad_pixels(buffer_params, destination, num_written_components);
|
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
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PassAccessor::init_kernel_film_convert(KernelFilmConvert *kfilm_convert,
|
|
|
|
|
const BufferParams &buffer_params,
|
|
|
|
|
const Destination &destination) const
|
|
|
|
|
{
|
|
|
|
|
const PassMode mode = pass_access_info_.mode;
|
2022-04-02 00:11:11 +02:00
|
|
|
const PassInfo &pass_info = Pass::get_info(
|
|
|
|
|
pass_access_info_.type, pass_access_info_.include_albedo, pass_access_info_.is_lightgroup);
|
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
|
|
|
|
|
|
|
|
kfilm_convert->pass_offset = pass_access_info_.offset;
|
|
|
|
|
kfilm_convert->pass_stride = buffer_params.pass_stride;
|
|
|
|
|
|
|
|
|
|
kfilm_convert->pass_use_exposure = pass_info.use_exposure;
|
|
|
|
|
kfilm_convert->pass_use_filter = pass_info.use_filter;
|
|
|
|
|
|
|
|
|
|
/* TODO(sergey): Some of the passes needs to become denoised when denoised pass is accessed. */
|
|
|
|
|
if (pass_info.direct_type != PASS_NONE) {
|
|
|
|
|
kfilm_convert->pass_offset = buffer_params.get_pass_offset(pass_info.direct_type);
|
|
|
|
|
}
|
|
|
|
|
kfilm_convert->pass_indirect = buffer_params.get_pass_offset(pass_info.indirect_type);
|
|
|
|
|
kfilm_convert->pass_divide = buffer_params.get_pass_offset(pass_info.divide_type);
|
|
|
|
|
|
|
|
|
|
kfilm_convert->pass_combined = buffer_params.get_pass_offset(PASS_COMBINED);
|
|
|
|
|
kfilm_convert->pass_sample_count = buffer_params.get_pass_offset(PASS_SAMPLE_COUNT);
|
|
|
|
|
kfilm_convert->pass_adaptive_aux_buffer = buffer_params.get_pass_offset(
|
|
|
|
|
PASS_ADAPTIVE_AUX_BUFFER);
|
|
|
|
|
kfilm_convert->pass_motion_weight = buffer_params.get_pass_offset(PASS_MOTION_WEIGHT);
|
|
|
|
|
kfilm_convert->pass_shadow_catcher = buffer_params.get_pass_offset(PASS_SHADOW_CATCHER, mode);
|
|
|
|
|
kfilm_convert->pass_shadow_catcher_sample_count = buffer_params.get_pass_offset(
|
|
|
|
|
PASS_SHADOW_CATCHER_SAMPLE_COUNT);
|
|
|
|
|
kfilm_convert->pass_shadow_catcher_matte = buffer_params.get_pass_offset(
|
|
|
|
|
PASS_SHADOW_CATCHER_MATTE, mode);
|
|
|
|
|
|
|
|
|
|
/* Background is not denoised, so always use noisy pass. */
|
|
|
|
|
kfilm_convert->pass_background = buffer_params.get_pass_offset(PASS_BACKGROUND);
|
|
|
|
|
|
|
|
|
|
if (pass_info.use_filter) {
|
|
|
|
|
kfilm_convert->scale = num_samples_ != 0 ? 1.0f / num_samples_ : 0.0f;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
kfilm_convert->scale = 1.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pass_info.use_exposure) {
|
|
|
|
|
kfilm_convert->exposure = exposure_;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
kfilm_convert->exposure = 1.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
kfilm_convert->scale_exposure = kfilm_convert->scale * kfilm_convert->exposure;
|
|
|
|
|
|
|
|
|
|
kfilm_convert->use_approximate_shadow_catcher = pass_access_info_.use_approximate_shadow_catcher;
|
|
|
|
|
kfilm_convert->use_approximate_shadow_catcher_background =
|
|
|
|
|
pass_access_info_.use_approximate_shadow_catcher_background;
|
|
|
|
|
kfilm_convert->show_active_pixels = pass_access_info_.show_active_pixels;
|
|
|
|
|
|
|
|
|
|
kfilm_convert->num_components = destination.num_components;
|
|
|
|
|
kfilm_convert->pixel_stride = destination.pixel_stride ? destination.pixel_stride :
|
|
|
|
|
destination.num_components;
|
|
|
|
|
|
|
|
|
|
kfilm_convert->is_denoised = (mode == PassMode::DENOISED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool PassAccessor::set_render_tile_pixels(RenderBuffers *render_buffers, const Source &source)
|
|
|
|
|
{
|
|
|
|
|
if (render_buffers == nullptr || render_buffers->buffer.data() == nullptr) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-02 00:11:11 +02:00
|
|
|
const PassInfo pass_info = Pass::get_info(
|
|
|
|
|
pass_access_info_.type, pass_access_info_.include_albedo, pass_access_info_.is_lightgroup);
|
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 BufferParams &buffer_params = render_buffers->params;
|
|
|
|
|
|
|
|
|
|
float *buffer_data = render_buffers->buffer.data();
|
|
|
|
|
const int size = buffer_params.width * buffer_params.height;
|
|
|
|
|
|
|
|
|
|
const int out_stride = buffer_params.pass_stride;
|
|
|
|
|
const int in_stride = source.num_components;
|
|
|
|
|
const int num_components_to_copy = min(source.num_components, pass_info.num_components);
|
|
|
|
|
|
|
|
|
|
float *out = buffer_data + pass_access_info_.offset;
|
|
|
|
|
const float *in = source.pixels + source.offset * in_stride;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < size; i++, out += out_stride, in += in_stride) {
|
|
|
|
|
memcpy(out, in, sizeof(float) * num_components_to_copy);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CCL_NAMESPACE_END
|