Refactor geometry generation to standardize Blender object coordinates

- Unified the canonical local frame for generated geometries (Plane, Depth Plane, Relief Plane, Cutout, Depth Cutout) to align with Blender's object coordinate system, setting X as horizontal, Z as up, and +Y as depth.
- Removed the `Depth Axis` parameter from `O Image Cutout` and `O Image Depth Cutout`, simplifying the geometry generation process.
- Updated the depth direction defaults to use +Y instead of -Z for `O Image Relief Plane` and Depth Symmetry.
- Adjusted the geometry nodes to ensure thickness, projection, and shell displacements operate along the Y-axis.
- Implemented new capabilities for handling object space normals to align with the new canonical frame.
- Enhanced the Depth Symmetry functionality to mirror across the canonical Y-axis and perform a final rotation to maintain the correct orientation.
- Added tests to validate the new coordinate system and ensure compatibility with existing assets.
This commit is contained in:
2026-09-15 13:33:37 +08:00
parent 591e62085a
commit 4035f5c9e4
47 changed files with 892 additions and 570 deletions

View File

@@ -2,7 +2,7 @@
import bpy
from ...common.object import modifier_input_identifier, set_modifier_input
from ...common.object import blender_frame_rotation, modifier_input_identifier, set_modifier_input
from ...common.node import load_node_group
@@ -14,7 +14,7 @@ def build_image_plane_matrix(matrix_world, bounds):
x_min, x_max, y_min, y_max = bounds
center = ((x_min + x_max) * 0.5, (y_min + y_max) * 0.5, 0.0)
return matrix_world @ Matrix.Translation(center)
return matrix_world @ Matrix.Translation(center) @ blender_frame_rotation().inverted()
def create_image_plane_mesh(name, bounds):
@@ -28,10 +28,10 @@ def create_image_plane_mesh(name, bounds):
mesh = bpy.data.meshes.new(name)
mesh.from_pydata(
(
(-half_width, -half_height, 0.0),
(half_width, -half_height, 0.0),
(half_width, half_height, 0.0),
(-half_width, half_height, 0.0),
(-half_width, 0.0, -half_height),
(half_width, 0.0, -half_height),
(half_width, 0.0, half_height),
(-half_width, 0.0, half_height),
),
(),
((0, 1, 2, 3),),

View File

@@ -13,6 +13,7 @@ from ...common.depth import (
load_depth_metadata,
load_depth_result_image,
)
from ...common.coordinate import canonical_direction_to_legacy
from ...common.material import create_image_material
from ...common.color_image import material_color_image
from ...common.object import (
@@ -96,6 +97,7 @@ def create_depth_plane_object(
)
except ValueError:
depth_direction = (0.0, 0.0, 1.0)
depth_direction = canonical_direction_to_legacy(depth_direction)
inputs.append((
"Depth Direction",
depth_direction,