Using Niagara to show stars in the sky

Hi!

I have the location of all of those bright stars in the sky. Someone has suggested me to use Niagara to draw them instead of using actors with a emissive material:

But I haven’t done anything before with Niagara.

How can I spawn something like that in a location (x, y, z) using Niagara?

The stars are spheres with an emissive material with different sizes.

Thanks!

I’m assuming you need to move them around for gameplay is why you’re using Niagara? If so, look at using Niagara Data Channels:

Now I’m using Actors. I have no idea about Niagara.

Someone has suggested me to use Niagara instead of spawn 8k actors.

I want to spawn (or whatever is called in Niagara) something that looks like a star using Niagara.

Thanks for your answer!

Niagara will be way more performant than actors. NDC will let you push data and use it in emitters however you need (position, color, size, duration…).

If you just need a star background, I would go with a material based approach on a sky dome/sphere for best performance.

I’ve found this: https://www.youtube.com/watch?v=0R7llmGGTXA

I need a tutorial or something to learn how to do it.

@Countsie

I’ve forgotten to mention that I’m using actors because I need to hide them and show them again. Or because the player can interact with them, by clicking on them. Can I do that with a Niagara Effect?

Thanks!

hmmm. i dont think there is an easy way to select individual emitters/particles like with a linetrace. in that case, I would do it with a ISM/HISM, you can get the ‘item’ from the hit result and it will be the index of the specific instance. You can use custom data to change the instance color in it’s material, use the random instance value in your material to modify the ‘twinkle’. you can ‘hide’ an instance by setting it’s scale to 0.

if not using nanite, keep your star mesh SUPER simple if you’re doing 8k objects. Try a cube, see if that works.

once you get it set up and working, if you still have performance issues, i might consider breaking the stars into visual ‘sections’, each using it’s own ISM so view culling can skip rendering ISMs not in view.

honest take first: for a static star field niagara may be more machinery than needed. two thousand fixed points render cheapest as an instanced static mesh with an emissive material, zero simulation.

if you want niagara anyway (twinkle, color variance, one system): spawn burst with count equal to your star list size and feed positions once. the clean way is a user parameter of vector array type written from blueprint or c++, then in particle spawn sample the array by particle index to set each position. no loop, no per frame updates, freeze after spawn.

color and brightness: write magnitude or color temperature into a second array and map it to color in particle spawn, twinkle is then a cheap sine on normalized age in particle update.

ndc (suggested earlier in the thread) is the wrong tool here, data channels are for gameplay to effect or effect to effect messaging, not static position data.

the friction point you will hit: stock blueprint cannot write vector arrays into niagara systems, there are no set array nodes. c++ can (SetNiagaraArrayVector on the component), or the Expose Niagara Variables C++ & Blueprints plugin exposes the array types plus 18 variable types across all 8 namespaces with getters in blueprint and c++, which turns the whole star list into one node call: Expose Niagara Variables C++ & Blueprints | Fab