How to pass custom parameters to ShaderMaterial for every Solid Particle?

I am using Solid Particle System to render a lot of special 2D shapes. And I am using a ShaderMaterial to control the render process.

Here I want pass some parameters for every particle. And I can achieve this process by using the particle.color parameter.

But in this way, I can only pass 4 parameters. What should I do if I want to pass more parameters?

SPS is not instances meshes, so I can’t use VertexBuffer to pass parameters. Other parameters like position, normal, and uv are for the original mesh added in SPS, and it seems I can’t modify them into parameters for each particle.

Don’t know if this will help you, but for my cases I used procedural textures and use UV offsets with individual timings for the particles. Might not be what you need but could give you some alternative ideas.

1 Like

Thank you for your reply! You did a great job!

It seems that I can change the particle.uvs property like below and every vertex of the particle will share the same value on uv. So I have 6 paras now.

When I tried to update the normals of the SPS.mesh myself or add a uv2 data to VertexData of the mesh, the shader could not get the new data. Just don’t know why.

1 Like

Ok cool! So that concept worked for you? I’m super happy! Good luck on you visual.

You technically don’t have to use those values as they are defined, they can represent any sort of value that you can sample at will.

About the extra buffers, I think its just set for a specific amount so any other sort of sampling space otherwise needs to happen on the CPU unless you extend the particle class to accept more attributes. The attributes can be distributed per vertex but things like uniform are shared globally.