2011-04-27 11:58:34 +00:00
|
|
|
/*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Copyright 2011-2013 Blender Foundation
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2011-04-27 11:58:34 +00:00
|
|
|
*
|
2013-08-18 14:16:15 +00:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
2014-12-25 02:50:24 +01:00
|
|
|
* limitations under the License.
|
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
|
|
|
|
|
|
|
|
|
|
#include "kernel_differential.h"
|
|
|
|
|
#include "kernel_lookup_table.h"
|
|
|
|
|
#include "kernel_montecarlo.h"
|
|
|
|
|
#include "kernel_projection.h"
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
|
|
/* Perspective Camera */
|
|
|
|
|
|
2018-01-12 02:14:27 +01:00
|
|
|
ccl_device float2 camera_sample_aperture(ccl_constant KernelCamera *cam, float u, float v)
|
2011-09-16 13:14:02 +00:00
|
|
|
{
|
2018-01-12 02:14:27 +01:00
|
|
|
float blades = cam->blades;
|
2014-08-27 10:51:50 +02:00
|
|
|
float2 bokeh;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-09-16 13:14:02 +00:00
|
|
|
if (blades == 0.0f) {
|
|
|
|
|
/* sample disk */
|
2014-08-27 10:51:50 +02:00
|
|
|
bokeh = concentric_sample_disk(u, v);
|
2011-09-16 13:14:02 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* sample polygon */
|
2018-01-12 02:14:27 +01:00
|
|
|
float rotation = cam->bladesrotation;
|
2014-08-27 10:51:50 +02:00
|
|
|
bokeh = regular_polygon_sample(blades, rotation, u, v);
|
2011-09-16 13:14:02 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-08-27 10:51:50 +02:00
|
|
|
/* anamorphic lens bokeh */
|
2018-01-12 02:14:27 +01:00
|
|
|
bokeh.x *= cam->inv_aperture_ratio;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-08-27 10:51:50 +02:00
|
|
|
return bokeh;
|
2011-09-16 13:14:02 +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 void camera_sample_perspective(ccl_global const KernelGlobals *ccl_restrict kg,
|
Cycles: OpenCL kernel split
This commit contains all the work related on the AMD megakernel split work
which was mainly done by Varun Sundar, George Kyriazis and Lenny Wang, plus
some help from Sergey Sharybin, Martijn Berger, Thomas Dinges and likely
someone else which we're forgetting to mention.
Currently only AMD cards are enabled for the new split kernel, but it is
possible to force split opencl kernel to be used by setting the following
environment variable: CYCLES_OPENCL_SPLIT_KERNEL_TEST=1.
Not all the features are supported yet, and that being said no motion blur,
camera blur, SSS and volumetrics for now. Also transparent shadows are
disabled on AMD device because of some compiler bug.
This kernel is also only implements regular path tracing and supporting
branched one will take a bit. Branched path tracing is exposed to the
interface still, which is a bit misleading and will be hidden there soon.
More feature will be enabled once they're ported to the split kernel and
tested.
Neither regular CPU nor CUDA has any difference, they're generating the
same exact code, which means no regressions/improvements there.
Based on the research paper:
https://research.nvidia.com/sites/default/files/publications/laine2013hpg_paper.pdf
Here's the documentation:
https://docs.google.com/document/d/1LuXW-CV-sVJkQaEGZlMJ86jZ8FmoPfecaMdR-oiWbUY/edit
Design discussion of the patch:
https://developer.blender.org/T44197
Differential Revision: https://developer.blender.org/D1200
2015-05-09 19:34:30 +05:00
|
|
|
float raster_x,
|
|
|
|
|
float raster_y,
|
|
|
|
|
float lens_u,
|
|
|
|
|
float lens_v,
|
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 Ray *ray)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
|
/* create ray form raster position */
|
2018-03-08 05:33:55 +01:00
|
|
|
ProjectionTransform rastertocamera = kernel_data.cam.rastertocamera;
|
2015-07-21 15:36:35 +02:00
|
|
|
float3 raster = make_float3(raster_x, raster_y, 0.0f);
|
|
|
|
|
float3 Pcamera = transform_perspective(&rastertocamera, raster);
|
|
|
|
|
|
|
|
|
|
#ifdef __CAMERA_MOTION__
|
|
|
|
|
if (kernel_data.cam.have_perspective_motion) {
|
|
|
|
|
/* TODO(sergey): Currently we interpolate projected coordinate which
|
|
|
|
|
* gives nice looking result and which is simple, but is in fact a bit
|
|
|
|
|
* different comparing to constructing projective matrix from an
|
|
|
|
|
* interpolated field of view.
|
|
|
|
|
*/
|
|
|
|
|
if (ray->time < 0.5f) {
|
2018-03-10 00:37:07 +01:00
|
|
|
ProjectionTransform rastertocamera_pre = kernel_data.cam.perspective_pre;
|
2015-07-21 15:36:35 +02:00
|
|
|
float3 Pcamera_pre = transform_perspective(&rastertocamera_pre, raster);
|
|
|
|
|
Pcamera = interp(Pcamera_pre, Pcamera, ray->time * 2.0f);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2018-03-10 00:37:07 +01:00
|
|
|
ProjectionTransform rastertocamera_post = kernel_data.cam.perspective_post;
|
2015-07-21 15:36:35 +02:00
|
|
|
float3 Pcamera_post = transform_perspective(&rastertocamera_post, raster);
|
|
|
|
|
Pcamera = interp(Pcamera, Pcamera_post, (ray->time - 0.5f) * 2.0f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2021-02-17 01:47:18 +01:00
|
|
|
float3 P = zero_float3();
|
2016-10-22 23:25:39 +02:00
|
|
|
float3 D = Pcamera;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
|
/* modify ray for depth of field */
|
2011-09-16 13:14:02 +00:00
|
|
|
float aperturesize = kernel_data.cam.aperturesize;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2011-09-16 13:14:02 +00:00
|
|
|
if (aperturesize > 0.0f) {
|
|
|
|
|
/* sample point on aperture */
|
2018-01-12 02:14:27 +01:00
|
|
|
float2 lensuv = camera_sample_aperture(&kernel_data.cam, lens_u, lens_v) * aperturesize;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
|
/* compute point on plane of focus */
|
2016-10-22 23:25:39 +02:00
|
|
|
float ft = kernel_data.cam.focaldistance / D.z;
|
|
|
|
|
float3 Pfocus = D * ft;
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
|
/* update ray for effect of lens */
|
2016-10-22 23:25:39 +02:00
|
|
|
P = make_float3(lensuv.x, lensuv.y, 0.0f);
|
|
|
|
|
D = normalize(Pfocus - P);
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* transform ray from camera to world */
|
|
|
|
|
Transform cameratoworld = kernel_data.cam.cameratoworld;
|
|
|
|
|
|
2012-10-09 18:37:14 +00:00
|
|
|
#ifdef __CAMERA_MOTION__
|
2018-03-10 01:36:09 +01:00
|
|
|
if (kernel_data.cam.num_motion_steps) {
|
|
|
|
|
transform_motion_array_interpolate(&cameratoworld,
|
|
|
|
|
kernel_tex_array(__camera_motion),
|
|
|
|
|
kernel_data.cam.num_motion_steps,
|
|
|
|
|
ray->time);
|
2015-02-21 12:33:21 +05:00
|
|
|
}
|
2012-04-30 12:49:26 +00:00
|
|
|
#endif
|
|
|
|
|
|
2016-10-22 23:25:39 +02:00
|
|
|
P = transform_point(&cameratoworld, P);
|
|
|
|
|
D = normalize(transform_direction(&cameratoworld, D));
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2016-10-22 15:59:23 +02:00
|
|
|
bool use_stereo = kernel_data.cam.interocular_offset != 0.0f;
|
2016-10-24 12:26:12 +02:00
|
|
|
if (!use_stereo) {
|
2016-10-22 15:59:23 +02:00
|
|
|
/* No stereo */
|
2016-10-22 23:25:39 +02:00
|
|
|
ray->P = P;
|
|
|
|
|
ray->D = D;
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
#ifdef __RAY_DIFFERENTIALS__
|
2016-10-22 15:59:23 +02:00
|
|
|
float3 Dcenter = transform_direction(&cameratoworld, Pcamera);
|
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
|
|
|
float3 Dcenter_normalized = normalize(Dcenter);
|
|
|
|
|
|
|
|
|
|
/* TODO: can this be optimized to give compact differentials directly? */
|
|
|
|
|
ray->dP = differential_zero_compact();
|
|
|
|
|
differential3 dD;
|
|
|
|
|
dD.dx = normalize(Dcenter + float4_to_float3(kernel_data.cam.dx)) - Dcenter_normalized;
|
|
|
|
|
dD.dy = normalize(Dcenter + float4_to_float3(kernel_data.cam.dy)) - Dcenter_normalized;
|
|
|
|
|
ray->dD = differential_make_compact(dD);
|
2016-10-22 15:59:23 +02:00
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* Spherical stereo */
|
2018-01-12 02:14:27 +01:00
|
|
|
spherical_stereo_transform(&kernel_data.cam, &P, &D);
|
2016-10-22 23:25:39 +02:00
|
|
|
ray->P = P;
|
|
|
|
|
ray->D = D;
|
2016-10-22 15:59:23 +02:00
|
|
|
|
|
|
|
|
#ifdef __RAY_DIFFERENTIALS__
|
|
|
|
|
/* Ray differentials, computed from scratch using the raster coordinates
|
|
|
|
|
* because we don't want to be affected by depth of field. We compute
|
2019-07-07 15:38:41 +10:00
|
|
|
* ray origin and direction for the center and two neighboring pixels
|
2016-10-22 15:59:23 +02:00
|
|
|
* and simply take their differences. */
|
2021-02-17 01:47:18 +01:00
|
|
|
float3 Pnostereo = transform_point(&cameratoworld, zero_float3());
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-10-22 15:59:23 +02:00
|
|
|
float3 Pcenter = Pnostereo;
|
|
|
|
|
float3 Dcenter = Pcamera;
|
|
|
|
|
Dcenter = normalize(transform_direction(&cameratoworld, Dcenter));
|
2018-01-12 02:14:27 +01:00
|
|
|
spherical_stereo_transform(&kernel_data.cam, &Pcenter, &Dcenter);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-10-22 15:59:23 +02:00
|
|
|
float3 Px = Pnostereo;
|
|
|
|
|
float3 Dx = transform_perspective(&rastertocamera,
|
|
|
|
|
make_float3(raster_x + 1.0f, raster_y, 0.0f));
|
|
|
|
|
Dx = normalize(transform_direction(&cameratoworld, Dx));
|
2018-01-12 02:14:27 +01:00
|
|
|
spherical_stereo_transform(&kernel_data.cam, &Px, &Dx);
|
2019-04-17 06:17:24 +02: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
|
|
|
differential3 dP, dD;
|
|
|
|
|
|
|
|
|
|
dP.dx = Px - Pcenter;
|
|
|
|
|
dD.dx = Dx - Dcenter;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-10-22 15:59:23 +02:00
|
|
|
float3 Py = Pnostereo;
|
|
|
|
|
float3 Dy = transform_perspective(&rastertocamera,
|
|
|
|
|
make_float3(raster_x, raster_y + 1.0f, 0.0f));
|
|
|
|
|
Dy = normalize(transform_direction(&cameratoworld, Dy));
|
2018-01-12 02:14:27 +01:00
|
|
|
spherical_stereo_transform(&kernel_data.cam, &Py, &Dy);
|
2019-04-17 06:17:24 +02: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
|
|
|
dP.dy = Py - Pcenter;
|
|
|
|
|
dD.dy = Dy - Dcenter;
|
|
|
|
|
ray->dD = differential_make_compact(dD);
|
|
|
|
|
ray->dP = differential_make_compact(dP);
|
2011-04-27 11:58:34 +00:00
|
|
|
#endif
|
2016-10-22 15:59:23 +02:00
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
|
#ifdef __CAMERA_CLIPPING__
|
|
|
|
|
/* clipping */
|
2016-10-22 15:59:23 +02:00
|
|
|
float z_inv = 1.0f / normalize(Pcamera).z;
|
|
|
|
|
float nearclip = kernel_data.cam.nearclip * z_inv;
|
|
|
|
|
ray->P += nearclip * ray->D;
|
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
|
|
|
ray->dP += nearclip * ray->dD;
|
2015-01-14 02:34:49 +05:00
|
|
|
ray->t = kernel_data.cam.cliplength * z_inv;
|
2011-04-27 11:58:34 +00:00
|
|
|
#else
|
|
|
|
|
ray->t = FLT_MAX;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Orthographic Camera */
|
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 void camera_sample_orthographic(ccl_global const KernelGlobals *ccl_restrict kg,
|
Cycles: OpenCL kernel split
This commit contains all the work related on the AMD megakernel split work
which was mainly done by Varun Sundar, George Kyriazis and Lenny Wang, plus
some help from Sergey Sharybin, Martijn Berger, Thomas Dinges and likely
someone else which we're forgetting to mention.
Currently only AMD cards are enabled for the new split kernel, but it is
possible to force split opencl kernel to be used by setting the following
environment variable: CYCLES_OPENCL_SPLIT_KERNEL_TEST=1.
Not all the features are supported yet, and that being said no motion blur,
camera blur, SSS and volumetrics for now. Also transparent shadows are
disabled on AMD device because of some compiler bug.
This kernel is also only implements regular path tracing and supporting
branched one will take a bit. Branched path tracing is exposed to the
interface still, which is a bit misleading and will be hidden there soon.
More feature will be enabled once they're ported to the split kernel and
tested.
Neither regular CPU nor CUDA has any difference, they're generating the
same exact code, which means no regressions/improvements there.
Based on the research paper:
https://research.nvidia.com/sites/default/files/publications/laine2013hpg_paper.pdf
Here's the documentation:
https://docs.google.com/document/d/1LuXW-CV-sVJkQaEGZlMJ86jZ8FmoPfecaMdR-oiWbUY/edit
Design discussion of the patch:
https://developer.blender.org/T44197
Differential Revision: https://developer.blender.org/D1200
2015-05-09 19:34:30 +05:00
|
|
|
float raster_x,
|
|
|
|
|
float raster_y,
|
|
|
|
|
float lens_u,
|
|
|
|
|
float lens_v,
|
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 Ray *ray)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
|
/* create ray form raster position */
|
2018-03-08 05:33:55 +01:00
|
|
|
ProjectionTransform rastertocamera = kernel_data.cam.rastertocamera;
|
2012-04-16 08:35:21 +00:00
|
|
|
float3 Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-10-22 23:25:39 +02:00
|
|
|
float3 P;
|
|
|
|
|
float3 D = make_float3(0.0f, 0.0f, 1.0f);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-21 02:38:11 +00:00
|
|
|
/* modify ray for depth of field */
|
|
|
|
|
float aperturesize = kernel_data.cam.aperturesize;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-21 02:38:11 +00:00
|
|
|
if (aperturesize > 0.0f) {
|
|
|
|
|
/* sample point on aperture */
|
2018-01-12 02:14:27 +01:00
|
|
|
float2 lensuv = camera_sample_aperture(&kernel_data.cam, lens_u, lens_v) * aperturesize;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-21 02:38:11 +00:00
|
|
|
/* compute point on plane of focus */
|
2016-10-22 23:25:39 +02:00
|
|
|
float3 Pfocus = D * kernel_data.cam.focaldistance;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-03-21 02:38:11 +00:00
|
|
|
/* update ray for effect of lens */
|
2013-04-04 23:52:33 +00:00
|
|
|
float3 lensuvw = make_float3(lensuv.x, lensuv.y, 0.0f);
|
2016-10-22 23:25:39 +02:00
|
|
|
P = Pcamera + lensuvw;
|
|
|
|
|
D = normalize(Pfocus - lensuvw);
|
2013-03-21 02:38:11 +00:00
|
|
|
}
|
2013-04-06 11:52:40 +00:00
|
|
|
else {
|
2016-10-22 23:25:39 +02:00
|
|
|
P = Pcamera;
|
2013-04-06 11:52:40 +00:00
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
/* transform ray from camera to world */
|
|
|
|
|
Transform cameratoworld = kernel_data.cam.cameratoworld;
|
|
|
|
|
|
2012-10-09 18:37:14 +00:00
|
|
|
#ifdef __CAMERA_MOTION__
|
2018-03-10 01:36:09 +01:00
|
|
|
if (kernel_data.cam.num_motion_steps) {
|
|
|
|
|
transform_motion_array_interpolate(&cameratoworld,
|
|
|
|
|
kernel_tex_array(__camera_motion),
|
|
|
|
|
kernel_data.cam.num_motion_steps,
|
|
|
|
|
ray->time);
|
2015-02-21 12:33:21 +05:00
|
|
|
}
|
2012-04-30 12:49:26 +00:00
|
|
|
#endif
|
|
|
|
|
|
2016-10-22 23:25:39 +02:00
|
|
|
ray->P = transform_point(&cameratoworld, P);
|
|
|
|
|
ray->D = normalize(transform_direction(&cameratoworld, D));
|
2011-04-27 11:58:34 +00:00
|
|
|
|
|
|
|
|
#ifdef __RAY_DIFFERENTIALS__
|
|
|
|
|
/* ray differential */
|
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
|
|
|
differential3 dP;
|
|
|
|
|
dP.dx = float4_to_float3(kernel_data.cam.dx);
|
|
|
|
|
dP.dy = float4_to_float3(kernel_data.cam.dx);
|
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
|
|
|
ray->dP = differential_make_compact(dP);
|
|
|
|
|
ray->dD = differential_zero_compact();
|
2011-04-27 11:58:34 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef __CAMERA_CLIPPING__
|
|
|
|
|
/* clipping */
|
|
|
|
|
ray->t = kernel_data.cam.cliplength;
|
|
|
|
|
#else
|
|
|
|
|
ray->t = FLT_MAX;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-04 16:20:51 +00:00
|
|
|
/* Panorama Camera */
|
2012-02-28 16:44:54 +00:00
|
|
|
|
2018-01-12 02:14:27 +01:00
|
|
|
ccl_device_inline void camera_sample_panorama(ccl_constant KernelCamera *cam,
|
2019-08-21 12:04:40 +02:00
|
|
|
#ifdef __CAMERA_MOTION__
|
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_global const DecomposedTransform *cam_motion,
|
2019-08-21 12:04:40 +02:00
|
|
|
#endif
|
2016-08-01 15:40:46 +02:00
|
|
|
float raster_x,
|
|
|
|
|
float raster_y,
|
|
|
|
|
float lens_u,
|
|
|
|
|
float lens_v,
|
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 Ray *ray)
|
2012-02-28 16:44:54 +00:00
|
|
|
{
|
2018-03-08 05:33:55 +01:00
|
|
|
ProjectionTransform rastertocamera = cam->rastertocamera;
|
2012-04-16 08:35:21 +00:00
|
|
|
float3 Pcamera = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
|
2012-02-28 16:44:54 +00:00
|
|
|
|
|
|
|
|
/* create ray form raster position */
|
2021-02-17 01:47:18 +01:00
|
|
|
float3 P = zero_float3();
|
2018-01-12 02:14:27 +01:00
|
|
|
float3 D = panorama_to_direction(cam, Pcamera.x, Pcamera.y);
|
2012-05-05 19:44:35 +00:00
|
|
|
|
2013-07-10 17:25:52 +00:00
|
|
|
/* indicates ray should not receive any light, outside of the lens */
|
2016-10-22 23:25:39 +02:00
|
|
|
if (is_zero(D)) {
|
2013-07-10 17:25:52 +00:00
|
|
|
ray->t = 0.0f;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-17 11:25:29 +00:00
|
|
|
/* modify ray for depth of field */
|
2018-01-12 02:14:27 +01:00
|
|
|
float aperturesize = cam->aperturesize;
|
2012-09-17 11:25:29 +00:00
|
|
|
|
|
|
|
|
if (aperturesize > 0.0f) {
|
|
|
|
|
/* sample point on aperture */
|
2018-01-12 02:14:27 +01:00
|
|
|
float2 lensuv = camera_sample_aperture(cam, lens_u, lens_v) * aperturesize;
|
2012-09-17 11:25:29 +00:00
|
|
|
|
|
|
|
|
/* compute point on plane of focus */
|
2016-10-24 14:04:31 +02:00
|
|
|
float3 Dfocus = normalize(D);
|
2018-01-12 02:14:27 +01:00
|
|
|
float3 Pfocus = Dfocus * cam->focaldistance;
|
2012-09-17 11:25:29 +00:00
|
|
|
|
2016-10-24 14:04:31 +02:00
|
|
|
/* calculate orthonormal coordinates perpendicular to Dfocus */
|
2012-09-17 11:25:29 +00:00
|
|
|
float3 U, V;
|
2016-10-24 14:04:31 +02:00
|
|
|
U = normalize(make_float3(1.0f, 0.0f, 0.0f) - Dfocus.x * Dfocus);
|
|
|
|
|
V = normalize(cross(Dfocus, U));
|
2012-09-17 11:25:29 +00:00
|
|
|
|
|
|
|
|
/* update ray for effect of lens */
|
2016-10-22 23:25:39 +02:00
|
|
|
P = U * lensuv.x + V * lensuv.y;
|
|
|
|
|
D = normalize(Pfocus - P);
|
2012-09-17 11:25:29 +00:00
|
|
|
}
|
|
|
|
|
|
2012-02-28 16:44:54 +00:00
|
|
|
/* transform ray from camera to world */
|
2018-01-12 02:14:27 +01:00
|
|
|
Transform cameratoworld = cam->cameratoworld;
|
2012-02-28 16:44:54 +00:00
|
|
|
|
2012-10-09 18:37:14 +00:00
|
|
|
#ifdef __CAMERA_MOTION__
|
2018-03-10 01:36:09 +01:00
|
|
|
if (cam->num_motion_steps) {
|
|
|
|
|
transform_motion_array_interpolate(
|
|
|
|
|
&cameratoworld, cam_motion, cam->num_motion_steps, ray->time);
|
2015-05-09 18:57:51 +05:00
|
|
|
}
|
|
|
|
|
#endif
|
2012-04-30 12:49:26 +00:00
|
|
|
|
2016-10-22 23:25:39 +02:00
|
|
|
P = transform_point(&cameratoworld, P);
|
|
|
|
|
D = normalize(transform_direction(&cameratoworld, D));
|
2016-10-22 15:59:23 +02:00
|
|
|
|
|
|
|
|
/* Stereo transform */
|
2018-01-12 02:14:27 +01:00
|
|
|
bool use_stereo = cam->interocular_offset != 0.0f;
|
2016-10-24 12:26:12 +02:00
|
|
|
if (use_stereo) {
|
2018-01-12 02:14:27 +01:00
|
|
|
spherical_stereo_transform(cam, &P, &D);
|
2016-10-22 15:59:23 +02:00
|
|
|
}
|
2012-02-28 16:44:54 +00:00
|
|
|
|
2016-10-22 23:25:39 +02:00
|
|
|
ray->P = P;
|
|
|
|
|
ray->D = D;
|
|
|
|
|
|
2012-02-28 16:44:54 +00:00
|
|
|
#ifdef __RAY_DIFFERENTIALS__
|
2016-10-22 15:59:23 +02:00
|
|
|
/* Ray differentials, computed from scratch using the raster coordinates
|
|
|
|
|
* because we don't want to be affected by depth of field. We compute
|
2019-07-07 15:38:41 +10:00
|
|
|
* ray origin and direction for the center and two neighboring pixels
|
2016-10-22 15:59:23 +02:00
|
|
|
* and simply take their differences. */
|
|
|
|
|
float3 Pcenter = Pcamera;
|
2018-01-12 02:14:27 +01:00
|
|
|
float3 Dcenter = panorama_to_direction(cam, Pcenter.x, Pcenter.y);
|
2016-10-22 15:59:23 +02:00
|
|
|
Pcenter = transform_point(&cameratoworld, Pcenter);
|
|
|
|
|
Dcenter = normalize(transform_direction(&cameratoworld, Dcenter));
|
2016-10-24 12:26:12 +02:00
|
|
|
if (use_stereo) {
|
2018-01-12 02:14:27 +01:00
|
|
|
spherical_stereo_transform(cam, &Pcenter, &Dcenter);
|
2016-10-22 15:59:23 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-10-22 15:59:23 +02:00
|
|
|
float3 Px = transform_perspective(&rastertocamera, make_float3(raster_x + 1.0f, raster_y, 0.0f));
|
2018-01-12 02:14:27 +01:00
|
|
|
float3 Dx = panorama_to_direction(cam, Px.x, Px.y);
|
2016-10-22 15:59:23 +02:00
|
|
|
Px = transform_point(&cameratoworld, Px);
|
|
|
|
|
Dx = normalize(transform_direction(&cameratoworld, Dx));
|
2016-10-24 12:26:12 +02:00
|
|
|
if (use_stereo) {
|
2018-01-12 02:14:27 +01:00
|
|
|
spherical_stereo_transform(cam, &Px, &Dx);
|
2016-10-22 15:59:23 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02: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
|
|
|
differential3 dP, dD;
|
|
|
|
|
dP.dx = Px - Pcenter;
|
|
|
|
|
dD.dx = Dx - Dcenter;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-10-22 15:59:23 +02:00
|
|
|
float3 Py = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y + 1.0f, 0.0f));
|
2018-01-12 02:14:27 +01:00
|
|
|
float3 Dy = panorama_to_direction(cam, Py.x, Py.y);
|
2016-10-22 15:59:23 +02:00
|
|
|
Py = transform_point(&cameratoworld, Py);
|
|
|
|
|
Dy = normalize(transform_direction(&cameratoworld, Dy));
|
2016-10-24 12:26:12 +02:00
|
|
|
if (use_stereo) {
|
2018-01-12 02:14:27 +01:00
|
|
|
spherical_stereo_transform(cam, &Py, &Dy);
|
2016-10-22 15:59:23 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02: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
|
|
|
dP.dy = Py - Pcenter;
|
|
|
|
|
dD.dy = Dy - Dcenter;
|
|
|
|
|
ray->dD = differential_make_compact(dD);
|
|
|
|
|
ray->dP = differential_make_compact(dP);
|
2012-02-28 16:44:54 +00:00
|
|
|
#endif
|
2016-10-15 00:11:42 +02:00
|
|
|
|
|
|
|
|
#ifdef __CAMERA_CLIPPING__
|
|
|
|
|
/* clipping */
|
2018-01-12 02:14:27 +01:00
|
|
|
float nearclip = cam->nearclip;
|
2016-10-22 15:59:23 +02:00
|
|
|
ray->P += nearclip * ray->D;
|
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
|
|
|
ray->dP += nearclip * ray->dD;
|
2018-01-12 02:14:27 +01:00
|
|
|
ray->t = cam->cliplength;
|
2016-10-15 00:11:42 +02:00
|
|
|
#else
|
|
|
|
|
ray->t = FLT_MAX;
|
|
|
|
|
#endif
|
2012-02-28 16:44:54 +00:00
|
|
|
}
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* Common */
|
|
|
|
|
|
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_inline void camera_sample(ccl_global const KernelGlobals *ccl_restrict kg,
|
2016-08-01 15:40:46 +02:00
|
|
|
int x,
|
|
|
|
|
int y,
|
|
|
|
|
float filter_u,
|
|
|
|
|
float filter_v,
|
|
|
|
|
float lens_u,
|
|
|
|
|
float lens_v,
|
|
|
|
|
float time,
|
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 Ray *ray)
|
2011-04-27 11:58:34 +00:00
|
|
|
{
|
|
|
|
|
/* pixel filter */
|
2013-04-01 20:26:43 +00:00
|
|
|
int filter_table_offset = kernel_data.film.filter_table_offset;
|
2013-04-01 20:26:52 +00:00
|
|
|
float raster_x = x + lookup_table_read(kg, filter_u, filter_table_offset, FILTER_TABLE_SIZE);
|
|
|
|
|
float raster_y = y + lookup_table_read(kg, filter_v, filter_table_offset, FILTER_TABLE_SIZE);
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2015-02-26 13:27:02 +01:00
|
|
|
#ifdef __CAMERA_MOTION__
|
|
|
|
|
/* motion blur */
|
2015-10-27 13:16:04 +05:00
|
|
|
if (kernel_data.cam.shuttertime == -1.0f) {
|
2016-09-02 21:37:17 -04:00
|
|
|
ray->time = 0.5f;
|
2015-10-27 13:16:04 +05:00
|
|
|
}
|
|
|
|
|
else {
|
2015-11-20 14:42:34 +05:00
|
|
|
/* TODO(sergey): Such lookup is unneeded when there's rolling shutter
|
2016-01-14 17:01:39 +05:00
|
|
|
* effect in use but rolling shutter duration is set to 0.0.
|
2015-11-20 14:42:34 +05:00
|
|
|
*/
|
2015-10-27 13:16:04 +05:00
|
|
|
const int shutter_table_offset = kernel_data.cam.shutter_table_offset;
|
|
|
|
|
ray->time = lookup_table_read(kg, time, shutter_table_offset, SHUTTER_TABLE_SIZE);
|
2015-11-20 14:42:34 +05:00
|
|
|
/* TODO(sergey): Currently single rolling shutter effect type only
|
2020-07-07 12:44:47 +10:00
|
|
|
* where scan-lines are acquired from top to bottom and whole scan-line
|
2015-11-20 14:42:34 +05:00
|
|
|
* is acquired at once (no delay in acquisition happens between pixels
|
2019-06-12 09:04:10 +10:00
|
|
|
* of single scan-line).
|
2015-11-20 14:42:34 +05:00
|
|
|
*
|
|
|
|
|
* Might want to support more models in the future.
|
|
|
|
|
*/
|
|
|
|
|
if (kernel_data.cam.rolling_shutter_type) {
|
|
|
|
|
/* Time corresponding to a fully rolling shutter only effect:
|
|
|
|
|
* top of the frame is time 0.0, bottom of the frame is time 1.0.
|
|
|
|
|
*/
|
|
|
|
|
const float time = 1.0f - (float)y / kernel_data.cam.height;
|
|
|
|
|
const float duration = kernel_data.cam.rolling_shutter_duration;
|
|
|
|
|
if (duration != 0.0f) {
|
|
|
|
|
/* This isn't fully physical correct, but lets us to have simple
|
|
|
|
|
* controls in the interface. The idea here is basically sort of
|
|
|
|
|
* linear interpolation between how much rolling shutter effect
|
|
|
|
|
* exist on the frame and how much of it is a motion blur effect.
|
|
|
|
|
*/
|
|
|
|
|
ray->time = (ray->time - 0.5f) * duration;
|
|
|
|
|
ray->time += (time - 0.5f) * (1.0f - duration) + 0.5f;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ray->time = time;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-10-27 13:16:04 +05:00
|
|
|
}
|
2015-02-26 13:27:02 +01:00
|
|
|
#endif
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
/* sample */
|
2018-03-10 01:36:09 +01:00
|
|
|
if (kernel_data.cam.type == CAMERA_PERSPECTIVE) {
|
2012-02-28 16:44:54 +00:00
|
|
|
camera_sample_perspective(kg, raster_x, raster_y, lens_u, lens_v, ray);
|
2018-03-10 01:36:09 +01:00
|
|
|
}
|
|
|
|
|
else if (kernel_data.cam.type == CAMERA_ORTHOGRAPHIC) {
|
2013-03-21 02:38:11 +00:00
|
|
|
camera_sample_orthographic(kg, raster_x, raster_y, lens_u, lens_v, ray);
|
2018-03-10 01:36:09 +01:00
|
|
|
}
|
|
|
|
|
else {
|
2019-08-21 12:04:40 +02:00
|
|
|
#ifdef __CAMERA_MOTION__
|
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_global const DecomposedTransform *cam_motion = kernel_tex_array(__camera_motion);
|
2018-03-10 01:36:09 +01:00
|
|
|
camera_sample_panorama(&kernel_data.cam, cam_motion, raster_x, raster_y, lens_u, lens_v, ray);
|
2019-08-21 12:04:40 +02:00
|
|
|
#else
|
|
|
|
|
camera_sample_panorama(&kernel_data.cam, raster_x, raster_y, lens_u, lens_v, ray);
|
|
|
|
|
#endif
|
2018-03-10 01:36:09 +01:00
|
|
|
}
|
2011-04-27 11:58:34 +00:00
|
|
|
}
|
|
|
|
|
|
2012-11-21 13:00:57 +00:00
|
|
|
/* Utilities */
|
|
|
|
|
|
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_inline float3 camera_position(ccl_global const KernelGlobals *kg)
|
2013-06-08 10:51:33 +00:00
|
|
|
{
|
|
|
|
|
Transform cameratoworld = kernel_data.cam.cameratoworld;
|
|
|
|
|
return make_float3(cameratoworld.x.w, cameratoworld.y.w, cameratoworld.z.w);
|
|
|
|
|
}
|
|
|
|
|
|
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_inline float camera_distance(ccl_global const KernelGlobals *kg, float3 P)
|
2012-11-21 13:00:57 +00:00
|
|
|
{
|
|
|
|
|
Transform cameratoworld = kernel_data.cam.cameratoworld;
|
|
|
|
|
float3 camP = make_float3(cameratoworld.x.w, cameratoworld.y.w, cameratoworld.z.w);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-21 13:00:57 +00:00
|
|
|
if (kernel_data.cam.type == CAMERA_ORTHOGRAPHIC) {
|
|
|
|
|
float3 camD = make_float3(cameratoworld.x.z, cameratoworld.y.z, cameratoworld.z.z);
|
|
|
|
|
return fabsf(dot((P - camP), camD));
|
|
|
|
|
}
|
2020-05-10 16:12:46 +02:00
|
|
|
else {
|
2013-06-04 17:20:00 +00:00
|
|
|
return len(P - camP);
|
2020-05-10 16:12:46 +02: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_inline float camera_z_depth(ccl_global const KernelGlobals *kg, float3 P)
|
2020-05-10 16:12:46 +02:00
|
|
|
{
|
|
|
|
|
if (kernel_data.cam.type != CAMERA_PANORAMA) {
|
|
|
|
|
Transform worldtocamera = kernel_data.cam.worldtocamera;
|
|
|
|
|
return transform_point(&worldtocamera, P).z;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
Transform cameratoworld = kernel_data.cam.cameratoworld;
|
|
|
|
|
float3 camP = make_float3(cameratoworld.x.w, cameratoworld.y.w, cameratoworld.z.w);
|
|
|
|
|
return len(P - camP);
|
|
|
|
|
}
|
2012-11-21 13:00:57 +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_inline float3 camera_direction_from_point(ccl_global const KernelGlobals *kg, float3 P)
|
2014-05-27 10:56:59 -03:00
|
|
|
{
|
|
|
|
|
Transform cameratoworld = kernel_data.cam.cameratoworld;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-05-27 10:56:59 -03:00
|
|
|
if (kernel_data.cam.type == CAMERA_ORTHOGRAPHIC) {
|
|
|
|
|
float3 camD = make_float3(cameratoworld.x.z, cameratoworld.y.z, cameratoworld.z.z);
|
|
|
|
|
return -camD;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
float3 camP = make_float3(cameratoworld.x.w, cameratoworld.y.w, cameratoworld.z.w);
|
|
|
|
|
return normalize(camP - P);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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_inline float3 camera_world_to_ndc(ccl_global const KernelGlobals *kg,
|
|
|
|
|
ccl_private ShaderData *sd,
|
|
|
|
|
float3 P)
|
2013-06-08 10:51:33 +00:00
|
|
|
{
|
|
|
|
|
if (kernel_data.cam.type != CAMERA_PANORAMA) {
|
|
|
|
|
/* perspective / ortho */
|
2017-02-16 06:24:13 -05:00
|
|
|
if (sd->object == PRIM_NONE && kernel_data.cam.type == CAMERA_PERSPECTIVE)
|
2013-06-08 10:51:33 +00:00
|
|
|
P += camera_position(kg);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-03-08 05:33:55 +01:00
|
|
|
ProjectionTransform tfm = kernel_data.cam.worldtondc;
|
2013-06-08 10:51:33 +00:00
|
|
|
return transform_perspective(&tfm, P);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* panorama */
|
|
|
|
|
Transform tfm = kernel_data.cam.worldtocamera;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-16 06:24:13 -05:00
|
|
|
if (sd->object != OBJECT_NONE)
|
2013-06-08 10:51:33 +00:00
|
|
|
P = normalize(transform_point(&tfm, P));
|
|
|
|
|
else
|
|
|
|
|
P = normalize(transform_direction(&tfm, P));
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-12 02:14:27 +01:00
|
|
|
float2 uv = direction_to_panorama(&kernel_data.cam, P);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-06-08 10:51:33 +00:00
|
|
|
return make_float3(uv.x, uv.y, 0.0f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
CCL_NAMESPACE_END
|