Lighting calculations for large point cloud

I have a large point cloud (~6-7 million points) that comes with a normal and a color for each point.

At the moment I am using a VBO and simply associating a color with each point. I would like to use the normals ti do some lighting calculations but AFAIK there is no equivalent of the glColorPointer(…) for materials, or is there?

I suppose the obvious solution would be to write a vertex shader.

I was just wondering if there is a simpler way.

My second question is regarding efficiency. I hear that the graphics hardware stores colors as floats no matter what format they are passed as. I am currently passing the colors as GLubyte, is this inefficient?

Any other advice regarding rendering large point clouds are obviously welcome as well! :slight_smile:



Yes, there is a way to get colors into some material slots.
Try this for example (fixed function lighting only, not with shaders):


Does passing colors as GLubyte have an impact on performance?

If you’re using Color4ub types, no it shouldn’t be slow.
There are some gotchas with VBOs, for example interleaved data is faster then individual attribute arrays due to cache locality, double is not supported, unsigned integer and shorts for attributes normally slow down, signed shorts work fast mostly.
Anyway, using 32-bit floating point attributes throughout is plenty fast for most usages.

When you say interleaved data do you mean storing all the data in the same VBO? Or are you pointing to how the data is stored?

For instance the data could be stored:
Vec3_1, Color_1, Normal_1, Vec3_2, Color_2, Normal_2, etc…


Vec3_1, Vec3_2, Color_1, Color_2, Normal_1, Normal_2, etc…

As I understand it, Relic, you are saying the first alternative is better?