Blender V5.3
scene/camera.cpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#include <algorithm>
6
7#include "scene/camera.h"
8#include "scene/mesh.h"
9#include "scene/object.h"
10#include "scene/osl.h"
11#include "scene/scene.h"
12#include "scene/stats.h"
13#include "scene/tables.h"
14
15#include "device/device.h"
16
17#include "util/log.h"
18#include "util/math_cdf.h"
19#include "util/tbb.h"
20#include "util/time.h"
21#include "util/vector.h"
22
24
25/* Custom cameras don't work with adaptive subdivision currently, and it's a bit tricky
26 * to fix for the OptiX case as there is no OSL shader compiled for the CPU. This is a temporary
27 * workaround to fall back to a perspective camera for that case. */
28#define FIX_CUSTOM_CAMERA_CRASH
29
31
32static float shutter_curve_eval(float x, array<float> &shutter_curve)
33{
34 if (shutter_curve.size() == 0) {
35 return 1.0f;
36 }
37
38 x = saturatef(x) * shutter_curve.size() - 1;
39 const int index = (int)x;
40 const float frac = x - index;
41 if (index < shutter_curve.size() - 1) {
42 return mix(shutter_curve[index], shutter_curve[index + 1], frac);
43 }
44 return shutter_curve[shutter_curve.size() - 1];
45}
46
48{
49 NodeType *type = NodeType::add("camera", create);
50
51 SOCKET_FLOAT(shuttertime, "Shutter Time", 1.0f);
52
53 static NodeEnum motion_position_enum;
54 motion_position_enum.insert("start", MOTION_POSITION_START);
55 motion_position_enum.insert("center", MOTION_POSITION_CENTER);
56 motion_position_enum.insert("end", MOTION_POSITION_END);
57 SOCKET_ENUM(motion_position, "Motion Position", motion_position_enum, MOTION_POSITION_CENTER);
58
59 static NodeEnum rolling_shutter_type_enum;
60 rolling_shutter_type_enum.insert("none", ROLLING_SHUTTER_NONE);
61 rolling_shutter_type_enum.insert("top", ROLLING_SHUTTER_TOP);
62 SOCKET_ENUM(rolling_shutter_type,
63 "Rolling Shutter Type",
64 rolling_shutter_type_enum,
65 ROLLING_SHUTTER_NONE);
66 SOCKET_FLOAT(rolling_shutter_duration, "Rolling Shutter Duration", 0.1f);
67
68 SOCKET_FLOAT_ARRAY(shutter_curve, "Shutter Curve", array<float>());
69
70 SOCKET_FLOAT(aperturesize, "Aperture Size", 0.0f);
71 SOCKET_FLOAT(focaldistance, "Focal Distance", 10.0f);
72 SOCKET_UINT(blades, "Blades", 0);
73 SOCKET_FLOAT(bladesrotation, "Blades Rotation", 0.0f);
74
75 SOCKET_TRANSFORM(matrix, "Matrix", transform_identity());
76 SOCKET_TRANSFORM_ARRAY(motion, "Motion", array<Transform>());
77
78 SOCKET_FLOAT(aperture_ratio, "Aperture Ratio", 1.0f);
79
80 static NodeEnum type_enum;
81 type_enum.insert("perspective", CAMERA_PERSPECTIVE);
82 type_enum.insert("orthograph", CAMERA_ORTHOGRAPHIC);
83 type_enum.insert("panorama", CAMERA_PANORAMA);
84 type_enum.insert("custom", CAMERA_CUSTOM);
85 SOCKET_ENUM(camera_type, "Type", type_enum, CAMERA_PERSPECTIVE);
86
87 static NodeEnum panorama_type_enum;
88 panorama_type_enum.insert("equirectangular", PANORAMA_EQUIRECTANGULAR);
89 panorama_type_enum.insert("equiangular_cubemap_face", PANORAMA_EQUIANGULAR_CUBEMAP_FACE);
90 panorama_type_enum.insert("mirrorball", PANORAMA_MIRRORBALL);
91 panorama_type_enum.insert("fisheye_equidistant", PANORAMA_FISHEYE_EQUIDISTANT);
92 panorama_type_enum.insert("fisheye_equisolid", PANORAMA_FISHEYE_EQUISOLID);
93 panorama_type_enum.insert("fisheye_lens_polynomial", PANORAMA_FISHEYE_LENS_POLYNOMIAL);
94 panorama_type_enum.insert("panorama_central_cylindrical", PANORAMA_CENTRAL_CYLINDRICAL);
95 SOCKET_ENUM(panorama_type, "Panorama Type", panorama_type_enum, PANORAMA_EQUIRECTANGULAR);
96
97 SOCKET_FLOAT(fisheye_fov, "Fisheye FOV", M_PI_F);
98 SOCKET_FLOAT(fisheye_lens, "Fisheye Lens", 10.5f);
99 SOCKET_FLOAT(latitude_min, "Latitude Min", -M_PI_2_F);
100 SOCKET_FLOAT(latitude_max, "Latitude Max", M_PI_2_F);
101 SOCKET_FLOAT(longitude_min, "Longitude Min", -M_PI_F);
102 SOCKET_FLOAT(longitude_max, "Longitude Max", M_PI_F);
103 SOCKET_FLOAT(fov, "FOV", M_PI_4_F);
104 SOCKET_FLOAT(fov_pre, "FOV Pre", M_PI_4_F);
105 SOCKET_FLOAT(fov_post, "FOV Post", M_PI_4_F);
106
107 SOCKET_FLOAT(fisheye_polynomial_k0, "Fisheye Polynomial K0", 0.0f);
108 SOCKET_FLOAT(fisheye_polynomial_k1, "Fisheye Polynomial K1", 0.0f);
109 SOCKET_FLOAT(fisheye_polynomial_k2, "Fisheye Polynomial K2", 0.0f);
110 SOCKET_FLOAT(fisheye_polynomial_k3, "Fisheye Polynomial K3", 0.0f);
111 SOCKET_FLOAT(fisheye_polynomial_k4, "Fisheye Polynomial K4", 0.0f);
112
113 SOCKET_FLOAT(central_cylindrical_range_u_min, "Central Cylindrical Range U Min", -M_PI_F);
114 SOCKET_FLOAT(central_cylindrical_range_u_max, "Central Cylindrical Range U Max", M_PI_F);
115 SOCKET_FLOAT(central_cylindrical_range_v_min, "Central Cylindrical Range V Min", -1.0f);
116 SOCKET_FLOAT(central_cylindrical_range_v_max, "Central Cylindrical Range V Max", 1.0f);
117
118 static NodeEnum stereo_eye_enum;
119 stereo_eye_enum.insert("none", STEREO_NONE);
120 stereo_eye_enum.insert("left", STEREO_LEFT);
121 stereo_eye_enum.insert("right", STEREO_RIGHT);
122 SOCKET_ENUM(stereo_eye, "Stereo Eye", stereo_eye_enum, STEREO_NONE);
123
124 SOCKET_BOOLEAN(use_spherical_stereo, "Use Spherical Stereo", false);
125
126 SOCKET_FLOAT(interocular_distance, "Interocular Distance", 0.065f);
127 SOCKET_FLOAT(convergence_distance, "Convergence Distance", 30.0f * 0.065f);
128
129 SOCKET_BOOLEAN(use_pole_merge, "Use Pole Merge", false);
130 SOCKET_FLOAT(pole_merge_angle_from, "Pole Merge Angle From", 60.0f * M_PI_F / 180.0f);
131 SOCKET_FLOAT(pole_merge_angle_to, "Pole Merge Angle To", 75.0f * M_PI_F / 180.0f);
132
133 SOCKET_FLOAT(sensorwidth, "Sensor Width", 0.036f);
134 SOCKET_FLOAT(sensorheight, "Sensor Height", 0.024f);
135
136 SOCKET_FLOAT(nearclip, "Near Clip", 1e-5f);
137 SOCKET_FLOAT(farclip, "Far Clip", 1e5f);
138
139 SOCKET_FLOAT(viewplane.left, "Viewplane Left", 0);
140 SOCKET_FLOAT(viewplane.right, "Viewplane Right", 1);
141 SOCKET_FLOAT(viewplane.bottom, "Viewplane Bottom", 0);
142 SOCKET_FLOAT(viewplane.top, "Viewplane Top", 1);
143
144 SOCKET_FLOAT(viewplane_pre.left, "Viewplane Pre Left", 0);
145 SOCKET_FLOAT(viewplane_pre.right, "Viewplane Pre Right", 0);
146 SOCKET_FLOAT(viewplane_pre.bottom, "Viewplane Pre Bottom", 0);
147 SOCKET_FLOAT(viewplane_pre.top, "Viewplane Pre Top", 0);
148
149 SOCKET_FLOAT(viewplane_post.left, "Viewplane Post Left", 0);
150 SOCKET_FLOAT(viewplane_post.right, "Viewplane Post Right", 0);
151 SOCKET_FLOAT(viewplane_post.bottom, "Viewplane Post Bottom", 0);
152 SOCKET_FLOAT(viewplane_post.top, "Viewplane Post Top", 0);
153
154 SOCKET_FLOAT(border.left, "Border Left", 0);
155 SOCKET_FLOAT(border.right, "Border Right", 1);
156 SOCKET_FLOAT(border.bottom, "Border Bottom", 0);
157 SOCKET_FLOAT(border.top, "Border Top", 1);
158
159 SOCKET_FLOAT(border_pre_left, "Border Pre Left", -1);
160 SOCKET_FLOAT(border_pre_bottom, "Border Pre Bottom", -1);
161
162 SOCKET_FLOAT(viewport_camera_border.left, "Viewport Border Left", 0);
163 SOCKET_FLOAT(viewport_camera_border.right, "Viewport Border Right", 1);
164 SOCKET_FLOAT(viewport_camera_border.bottom, "Viewport Border Bottom", 0);
165 SOCKET_FLOAT(viewport_camera_border.top, "Viewport Border Top", 1);
166
167 SOCKET_FLOAT(offscreen_dicing_scale, "Offscreen Dicing Scale", 1.0f);
168
169 SOCKET_INT(full_width, "Full Width", 1024);
170 SOCKET_INT(full_height, "Full Height", 512);
171
172 SOCKET_BOOLEAN(use_perspective_motion, "Use Perspective Motion", false);
173
174 return type;
175}
176
177Camera::Camera() : Node(get_node_type())
178{
180
181 use_perspective_motion = false;
182
183 shutter_curve.resize(RAMP_TABLE_SIZE);
184 for (int i = 0; i < shutter_curve.size(); ++i) {
185 shutter_curve[i] = 1.0f;
186 }
187
189
196
198
199 dx = zero_float3();
200 dy = zero_float3();
201
202 need_device_update = true;
203 need_flags_update = true;
205
206 memset((void *)&kernel_camera, 0, sizeof(kernel_camera));
207}
208
209Camera::~Camera() = default;
210
212{
213 if (camera_type == CAMERA_PANORAMA || camera_type == CAMERA_CUSTOM) {
215 }
216 else {
217 const float aspect = (float)full_width / (float)full_height;
218 if (full_width >= full_height) {
219 viewplane = BoundBox2D(make_float2(aspect, 1.0f));
220 }
221 else {
222 viewplane = BoundBox2D(make_float2(1.0f, 1.0f / aspect));
223 }
224 }
225}
226
228{
229 const Scene::MotionType need_motion = scene->need_motion();
230
231 if (previous_need_motion != need_motion) {
232 /* scene's motion model could have been changed since previous device
233 * camera update this could happen for example in case when one render
234 * layer has got motion pass and another not */
235 need_device_update = true;
236 }
237
238 if (!is_modified()) {
239 return;
240 }
241
242 const scoped_callback_timer timer([scene](double time) {
243 if (scene->update_stats) {
244 scene->update_stats->camera.times.add_entry({"update", time});
245 }
246 });
247
248 /* Full viewport to camera border in the viewport. */
250 const Transform bordertofull = transform_inverse(fulltoborder);
251
252 /* NDC to raster. */
253 const Transform ndctoraster = transform_scale(width, height, 1.0f) * bordertofull;
254 const Transform full_ndctoraster = transform_scale(full_width, full_height, 1.0f) * bordertofull;
255
256 /* Raster to screen. */
257 const Transform screentondc = fulltoborder * transform_from_viewplane(viewplane);
258
259 const Transform screentoraster = ndctoraster * screentondc;
260 const Transform rastertoscreen = transform_inverse(screentoraster);
261 const Transform full_screentoraster = full_ndctoraster * screentondc;
262 const Transform full_rastertoscreen = transform_inverse(full_screentoraster);
263
264 /* Screen to camera. */
265 ProjectionTransform cameratoscreen;
266 if (camera_type == CAMERA_PERSPECTIVE) {
267 cameratoscreen = projection_perspective(fov, nearclip, farclip);
268 }
269 else if (camera_type == CAMERA_ORTHOGRAPHIC) {
270 cameratoscreen = projection_orthographic(nearclip, farclip);
271 }
272 else {
273 cameratoscreen = projection_identity();
274 }
275
276 const ProjectionTransform screentocamera = projection_inverse(cameratoscreen);
277
278 rastertocamera = screentocamera * rastertoscreen;
279 full_rastertocamera = screentocamera * full_rastertoscreen;
280
281#ifdef FIX_CUSTOM_CAMERA_CRASH
282 if (camera_type == CAMERA_CUSTOM) {
283 const ProjectionTransform full_cameratoscreen = projection_perspective(fov, nearclip, farclip);
284 const ProjectionTransform full_screentocamera = projection_inverse(full_cameratoscreen);
285 full_rastertocamera = full_screentocamera * full_rastertoscreen;
286 }
287#endif
288
289 cameratoworld = matrix;
290 screentoworld = cameratoworld * screentocamera;
292 ndctoworld = rastertoworld * ndctoraster;
293
294 /* note we recompose matrices instead of taking inverses of the above, this
295 * is needed to avoid inverting near degenerate matrices that happen due to
296 * precision issues with large scenes */
298 worldtoscreen = cameratoscreen * worldtocamera;
299 worldtondc = screentondc * worldtoscreen;
300 worldtoraster = ndctoraster * worldtondc;
301
302 /* differentials */
303 if (camera_type == CAMERA_ORTHOGRAPHIC) {
308 }
309 else if (camera_type == CAMERA_PERSPECTIVE) {
318 }
319 else {
320#ifdef FIX_CUSTOM_CAMERA_CRASH
321 if (camera_type == CAMERA_CUSTOM) {
326 }
327#endif
328 dx = zero_float3();
329 dy = zero_float3();
330 }
331
336
337#ifdef FIX_CUSTOM_CAMERA_CRASH
338 if (camera_type == CAMERA_PERSPECTIVE || camera_type == CAMERA_CUSTOM) {
339#else
340 if (camera_type == CAMERA_PERSPECTIVE) {
341#endif
343 make_float3(full_width, full_height, 0.0f));
344 frustum_right_normal = normalize(make_float3(v.z, 0.0f, -v.x));
345 frustum_top_normal = normalize(make_float3(0.0f, v.z, -v.y));
346
348 frustum_left_normal = normalize(make_float3(-v.z, 0.0f, v.x));
349 frustum_bottom_normal = normalize(make_float3(0.0f, -v.z, v.y));
350 }
351
352 /* Compute kernel camera data. */
354
355 /* store matrices */
363 kcam->worldtondc = worldtondc;
364 kcam->ndctoworld = ndctoworld;
365
366 /* camera motion */
367 kcam->num_motion_steps = 0;
368 kcam->have_perspective_motion = 0;
370
371 /* Test if any of the transforms are actually different. */
372 bool have_motion = false;
373 for (size_t i = 0; i < motion.size(); i++) {
374 have_motion = have_motion || motion[i] != matrix;
375 }
376
377 if (need_motion == Scene::MOTION_PASS || need_motion == Scene::MOTION_PASS_INTERACTIVE) {
378 if (have_motion) {
379 kcam->motion_pass_pre = transform_inverse(motion[0]);
380 kcam->motion_pass_post = transform_inverse(motion[motion.size() - 1]);
381 }
382 else {
383 kcam->motion_pass_pre = kcam->worldtocamera;
384 kcam->motion_pass_post = kcam->worldtocamera;
385 }
386 if (camera_type != CAMERA_PANORAMA && camera_type != CAMERA_CUSTOM) {
387 BoundBox2D motion_viewplane_pre = viewplane_pre.is_empty() ? viewplane : viewplane_pre;
388 BoundBox2D motion_viewplane_post = viewplane_post.is_empty() ? viewplane : viewplane_post;
389 if (border_pre_left >= 0 && border_pre_bottom >= 0) {
390 /* Filter out panning movements of the border, since they do not result in pixels moving in
391 * the render buffer. */
392 motion_viewplane_pre = motion_viewplane_pre.offset(
393 make_float2(-(border.left - border_pre_left) * motion_viewplane_pre.width(),
394 -(border.bottom - border_pre_bottom) * motion_viewplane_pre.height()));
395 }
396
397 if (have_motion || fov != fov_pre || fov != fov_post || viewplane != motion_viewplane_pre ||
398 viewplane != motion_viewplane_post)
399 {
400 /* Note the values for perspective_pre/perspective_post calculated for MOTION_PASS are
401 * different to those calculated for MOTION_BLUR below, so the code has not been combined.
402 */
403 ProjectionTransform cameratoscreen_pre = cameratoscreen;
404 ProjectionTransform cameratoscreen_post = cameratoscreen;
405 if (camera_type == CAMERA_PERSPECTIVE) {
406 cameratoscreen_pre = projection_perspective(fov_pre, nearclip, farclip);
407 cameratoscreen_post = projection_perspective(fov_post, nearclip, farclip);
408 }
409
410 const Transform screentoraster_pre = ndctoraster * fulltoborder *
411 transform_from_viewplane(motion_viewplane_pre);
412 const Transform screentoraster_post = ndctoraster * fulltoborder *
413 transform_from_viewplane(motion_viewplane_post);
414
415 const ProjectionTransform cameratoraster_pre = screentoraster_pre * cameratoscreen_pre;
416 const ProjectionTransform cameratoraster_post = screentoraster_post * cameratoscreen_post;
417 if (have_motion) {
418 kcam->perspective_pre = cameratoraster_pre * transform_inverse(motion[0]);
419 kcam->perspective_post = cameratoraster_post *
420 transform_inverse(motion[motion.size() - 1]);
421 }
422 else {
423 kcam->perspective_pre = cameratoraster_pre * worldtocamera;
424 kcam->perspective_post = cameratoraster_post * worldtocamera;
425 }
426 }
427 else {
430 }
431 }
432 }
433 else if (need_motion == Scene::MOTION_BLUR) {
434 if (have_motion) {
435 kernel_camera_motion.resize(motion.size());
436 transform_motion_decompose(kernel_camera_motion.data(), motion.data(), motion.size());
437 kcam->num_motion_steps = motion.size();
438 }
439
440 /* TODO(sergey): Support other types of camera. */
441 if (use_perspective_motion && camera_type == CAMERA_PERSPECTIVE) {
442 const ProjectionTransform screentocamera_pre = projection_inverse(
443 projection_perspective(fov_pre, nearclip, farclip));
444 const ProjectionTransform screentocamera_post = projection_inverse(
445 projection_perspective(fov_post, nearclip, farclip));
446
447 kcam->perspective_pre = screentocamera_pre * rastertoscreen;
448 kcam->perspective_post = screentocamera_post * rastertoscreen;
449 kcam->have_perspective_motion = 1;
450 }
451 }
452
453 /* depth of field */
454 kcam->aperturesize = aperturesize;
455 kcam->focaldistance = max(focaldistance, 1e-5f);
456 kcam->blades = (blades < 3) ? 0.0f : blades;
457 kcam->bladesrotation = bladesrotation;
458
459 /* motion blur */
460 kcam->shuttertime = (need_motion == Scene::MOTION_BLUR) ? shuttertime : -1.0f;
461 kcam->motion_position = motion_position;
462
463 /* type */
464 kcam->type = camera_type;
465
466 /* anamorphic lens bokeh */
467 kcam->inv_aperture_ratio = 1.0f / aperture_ratio;
468
469 /* panorama */
470 kcam->panorama_type = panorama_type;
471 kcam->fisheye_fov = fisheye_fov;
472 kcam->fisheye_lens = fisheye_lens;
473 kcam->equirectangular_range = make_float4(longitude_min - longitude_max,
474 -longitude_min,
475 latitude_min - latitude_max,
476 -latitude_min + M_PI_2_F);
477 kcam->fisheye_lens_polynomial_bias = fisheye_polynomial_k0;
479 fisheye_polynomial_k1, fisheye_polynomial_k2, fisheye_polynomial_k3, fisheye_polynomial_k4);
480 kcam->central_cylindrical_range = make_float4(-central_cylindrical_range_u_min,
481 -central_cylindrical_range_u_max,
482 central_cylindrical_range_v_min,
483 central_cylindrical_range_v_max);
484
485 switch (stereo_eye) {
486 case STEREO_LEFT:
487 kcam->interocular_offset = -interocular_distance * 0.5f;
488 break;
489 case STEREO_RIGHT:
490 kcam->interocular_offset = interocular_distance * 0.5f;
491 break;
492 case STEREO_NONE:
493 default:
494 kcam->interocular_offset = 0.0f;
495 break;
496 }
497
498 kcam->convergence_distance = convergence_distance;
499 if (use_pole_merge) {
500 kcam->pole_merge_angle_from = pole_merge_angle_from;
501 kcam->pole_merge_angle_to = pole_merge_angle_to;
502 }
503 else {
504 kcam->pole_merge_angle_from = -1.0f;
505 kcam->pole_merge_angle_to = -1.0f;
506 }
507
508 /* sensor size */
509 kcam->sensorwidth = sensorwidth;
510 kcam->sensorheight = sensorheight;
511
512 /* render size */
513 kcam->width = width;
514 kcam->height = height;
515
516 /* store differentials */
517 kcam->dx = make_float4(dx);
518 kcam->dy = make_float4(dy);
519
520 /* Compensation for progressive rendering, so we use the same texture cache tiles
521 * as for the full render resolution rather. */
522 kcam->differential_scale = 0.5f * (width / float(full_width) + height / float(full_height));
523
524 /* clipping */
525 kcam->nearclip = nearclip;
526 kcam->cliplength = (farclip == FLT_MAX) ? FLT_MAX : farclip - nearclip;
527
528 /* Rolling shutter effect */
529 kcam->rolling_shutter_type = rolling_shutter_type;
530 kcam->rolling_shutter_duration = rolling_shutter_duration;
531
532 /* Set further update flags */
534 need_device_update = true;
535 need_flags_update = true;
536 previous_need_motion = need_motion;
537}
538
540{
541 array<Transform> motion = get_motion();
542 if (!motion.empty()) {
543 motion[0] = matrix;
544
545 /* Trigger another update if there was motion compared to previous frame, so that last viewport
546 * camera movement does not stick around. */
547 set_motion(motion);
548 }
549
550 set_fov_pre(fov);
551 set_border_pre_left(border.left);
552 set_border_pre_bottom(border.bottom);
553 set_viewplane_pre_left(viewplane.left);
554 set_viewplane_pre_right(viewplane.right);
555 set_viewplane_pre_bottom(viewplane.bottom);
556 set_viewplane_pre_top(viewplane.top);
557}
558
559void Camera::device_update(Device * /*device*/, DeviceScene *dscene, Scene *scene)
560{
561 update(scene);
562
563 if (!need_device_update) {
564 return;
565 }
566
567 const scoped_callback_timer timer([scene](double time) {
568 if (scene->update_stats) {
569 scene->update_stats->camera.times.add_entry({"device_update", time});
570 }
571 });
572
573 scene->lookup_tables->remove_table(&shutter_table_offset);
574 if (kernel_camera.shuttertime != -1.0f) {
575 vector<float> shutter_table;
578 0.0f,
579 1.0f,
580 [this](const float x) { return shutter_curve_eval(x, shutter_curve); },
581 false,
582 shutter_table);
583 shutter_table_offset = scene->lookup_tables->add_table(dscene, shutter_table);
585 }
586
587 dscene->data.cam = kernel_camera;
588
589 const size_t num_motion_steps = kernel_camera_motion.size();
590 if (num_motion_steps) {
591 DecomposedTransform *camera_motion = dscene->camera_motion.alloc(num_motion_steps);
592 std::copy_n(kernel_camera_motion.data(), num_motion_steps, camera_motion);
594 }
595 else {
596 dscene->camera_motion.free();
597 }
598}
599
600void Camera::device_update_volume(Device * /*device*/, DeviceScene *dscene, Scene *scene)
601{
603 return;
604 }
605
607
608 KernelIntegrator *kintegrator = &dscene->data.integrator;
609 if (kintegrator->use_volumes) {
610 if (camera_type == CAMERA_CUSTOM) {
612 LOG_INFO << "Considering custom camera to be inside volume.";
613 }
614 else {
615 BoundBox viewplane_boundbox = viewplane_bounds_get();
616
617 /* Parallel object update, with grain size to avoid too much threading overhead
618 * for individual objects. */
619 static const int OBJECTS_PER_TASK = 32;
620 parallel_for(blocked_range<size_t>(0, scene->objects.size(), OBJECTS_PER_TASK),
621 [&](const blocked_range<size_t> &r) {
622 for (size_t i = r.begin(); i != r.end(); i++) {
623 Object *object = scene->objects[i];
624 if (object->get_geometry()->has_volume &&
625 viewplane_boundbox.intersects(object->bounds))
626 {
627 /* TODO(sergey): Consider adding more grained check. */
628 LOG_INFO << "Detected camera inside volume.";
629 kernel_camera.is_inside_volume = 1;
630 parallel_for_cancel();
631 break;
632 }
633 }
634 });
635
637 LOG_INFO << "Camera is outside of the volume.";
638 }
639 }
640 }
641
642 dscene->data.cam.is_inside_volume = kernel_camera.is_inside_volume;
643
644 need_device_update = false;
645 need_flags_update = false;
646}
647
648void Camera::device_free(Device * /*device*/, DeviceScene *dscene, Scene *scene)
649{
650 scene->lookup_tables->remove_table(&shutter_table_offset);
651 dscene->camera_motion.free();
652}
653
654float3 Camera::transform_full_raster_to_world(const float raster_x, const float raster_y)
655{
656 float3 D;
657 float3 P;
658 if (camera_type == CAMERA_PERSPECTIVE) {
659 D = transform_perspective(&full_rastertocamera, make_float3(raster_x, raster_y, 0.0f));
660 const float3 Pclip = normalize(D);
661 P = zero_float3();
662 /* TODO(sergey): Aperture support? */
665 /* TODO(sergey): Clipping is conditional in kernel, and hence it could
666 * be mistakes in here, currently leading to wrong camera-in-volume
667 * detection.
668 */
669 P += nearclip * D / Pclip.z;
670 }
671 else if (camera_type == CAMERA_ORTHOGRAPHIC) {
672 D = make_float3(0.0f, 0.0f, 1.0f);
673 /* TODO(sergey): Aperture support? */
674 P = transform_perspective(&full_rastertocamera, make_float3(raster_x, raster_y, 0.0f));
677 }
678 else {
679 assert(!"unsupported camera type");
680 }
681 return P;
682}
683
685{
686 /* TODO(sergey): This is all rather stupid, but is there a way to perform
687 * checks we need in a more clear and smart fashion? */
688 BoundBox bounds = BoundBox::empty;
689
690 const float max_aperture_size = aperture_ratio < 1.0f ? aperturesize / aperture_ratio :
691 aperturesize;
692
693 if (camera_type == CAMERA_PANORAMA || camera_type == CAMERA_CUSTOM) {
694 const float extend = max_aperture_size + nearclip;
695 if (use_spherical_stereo == false) {
697 }
698 else {
699 const float half_eye_distance = interocular_distance * 0.5f;
700
701 bounds.grow(
702 make_float3(cameratoworld.x.w + half_eye_distance, cameratoworld.y.w, cameratoworld.z.w),
703 extend);
704
705 bounds.grow(
706 make_float3(cameratoworld.z.w, cameratoworld.y.w + half_eye_distance, cameratoworld.z.w),
707 extend);
708
709 bounds.grow(
710 make_float3(cameratoworld.x.w - half_eye_distance, cameratoworld.y.w, cameratoworld.z.w),
711 extend);
712
713 bounds.grow(
714 make_float3(cameratoworld.x.w, cameratoworld.y.w - half_eye_distance, cameratoworld.z.w),
715 extend);
716 }
717 }
718 else {
719 /* max_aperture_size = Max horizontal distance a ray travels from aperture edge to focus point.
720 * Scale that value based on the ratio between focaldistance and nearclip to figure out the
721 * horizontal distance the DOF ray will travel before reaching the nearclip plane, where it
722 * will start rendering from.
723 * In some cases (focus distance is close to camera, and nearclip plane is far from camera),
724 * this scaled value is larger than nearclip, in which case we add it to `extend` to extend the
725 * bounding box to account for these rays.
726 *
727 * ----------------- nearclip plane
728 * / scaled_horz_dof_ray, nearclip
729 * /
730 * /
731 * / max_aperture_size, focaldistance
732 * /|
733 * / |
734 * / |
735 * / |
736 * ------ max_aperture_size, 0
737 * 0, 0
738 */
739
740 const float scaled_horz_dof_ray = (max_aperture_size > 0.0f) ?
741 max_aperture_size * (nearclip / focaldistance) :
742 0.0f;
743 const float extend = max_aperture_size + max(nearclip, scaled_horz_dof_ray);
744
745 bounds.grow(transform_full_raster_to_world(0.0f, 0.0f), extend);
746 bounds.grow(transform_full_raster_to_world(0.0f, (float)full_height), extend);
747 bounds.grow(transform_full_raster_to_world((float)full_width, (float)full_height), extend);
748 bounds.grow(transform_full_raster_to_world((float)full_width, 0.0f), extend);
749 if (camera_type == CAMERA_PERSPECTIVE) {
750 /* Center point has the most distance in local Z axis,
751 * use it to construct bounding box/
752 */
753 bounds.grow(transform_full_raster_to_world(0.5f * full_width, 0.5f * full_height), extend);
754 }
755 }
756 return bounds;
757}
758
760{
761 float res = 1.0f;
762
763 if (camera_type == CAMERA_ORTHOGRAPHIC) {
764 res = min(len(full_dx), len(full_dy));
765
766 if (offscreen_dicing_scale > 1.0f) {
769 make_float3(full_width, full_height, 0.0f));
771
772 /* Create point clamped to frustum */
773 float3 c;
774 c.x = max(v2.x, min(v1.x, p.x));
775 c.y = max(v2.y, min(v1.y, p.y));
776 c.z = max(0.0f, p.z);
777
778 /* Check right side */
779 float f_dist = len(p - c) / sqrtf((v1.x * v1.x + v1.y * v1.y) * 0.5f);
780 if (f_dist < 0.0f) {
781 /* Check left side */
782 f_dist = len(p - c) / sqrtf((v2.x * v2.x + v2.y * v2.y) * 0.5f);
783 }
784 if (f_dist > 0.0f) {
785 res += res * f_dist * (offscreen_dicing_scale - 1.0f);
786 }
787 }
788 }
789#ifdef FIX_CUSTOM_CAMERA_CRASH
790 else if (camera_type == CAMERA_PERSPECTIVE || camera_type == CAMERA_CUSTOM) {
791#else
792 else if (camera_type == CAMERA_PERSPECTIVE) {
793#endif
794 /* Calculate as if point is directly ahead of the camera. */
795 const float3 raster = make_float3(0.5f * full_width, 0.5f * full_height, 0.0f);
796 const float3 Pcamera = transform_perspective(&full_rastertocamera, raster);
797
798 /* dDdx */
799 const float3 Ddiff = transform_direction(&cameratoworld, Pcamera);
801 const float3 dDdx = normalize(Ddiff + dx) - normalize(Ddiff);
802
803 /* dPdx */
804 const float dist = len(transform_point(&worldtocamera, P));
805 const float3 D = normalize(Ddiff);
806 res = len(dist * dDdx - dot(dist * dDdx, D) * D);
807
808 /* Decent approx distance to frustum
809 * (doesn't handle corners correctly, but not that big of a deal) */
810 float f_dist = 0.0f;
811
812 if (offscreen_dicing_scale > 1.0f) {
814
815 /* Distance from the four planes */
816 const float r = dot(p, frustum_right_normal);
817 const float t = dot(p, frustum_top_normal);
818 const float l = dot(p, frustum_left_normal);
819 const float b = dot(p, frustum_bottom_normal);
820
821 if (r <= 0.0f && l <= 0.0f && t <= 0.0f && b <= 0.0f) {
822 /* Point is inside frustum */
823 f_dist = 0.0f;
824 }
825 else if (r > 0.0f && l > 0.0f && t > 0.0f && b > 0.0f) {
826 /* Point is behind frustum */
827 f_dist = len(p);
828 }
829 else {
830 /* Point may be behind or off to the side, need to check */
831 const float3 along_right = make_float3(
833 const float3 along_left = make_float3(frustum_left_normal.z, 0.0f, -frustum_left_normal.x);
834 const float3 along_top = make_float3(0.0f, -frustum_top_normal.z, frustum_top_normal.y);
835 const float3 along_bottom = make_float3(
837
838 float dist[] = {r, l, t, b};
839 float3 along[] = {along_right, along_left, along_top, along_bottom};
840
841 bool test_o = false;
842
843 float *d = dist;
844 float3 *a = along;
845 for (int i = 0; i < 4; i++, d++, a++) {
846 /* Test if we should check this side at all */
847 if (*d > 0.0f) {
848 if (dot(p, *a) >= 0.0f) {
849 /* We are in front of the back edge of this side of the frustum */
850 f_dist = max(f_dist, *d);
851 }
852 else {
853 /* Possibly far enough behind the frustum to use distance to origin instead of edge
854 */
855 test_o = true;
856 }
857 }
858 }
859
860 if (test_o) {
861 f_dist = (f_dist > 0) ? min(f_dist, len(p)) : len(p);
862 }
863 }
864
865 if (f_dist > 0.0f) {
866 res += len(dDdx - dot(dDdx, D) * D) * f_dist * (offscreen_dicing_scale - 1.0f);
867 }
868 }
869 }
870 else if (camera_type == CAMERA_PANORAMA || camera_type == CAMERA_CUSTOM) {
872 const float dist = len(D);
873
874 Ray ray = {};
875
876 /* Distortion can become so great that the results become meaningless, there
877 * may be a better way to do this, but calculating differentials from the
878 * point directly ahead seems to produce good enough results. */
879 if (camera_type == CAMERA_CUSTOM) {
880 int cache_miss = 0;
881 camera_sample_custom(nullptr,
884 0.5f * make_float2(full_width, full_height),
885 zero_float2(),
886 &ray,
887 cache_miss);
888 }
889 else {
890#if 0
892 float3 raster = transform_perspective(&full_cameratoraster, make_float3(dir.x, dir.y, 0.0f));
893
894 ray.t = 1.0f;
896 &kernel_camera, kernel_camera_motion.data(), raster.x, raster.y, 0.0f, 0.0f, &ray);
897 if (ray.t == 0.0f) {
898 /* No differentials, just use from directly ahead. */
901 0.5f * make_float2(full_width, full_height),
902 zero_float2(),
903 &ray);
904 }
905#else
908 0.5f * make_float2(full_width, full_height),
909 zero_float2(),
910 &ray);
911#endif
912 }
913
914 /* TODO: would it help to use more accurate differentials here? */
915 return differential_transfer_compact(ray.dP, ray.D, ray.dD, dist);
916 }
917
918 return res;
919}
920
922{
923 return motion.size() > 1;
924}
925
926bool Camera::set_screen_size(const int width_, const int height_)
927{
928 if (width_ != width || height_ != height) {
929 width = width_;
930 height = height_;
931 tag_modified();
932 return true;
933 }
934
935 return false;
936}
937
938float Camera::motion_time(const int step) const
939{
940 return (use_motion()) ? 2.0f * step / (motion.size() - 1) - 1.0f : 0.0f;
941}
942
943int Camera::motion_step(const float time) const
944{
945 if (use_motion()) {
946 for (int step = 0; step < motion.size(); step++) {
947 if (time == motion_time(step)) {
948 return step;
949 }
950 }
951 }
952
953 return -1;
954}
955
957 OSLCameraParamQuery &params,
958 const std::string &filepath,
959 const std::string &bytecode_hash,
960 const std::string &bytecode)
961{
962#ifdef WITH_OSL
963 /* Ensure shading system exists before we try to load a shader. */
964 scene->osl_manager->shading_system_init(scene->shader_manager->get_scene_linear_interop_id());
965
966 /* Load the shader. */
967 const char *hash;
968
969 if (!filepath.empty()) {
970 hash = scene->osl_manager->shader_load_filepath(filepath);
971 }
972 else {
973 hash = scene->osl_manager->shader_test_loaded(bytecode_hash);
974 if (!hash) {
975 hash = scene->osl_manager->shader_load_bytecode(bytecode_hash, bytecode);
976 }
977 }
978
979 bool changed = false;
980
981 if (!hash) {
982 changed = (!script_name.empty() || !script_params.empty());
983 script_name = "";
984 script_params.clear();
985 }
986 else {
987 changed = (script_name != hash);
989
990 OSLShaderInfo *info = scene->osl_manager->shader_loaded_info(hash);
991
992 /* Fetch parameter values. */
993 std::set<ustring> used_params;
994 for (int i = 0; i < info->query.nparams(); i++) {
995 const OSL::OSLQuery::Parameter *param = info->query.getparam(i);
996
997 /* Skip unsupported types. */
998 if (param->varlenarray || param->isstruct || param->type.arraylen > 1 || param->isoutput ||
999 param->isclosure)
1000 {
1001 continue;
1002 }
1003
1004 vector<uint8_t> raw_data;
1005 int vec_size = (int)param->type.aggregate;
1006 if (param->type.basetype == TypeDesc::INT) {
1007 vector<int> data;
1008 if (!params.get_int(param->name, data) || data.size() != vec_size) {
1009 continue;
1010 }
1011 raw_data.resize(sizeof(int) * vec_size);
1012 memcpy(raw_data.data(), data.data(), sizeof(int) * vec_size);
1013 }
1014 else if (param->type.basetype == TypeDesc::FLOAT) {
1015 vector<float> data;
1016 if (!params.get_float(param->name, data) || data.size() != vec_size) {
1017 continue;
1018 }
1019 raw_data.resize(sizeof(float) * vec_size);
1020 memcpy(raw_data.data(), data.data(), sizeof(float) * vec_size);
1021 }
1022 else if (param->type.basetype == TypeDesc::STRING) {
1023 string data;
1024 if (!params.get_string(param->name, data)) {
1025 continue;
1026 }
1027 raw_data.resize(data.length() + 1);
1028 memcpy(raw_data.data(), data.c_str(), data.length() + 1);
1029 }
1030 else {
1031 continue;
1032 }
1033
1034 auto entry = std::make_pair(raw_data, param->type);
1035 auto it = script_params.find(param->name);
1036 if (it == script_params.end()) {
1037 script_params[param->name] = entry;
1038 changed = true;
1039 }
1040 else if (it->second != entry) {
1041 it->second = entry;
1042 changed = true;
1043 }
1044
1045 used_params.insert(param->name);
1046 }
1047
1048 /* Remove unused parameters. */
1049 for (auto it = script_params.begin(); it != script_params.end();) {
1050 if (used_params.contains(it->first)) {
1051 it++;
1052 }
1053 else {
1054 it = script_params.erase(it);
1055 changed = true;
1056 }
1057 }
1058 }
1059
1060 if (changed) {
1061 tag_modified();
1062 scene->osl_manager->tag_update();
1063 }
1064#else
1065 (void)scene;
1066 (void)params;
1067 (void)filepath;
1068 (void)bytecode_hash;
1069 (void)bytecode;
1070#endif
1071}
1072
1074{
1075#ifdef WITH_OSL
1076 if (script_name == "") {
1077 return;
1078 }
1079
1080 script_name = "";
1081 script_params.clear();
1082
1083 scene->osl_manager->tag_update();
1084#else
1085 (void)scene;
1086#endif
1087}
1088
1090{
1091 uint64_t kernel_features = 0;
1092
1093 if (!script_name.empty()) {
1094 kernel_features |= KERNEL_FEATURE_OSL_CAMERA;
1095 }
1096
1097 return kernel_features;
1098}
1099
#define D
unsigned long long int uint64_t
btScalar max
float height() const
Definition boundbox.h:222
bool is_empty() const
Definition boundbox.h:227
BoundBox2D offset(const float2 offset) const
Definition boundbox.h:280
float bottom
Definition boundbox.h:198
float top
Definition boundbox.h:198
float right
Definition boundbox.h:198
float width() const
Definition boundbox.h:217
float left
Definition boundbox.h:198
BoundBox2D()=default
__forceinline float3 size() const
Definition boundbox.h:122
__forceinline void grow(const float3 &pt)
Definition boundbox.h:35
bool need_device_update
float world_to_raster_size(const float3 P)
ProjectionTransform worldtoraster
float3 frustum_right_normal
float motion_time(const int step) const
BoundBox2D viewplane
int previous_need_motion
float3 full_dy
BoundBox2D viewplane_pre
bool need_flags_update
float3 full_dx
ProjectionTransform rastertoworld
BoundBox viewplane_bounds_get()
void update_interactive_motion()
BoundBox2D viewplane_post
Transform worldtocamera
ProjectionTransform worldtoscreen
ProjectionTransform worldtondc
void update(Scene *scene)
ProjectionTransform rastertocamera
BoundBox2D border
ProjectionTransform screentoworld
bool use_motion() const
size_t shutter_table_offset
void device_update_volume(Device *device, DeviceScene *dscene, Scene *scene)
bool set_screen_size(int width, int height)
void device_free(Device *device, DeviceScene *dscene, Scene *scene)
int motion_step(const float time) const
ProjectionTransform ndctoworld
~Camera() override
float3 dx
std::string script_name
void device_update(Device *device, DeviceScene *dscene, Scene *scene)
float3 frustum_left_normal
void clear_osl_camera(Scene *scene)
Transform cameratoworld
uint64_t get_kernel_features() const
void compute_auto_viewplane()
float3 frustum_top_normal
ProjectionTransform full_rastertocamera
float3 frustum_bottom_normal
float3 dy
void set_osl_camera(Scene *scene, OSLCameraParamQuery &params, const std::string &filepath, const std::string &bytecode_hash="", const std::string &bytecode="")
@ STEREO_LEFT
@ STEREO_NONE
@ STEREO_RIGHT
BoundBox2D viewport_camera_border
KernelCamera kernel_camera
map< ustring, pair< vector< uint8_t >, TypeDesc > > script_params
array< DecomposedTransform > kernel_camera_motion
device_vector< DecomposedTransform > camera_motion
Definition devicescene.h:49
KernelData data
virtual bool get_string(ustring name, std::string &data)=0
virtual bool get_int(ustring name, vector< int > &data)=0
virtual bool get_float(ustring name, vector< float > &data)=0
Definition scene.h:133
MotionType need_motion() const
Definition scene.cpp:429
unique_ptr< SceneUpdateStats > update_stats
Definition scene.h:197
MotionType
Definition scene.h:207
@ MOTION_PASS
Definition scene.h:207
@ MOTION_BLUR
Definition scene.h:207
@ MOTION_PASS_INTERACTIVE
Definition scene.h:207
unique_ptr< ShaderManager > shader_manager
Definition scene.h:169
unique_ptr< OSLManager > osl_manager
Definition scene.h:168
unique_ptr_vector< Object > objects
Definition scene.h:162
unique_ptr< LookupTables > lookup_tables
Definition scene.h:143
size_t size() const
size_t empty() const
T * resize(const size_t newsize)
T * alloc(const size_t width, const size_t height=0)
size_t size() const
ccl_device_inline float2 direction_to_panorama(ccl_constant KernelCamera *cam, const float3 dir)
CCL_NAMESPACE_BEGIN ccl_device_inline float frac(const float x, ccl_private int *ix)
ccl_device_inline float3 transform_perspective_direction(const ccl_private ProjectionTransform *t, const float3 a)
CCL_NAMESPACE_END CCL_NAMESPACE_BEGIN ccl_device_inline float3 transform_perspective(const ccl_private ProjectionTransform *t, const float3 a)
ccl_device_inline ProjectionTransform projection_identity()
ccl_device_inline ProjectionTransform projection_inverse(const ProjectionTransform tfm)
#define M_PI_2_F
#define M_PI_4_F
#define SHUTTER_TABLE_SIZE
#define KERNEL_FEATURE_OSL_CAMERA
#define RAMP_TABLE_SIZE
#define CCL_NAMESPACE_END
#define saturatef(x)
ccl_device_forceinline float3 make_float3(const float x, const float y, const float z)
ccl_device_forceinline float differential_transfer_compact(const float ray_dP, const float3, const float ray_dD, const float ray_t)
#define assert(assertion)
#define FLT_MAX
#define index(i)
VecBase< float, D > normalize(VecOp< float, D >) RET
float dot(VecOp< float, D >, VecOp< float, D >) RET
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
float4x4 projection_orthographic(float left, float right, float bottom, float top, float near_clip, float far_clip)
Create an orthographic projection matrix using OpenGL coordinate convention: Maps each axis range to ...
float4x4 projection_perspective(float left, float right, float bottom, float top, float near_clip, float far_clip)
Create a perspective projection matrix using OpenGL coordinate convention: Maps each axis range to [-...
float3 transform_direction(float3x3 mat, float3 direction)
float3 transform_point(float3x3 mat, float3 point)
ccl_device_inline Spectrum camera_sample_panorama(ccl_constant KernelCamera *cam, const ccl_global DecomposedTransform *cam_motion, const float2 raster, const float2 rand_lens, ccl_private Ray *ray)
ccl_device_inline Spectrum camera_sample_custom(KernelGlobals kg, ccl_constant KernelCamera *cam, const ccl_global DecomposedTransform *cam_motion, const float2 raster, const float2 rand_lens, ccl_private Ray *ray, ccl_private int &r_cache_miss)
@ MOTION_POSITION_END
@ MOTION_POSITION_START
@ MOTION_POSITION_CENTER
@ PANORAMA_MIRRORBALL
@ PANORAMA_FISHEYE_EQUISOLID
@ PANORAMA_CENTRAL_CYLINDRICAL
@ PANORAMA_EQUIANGULAR_CUBEMAP_FACE
@ PANORAMA_FISHEYE_EQUIDISTANT
@ PANORAMA_FISHEYE_LENS_POLYNOMIAL
@ PANORAMA_EQUIRECTANGULAR
@ CAMERA_PERSPECTIVE
@ CAMERA_PANORAMA
@ CAMERA_CUSTOM
@ CAMERA_ORTHOGRAPHIC
#define LOG_INFO
Definition log.h:106
void util_cdf_inverted(const int resolution, const float from, const float to, Functor functor, const bool make_symmetric, vector< float > &inv_cdf)
Definition math_cdf.h:45
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
Definition math_dual.h:263
ccl_device_inline dual1 len_squared(const ccl_private dual< T > &a)
Definition math_dual.h:273
CCL_NAMESPACE_BEGIN ccl_device_inline float2 zero_float2()
Definition math_float2.h:13
CCL_NAMESPACE_BEGIN ccl_device_inline float3 zero_float3()
Definition math_float3.h:17
#define SOCKET_FLOAT(name, ui_name, default_value,...)
Definition node_type.h:219
#define SOCKET_INT(name, ui_name, default_value,...)
Definition node_type.h:213
#define SOCKET_FLOAT_ARRAY(name, ui_name, default_value,...)
Definition node_type.h:267
#define SOCKET_TRANSFORM(name, ui_name, default_value,...)
Definition node_type.h:233
#define SOCKET_UINT(name, ui_name, default_value,...)
Definition node_type.h:215
#define NODE_DEFINE(structname)
Definition node_type.h:157
#define SOCKET_TRANSFORM_ARRAY(name, ui_name, default_value,...)
Definition node_type.h:308
#define SOCKET_BOOLEAN(name, ui_name, default_value,...)
Definition node_type.h:211
#define SOCKET_ENUM(name, ui_name, values, default_value,...)
Definition node_type.h:235
#define mix
#define sqrtf
#define make_float2
#define make_float4
#define M_PI_F
static CCL_NAMESPACE_BEGIN float shutter_curve_eval(float x, array< float > &shutter_curve)
@ TABLE_OFFSET_INVALID
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
#define min(a, b)
Definition sort.cc:38
ProjectionTransform ndctoworld
float pole_merge_angle_to
int have_perspective_motion
ProjectionTransform rastertocamera
float pole_merge_angle_from
float4 central_cylindrical_range
ProjectionTransform worldtoraster
float fisheye_lens_polynomial_bias
Transform motion_pass_post
Transform cameratoworld
float4 equirectangular_range
float interocular_offset
Transform worldtocamera
ProjectionTransform screentoworld
float inv_aperture_ratio
ProjectionTransform perspective_post
float rolling_shutter_duration
ProjectionTransform perspective_pre
ProjectionTransform worldtoscreen
Transform motion_pass_pre
ProjectionTransform worldtondc
float convergence_distance
float differential_scale
ProjectionTransform rastertoworld
float4 fisheye_lens_polynomial_coefficients
void insert(const char *x, const int y)
Definition node_enum.h:21
static NodeType * add(const char *name, CreateFunc create, Type type=NONE, const NodeType *base=nullptr)
void clear_modified()
void hash(MD5Hash &md5)
void tag_modified()
bool is_modified() const
Node(const NodeType *type, ustring name=ustring())
float3 D
float4 y
Definition transform.h:53
float4 x
Definition transform.h:53
float4 z
Definition transform.h:53
float x
float y
float z
Definition sky_math.h:136
float y
Definition sky_math.h:136
float x
Definition sky_math.h:136
float w
Definition sky_math.h:225
void transform_motion_decompose(DecomposedTransform *decomp, const Transform *motion, const size_t size)
Transform transform_from_viewplane(const BoundBox2D &viewplane)
ccl_device_inline Transform transform_identity()
Definition transform.h:355
ccl_device_inline Transform transform_scale(const float3 s)
Definition transform.h:313
ccl_device_inline Transform transform_inverse(const Transform tfm)
Definition transform.h:563