【发布时间】:2020-05-13 00:43:41
【问题描述】:
我正在尝试从 xyz 坐标数据列表创建 3d 模型。我创建了一个 Python 脚本来创建一个小球体,然后为每个数据点复制它。不幸的是,该程序花费了不合理的长时间。我计算出完成创建模型最多需要 8 天。我什至尝试使用 Google Compute Engine 运行脚本,但仍然需要很长时间。有没有办法在合理的时间范围内创建一个这么大的模型?我愿意尝试除 Blender 之外的其他程序。动画公司如何打造巨模?总有办法吧?
这是用于创建模型的 Python 脚本:
import bpy
import os
radius = 0.0005
scale = 0.001
bpy.ops.object.select_all(action='DESELECT')
bpy.ops.mesh.primitive_uv_sphere_add(size=radius)
sphere = bpy.context.object
filename = 'points.xyz'
directory = 'C:\\Users\\User1\\Desktop'
fullpath = os.path.join(os.getcwd(), filename)
print("Creating OBJ file")
sphereCount = 1
def makeSphere(x,y,z):
global sphereCount
print("Creating Sphere #" + str(sphereCount))
ob = sphere.copy()
ob.location.x = x
ob.location.y = y
ob.location.z = z
bpy.context.scene.objects.link(ob)
sphereCount += 1
with open(fullpath,"r") as f:
for line in f:
values = line.split()
x = values[0]
y = values[1]
z = values[2]
makeSphere(scale*float(x),scale*float(y),scale*float(z))
bpy.context.scene.update()
#Export as OBJ file
filename = 'finalObject.obj'
directory = '/home/user1'
fullpath = os.path.join(os.getcwd(), filename)
print("Exporting OBJ");
bpy.ops.export_scene.obj(filepath=fullpath)
我在网上找到this question 并尝试了这种方法,但它的运行速度比复制每个球体要慢。
【问题讨论】:
-
与其创建 50mill 对象,不如创建一个 50mill verts 的网格并使用dupliverts 在每个点复制一个球体。实际上,听起来更像是您拥有体积数据并且只想查看外壳,请查看openvdb,我相信它具有将体积数据转换为网格壳的工具,它将使用iso surface generation,就像在cubesurfer 插件中使用的一样.