Lower peak trellis workflow vram and ram usage. (#16054)

This commit is contained in:
comfyanonymous
2026-09-03 16:01:51 -07:00
committed by GitHub
parent 9c90340bc2
commit 0eb098b591
7 changed files with 397 additions and 223 deletions
+23
View File
@@ -12,6 +12,9 @@ class VOXEL:
self.voxel_colors = voxel_colors
self.resolution = resolution # each 3d model has its own resolution
def _comfy_cache_tensors(self):
return self.data, self.voxel_colors
class SPLAT:
"""A batch of 3D Gaussian splats in render-ready (activated, world-space) form.
@@ -29,6 +32,9 @@ class SPLAT:
self.sh = sh # (B, N, K, 3) spherical-harmonic color coefficients
self.counts = counts # (B,) real lengths, or None
def _comfy_cache_tensors(self):
return self.positions, self.scales, self.rotations, self.opacities, self.sh, self.counts
class MESH:
def __init__(self, vertices: torch.Tensor, faces: torch.Tensor,
@@ -72,6 +78,23 @@ class MESH:
self.material = material # SetMeshMaterial scalar/factor overrides
self.emissive = emissive # emissive map: (B, H, W, 3)
def _comfy_cache_tensors(self):
return (
self.vertices,
self.faces,
self.uvs,
self.vertex_colors,
self.texture,
self.metallic_roughness,
self.vertex_counts,
self.face_counts,
self.normals,
self.tangents,
self.normal_map,
self.material,
self.emissive,
)
class File3D:
"""Class representing a 3D file from a file path or binary stream.