Rendering a Colored Point Cloud in BLENDER.


This Image shown above is a Point Cloud Rendered using BLENDER.

The problem with rendering a point cloud in Blender is that it is built to work with meshes. Any mesh format be it .ply, .obj etc has face information . But Point Cloud has only information of vertices and their attributes.  The  point cloud .ply file that I have rendered using the method described in this post has following vertex attributes :

  1. vertex position : <x, y, z>
  2. vertex normal: <nx, ny, nz>
  3. vertex color: <r, g, b, a>

If you don’t know the format of a .ply file then you can have a look at this link:

The method that i have used is a 2 step process-

  1. Generate splats at each vertex and save this information in new .ply file.
  2. Import this new .Ply file in Blender and Render it.

Step 1 : Generating Splats

A splat can be though of a quadrilateral, usually square, having its center at the vertex point for which it is generated. We do this step because the smallest primitive that Blender handles is a plane. So, keeping this in mind we create small planes at all the vertices in the point cloud and orient them perpendicular to the normal at these vertices.

The main mathematical ingredient to orient the splats perpendicular to the normal at each vertex is:

For a vertex V = <a,b,c> having normal : <nx, ny, nz>

float magNormal= sqrt (nx*nx + ny*ny + nz * nz);       // magnitude of the normal vector

double theta = asin(ny/magNormal);       // angle between the normal and the x-z plane

double phi = atan(nx/nor.z);             // angle between ‘normal’s projection on x-z plane’  and z-axis.

RotateX(P,theta);                                    //  rotate vector P at angle theta about x-axis.

RotateY(P,phi);                                        //   rotate vector P at angle phi about y-axis.

Translate(P,pos);                                     // Translate the vector P by vector ‘pos’.

To explain what is happening here

    1. A plane/splat of a specific size is created in the xy plane , i.e having its normal along the Z-axis.
    2. Rotate the plane about X axis and Y axis by angles theta and phi respectively.

Translate the rotated plane to the position of the vertex, forming the center of this splat.
When all the vertices have been processed we will have a splat at each vertex , therefore we will have face information. Now we write all this new information in a new .ply file.

The C++ code to read a binary .ply file and generate a splatted .ply file can be downloaded from following Github repository ( getting this code working properly costed me 3 MANGO SHAKES!!!  😀 ) :

Step 2: Importing .ply files in blender and Render them

The .ply files can be imported in blender by File>Import>.ply file, then select the .ply that you have just created in the above step. Once imported in the Blender then you are ready to render it , just one more thing  to be done.

Blender by default comes with 2 different rendering engines

  1. Blender Render (blender’s internal renderer)
  2. Cycles

To get the colored rendering of the splatted point cloud you need to switch on the vertex color attribute no matter which renderer you use. You can refer to the following post to switch on the vertex color attribute:

Since now, you have switched on the vertex color, set the camera at appropriate location and




7 thoughts on “Rendering a Colored Point Cloud in BLENDER.

  1. Hi, this is really awesome. unfortunately I’m not able to compile the code by myself. Is it possible o have a binary ? every OS is ok for me (win7, OSX, ubuntu). I suppose this piece of software works in command line, somehow including the ply input and the ply output filename. Thanks a lot !

    • I think the code should compile easily on ubuntu using g++ compiler, I made this on windows using visual studios 2010. Try to compile again, if nothing works then let me know. I will upload the executable in the github repository. 🙂

      • hi Vinesh, this is great! but I ‘m also not a programmer, I downloaded windows studio 2013, tried, realized it needed glm, put that in the project, tried again, but still got a lot of errors. I don’t know what to do next… is it possible to put an executable in the github repository? thanks!

  2. Pingback: Point Cloud Rendering Engine | Vishesh Gupta

  3. Pingback: Efficient way(s) to render point clouds of 3D scan datas in cycles | DL-UAT

  4. Hi, I know this is an old post but I’d like to know if there is a way to control the size of the splats generated ?
    The method works like a charm except that the splats are a little too big in my case.
    Thanks a lot anyway !!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s