0
$\begingroup$

Given the following data set which stems from the export of a photogrammetric scan:

ply
format ascii 1.0
element vertex 28182405          
property float x
property float y
property float z
property uchar red
property uchar green
property uchar blue
end_header
1.799052 -12.315076 152.604066 114 110 83
1.980052 -12.459076 152.613066 80 87 54
1.836052 -12.331076 152.600066 122 112 87
2.041052 -12.358076 152.613066 86 90 57
1.937052 -12.312076 152.605066 99 96 63
1.976052 -12.453076 152.613066 83 88 56
1.969052 -12.464076 152.613066 81 88 57
1.885052 -12.342076 152.599066 155 141 115
...

I can import this data into Blender 4.0 using the Stanford PLY importer. I then have a point cloud visible:

Point cloud in Blender - black points

Checking the source code of the importer I am pretty sure that the red/green/blue color values were imported into Blender, too:

/* Vertex colors */
if (has_color) {
  float4 colors4;
  colors4.x = std::stof(value_vec[color_index.x]) / 255.0f;
  colors4.y = std::stof(value_vec[color_index.y]) / 255.0f;
  colors4.z = std::stof(value_vec[color_index.z]) / 255.0f;
  if (has_alpha) {
    colors4.w = std::stof(value_vec[alpha_index]) / 255.0f;
  }
  else {
    colors4.w = 1.0f;
  }

  data.vertex_colors.append(colors4);
}

I then tried to play around with the shaders, yet with no success.

enter image description here

I may have misunderstood some of the hints I found for older versions of Blender. Also the docs do not reveal any procedure on how to visualize the color. Any hint appreciated.

Update in reaction to Blunder's question: The spreadsheet in the Geometry Nodes editor looks like this:

enter image description here

Update 2: Using Blunder's proposal from below I still seem to miss something:

enter image description here

$\endgroup$
2
  • $\begingroup$ Have you checked the Object Data Properties tab > Attributes section? Or the spreadsheet in the Geometry Nodes editor? $\endgroup$
    – Blunder
    Jan 30 at 16:41
  • $\begingroup$ The spreadsheet has the data. I update my question accordingly. $\endgroup$
    – Markus W.
    Jan 30 at 17:34

1 Answer 1

2
$\begingroup$

When you import your PLY file, you get a mesh with a lot of vertices, each of them with a vertex color (Col attribute). Technically, it's not a Point Cloud but a Mesh object with only vertices. Since this mesh has no faces, nothing is rendered = no color.

screenshot of shader and GN modifier

With a Geometry Nodes (GN) modifier and a Mesh To Points node you can convert the mesh into a point cloud. It's recommended to use Cycles to render point clouds because it can render point clouds natively and does not require geometry. The points will always be rendered as spheres. The radius attribute defines the size. You can define this value in the Mesh To Points node (see also Set Radius node).

Then create a material that uses the Col attribute as you did and set this material in the GN modifier. Make sure you set Viewport Shading (Z) to Rendered and the render engine to Cycles. The points are not visible in the Material Preview shading mode because this mode uses the Eevee render engine.

The render engine Eevee cannot render points directly and needs geometry. (As of the time this was written, Blender 4.0 was the current version. Perhaps Eevee will be able to do this in future versions of Blender.) - You could instantiate a low-poly object like a cube with 8 verts on the points to see them in the viewport and Eevee renders, but you also need to realize the geometry for the color (see Realize Instances node). But don't do this! Because you have over 28 million points you would end up with over 8 * 28 = 224 million vertices!

$\endgroup$
5
  • $\begingroup$ One step further: The modifier works. Do I have to add material to the points somehow to obtain PointMaterial? In my settings the "Material" of the original data was proposed but with that one modified via attributes I see no effect. I miss something here. $\endgroup$
    – Markus W.
    Jan 30 at 18:15
  • $\begingroup$ I updated my question adding a screenshot of me following your advice. I may have missed something crucial. $\endgroup$
    – Markus W.
    Jan 30 at 18:38
  • $\begingroup$ OMG! That is the solution! Could you please add that little information to your answer I will then mark it as solution. Many, many thanks! $\endgroup$
    – Markus W.
    Jan 30 at 20:05
  • $\begingroup$ Marked as solution, anyway. $\endgroup$
    – Markus W.
    Feb 4 at 19:58
  • $\begingroup$ Nice to read that it worked for you. I have added my comment to the answer and hopefully, it is now clearer that you need Cycles to see the points. $\endgroup$
    – Blunder
    Feb 5 at 14:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .