2022-02-11 13:53:21 +01:00
|
|
|
/* SPDX-License-Identifier: Apache-2.0
|
|
|
|
* Copyright 2011-2022 Blender Foundation */
|
2015-07-18 22:09:20 +02:00
|
|
|
|
2021-10-24 14:19:19 +02:00
|
|
|
#pragma once
|
|
|
|
|
2015-07-18 22:09:20 +02:00
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
/* TODO(sergey): Think of making it more generic volume-type attribute
|
|
|
|
* sampler.
|
|
|
|
*/
|
2021-10-17 16:10:10 +02:00
|
|
|
ccl_device_noinline int svm_node_tex_voxel(
|
|
|
|
KernelGlobals kg, ccl_private ShaderData *sd, ccl_private float *stack, uint4 node, int offset)
|
2015-07-18 22:09:20 +02:00
|
|
|
{
|
2019-04-17 06:17:24 +02:00
|
|
|
uint co_offset, density_out_offset, color_out_offset, space;
|
2019-08-21 11:59:57 +02:00
|
|
|
svm_unpack_node_uchar4(node.z, &co_offset, &density_out_offset, &color_out_offset, &space);
|
2016-02-17 01:20:46 +01:00
|
|
|
#ifdef __VOLUME__
|
2019-04-17 06:17:24 +02:00
|
|
|
int id = node.y;
|
|
|
|
float3 co = stack_load_float3(stack, co_offset);
|
|
|
|
if (space == NODE_TEX_VOXEL_SPACE_OBJECT) {
|
|
|
|
co = volume_normalized_position(kg, sd, co);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
kernel_assert(space == NODE_TEX_VOXEL_SPACE_WORLD);
|
|
|
|
Transform tfm;
|
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
|
|
|
tfm.x = read_node_float(kg, &offset);
|
|
|
|
tfm.y = read_node_float(kg, &offset);
|
|
|
|
tfm.z = read_node_float(kg, &offset);
|
2019-04-17 06:17:24 +02:00
|
|
|
co = transform_point(&tfm, co);
|
|
|
|
}
|
2017-10-06 21:47:41 +02:00
|
|
|
|
2020-03-17 16:48:00 +01:00
|
|
|
float4 r = kernel_tex_image_interp_3d(kg, id, co, INTERPOLATION_NONE);
|
2016-02-17 01:20:46 +01:00
|
|
|
#else
|
2022-03-23 15:53:10 +01:00
|
|
|
float4 r = zero_float4();
|
2016-02-15 15:40:39 +01:00
|
|
|
#endif
|
2019-04-17 06:17:24 +02:00
|
|
|
if (stack_valid(density_out_offset))
|
|
|
|
stack_store_float(stack, density_out_offset, r.w);
|
|
|
|
if (stack_valid(color_out_offset))
|
|
|
|
stack_store_float3(stack, color_out_offset, make_float3(r.x, r.y, r.z));
|
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 offset;
|
2015-07-18 22:09:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
CCL_NAMESPACE_END
|