"helper" functions?

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Post Reply
leon
Posts: 0
Joined: Mon Oct 20, 2003 7:14 am

"helper" functions?

Post by leon » Fri Feb 06, 2004 1:54 am

hi all,

still playing around with the source code (just for my own amusement!) and having a play with particles.....

I'm trying to code deflectors - i'm not sure it will ever be a useful solution due to the limited number of particle keys, but it seems to work ok if you have low particle lifetimes.

I've added some code to effect.c and I've got it working to the point where I can "bounce" particles off the x, y or z plane according to the location of a plane. Now I need to calculate actual collisions with planes or faces.

Are there any "helper" functions I can use to calculate things like intersections of lines with planes? If not I can do the maths, but would rather avoid it if I can!!!

Also, are there any functions for getting the location of an object at a particular time? (so I can animate the deflector).

Any help appreciated!

Cheers

Leon

leon
Posts: 0
Joined: Mon Oct 20, 2003 7:14 am

Post by leon » Sat Feb 07, 2004 3:18 pm

ok, well I got it working, sort of!!!

there's a little test animation (1.6mb) here if anyone's interested.

Not sure I'll take it much further, but if anyone wants info on how I've done it, just let me know....

cheers

leon

ilac
Posts: 131
Joined: Mon Oct 14, 2002 8:24 am

Post by ilac » Sat Feb 07, 2004 4:13 pm

That actually looks pretty good! :D

Are there any custom settings or is it all hard-coded? Pity you don't have any plans to take it further, looked like you were on the right path!

leon
Posts: 0
Joined: Mon Oct 20, 2003 7:14 am

Post by leon » Sun Feb 08, 2004 1:43 am

hi ilac,

It is custom settings rather than hard coding: basically I've added two extra settings in the mesh buttons for particle deflection - on or off, and "surface damping" which determines how high the particles bounce.

It works well for deflectors which are fairly large flat surfaces, but not really for anything much more complicated. You need the particle keys at 32 to get nice results too. Another sample here......(sorted out the divx settings, so only 500k this time!!!)

I don't know what would be needed to put this in Tuhopuu, or even whether the coders would want this! It's quite a hack - I'm sure I've done many things I shouldn't and not done lots of things I should! But if someone would like to review the code, please let me know!

Cheers

Leon

theeth
Posts: 500
Joined: Wed Oct 16, 2002 5:47 am
Location: Montreal
Contact:

Post by theeth » Sun Feb 08, 2004 2:14 am

Really neat demo videos!

If you can send a patch to the tuhopuu dev mailing list, I could review the code and see if it can be commited easily (with due credits, of course).

Martin
Life is what happens to you when you're busy making other plans.
- John Lennon

Smerity
Posts: 10
Joined: Wed Mar 19, 2003 10:48 am

Post by Smerity » Sun Feb 08, 2004 3:01 am

Imho leon, you have working code there, and if it fits theeth's specs, and can be put in the tree, then why not submit it? =)
Even if only in its alpha state, the foundations are there and other coders may pick up where you left off, and it may just end up working on super complex arbritary meshes with insane amounts of particles ;)

So, put simply, yes, I'd say the coders want this! ^_^
At the very least, it'll put the idea in coders heads =)

Nice work so far! Too bad you don't want to continue, but don't deny the chance for others to build off ur scaffolding! ^_^
----
if( Smerity_sleepy == 1 ) caffeine(overdose); else code();

leon
Posts: 0
Joined: Mon Oct 20, 2003 7:14 am

Post by leon » Sun Feb 08, 2004 3:03 am

OK, will do!

It might take me some time (since I've been coding in a copy of bf-blender so far), and I need to get tuhopuu compiling via cygwin, then port the code across.

But it's a good thing since it will force me to clean up my code a bit! So I now have something to do today!!!

btw, can anyone tell me how to apply an objects deformation matrix to the vertex co-ordinates? At the moment you have to do a ctrl-a on any deflectors before the particles bounce in the right place....

cheers

leon

theeth
Posts: 500
Joined: Wed Oct 16, 2002 5:47 am
Location: Montreal
Contact:

Post by theeth » Sun Feb 08, 2004 3:48 am

Space.c is where the hotkeys are defined. You can probably trace the Ctrl-A function from there.

All in all, it's a rather basic matrix multiplication. You multiply the local coordinates by the object's transformation matrix to get the global coordinates.

Martin
Life is what happens to you when you're busy making other plans.
- John Lennon

leon
Posts: 0
Joined: Mon Oct 20, 2003 7:14 am

Post by leon » Sun Feb 08, 2004 10:14 am

thanks for that Theeth, you're right, it was simple!!!

OK, I've emailed the patch to tuhopuu-dev@blender.org - let me know if this isn't the right address....

Cheers

Leon

ilac
Posts: 131
Joined: Mon Oct 14, 2002 8:24 am

Post by ilac » Sun Feb 08, 2004 10:54 am

Thanks Leon! I'm sure this will come in handy! :D

If anyone ever doubts that coders are not artists I think we have lots of proof in this community - and I'm not refering to the actual work but the negative attitude some coders have towards their really GOOD work! Typical stereotype artists! :P :wink: :D

theeth
Posts: 500
Joined: Wed Oct 16, 2002 5:47 am
Location: Montreal
Contact:

Post by theeth » Sun Feb 08, 2004 3:40 pm

tuhopuu-dev@blender.org is an unused mailing list. Try tuhopuu-devel@blender.org instead.

Martin
Life is what happens to you when you're busy making other plans.
- John Lennon

leon
Posts: 0
Joined: Mon Oct 20, 2003 7:14 am

Post by leon » Sun Feb 08, 2004 4:08 pm

ok, I've sent it, let me know if it doesn't get there....

cheers

leon

poutsa
Posts: 0
Joined: Sat Jan 03, 2004 4:49 pm
Location: Munich (Germany)

Deflectror Lines Helpers in Blenders Particles System!!!

Post by poutsa » Tue Feb 10, 2004 11:16 pm

Thats Great, isee the Animations (Dvx) thats look very good,
The Deflectors Lines(helpers) like in the Particle Illusion 3.0 from Wondertouch!!
I hope this additional Featurefor Blenders Particle System comes one day in the Official Version of Blender maybe 2.34...2.35 very fast.
I wrote some articles about the Deflector Lines in the Forum to the Coders to do something like this and now THATS REALITY!!!
I am very happy about this..and Thanks Guys for this Development speed.
I work with 3ds max5.1 and i use Blender 95 % and max only 5%...because i like the art and the GUI and all in Blender...!!!


Thanks again.!!by by

Vassilios

leon
Posts: 0
Joined: Mon Oct 20, 2003 7:14 am

Post by leon » Wed Feb 11, 2004 9:44 am

Theeth - I've sent another patch to the devel mail list - it replaces the old patch... (a few improvements to the particle leak problem).

If you've already done something with the original patch, ignore the new one and I'll make the changes later though.

Poutsa - thanks, but don't get too excited yet! it's all quite experimental!

cheers

leon

levon
Posts: 0
Joined: Thu Jul 31, 2003 6:06 am
Location: adelaide

Post by levon » Wed Feb 11, 2004 1:56 pm

wow i love experimental, is it in thopuu yet or will it bee soon?


i hope someone picks this up, it would be a great addition to blender.

Post Reply