Add new tests and functionality for image processing and geometry handling
- Introduced color_image.py for preparing standalone color images for tests. - Added hdr_image.py to create HDR textures for testing. - Implemented test_image_depth_panorama.py to evaluate panorama topology, UVs, and depth discontinuities. - Created test_shadeless.py to validate the opacity and HDR color endpoints of the Shadeless group. - Developed moge3_export.py for exporting dynamic MoGe-3 backbone and ONNX graphs. - Added material.py to inherit material slots onto generated geometry. - Built image_depth_panorama.py to construct a quad panorama with depth separation and sampling.
This commit is contained in:
@@ -168,8 +168,8 @@ def _remove_strip_faces(group, geometry, *, triangles=False):
|
||||
return delete.outputs["Geometry"]
|
||||
|
||||
|
||||
def split_depth_surface(group, geometry, image, strength, uniform, *, triangles=False):
|
||||
"""Keep each face's camera sample on its own corners before splitting."""
|
||||
def sample_face_camera(group, image):
|
||||
"""Sample camera XYZ at each planar face's UV center."""
|
||||
nodes, links = group.nodes, group.links
|
||||
uv = nodes.new("GeometryNodeInputNamedAttribute")
|
||||
uv.data_type = "FLOAT_VECTOR"
|
||||
@@ -183,9 +183,17 @@ def split_depth_surface(group, geometry, image, strength, uniform, *, triangles=
|
||||
texture.extension = "EXTEND"
|
||||
links.new(image, texture.inputs["Image"])
|
||||
links.new(face_uv.outputs["Value"], texture.inputs["Vector"])
|
||||
position = nodes.new("GeometryNodeInputPosition")
|
||||
faces = _store(group, geometry, "face_center", position.outputs[0])
|
||||
faces = _store(group, faces, "face_camera", texture.outputs["Color"])
|
||||
return texture.outputs["Color"]
|
||||
|
||||
|
||||
def split_depth_surface(group, geometry, face_camera, strength, uniform, *,
|
||||
face_center=None, triangles=False):
|
||||
"""Split adjacent face samples using their Z depth and base center spacing."""
|
||||
nodes, links = group.nodes, group.links
|
||||
if face_center is None:
|
||||
face_center = nodes.new("GeometryNodeInputPosition").outputs[0]
|
||||
faces = _store(group, geometry, "face_center", face_center)
|
||||
faces = _store(group, faces, "face_camera", face_camera)
|
||||
axes = nodes.new("ShaderNodeSeparateXYZ")
|
||||
links.new(_read(group, "face_camera"), axes.inputs[0])
|
||||
center_field = _read(group, "face_center")
|
||||
|
||||
22
tools/nodes/common/material.py
Normal file
22
tools/nodes/common/material.py
Normal file
@@ -0,0 +1,22 @@
|
||||
"""Carry the input mesh's material slots onto generated geometry."""
|
||||
|
||||
|
||||
def inherit_material_slots(group, geometry, source):
|
||||
nodes, links = group.nodes, group.links
|
||||
capture = nodes.new("GeometryNodeCaptureAttribute")
|
||||
capture.domain = "POINT"
|
||||
capture.capture_items.clear()
|
||||
capture.capture_items.new("BOOLEAN", "Source")
|
||||
capture.inputs["Source"].default_value = True
|
||||
links.new(source, capture.inputs["Geometry"])
|
||||
join = nodes.new("GeometryNodeJoinGeometry")
|
||||
links.new(geometry, join.inputs["Geometry"])
|
||||
links.new(capture.outputs["Geometry"], join.inputs["Geometry"])
|
||||
material = nodes.new("GeometryNodeSetMaterialIndex")
|
||||
material.inputs["Material Index"].default_value = 0
|
||||
links.new(join.outputs["Geometry"], material.inputs["Geometry"])
|
||||
delete = nodes.new("GeometryNodeDeleteGeometry")
|
||||
delete.domain = "POINT"
|
||||
links.new(material.outputs["Geometry"], delete.inputs["Geometry"])
|
||||
links.new(capture.outputs["Source"], delete.inputs["Selection"])
|
||||
return delete.outputs["Geometry"]
|
||||
Reference in New Issue
Block a user