IcoSphere Explosions

I’m interested in generated ‘explosions’ that are made from low poly sphere mesh’s. Does anyone have a easy way to do that? Or do I need to roll my own with like blender animations?

Thanks

1 Like

Not sure i follow 100% on what you mean. I know what a icosphere is, but generally we would want to blow up more general meshes.

I rolled my own. But 100% in game. In blender you just provide a “fragment” mesh and then a explosion controller moves the pieces based on the relative position.

1 Like

I’m looking to create an effect like this:

I need smoke trails but I also want explosions in that style.

2 Likes

So basically you want to take a “regular” mesh emitting particle emission system (not sure if stock jme can do that, tonegods particles probably can), and just use colored icospheres as emitted mesh.

Background: Normally particles are just Quads with a BillboardControl, so it should be possible to use icospheres instead.

1 Like

The formula for an icosphere (d20, icosahedron) is pretty simple by the way (see Wikipedia).
You could use a custom mesh that has many icospheres in it.
Maybe move them via vertex shader - each 20 triangles move into a different direction than the rest.

If you don’t want so much math / shaders, you can also use the geometry batch factory on imported meshes - but that might produce much more garbage for the GC.
OR…
You could animate a mesh inside Blender, then import that animated explosion model. It would have bones just as other animated meshes have.

AND: The “self-folding donut with mushroom cloud” seems to be the coolest explosion I could think of … and also you could use Bullet’s physics together with rocks / debris - nothing cooler than some convex rocks flying into all directions and bouncing off the walls of the environment! :slight_smile:

1 Like

If you want to do this in code then the simplest way I could envision this would be to make a custom mesh of 20 triangular pyramids that when put together = an IcoSphere (another term you may want to use when looking for details on this is icosahedron as a side note). Then when the explosion happens have each pyramid fly off in the same direction as the normal of that face. Perhaps make it spin a bit too.

2 Likes

This should be quite simple: Make a 1 unit large icosphere in blender, import to jme and plug it into the stock particle emitter. Done.

5 Likes
1 Like

I thought the stock emitter only supported triangles? Or do you mean copy and edit by ‘plug it into’

Thanks

Hmm, right. Now that I’ve looked at the actual code it seems you’re right. For the longest time I just assumed it had the option for it but I never needed it so I never checked. I’m fairly sure I’ve seen multiple people say it had the implementation for it and figured it was something like setMesh(yourcustommesh).

Looking at the code for the emitter it does somewhat look like it could be hacked to use custom meshes but I don’t know what kind of pitfalls that may have. It could just stop working completely.

I suppose you have four options now:

  • copy the code for the particleemitter and try to modify it
  • use the code for the tonegod emitter (that may or may not support it) which I personally cannot find anywhere at all
  • limit yourself to opengl 3.1 and upwards (pretty much all PCs in existence except everything apple because they’re pricks) and use instancing as it’s sort of simmilar to a particle emitter and would probably work pretty well for this case
  • record the frames of a spinning icosphere and put them into the stock particle emitter as an animation on a quad

The quad animation is probably the simplest but will also likely look the worst of them all since the spheres are so close together. It just won’t look right since they’re not really spheres and cannot actually clip into one another.

If you do decide to go the instancing way, make sure to read at least from the linked post until the end of the thread since there are some problems and solutions discussed about the code I linked to.