Game Development Community

dev|Pro Game Development Curriculum

Adding animated particles and animated shaders to Torque

by Lukas Joergensen · 05/14/2012 (12:13 am) · 8 comments

Edit: For the newest updates on this look Here
So, this is kind of a heads up as i suspect a lot of people haven't discovered the amazing Twillex engine written by Charlie Patterson Link.

This Twillex engine was primarily made for Torque2D and iTorque2D. But it is written purely in script so it integrated into Torque3D as well without any problems really!
So i thought, besides GUI and positions etc how could you use this resource to create something a little more.. Spicy.

My first thought was to create swirling emitters on projectiles, but due to the way projectiles are handled this is not possible without source edit. So as i began to work with shaders i thought, this could be nice for creating animated shaders!

The result:

Note: i did make some changes to the Twillex engine so this wont work out of the box (Read comments in the resource to see the changes)

Then i thought hmm what more can this resource be used for?
I decided to create animated particle emitters which is really easy with the twillex engine:

The result:

Now as this was very interesting, i realised that you can only apply these changes to the datablock, so it would change all the particle emitters using said datablock. So even tho this does work out of the box, it isn't working if you need several independently animated emitters! I had to make some code changes to cover this but it is now working as it should!
(I will include these changes into a resource at some point)

Now i've run out of ideas!
Does anyone else see some uses for this Twillex engine?
I would love to look at your ideas and creating some proof of concept!
Also if you have any idea to some particle effects or shader you think would be cool just post it here!

I created an effect i call 'Voidsphere' (might be changed later tho >.<) Which creates a dark sphere over a location, and then it crashes down damaging any target standing there! It will be a part of an advanced spell system later and i will post a video of it in this blog when i get around to do it! It is a great showcase of how this can be used for spells in game!

Edit: Oh yeah i thought i would stress out how easy it is to animate a particleEmitter using Twillex!
The particles in the above example was animated with 6 lines of code:
$p1 = MyTweenEngine.to(4000, testEmitter.emitter, "phiVariance:360", "");
$p2 = MyTweenEngine.to(5000, testEmitter.emitter, "ejectionOffset:0", "");
$p3 = MyTweenEngine.to(2000, testEmitter.emitter, "ejectionVelocity:2", "");

$p1.tweenData.onComplete = "$p2.play";
$p2.tweenData.onComplete = "$p3.play";
$p1.play(); // call this to start the animation

#1
05/14/2012 (4:41 am)
I would be interested in seeing the animated particle resource when you get around to that.
#2
05/14/2012 (4:46 am)
I'll have it up in the next couple of days! I expect to get some time on my hands from tomorrow of so it isn't so far away.
#3
05/14/2012 (8:31 am)
Could the animated particles be rain falling on a background? It does sound interesting.
#4
05/14/2012 (8:39 am)
A showcase of the voidSphere spell ( proof of concept ).
An example of how this could be used in-game for spells!

This spell will be included in the advanced spell system resource i will write in the near future!

A voidimplosion spell, basically the same with just one minor change in the code:


Especially note how the emitters is acting independently to each other, they are not bound to the values in the datablock.

@Kory Not sure what you mean? I believe rain would be done through precipitation :)
#5
05/14/2012 (4:13 pm)
Released a resource covering how to make these changes to the Torque engine:
Advanced spell system
Please go have fun with it!
#6
05/17/2012 (1:15 pm)
the shader example is beautiful and with the animated particles...you could easily get into psychedelic Jeff Minter territory (llamaspells?). nice work!

Now, If anyone asks why I'm reading about twillex:
http://www.youtube.com/watch?v=ObzTnCcesK4
#7
05/19/2012 (9:26 am)
HAHA @Patrick that video took me by surprise!

If you are interested in particle effects I believe you would love my current project! As soon as I figure out how to get rid of these error C2838 i will have a really nice particle system resource in the works! :

BTW if anyone know a bit about c++ please check out my inquiry for help here: http://www.garagegames.com/community/forums/viewthread/130577
Really can't figure out how to get rid of that bug! :/
#8
05/22/2012 (12:43 pm)
I can't wait to hear what that is.

The first stuff I actually got my head around in torque was particles. I used to program granular sound stuff and it's essentially musical particles...hopefully I can figure a way to tie individual tiny sound files of around 30 msecs to particle generation and make procedural sound clouds based on the generator's settings. IE adaptive musical jets. given the 3d sound placement and doppler effects of openal you could get some really wild sounds with only very small audio sprites and a little more cpu. I guess you would call it quasi procedural ambient audio? lol.

sorry about the slow response was in analogue design land for the last few days. thanks for sparking some crazy ideas.