Many objects, particles, shaders

My overall aim is to display many colourful point-like objects, up to 10,000s or 100,000s.
Each point has a position (xyz) and a colour (rgb). Position could be static if needed, but colour is definitely not.

I am fairly new to unreal but have tried many options with limited success.
I have tried:

Actor components with static-mesh Spheres

  • obviously can’t handle the required numbers

Actor components with billboards

  • better, but again can’t handle the numbers

Billboard components

  • no different to above

Particles

  • Didn’t seem to be able to control their spawn location
  • GPU particles all have the same colour
  • Don’t seem to be able to change colours after spawn, or reference individual particles in any way

Material (Shader)

  • I thought that maybe if I could make a static mesh of the points, I could make a shader to show points (like wireframe… but points)
  • No luck

(reading) Point Clouds

I believe I’ll need to harness the GPU to make this possible. Possibly my understanding of shaders is wrong, but I was under the impression I should be able to send the GPU vertex data (with attached colour data), and have the GPU execute a shader (geometry shader?) to transform this data into better-looking models and render appropriately.

This doesn’t seem like it should be a difficult thing to do, however ue4 is setup for more traditional operations.
Can someone please point me in the right direction?

That’s something that you should be able to do with particles, I haven’t done any coding with particles but there definitely should be a way to assign a position and a color to individual particles. If you aren’t doing lots of other crazy calculations to each particle then it should run just fine after that.

The point cloud method can handle dynamic point colors and positions, and it’s far easier than rolling your own vertex shader. You just need to make a Dynamic Material Instance of your point cloud material, then use Render Targets as Texture Parameters for color and position. Use Draw Material to Render target to update them. Or you can use a custom CanvasRenderTarget2D if you want to draw specific points.

I havent tried this before, and sadly dont have the time to try and create it.

I can give some pointers though:
in the material: “ParticlePosition” node outputs V3 (RGB) data representing each seperate particle’s position in world space.
This means that each particle has its own unique XYZ value.

If you can convert the XYZ output of particleposition back to RGB values within range, you’d have full control over the particle color.

Now in the initial location module in cascade you have “start location” if you set the min/max to 50/50/50 and -50/-50/-50 (XYZ)
Max location on each axis is 100, and thats a good math base to convert it to a 0-100% color range.

Also in the same initial location module you can enable “distribute over NPoints” and make this the same amount as the amount of particles you are emitting.
If cascade works fine each particle will have its own unique location each time.
Make sure to set distribution treshhold to 1, as any lower value will increases the percentage of a particle being emitted at a random location.

If you’d spawn 1000000 particles, and set the Npoints to 1000000 as well, each particle would have its own location be evenly spread over 100/100/100 (XYZ) locations and therefore able to get its own color, or at least a unique value to create colors with.

Keep in mind that cpu particles might not reach that amount, and gpu particles might not work with particleposition (havent tried yet)
i’d suggest to start with about 100 to 10000 particles.

Good luck and let me know if things work out.

@Luos Distribute over N Points doesn’t work like that, I dealt with this issue when developing a point cloud method. It picks the points randomly among the possible set, but not uniquely, so you need to have many times the number of points before you can guarantee that they are all occupied. The only way to guarantee N particles spawning at N points is to use spawn per unit, wait one tick after the emitter is created and move the particle system N units. However, particles have way more overhead than a mesh of an equivalent number of disconnected quads so it’s much more efficient to use those.

Oh yea, i forgot I am using a custom thing for that that doesn’t just create them between min and max in a straight line, but takes the min/max input separately for each XYZ thing.
So yea, maybe ask/pay @Cultrarius or someone else to make a proper mod for it :stuck_out_tongue:

To the original OP or others who may know, has there been any clarification to the original question about a proper method to spawn a large number of objects/particles which can be individually controlled?