New Particle System

Anyone interested in trying out a new particle system? :smiley:

Features:

  • Particle drivers (like influencers from PM, but far more powerful)
  • Instanced particle geometry (compatible with any instancable material)
  • Single vertex and quad particle geometry
  • Trailing geometry (useful for slashing effects)
  • Sprite sheets

As for the API itself, in order to cover as many use-cases as possible, all particle logic (including spawning logic) has been moved to drivers (aka influencers) and Iā€™ve made an effort to make system components extendable and/or replaceable.

Known Issues:

  • Takes more time to setup even a simple effect with this system than it does with ParticleMonkey or JME particles (see sample code below).
  • Interpolation/tween API is still pretty sketchy. I hope people could provide feedback and suggestions for this feature in particular.
  • Particles following geometry is not supported.

Code Sample:

public class TestBasicParticles extends DemoApplication {
    
    public static void main(String[] args) {
        new TestBasicParticles().start();
    }
    
    @Override
    public void demoInitApp() {
    
        ParticleGroup<ParticleData> group = new ParticleGroup(200);
        group.setLocalTranslation(0, 3, 0);
        group.setOverflowStrategy(OverflowStrategy.CullOld);
        group.addDriver(ParticleDriver.force(new Vector3f(0f, -3f, 0f)));
        group.addDriver(ParticleDriver.Position);
        group.addDriver(ParticleDriver.Angle);
        Emitter e = Emitter.create();
        e.setParticlesPerEmission(Value.constant(5));
        e.setEmissionRate(Value.constant(.1f));
        group.addDriver(e);
        group.addDriver(new ParticleFactory<ParticleData>() {
            @Override
            public void particleAdded(ParticleGroup<ParticleData> group, ParticleData p) {
                p.setLife(4f);
                p.setPosition(group.getVolume().getNextPosition(group.getWorldTransform()));
                p.color.set(new ColorHSBA(FastMath.nextRandomFloat(), 1f, .5f, 1f).toRGBA());
                p.linearVelocity = VfxUtils.gen.nextUnitVector3f().multLocal(VfxUtils.gen.nextFloat(4));
                p.setScale(FastMath.rand.nextFloat(.05f, .2f));
                p.angleSpeed.set(FastMath.rand.nextFloat(-5f, 5f));
            }
        });
        rootNode.attachChild(group);
        
        TriParticleGeometry geometry = new TriParticleGeometry(group, MeshPrototype.QUAD);
        geometry.setQueueBucket(RenderQueue.Bucket.Transparent);
        Material mat = new Material(assetManager, "MatDefs/particles.j3md");
        mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
        mat.setTransparent(true);
        geometry.setMaterial(mat);
        rootNode.attachChild(geometry);
    
    }
    @Override
    public void demoUpdate(float tpf) {}

}

I would be grateful if folks would give this particle system a try and provide feedback for me! :chimpanzee_cool:

19 Likes

I would like to try it when I have some time. Will it work on Android devices as well?

As far as I know, yes. I donā€™t have an android or android sdk, so I donā€™t know for sure.

1 Like

Hi @codex , I downloaded your project to try it and it does not compile.

  1. The jme3utilities.math.noise.Generator.nextFloat(float v) method does not exist in the Heart-8.8.0 library, so all VfxUtils.gen.nextFloat(x) and VfxUtils.getGenerator().nextFloat(x) instructions are reported as an error. Could you please check and fix the problem?
  2. There are unused classes in the codex.vfx and codex.vfx.annotations packages. What are they used for?
  3. I would suggest you convert the project with Gradle, otherwise it is complicated to put all the pieces of the project together. If you are interested I will do it for you and post it on github.

image

image

2 Likes

Hi @capdevon, thanks for trying it out!

nextFloat(x) is inherited from java.util.random.RandomGenerator. Which JDK are you using for this project?

Those are for an in-game effect editor I started working on. Sorry for that being in the master branch, though none of that code should affect anything.

