tombstonetumbleweedart / import-ply-as-verts Goto Github PK
View Code? Open in Web Editor NEWBlender Python PLY importer for point clouds and nonstandard models.
Blender Python PLY importer for point clouds and nonstandard models.
Hello,
Thanks for such nice tool.
I have some problem when import the pointcloud as it seems it modifies the coordinates while importing. In the image, you can see that in blender (left) the two models do not overlap as they should. When open the models on meshlab it does work (right image). Is this a problem that can be solved?
Best,
Bryan
I've been working on a ply writer for some particle simulation data which can map one attribute to RGB, another to alpha, and a third to emission. With very little coding experience myself, I've been working on a personal set of edits to this reader for an additional column but I figure this may be something useful to others as well, hence why I bring it as a suggestion here.
Hi, thanks for creating this updated ply importer!
I wrote something that creates a material and geometry node tree:
import bpy
mat_name = "pointcloud"
materials = bpy.data.materials
if materials.get(mat_name) is None:
print("creating pointcloud material")
mat = materials.new(mat_name)
mat.use_nodes = True
materialtree = mat.node_tree.nodes
materialtree.remove(materialtree.get("Principled BSDF"))
materialtree.remove(materialtree.get("Material Output"))
attributenode = materialtree.new(type="ShaderNodeAttribute")
attributenode.attribute_name="Col"
outputnode = materialtree.new(type="ShaderNodeOutputMaterial")
pbrnode = materialtree.new(type="ShaderNodeBsdfPrincipled")
mat.node_tree.links.new(attributenode.outputs[0],pbrnode.inputs[0])
mat.node_tree.links.new(pbrnode.outputs[0],outputnode.inputs[0])
mat = materials.get(mat_name)
#import object
bpy.ops.import_mesh.ply(filepath=r"C:\Users\User\Desktop\file.ply")
importedObject = bpy.context.active_object
#create geometry node tree
bpy.ops.object.modifier_add(type='NODES')
nodeTree = bpy.context.active_object.modifiers[0].node_group
cubenode = nodeTree.nodes.new(type="GeometryNodeMeshCube")
CubeSize = 0.001
cubenode.inputs[0].default_value[0] = CubeSize
cubenode.inputs[0].default_value[1] = CubeSize
cubenode.inputs[0].default_value[2] = CubeSize
instancenode = nodeTree.nodes.new(type="GeometryNodeInstanceOnPoints")
materialnode = nodeTree.nodes.new(type="GeometryNodeSetMaterial")
materialnode.inputs[2].default_value = mat
shadenode = nodeTree.nodes.new(type="GeometryNodeSetShadeSmooth")
realizenode = nodeTree.nodes.new(type="GeometryNodeRealizeInstances")
geonode = nodeTree.nodes[0]
outnode = nodeTree.nodes[1]
nodeTree.links.new( geonode.outputs['Geometry'] , instancenode.inputs['Points'])
nodeTree.links.new( cubenode.outputs['Mesh'], shadenode.inputs['Geometry'])
nodeTree.links.new( shadenode.outputs['Geometry'], materialnode.inputs['Geometry'])
nodeTree.links.new( materialnode.outputs['Geometry'], instancenode.inputs['Instance'])
nodeTree.links.new( instancenode.outputs['Instances'], realizenode.inputs['Geometry'])
nodeTree.links.new( realizenode.outputs['Geometry'], outnode.inputs['Geometry'])
Hi!
I've tryed writing on the youtube video but seems the commet are disappeared.
The problem I was asking is that i can't get the color attribute to the points, I've defined the shader with the "attribute" "Col" as base color, and then the geometry node both with instance or mesh to points, but the points still has no colors
Certain JWF formulas will place additional nonstandard property fields into the PLY file when exporting.
This was reported by Brad Stefanov on Feb 4 2022 and replicated on my end.
Patched in v1.01, will revisit for more comprehensive solution.
Feb 5, 2022 -MAP
I couldn't install the addon in Blender 4.0
I do not know what i am getting wrong here, Ty
Hello, on Mint, the original plugin is located at something like
snap/blender/3915/3.6/scripts/addons/io_mesh_ply/import_ply.py
snaps are not editable. Even when running sudo nemo
, I can't edit those files.
How could I use your plugin ?
Hi Tombstone,
Thank you very much for sharing this script. It's really helpful along with your youtube video there for a blender newbie.
I'm just wondering could this show the point color correctly with just points coordinates and their color given as input? For my file it couldn't show the color correctly as it shown in open3d.
Blender gives me this:
With open3d's image as:
My nodes connection is here and I would really appreciate if you could take a look at this specific case!
(The ply file is here
table.zip
)
Best regards,
Batwho
Hello, I'm having some trouble getting the vertex colors to appear. I exported a point cloud from meshlab, and it appears just fine, but with no color data. I don't know if this is intended, but "Col" is in the spreadsheet and seems to have correct colors, but there is no geometry node setup or material on import. Reinstalling didn't seem to help. I tried to manually prepare these, but I don't know the node editors very well. For example, I typed in Col under "Attribute" as I've seen in other issues, but I'm not sure how (or if) it gets this data from the model. I'm using Blender 3.6.1 LTS.
Thanks for any help!
Hello! Am I able to get a copy of the previous version of this addon? I know there are benefits to the current version, but for our workflow, it breaks the whole process and we don't need the new features. Not sure why the previous version was murdered instead of just ignored. I'm talking about the old version that would display the point cloud with "Point Cloud Visualizer"
When importing BTracer2 PLY files, the colors load fine when importing as mesh but do not load when importing as verts.
Currently under investigation
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.