How to change the color of a particle at a particular location

Hello everyone
I need to use to generate a heat map is similar to the effect of https://www.patrick-wied.at/static/heatmapjs/

But this is a 2d I need 3d, how should I use Babylon to generate, this effect this is my playground https://playground.babylonjs.com/#4XA0XW

1 Like

I think I should use particleSystem.updateFunction ?

1 Like

Hello and welcome to the Babylon community! I think updateFunction is a good idea, since you can access the particle position from there.

https://playground.babylonjs.com/#MRRGXL#267

I tried it in a very simple playground, coloring the particles according to their x,y,z positions. :smiley:

5 Likes

Hi @lingliyi and welcome from me.

This is an example using Solid Particle System

https://playground.babylonjs.com/#ZQANND#1

For some reason I have not worked out yet (but @jerome might if has time) there are camera angles that make sections of the map disappear.

I have overcome this by adding three orthagonal planes at each point but this slows the creation of the map down Babylon.js Playground

3 Likes

If you set the billboard to true, you have to call setParticles() each frame so the planar particle rotations are computed according to the camera position
https://playground.babylonjs.com/#ZQANND#2
(with less points, because it’s CPU intensive)

other approach : use 3D particles instead of planar ones and don’t rotate them (so no billboarding) each frame

4 Likes

Thank you, knew I was missing something simple.

4 Likes

Thank you. I think the best solution right now is to use updateFunction

1 Like