How to use the alpha color in the PointscloudSystem?

I would like operate with the alpha in the PointsCloudSystem. But it seems not working

Line 73:
particle.color.set(c, c, c, 0.1);

demo: Babylon.js Playground

Something like this ?

yes, yes, yes… foggy!!! thank you, Cedric! :slight_smile:

I managed to add alpha that way but could not set it up per particles :thinking:


Edit : Ahah sorry for doubling the answer, @Cedric arrived a few seconds before :stuck_out_tongue_closed_eyes:

1 Like

but my shadowing is gone… i have to look for ALPHA_MULTIPLY? instead ALPHA_ADD?

thank you tricotou! there are my shadows again! :sunny:

I had disabled the glow to work on colors sorry, here is the glow back :stuck_out_tongue:


The pointscloud system has a serious disadvantage. The update function is called for each particle. At the assembler level, this means: put all parameters on the stack, put the current address on the heap, jump into the function, get the parameters from stack, process the particle, get the return address and jump back… and that for every particle. This is very cpu consuming!

Although I haven’t dived deep into rabbit hole to explore the actual functionality, I can see from the result that we end up with a normal mesh that fetches its facets from an array of points. The colours are stored in a different array per facet, which can also handle an alpha.

So now I have my theoretical solution in front of me, which I will put into practice today, where I can set the positions and colors of the “particles” directly in the arrays.

If you still want to use alpha for each particle in the PointscloudSystem, I would suggest editing the mesh facet color information with mesh.setVerticesData(BABYLON.VertexBuffer.ColorKind, colors);

During the last weeks I worked on my free time on trying to generalize the use of GPGPU with a JS to GLSL wrapper… Not an easy task I have to say, but maybe one day, Babylon JS will have nice wrapper for having this per particle function run on GPU side :grin:

… you are awesome! :slight_smile: I can’t wait to see your wrapper in action.

I have to correct my statement that BABYLON.VertexBuffer.ColorKind can handle alpha. No, it cannot. You have to write your own shader that supports alpha!

But while searching for a simple shader example I came across an interesting oily example! Reflective Water | Babylon.js Playground (

1 Like

Salute to ChatGPT!

shader learn - use alpha | Babylon.js Playground (

1 Like