How to choose multiple meshes from renderer array based only on int?

Heya folks. Is there a way to output the needed indices for each particles using a simple int for the Mesh renderer mesh index variable?


Context: I’m doing floating numbers with niagara and so far I’ve been using it by spawning a different System each time a damage event took place and fed it the numbers. As the screenshot shows I was doing it through an int selection array where I fed each number per index in blueprint and it displayed the correct number.

Now I wish to swap to the Data Channel workflow for optimization reasons as with several enemies on screen there were quite a bit too many systems spawning especially from damage AoEs.

Problem is the data channel doesn’t seem to accept integer arrays in order to feed the proper damage number to display from blueprint. Would be any other way to do this with an int or float or something? :thinking:

This is an interesting issue. The only fix I can think of is setting the particle mesh index using random int values with user parameters. But I am not sure how that would work with a data channel since I haven’t had the chance to use it and I am not sure what your bp setup is.

Unfortunately data channel is a fairly recent feature and maybe hasn’t been used extensively by devs/vfx artists yet hence there is little to no information on it. It is also still experimental; epic even says it is under heavy development, so hopefully int arrays would be added in the future.

1 Like

If I understand correctly, you’re spawning a number of particles equal to the number of digits, then setting the mesh index per particle to match the damage number?

If my assumption is correct, you can do this bit of logic here to isolate each digit - the NumberIn is the raw damage number from the gameplay system, the DigitToDisplay would be your particle index +1 (in my case I’m feeding it manually)

I built this quick test and seems to work up until 8 digits, more than that things get a bit funny, probably because of floating point precision problems. I’m just passing on this final NumberOut value to a debug material in a single particle.
numbersdisplay

That said, have you looked into displaying your numbers in a single particle, and picking the number with shader math instead? If not, look into the DebugScalarValues function!

1 Like

That’s a pretty cool approach. Your assumption is correct. I’ve given up on the Niagara Data Channel approach as it’s imprecise for such an endeavour sadly. Position and the actual numbers I wanted to display sometime didn’t fire with precision. I’m assuming the NDC is more for impact stuff that doesn’t need 100% precision.

Thank you for taking the time to test that. It’s given me some ideas for the future. I didn’t consider doing it in the material as it was something a bit beyond my skills tbh. I’ll definitely check that function out thank you!