Refactor: Cycles: Use full resolution for viewplane bounds check

Results should be unchanged, but it's confusing if these use the progressive
refinement resolution instead of the full resolution.

Pull Request: https://projects.blender.org/blender/blender/pulls/137228
This commit is contained in:
Brecht Van Lommel
2025-04-09 18:48:14 +02:00
parent a2338e3eca
commit c4db213127
2 changed files with 9 additions and 9 deletions

View File

@@ -568,12 +568,12 @@ void Camera::device_free(Device * /*device*/, DeviceScene *dscene, Scene *scene)
dscene->camera_motion.free();
}
float3 Camera::transform_raster_to_world(const float raster_x, const float raster_y)
float3 Camera::transform_full_raster_to_world(const float raster_x, const float raster_y)
{
float3 D;
float3 P;
if (camera_type == CAMERA_PERSPECTIVE) {
D = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
D = transform_perspective(&full_rastertocamera, make_float3(raster_x, raster_y, 0.0f));
const float3 Pclip = normalize(D);
P = zero_float3();
/* TODO(sergey): Aperture support? */
@@ -588,7 +588,7 @@ float3 Camera::transform_raster_to_world(const float raster_x, const float raste
else if (camera_type == CAMERA_ORTHOGRAPHIC) {
D = make_float3(0.0f, 0.0f, 1.0f);
/* TODO(sergey): Aperture support? */
P = transform_perspective(&rastertocamera, make_float3(raster_x, raster_y, 0.0f));
P = transform_perspective(&full_rastertocamera, make_float3(raster_x, raster_y, 0.0f));
P = transform_point(&cameratoworld, P);
D = normalize(transform_direction(&cameratoworld, D));
}
@@ -659,15 +659,15 @@ BoundBox Camera::viewplane_bounds_get()
0.0f;
const float extend = max_aperture_size + max(nearclip, scaled_horz_dof_ray);
bounds.grow(transform_raster_to_world(0.0f, 0.0f), extend);
bounds.grow(transform_raster_to_world(0.0f, (float)height), extend);
bounds.grow(transform_raster_to_world((float)width, (float)height), extend);
bounds.grow(transform_raster_to_world((float)width, 0.0f), extend);
bounds.grow(transform_full_raster_to_world(0.0f, 0.0f), extend);
bounds.grow(transform_full_raster_to_world(0.0f, (float)full_height), extend);
bounds.grow(transform_full_raster_to_world((float)full_width, (float)full_height), extend);
bounds.grow(transform_full_raster_to_world((float)full_width, 0.0f), extend);
if (camera_type == CAMERA_PERSPECTIVE) {
/* Center point has the most distance in local Z axis,
* use it to construct bounding box/
*/
bounds.grow(transform_raster_to_world(0.5f * width, 0.5f * height), extend);
bounds.grow(transform_full_raster_to_world(0.5f * full_width, 0.5f * full_height), extend);
}
}
return bounds;

View File

@@ -213,7 +213,7 @@ class Camera : public Node {
private:
/* Private utility functions. */
float3 transform_raster_to_world(const float raster_x, const float raster_y);
float3 transform_full_raster_to_world(const float raster_x, const float raster_y);
};
CCL_NAMESPACE_END