Render large point cloud with color information

Hello,

I’m writing a Blender addon using Blender 3.1 and bpy.

I read data about atoms from another file, which I have given as x, y and z coordinates. From that I create points with these coordinates via a bpy script. I only have these points created by x, y, z information and no previous .obj/.ply mesh that can be imported.

My problem is that I have very large data sets of 10 millions of atoms or more which have to be rendered and displayed in colors. That means that I have 10 millions of vertices. Currently I’m using the geometry node Instance on Points which I give a cube as Instance:


I’m doing this because I need geometry on the points to color them.
But that’s computation-intensive and I’m running into problems because of that. So I’m wondering if it is possible to render point clouds with colors without using additional geometry on the points?

I can’t use other addons like the the Point Cloud Visualizer.

Does anyone have an idea how I can implement this on my own in a way that’s not too computation-intensive and without using imported .ply or .obj files? I’d be really thankful for any advice!

hi, cycles can render new pointcloud data types as spheres: https://wiki.blender.org/wiki/Reference/Release_Notes/3.1/Cycles
so should be able to skip whole instancing step and use geometry nodes only for sphere radius setting. first you create mesh with vertices, set attributes on them (radius, color for example) and then bpy.ops.object.convert(target='POINTCLOUD') (hope in future we will be able to manipulate pointcloud data directly, but not yet) but beware, this is available only in alpha blender builds, release builds does not include pointcloud object

edit: maybe you can skip to points conversion step by using mesh to points node and have regular vertices as input, but i suspect all is going to be slower with mesh data

ehm, may i know why? (i am PCV author)

2 Likes

Hello,
thank you a lot for your answer, this already helped me a lot! I have installed the 3.2.0 alpha now.

The conversion to the point cloud works for me, I’m just wondering how I can use the attributes of the point clouds (like color, radius, …). At first I tried it in blender itself but I can’t get blender to color the points. They don’t look like they’re filled with color as they are just gray. It makes no difference if I’m using Cycles or Eevee. Is my try to do it in the shader wrong?

I converted a cube to a point cloud to keep it simple. I added a color attribute which is (1.0, 1.0, 1.0, 1.0) per default as you can see in the spreadsheet. So I think it should be white but it isn’t.

I’m also wondering if I can edit this color value or also the radius values or at least their default values when adding an attribute?

Oh sorry, I think I worded that wrongly. I already installed and tried your PCV addon and it works perfectly fine for me! But I’m writing this addon for a job and we want our colleagues to use our addon and want to keep dependencies as low as possible. :slight_smile:

radius you can set after in geonodes and color is used in shader via attribute node

either you don’t use color at all or white turned to gray because of no lights in scene apart from uniform grey world

when you got mesh data and you loop over vertices to set locations, you can also set whatever you want in their attributes, i don’t see any problem here? you add attribute to mesh, default is always zero (at least in python), then you set some value…

i see :slight_smile:

1 Like

Thank you for your answer again!

The only point I’m still not getting is why the color isn’t displayed as soon as I’m in material preview or rendered mode. There’s a light source directly above one of the points and they’re still not colored. They even somehow seem transparent because of the x-axis that you can see because the points are not colored:

I can’t figure out what I’m missing out? Here’s a reference file if you want to have a look:
cube_point_cloud.blend (851.2 KB)

It’s a feature that’s only available to Cycles AFAIK.

1 Like

yes, it is for cycles only and your attribute should not be named color but something else, don’t ask me why… if it is just color the result is black

1 Like

I now managed to script my pipeline and render the point cloud in Cycles.
Thank you a lot for your time and help!