Yeah, probably a good idea. Iā€™m used to ant, so I keep putting learning gradle off :stuck_out_tongue:. If you want to post a gradle build, I would be gradleful grateful for that.

3 Likes

It doesnā€™t.

Edit:

Are you sure your local code is the same as the code you have committed to github?

1 Like

Oh, I see. Although I set the source format to JDK 8, Iā€™m still using Java 17ā€™s library. RandomGenerator was introduced in Java 17.

Iā€™ve pushed a temporary patch to the problem, but you have to modify the source slightly to remove an override annotation in VfxRandomGenerator.

I will look into getting java 8 downloaded to avoid further errors like this.

2 Likes

Gotcha

I would suggest adding the version of java required by the project to the README file on github.

1 Like

Thanks, good idea. I added that and a notice of this issue to the readme.

2 Likes

Hi @codex , the SSRFilter class does not exist in jme-3.6.1-stable. Could you add the source code to the Jme-VFX project, or remove it from the TestMultipleSystems test class please ?

2 Likes

Oops, I forgot I even tried to use ssr. Iā€™ve removed it now. Thanks for pointing it out!

2 Likes

Hi @codex, as promised I converted your project with gradle. I separated the test classes and functions from the library classes. I reworked the code and the javadoc. You can fork it and update it with new ideas (those annotation classes look promising and indicate that you are developing a GUI).

If you want to share your ideas and make your projects easier to use, I would suggest using gradle, it is not hard to learn. Google and the JME community are your friends. :wink:

I read on your github that you are a game designer. Are you good with shaders?

6 Likes

Thanks, much appreciated! :hugs:

Iā€™m alright at itā€¦ why do you ask?

1 Like

I have a list of shaders that are commonly used in video games.
Would you develop some of them for me and the community?

1 Like

Sure, Iā€™d be glad to take a crack at it.

2 Likes

Great! If you want to start with something simple here are two basic shaders included in both Unity and Godot engines. They are often used in UIs.

Usually the rectangular healthbar fills from left to right, while the circle healthbar fills clockwise and the background color is usually a darker version of the primary color.

Hereā€™s my challenge for you:

Of course, you can use Ant or whatever IDE you prefer to create the project. I will then help you convert it to gradle, and provide support where I am able. :wink:

Anyone who wants to take up the challenge is free to join.

8 Likes

I would be willing to help work on some of these.

I have a few of these on my to-do list for my game already actually, and I also have a few nearly-finished shaders that are (almost) the same as these, albeit less polished and less configurable at the moment (I have something like electricity and the dissolve, but not exactly like how its implemented in Unity)

I also have all of the code to do things like petrify, bodysheild, ghost, and ice using tri-planar texture projection on a player model ( in my case the code is used for splatting a plagued-slime texture onto any model, but if you change the slime texture to an ice or stone texture and add some bells and whistles, then it should work for ice and petrify effects as well)

Were you thinking of making an individual shader for each of these? Or would it be okay to pack them together into one shader for character models? In my situation, I have a shader called ā€œAfflictedCreaturesā€ which is my catch-all shader for player and NPC models, and I would probably put everything but the healthbars into that single shader (or preferably into seperate .glslib files that any shader can reference), so then all of these cool effects can be used in conjunction without switching the shader.

I can share some screenshots/gifs of what I have so far, but maybe we should start a new thread (or move the last few posts to a new thread if a mod is able to) so I donā€™t derail this thread too much.

1 Like

Hi @yaRnMcDonuts , Iā€™m glad you joined the challenge.
I moved the discussion to a dedicated thread. :wink:

Edit:

Yes, this would be preferable.

Share the pictures, Iā€™m really curious! :wink:

2 Likes

As luck would have it, Iā€™m only just in need of a particle system. I read through the wiki and like what I see, so Iā€™ll give it a go!

2 Likes

If Iā€™m not missing something, it looks like this requires the jME SDK to build? Iā€™m not seeing any build files in the repo that would pull in the dependencies listed on the wiki.

Edit: Just saw @capdevonā€™s fork.