Emitting particles of any shape, not only spheres, points or cubes

If you don’t want to read, watch the video

Some example usage

So imagine you want to create an effect like the one in the video above, a galaxy, made of Billions of stars, it is obviously impossible to represent them all, but how to make a somewhat realistic version of it?

Well, if you have tried using particles you probably have noticed that there are tons of parameters, and if you use them only occasionally like me, you probably haven’t tried all the possible parameters it offers.

But, sooner or later, you’ll wonder if some parameters available can help you achieve a certain particular use case.

Onto the point

Sooner or later, you might stumble upon the options above

So, to make particles emit to a specific shape, you have the option you can see in the center top part of the image above, there’s this menu option called “Create Emission Points from Mesh” and the other “Create Emission Points from Node”. Both allow you to parse a mesh or a MeshInstance node, to generate a list of emission points.

If you choose the “Node” option, you’ll be presented with this

If you choose the “Create Emission Points from Node” option, you’ll be presented with a window that let you select a node in the same scene, then another dialog will be presented as you can see in the picture below.

Choose then how many coordinates you’ll allow for the emission shape

The second window will present you with:

  • A numeric textbox, that indicates how many coordinates you want to generate out of that mesh/node, lots of points might require several minutes of processing (but just once, then coordinates will be then stored for later usage).
  • A select box when you can choose how Godot will parse the mesh, as a “Volume”, or as a surface (with or without normals).

The “Volume” option is the slowest, taking several minutes to generate the emission points, this option allows the emission points to be in any point inside the mesh.

The Surface, or surface + normals options, instead allows particles to emit only on the surface of the mesh you give them to process, and it’s much faster.

Beyond shape

Beyond the options above, there are a couple of things I would like to share.

One is that the emission points are stored as an image, that can be considered as an array of vertices, but stored as an image, if you ask me why, I say “I don’t know”.

Notice that “Point Texture” thingie. It’s where your emission points are stored

Now, it is interesting to notice that there is also another option called “Color Texture”. To my understanding, that was to tell what color each particle has, but I couldn’t find a way to generate that from the same interface shown before.

Anyhow, look at what happens if I put the same texture generated for emission points in the color texture too…

A bit further down…

down..

down..

..dang layout…

HERE! See? Particles assume a coloration divided by “sectors” we could say. I haven’t tried, but My guess here (As I couldn’t find any documentation about it), is that each pixel correspond to a particle emission point defined in the “Point texture” generated by the UI as we did here too. So, knowing where each pixel belongs to, you should be able to color the emission point to your liking.

I haven’t tried my theory, because to map it to the galaxy I have taken the shape from, I’d have to create code that decodes the point texture into vectors, then to the UV of the image, and then color them accordingly. I may take my time to do that one day.

…Or you can tell me that if I used a texture on the mesh I would have obtained the result I’m talking about, if so let me know because I couldn’t!

Posted in Miscellaneous.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.