mirror of
https://git.datalinker.icu/kijai/ComfyUI-Hunyuan3DWrapper.git
synced 2026-05-02 10:09:08 +08:00
BPT seed
This commit is contained in:
parent
9cd19fd9e0
commit
3b543e82bc
@ -66,21 +66,25 @@ def apply_normalize(mesh):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def sample_pc(trimesh, pc_num, with_normal=False):
|
def sample_pc(mesh, pc_num, with_normal=False, seed=1234):
|
||||||
mesh = apply_normalize(trimesh)
|
mesh = apply_normalize(mesh)
|
||||||
|
|
||||||
if not with_normal:
|
if not with_normal:
|
||||||
points, _ = mesh.sample(pc_num, return_index=True)
|
points, _ = mesh.sample(pc_num, return_index=True)
|
||||||
return points
|
return points
|
||||||
|
|
||||||
points, face_idx = mesh.sample(50000, return_index=True)
|
points, face_idx = trimesh.sample.sample_surface(mesh=mesh, count=50000, seed=seed)
|
||||||
|
|
||||||
|
#points, face_idx = mesh.sample(50000, return_index=True)
|
||||||
normals = mesh.face_normals[face_idx]
|
normals = mesh.face_normals[face_idx]
|
||||||
pc_normal = np.concatenate([points, normals], axis=-1, dtype=np.float16)
|
pc_normal = np.concatenate([points, normals], axis=-1, dtype=np.float16)
|
||||||
|
|
||||||
# random sample point cloud
|
# random sample point cloud
|
||||||
|
np.random.seed(seed)
|
||||||
ind = np.random.choice(pc_normal.shape[0], pc_num, replace=False)
|
ind = np.random.choice(pc_normal.shape[0], pc_num, replace=False)
|
||||||
pc_normal = pc_normal[ind]
|
pc_normal = pc_normal[ind]
|
||||||
|
|
||||||
|
|
||||||
return pc_normal
|
return pc_normal
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user