[2.3] Using custom renderables in Ogre's particle system

Problems building or running the engine, queries about how to use features etc.
Post Reply
Nucleartree
Kobold
Posts: 28
Joined: Tue Apr 04, 2017 9:10 pm
Location: Cardiff, UK
x 16

[2.3] Using custom renderables in Ogre's particle system

Post by Nucleartree »

Hi everyone.

I'm writing a game which uses a voxel art style. As a result, everything is pretty square. I'd like to incorporate some particles into what I have right now but would like to try particles which are shaped like cubes, rather than billboards. I'm trying to work out what's required for this. I've worked out that Ogre provides a OgreParticleSystemRenderer.h which can be used to render something custom. In the case of billboards it mostly uses the OgreBillboardSet class to do most of the heavy lifting.

I don't have too much time to spend on this so if it seems it's going to be a big job then I'd rather just skip some of this and animate my particles using scene nodes (doubt there will be that many of them anyway, but performance is on my mind none the less).

Has anyone attempted this before and has some code they'd be willing to share to get started with? I know the ParticleUniverse plugin provided meshes for particles but I'm using Ogre's built in system.

rpgplayerrobin
Gnoll
Posts: 617
Joined: Wed Mar 18, 2009 3:03 am
x 353

Re: [2.3] Using custom renderables in Ogre's particle system

Post by rpgplayerrobin »

It should be very possible if you make a new BillboardSet, BillboardParticleRenderer and BillboardSetFactory.

Check this post of mine explaining how to do that first: viewtopic.php?p=552363&hilit=addRendererFactory#p552363

When you have that code ready, you can alter all code needed in the BillboardSet (more specifically the functions injectBillboard, genQuadVertices, _createBuffers and a few others) to probably be able to render cubes instead.

You could also just skip rendering cubes and instead have the particles as they are (quads) but fake them being cubes by using math or normal maps for each particle.
I am not sure exactly what your application requires of them, but if the cubes are always facing the same orientation (but they could rotate around Z of course) you could just fake the lighting of them like I do for my spherical particles in my game. But it might just be easier to do real cubes instead and it would also have more features (like full real lighting and full rotation) than faked cubes.

Nucleartree
Kobold
Posts: 28
Joined: Tue Apr 04, 2017 9:10 pm
Location: Cardiff, UK
x 16

Re: [2.3] Using custom renderables in Ogre's particle system

Post by Nucleartree »

Thanks very much for that. That link especially will be very helpful!

For the short term think I'll have to prototype what I need with scene nodes as I still don't really know what I want it to look like, but when I come to optimise the game I'll have a proper go at getting this working.

Post Reply