Spheres, spheres it's all spheres!
by Lukas Joergensen · 05/19/2012 (12:53 pm) · 21 comments
One of the most frustrating things about the Torque3D engine from my perspective is that the particle system seems to only support spheres or sphere based emitters!
This makes it hard to create special emitters!
I have already made some work on improving the particle system in Torque 3D using the Twillex resource by Charlie Patterson. This gave me some nice particle effects like the voidSphere particle:
But i want more, even tho the particles can be animated with my resource now.
It is still spheres! So i thought, how can i extend the particle system, making it so customizeable that everyone can use it to make everything they want?
Function based emitters!
I made a very basic proof of concept video:
This is basically a particleEmitter with the function:
x=t
y=t
z=t
I hope to make some more advanced function and post them here soon!
Todo list:
I ended up using muParser by Ingo Berg to parse the expressions. (Released under MIT license)
To make the particleEmitter move like that sine curve in the video above i simply set 5 variables in my code:
Current issues is:
The t value is based on how many particles have been emitted. Causing it to reach funcMax fast on particleEmitter which spawns alot of particles and slowly on emitters with few particles, i need a general solution on this.
Cannot be edited from script yet.
It is really satisfying to work with this improved particle system! Everything is easier and it is so simple to make some really impressive effects!
Here is a video with 3 effects and a showcase of in script editing:
This makes it hard to create special emitters!
I have already made some work on improving the particle system in Torque 3D using the Twillex resource by Charlie Patterson. This gave me some nice particle effects like the voidSphere particle:
But i want more, even tho the particles can be animated with my resource now.
It is still spheres! So i thought, how can i extend the particle system, making it so customizeable that everyone can use it to make everything they want?
Function based emitters!
I made a very basic proof of concept video:
This is basically a particleEmitter with the function:
x=t
y=t
z=t
I hope to make some more advanced function and post them here soon!
Todo list:
- Make all the variables completely accessable from script
- Make composed expressions!
- Make an expression parser so you would set the function for x to something like "2t^2*sqrt(2t)+4"
- Expression variables editable from script
- Intervals
Update
Been working on this for quite a while now and the basic functions is working!I ended up using muParser by Ingo Berg to parse the expressions. (Released under MIT license)
To make the particleEmitter move like that sine curve in the video above i simply set 5 variables in my code:
xFunc = "5-sin(t/1000)*10"; yFunc = "t"; zFunc = "5+sin(t/100)*2"; funcMax = 200000; funcMin = 0;The constants are for properly offsetting the particles from the ground.
Current issues is:
The t value is based on how many particles have been emitted. Causing it to reach funcMax fast on particleEmitter which spawns alot of particles and slowly on emitters with few particles, i need a general solution on this.
Cannot be edited from script yet.
Another update
Damn... I can make so many effects with this, so easily! I wish i could show them all to you!It is really satisfying to work with this improved particle system! Everything is easier and it is so simple to make some really impressive effects!
Here is a video with 3 effects and a showcase of in script editing:
/**Waves: x = cos(t)*t*0.02 y = sin(t)*t*0.02 z = 0 Square spiral: x = cos(t/50)*t*0.02 y = sin(t)*t*0.02 z = 0 Spiral: x = cos(t/50)*t*0.02 y = sin(t/50)*t*0.02 z = 0 3D spiral (not shown): x = cos(t/50)*t*0.02 y = sin(t/50)*t*0.02 z = t*0.02 **/
About the author
IPS Bundle available at: https://www.winterleafentertainment.com/Products/IPS.aspx
#2
Therefore the function defining that example would look like:
x=t
y=t
z=t
I am currently recording and uploading a video of a sine curve to further show the concept!
Edit:
You can see the sine curve in the blog post now!
Oh btw the emitters is object space (an expression evaluating to zero will cause the particles to spawn at the center of the particleEmitter)
Spiraling around the z-coordinate is highly possible yes! :)
05/19/2012 (4:04 pm)
Yes it looks like it is spherical! But in fact it stays in the same spot ( approximately where i am looking, and the particles' coordinates is set by an increasing t value.Therefore the function defining that example would look like:
x=t
y=t
z=t
I am currently recording and uploading a video of a sine curve to further show the concept!
Edit:
You can see the sine curve in the blog post now!
Oh btw the emitters is object space (an expression evaluating to zero will cause the particles to spawn at the center of the particleEmitter)
Spiraling around the z-coordinate is highly possible yes! :)
#3
One way you could have it done in script is have a script callback you set against the object. Then you could coordinate emitters with a common callback if desired. Only use the callback if it is set in script. I think you can call something against an object like: isMethod (C++) or something to determine if the user defined the method (TS).
05/19/2012 (4:55 pm)
Ahh, very cool! This is a nice addition! Combine some of the gravity affects and it could be very interesting indeed! One way you could have it done in script is have a script callback you set against the object. Then you could coordinate emitters with a common callback if desired. Only use the callback if it is set in script. I think you can call something against an object like: isMethod (C++) or something to determine if the user defined the method (TS).
#4
Taking a break for now, if you have any suggestions for this system please do come with some input! It is easier to add now than later!
And all of this will be released as a free resource when it is ready so don't worry about that!
05/19/2012 (5:31 pm)
@Frank i believe gravity would affect the particles, they are spawned just like normal particles i have only edited the position at which they are spawned :)Taking a break for now, if you have any suggestions for this system please do come with some input! It is easier to add now than later!
And all of this will be released as a free resource when it is ready so don't worry about that!
#5
05/19/2012 (6:52 pm)
Oh, I know the gravity already works. This just adds another dimension of control. This is just awesomeness.
#6
When can I buy it?
05/19/2012 (9:14 pm)
Wow this is so cool! At first I thought that you'd merely animated the emitter but it was still ejecting particles from the emitter outward. Thus, spherically. Now I see that the emitter hadn't moved at all. Well done Lukas.When can I buy it?
#7
i do not have AFX add on.but i have seen something like that on show off videos of AFX.it is really encouraging to see something like that with this resource.
never was fond of graph.almost forgot everything.but after reading about that parser and that video,i will start again.promise,this time i will be a good student
can not wait for the resource.
very very nice work.
05/19/2012 (9:39 pm)
ohh,last video is mind blowing.using those curve equation!!!!i do not have AFX add on.but i have seen something like that on show off videos of AFX.it is really encouraging to see something like that with this resource.
never was fond of graph.almost forgot everything.but after reading about that parser and that video,i will start again.promise,this time i will be a good student
can not wait for the resource.
very very nice work.
#8
Missed that bit. I'd still buy this as a kit if you included some particles and example scripts. Something to consider at least.
Edit: Unless this is too close to Charlie Patterson's resource as to legitimise selling it, of course.
05/19/2012 (10:53 pm)
"And all of this will be released as a free resource when it is ready so don't worry about that!"Missed that bit. I'd still buy this as a kit if you included some particles and example scripts. Something to consider at least.
Edit: Unless this is too close to Charlie Patterson's resource as to legitimise selling it, of course.
#9
And i might include some particles and example scripts but it will still be free! No need to be so greedy!
Theres some reasons to why i release this for free.
First of, this doesn't even compare to the AFX, the AFX is a very sophisticated tool and i believe it would be able to do stuff like this fairly easy, so i don't wanna compete with AFX.
Besides i made this like a resource for people who don't need all the features of AFX, or can't afford it (like students like me)
And the biggest reason is of course that this community has given me so much, i believe it would be fitting to give something back!
05/20/2012 (12:11 am)
@Dan, actually i haven't implemented Charlie Pattersons resource into this system yet!And i might include some particles and example scripts but it will still be free! No need to be so greedy!
Theres some reasons to why i release this for free.
First of, this doesn't even compare to the AFX, the AFX is a very sophisticated tool and i believe it would be able to do stuff like this fairly easy, so i don't wanna compete with AFX.
Besides i made this like a resource for people who don't need all the features of AFX, or can't afford it (like students like me)
And the biggest reason is of course that this community has given me so much, i believe it would be fitting to give something back!
#10
Edit: the video of course (still uploading)
Was a bug tho so it wont be a feature, fixed it now so now you can actually have the expression based emitters with the spherical form!
The expression based emitter defines the center of the spherical form now so it is possible to manipulate the emitters even more.
05/20/2012 (1:03 am)
I made this video to show you how theta and phi could influence the expression based emitter.Edit: the video of course (still uploading)
Was a bug tho so it wont be a feature, fixed it now so now you can actually have the expression based emitters with the spherical form!
The expression based emitter defines the center of the spherical form now so it is possible to manipulate the emitters even more.
#11
a) Follow a namingpattern and have unlimited variables?
Something like specifying a dynamic variable called: "var1=a|2.0"
Var1 specifies that it is a new variable, the left side of | is the token and the right side is the value.
b) Have a set amount of static variables named using the token?
Something like: "a=2.0"
c) Have a set amount of dynamic variables?
Much like a)
Edit: oh yeah
I haven't made up my mind on the t value yet. Right now it is based on the amount of particles emitted.
Any wishes on this part? I think i will make it free to choose between the different methods of calculating t
Edit edit: Didn't really explain this enough..
You can have something like 10 variables in the inspector called a, b, c, d etc.. these are statics.
Or you could add them via Dynamic Fields, these are dynamic variables. Which do you prefer?
05/20/2012 (1:30 am)
A question to anyone interested in this. If you want dynamic variables, would you rather:a) Follow a namingpattern and have unlimited variables?
Something like specifying a dynamic variable called: "var1=a|2.0"
Var1 specifies that it is a new variable, the left side of | is the token and the right side is the value.
b) Have a set amount of static variables named using the token?
Something like: "a=2.0"
c) Have a set amount of dynamic variables?
Much like a)
Edit: oh yeah
I haven't made up my mind on the t value yet. Right now it is based on the amount of particles emitted.
Any wishes on this part? I think i will make it free to choose between the different methods of calculating t
Edit edit: Didn't really explain this enough..
You can have something like 10 variables in the inspector called a, b, c, d etc.. these are statics.
Or you could add them via Dynamic Fields, these are dynamic variables. Which do you prefer?
#12
05/20/2012 (1:14 pm)
If there is any way this could be setup to work with a callback you could do some awesome things. For instance you could make it so the particles are attracted to an object that can be at another location and could be moving. Then when the particle callback runs it can check the location of the object it is attracted to and update its interpolation to adjust toward that object. Or it could be the closest object, etc.
#13
Although, i might look into it when this project is finished! Still polishing it tho :)
05/20/2012 (1:28 pm)
@Frank now that would be something closer to particle physics! Unfortunately, the code i have written doesn't even touch the particles after they have been emitted. It is very possible to modify this code to emit the particles closer and closer to a point, but to move the particles after they have been emitted is another story.Although, i might look into it when this project is finished! Still polishing it tho :)
#14
05/20/2012 (1:46 pm)
Oh okay. I guess when I see the code it will make more sense.
#15
05/20/2012 (1:48 pm)
this is awesome!
#16
05/20/2012 (2:14 pm)
Yes this is very very cool stuff
#17
Now that no one will answer my questions I will just solve the issues as they suit me best! :)
My progress so far:
Have been stuck with some networking issues, leaving it for now ( the world editor is still not working properly but it works fine for now! Doubt it can be any better without too much time spent on it ) Some minor fixes and i will start writing the documentation!
Delaying the dynamic variables for now. Will be implemented later.
05/20/2012 (4:12 pm)
**Update**Now that no one will answer my questions I will just solve the issues as they suit me best! :)
My progress so far:
Have been stuck with some networking issues, leaving it for now ( the world editor is still not working properly but it works fine for now! Doubt it can be any better without too much time spent on it ) Some minor fixes and i will start writing the documentation!
Delaying the dynamic variables for now. Will be implemented later.
#18
@Lucas - Awesome news!
Edit: Oh, and for the questions above, I have only an answer/request for the first one. The answer is A.
05/20/2012 (4:15 pm)
You know what else this'd be perfect for? Plasma weapons. Not the Fallout style weapon that throws plasma at you along a vector, but the crazy Ghostbusters plasma weapons. The ones that arc all over the place. Hmmm... on second thought that might not work.@Lucas - Awesome news!
Edit: Oh, and for the questions above, I have only an answer/request for the first one. The answer is A.
#19
Sometimes you just gotta give it your best shot and let others comment when they have had a chance to use the code. Then they are better able to comment or provide code back for improvements.
05/20/2012 (6:24 pm)
@Lukas,Sometimes you just gotta give it your best shot and let others comment when they have had a chance to use the code. Then they are better able to comment or provide code back for improvements.

Torque Owner Demolishun
DemolishunConsulting Rocks!
Also, I see that the particle emitter still is spherical, it just looks like you change the position of the emitter? Or am I completely missing what you are trying to show us. Maybe a glimpse at the math would help me understand.
Good work!