diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-10-28 23:42:04 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-10-28 23:42:04 +0300 |
commit | adf82fe943bc4ad600754d7172deeca319e73bff (patch) | |
tree | bd2417c9d759f5197b8d7fa844685c4ad5d68613 | |
parent | fc36772b068834435f0061f8b95ee95fedc374b5 (diff) | |
parent | 35f4d254fd85cec475a00dfc019947b60d6c702d (diff) |
Merge branch 'blender-v3.0-release'
-rw-r--r-- | intern/cycles/kernel/camera/camera.h | 18 | ||||
-rw-r--r-- | intern/cycles/kernel/integrator/intersect_closest.h | 8 | ||||
-rw-r--r-- | intern/cycles/kernel/integrator/subsurface_disk.h | 18 | ||||
-rw-r--r-- | intern/cycles/scene/camera.cpp | 22 |
4 files changed, 41 insertions, 25 deletions
diff --git a/intern/cycles/kernel/camera/camera.h b/intern/cycles/kernel/camera/camera.h index e966e9e1596..4f3931583de 100644 --- a/intern/cycles/kernel/camera/camera.h +++ b/intern/cycles/kernel/camera/camera.h @@ -306,15 +306,15 @@ ccl_device_inline void camera_sample_panorama(ccl_constant KernelCamera *cam, } #endif - P = transform_point(&cameratoworld, P); - D = normalize(transform_direction(&cameratoworld, D)); - /* Stereo transform */ bool use_stereo = cam->interocular_offset != 0.0f; if (use_stereo) { spherical_stereo_transform(cam, &P, &D); } + P = transform_point(&cameratoworld, P); + D = normalize(transform_direction(&cameratoworld, D)); + ray->P = P; ray->D = D; @@ -325,19 +325,19 @@ ccl_device_inline void camera_sample_panorama(ccl_constant KernelCamera *cam, * and simply take their differences. */ float3 Pcenter = Pcamera; float3 Dcenter = panorama_to_direction(cam, Pcenter.x, Pcenter.y); - Pcenter = transform_point(&cameratoworld, Pcenter); - Dcenter = normalize(transform_direction(&cameratoworld, Dcenter)); if (use_stereo) { spherical_stereo_transform(cam, &Pcenter, &Dcenter); } + Pcenter = transform_point(&cameratoworld, Pcenter); + Dcenter = normalize(transform_direction(&cameratoworld, Dcenter)); float3 Px = transform_perspective(&rastertocamera, make_float3(raster_x + 1.0f, raster_y, 0.0f)); float3 Dx = panorama_to_direction(cam, Px.x, Px.y); - Px = transform_point(&cameratoworld, Px); - Dx = normalize(transform_direction(&cameratoworld, Dx)); if (use_stereo) { spherical_stereo_transform(cam, &Px, &Dx); } + Px = transform_point(&cameratoworld, Px); + Dx = normalize(transform_direction(&cameratoworld, Dx)); differential3 dP, dD; dP.dx = Px - Pcenter; @@ -345,11 +345,11 @@ ccl_device_inline void camera_sample_panorama(ccl_constant KernelCamera *cam, float3 Py = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y + 1.0f, 0.0f)); float3 Dy = panorama_to_direction(cam, Py.x, Py.y); - Py = transform_point(&cameratoworld, Py); - Dy = normalize(transform_direction(&cameratoworld, Dy)); if (use_stereo) { spherical_stereo_transform(cam, &Py, &Dy); } + Py = transform_point(&cameratoworld, Py); + Dy = normalize(transform_direction(&cameratoworld, Dy)); dP.dy = Py - Pcenter; dD.dy = Dy - Dcenter; diff --git a/intern/cycles/kernel/integrator/intersect_closest.h b/intern/cycles/kernel/integrator/intersect_closest.h index d5a9df9669b..7fb88fc2804 100644 --- a/intern/cycles/kernel/integrator/intersect_closest.h +++ b/intern/cycles/kernel/integrator/intersect_closest.h @@ -159,9 +159,11 @@ ccl_device void integrator_intersect_closest(KernelGlobals kg, IntegratorState s if (path_state_ao_bounce(kg, state)) { ray.t = kernel_data.integrator.ao_bounces_distance; - const float object_ao_distance = kernel_tex_fetch(__objects, last_isect_object).ao_distance; - if (object_ao_distance != 0.0f) { - ray.t = object_ao_distance; + if (last_isect_object != OBJECT_NONE) { + const float object_ao_distance = kernel_tex_fetch(__objects, last_isect_object).ao_distance; + if (object_ao_distance != 0.0f) { + ray.t = object_ao_distance; + } } } diff --git a/intern/cycles/kernel/integrator/subsurface_disk.h b/intern/cycles/kernel/integrator/subsurface_disk.h index e1cce13fb30..6146b8c41fc 100644 --- a/intern/cycles/kernel/integrator/subsurface_disk.h +++ b/intern/cycles/kernel/integrator/subsurface_disk.h @@ -119,9 +119,6 @@ ccl_device_inline bool subsurface_disk(KernelGlobals kg, float sum_weights = 0.0f; for (int hit = 0; hit < num_eval_hits; hit++) { - /* Quickly retrieve P and Ng without setting up ShaderData. */ - const float3 hit_P = ray.P + ray.D * ss_isect.hits[hit].t; - /* Get geometric normal. */ const int object = ss_isect.hits[hit].object; const int object_flag = kernel_tex_fetch(__object_flag, object); @@ -131,11 +128,24 @@ ccl_device_inline bool subsurface_disk(KernelGlobals kg, } if (!(object_flag & SD_OBJECT_TRANSFORM_APPLIED)) { + /* Transform normal to world space. */ Transform itfm; - object_fetch_transform_motion_test(kg, object, time, &itfm); + Transform tfm = object_fetch_transform_motion_test(kg, object, time, &itfm); hit_Ng = normalize(transform_direction_transposed(&itfm, hit_Ng)); + + /* Transform t to world space, except for OptiX where it already is. */ +#ifdef __KERNEL_OPTIX__ + (void)tfm; +#else + float3 D = transform_direction(&itfm, ray.D); + D = normalize(D) * ss_isect.hits[hit].t; + ss_isect.hits[hit].t = len(transform_direction(&tfm, D)); +#endif } + /* Quickly retrieve P and Ng without setting up ShaderData. */ + const float3 hit_P = ray.P + ray.D * ss_isect.hits[hit].t; + /* Probability densities for local frame axes. */ const float pdf_N = pick_pdf_N * fabsf(dot(disk_N, hit_Ng)); const float pdf_T = pick_pdf_T * fabsf(dot(disk_T, hit_Ng)); diff --git a/intern/cycles/scene/camera.cpp b/intern/cycles/scene/camera.cpp index 5877b82ead5..5bafe736fb5 100644 --- a/intern/cycles/scene/camera.cpp +++ b/intern/cycles/scene/camera.cpp @@ -592,22 +592,26 @@ BoundBox Camera::viewplane_bounds_get() if (camera_type == CAMERA_PANORAMA) { if (use_spherical_stereo == false) { - bounds.grow(make_float3(cameratoworld.x.w, cameratoworld.y.w, cameratoworld.z.w)); + bounds.grow(make_float3(cameratoworld.x.w, cameratoworld.y.w, cameratoworld.z.w), nearclip); } else { float half_eye_distance = interocular_distance * 0.5f; - bounds.grow(make_float3( - cameratoworld.x.w + half_eye_distance, cameratoworld.y.w, cameratoworld.z.w)); + bounds.grow( + make_float3(cameratoworld.x.w + half_eye_distance, cameratoworld.y.w, cameratoworld.z.w), + nearclip); - bounds.grow(make_float3( - cameratoworld.z.w, cameratoworld.y.w + half_eye_distance, cameratoworld.z.w)); + bounds.grow( + make_float3(cameratoworld.z.w, cameratoworld.y.w + half_eye_distance, cameratoworld.z.w), + nearclip); - bounds.grow(make_float3( - cameratoworld.x.w - half_eye_distance, cameratoworld.y.w, cameratoworld.z.w)); + bounds.grow( + make_float3(cameratoworld.x.w - half_eye_distance, cameratoworld.y.w, cameratoworld.z.w), + nearclip); - bounds.grow(make_float3( - cameratoworld.x.w, cameratoworld.y.w - half_eye_distance, cameratoworld.z.w)); + bounds.grow( + make_float3(cameratoworld.x.w, cameratoworld.y.w - half_eye_distance, cameratoworld.z.w), + nearclip); } } else { |