How to use a Shader with Point Cloud

Ref to GPU particles - start to end animation

I started out with a CPU version (with only 250 000 particles for faster viewing)

Then I thought I would see what would happen if I tried to do it with a shader. Since a point cloud does not use normals I thought I could use the values in the normals as the end target positions. However I am even more hopeless with shaders than I thought I was and everything goes blank!

(comment out lines lines 76 and 85 and you get the start point cloud).

Any shader experts happy to see what they can do?

I’m taking a look!

1 Like

I can apply the shader on a mesh with success.
But applying the scene.defaultMaterial to the PCS gives the same result.
So, I guess it’s in the material properties that something is missing.

1 Like

Will look into the PCS mesh construction further.

You need two things:

  • tell the material that it should be rendered as points: pcs.mesh.material.pointsCloud = true;
  • set the point size in the vertex shader: gl_PointSize = 2.0;

Here’s a PG with those changes:


Excellent thank you.

1 Like