Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3509 Members - Latest Member: lioneltenel

27. May 2012, 12:31:29 am
Xith3D CommunityGeneral CategoryFeature Requests & Brilliant Ideas (Moderators: Marvin Fröhlich, 'n ddrylliog)Particle Implementation
Pages: [1] 2
Print
Author Topic: Particle Implementation  (Read 5053 times)
kukanani
Fierce Warrior
****
Offline Offline

Posts: 504


My game is coming along fairly smoothly...


View Profile WWW
« on: 05. September 2007, 08:59:39 pm »

We really ought to port one of the particle systems to Xith offically.  I can try it...would that be JCD's, or the other one?
Logged

xith.setCoolnessLevel(10);
jMe.setCoolnessLevel(0);
xith.rock();
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 05. September 2007, 09:02:28 pm »

We really ought to port one of the particle systems to Xith offically.  I can try it...would that be JCD's, or the other one?

Never mind. guilhermegrg has created a much better PS. And we're almost ready with the Xith integration.
I will commit the (alpha) integration code in an hour or so.

Marvin
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #2 on: 05. September 2007, 11:37:38 pm »

I have committed the Xith3D JOPS implementation. Have a look at the testcase in org.xith3d.test.particles.

Creditds for the PS fully go to guilhermegrg.

Marvin

PS: Please keep in mind, that this implementation is ALPHA. Things may change here and there.
Logged
guilhermegrg
Enjoying the stay
*
Offline Offline

Posts: 88


View Profile Email
« Reply #3 on: 06. September 2007, 01:30:07 pm »

I'm still changing a few things in the XML file format that will most certainly break compatibility with the current file format, it's just way too hard to convert the examples.

On the  plus side it will be more readable, so that  in the future, other ppl can create their own PS system and still read from this file format more easily.

So don't start creating crazy effects with the editor just yet...just test the ones that are already done.

There is also 2 more things I'd like to do with the PS which i think its possible but we'll just have to wait and see.  Wink

I would like to thank Marvin for all the help, not only in the integration code but also for ordering my PS and Editor Code in sourceforge.

Expect an official release sometime in the next few weeks, with a few code examples, plus some preliminary documentation.

In the meanwhile please do try it and give us some feedback on it.

On a quick notice, there are a couple of bugs that we are aware of.

I'll soon post some short clips of some simple examples of the JOPS running in Xith3D.
« Last Edit: 06. September 2007, 01:40:24 pm by guilhermegrg » Logged
guilhermegrg
Enjoying the stay
*
Offline Offline

Posts: 88


View Profile Email
« Reply #4 on: 06. September 2007, 01:56:31 pm »

A quick explanation :
Particle Systems in Relative nodes work as if they are static, but translated and rotated as the nodes that contain them. Their particle's position do not convey their real space position.
Do not use for collision purposes.

Particle Systems in Absolute nodes are affected by their translation and rotation, and their particle's position is absolute in relation to the root node. Can be used for collision calculations.

The movements and rotations in these clips is done by Xith3D's scenegraph nodes. The PS's react accordingly.

Also, it's much smoother in real time than what appears in these captures.

A Candle rotating and moving in relative and absolute nodes.
http://softmed.org/downloads/oneCandleRelative.avi
http://softmed.org/downloads/oneCandleAbsolute.avi

9 Candles rotating and moving in relative and absolute nodes.
http://softmed.org/downloads/9CandlesRelative.avi
http://softmed.org/downloads/9CandlesAbsolute.avi

A gravitational orbiting effect rotating and moving in relative and absolute nodes.
http://softmed.org/downloads/gravCenterLeftRotateRelative.avi
http://softmed.org/downloads/gravCenterLeftRotateAbsolute.avi

the same orbiting effect now rotating around the Y axis in relative and absolute nodes.
http://softmed.org/downloads/gravCenterYRotateRelative.avi
http://softmed.org/downloads/gravCenterYRotateAbsolute.avi

A pentagram rotating and moving in relative and absolute nodes.
http://softmed.org/downloads/pentagramRelative.avi
http://softmed.org/downloads/pentagramAbsolute.avi

this is a stationary smoke column being affected by another PS that is moving in the scenegraph. This other PS contains a repulsive PointMass.
http://softmed.org/downloads/smoke.avi


« Last Edit: 06. September 2007, 02:00:04 pm by guilhermegrg » Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #5 on: 06. September 2007, 05:15:10 pm »

Some thoughts on improving the PS API:

Is it possible to say, that a certain PS type is always a relative one or an absolute one? If yes, this should be noted in the XML file, which would make the following API possible:
Code:
ParticleSystem ps = ParticleSystemFactory.load( bla, sceneBranch );
// optionally, if relative:
myGroup.add( ps );

This would manage all of the PS'es tasks like creating the right PS node (absolute, relative), adding absolute nodes to the BranchGroup, etc. If this is possible, we would simplify the API a lot.

Marvin
Logged
kukanani
Fierce Warrior
****
Offline Offline

Posts: 504


My game is coming along fairly smoothly...


View Profile WWW
« Reply #6 on: 06. September 2007, 05:42:51 pm »

I get some errors when updating the PS (see image). I know that the warnings have to do with my project settings, but the errors... Huh

I'm going to commit fixes in a sec, 'kay?
Logged

xith.setCoolnessLevel(10);
jMe.setCoolnessLevel(0);
xith.rock();
kukanani
Fierce Warrior
****
Offline Offline

Posts: 504


My game is coming along fairly smoothly...


View Profile WWW
« Reply #7 on: 06. September 2007, 06:01:53 pm »

I have fixed and committed all but two of the errors: The setLocation() and setRotation() ones. How do I fix these?

Additionally, I get this when trying to run the ParticleSystemTest:

Exception in thread "main" java.lang.Exception: java.lang.NoSuchMethodError: particle.ParticleManager.loadFile(Ljava/io/File;)Ljava/lang/String;
   at org.xith3d.test.particles.ParticleSystemTest.loadParticleSystemHandle(ParticleSystemTest.java:255)
   at org.xith3d.test.particles.ParticleSystemTest.loadParticleSystemHandle(ParticleSystemTest.java:270)
   at org.xith3d.test.particles.ParticleSystemTest.initParticleSystem(ParticleSystemTest.java:284)
   at org.xith3d.test.particles.ParticleSystemTest.<init>(ParticleSystemTest.java:321)
   at org.xith3d.test.particles.ParticleSystemTest.main(ParticleSystemTest.java:345)
Caused by: java.lang.NoSuchMethodError: particle.ParticleManager.loadFile(Ljava/io/File;)Ljava/lang/String;
   at org.xith3d.test.particles.ParticleSystemTest.loadParticleSystemHandle(ParticleSystemTest.java:248)
   ... 4 more
Logged

xith.setCoolnessLevel(10);
jMe.setCoolnessLevel(0);
xith.rock();
guilhermegrg
Enjoying the stay
*
Offline Offline

Posts: 88


View Profile Email
« Reply #8 on: 06. September 2007, 07:08:44 pm »

hi i just got back. I'm going to check that test out.
Logged
guilhermegrg
Enjoying the stay
*
Offline Offline

Posts: 88


View Profile Email
« Reply #9 on: 06. September 2007, 07:21:18 pm »

About saving the PS as absolute and relative in the file format : yes its possible, but...

I don't think it should be done. For a simple reason. The decision of using a PS as relative or absolute node will come down to artistic and practical questions.

You do have a valid point, but also imagine this : i've just built a PS in the editor, and save it as an absolute PS.

I load it in the Scenegraph, and test it out. It doesn't look so hot, so i decide i want to us it as a relative one.

If its saved in the file, that means I'll have to change it in the editor and save it again.
Where as in the code i just change from an absolute node to a relative one.

I don't think that the PS file should have details that are concerned about now their are used in a scenegraph.

In a practical sense, an engine should script how things are done : like a script for when a player shoots a gun , and it could be written in groovy saying that it should play this sound, and create a moving node with this 3D model , and also this PS in absolute mode, etc.

If you want to change the effect, just change the script, change from and absolute to a relative node, change the 3d model, etc.

With that said, I would like to know the opinion of other ppl about this issue. It's not written in stone, it's my point of view. If needed, I'll make the change to the API.

What about:
Code:
ParticleSystem ps = ParticleSystemFactory.loadAbsolute( bla, sceneBranch );

ParticleSystem ps = ParticleSystemFactory.loadRelative( bla, sceneBranch );

or

Code:
ParticleSystem ps = ParticleSystemFactory.load( bla, sceneBranch, true );

where the third argument specifies wether you want it in an absolute or relative node ?


« Last Edit: 06. September 2007, 07:29:29 pm by guilhermegrg » Logged
guilhermegrg
Enjoying the stay
*
Offline Offline

Posts: 88


View Profile Email
« Reply #10 on: 06. September 2007, 08:14:24 pm »

The bat/sh files are missing the loading of the jops.jar file as well as the jixb.jar neede to load Particle system files.

you'll need to add:

%THIRD%\particles\jops.jar;%THIRD%\jibx\jibx-run.jar;

to the classpath in the bat/sh files.
Also, copy the JIBX folder in the xith3d-th third party  to the demo's third party folder.
you'll need the jibx-run.jar.

Even so this won't work, because there is an error in the org.xith3d.test.particles.ParticleSystemTest.

I get a :
java.lang.IllegalArgumentException: URI is not hierarquical at java.io.File.<init>(Unknown Source)
at org.xith3d.test.particles.ParticleSystemTest.loadParticleSystemHandle (ParticleSystemTest.java:243)

Also one more problem in the bat/sh file : where it says: %LIBS%\xith-tk.jar it should say
%LIBS%\xith3d-tk.jar because that's what the correct name for the jar file of xith3d-tk.

If anyone can fix the error in the ParticleSystemTest, please go ahead.
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #11 on: 06. September 2007, 09:17:03 pm »

I like this one:

What about:
Code:
ParticleSystem ps = ParticleSystemFactory.loadAbsolute( bla, sceneBranch );

ParticleSystem ps = ParticleSystemFactory.loadRelative( bla, sceneBranch );

Even so this won't work, because there is an error in the org.xith3d.test.particles.ParticleSystemTest.

I get a :
java.lang.IllegalArgumentException: URI is not hierarquical at java.io.File.<init>(Unknown Source)
at org.xith3d.test.particles.ParticleSystemTest.loadParticleSystemHandle (ParticleSystemTest.java:243)

This is because there is no URL loading support so far. So you can't load from a jar. When this is added, the error will be gone, too.

Also one more problem in the bat/sh file : where it says: %LIBS%\xith-tk.jar it should say
%LIBS%\xith3d-tk.jar because that's what the correct name for the jar file of xith3d-tk.

If anyone can fix the error in the ParticleSystemTest, please go ahead.

No, the jar name is xith-tk.jar.

Marvin
Logged
guilhermegrg
Enjoying the stay
*
Offline Offline

Posts: 88


View Profile Email
« Reply #12 on: 06. September 2007, 09:57:24 pm »

Ok I'll start working on the URL loading then.

About the xith-tk, you're right, the jar is called xith-tk if built using the xith-tk.jardesc.

As I used the build.xml for ant, it produced a jars folder with the xith3d-tk.jar in it. So i guess the build.xml file from the xith-tk project should be changed then to maintain consistency.
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #13 on: 06. September 2007, 10:12:02 pm »

I have fixed and committed all but two of the errors: The setLocation() and setRotation() ones. How do I fix these?

Additionally, I get this when trying to run the ParticleSystemTest:

Exception in thread "main" java.lang.Exception: java.lang.NoSuchMethodError: particle.ParticleManager.loadFile(Ljava/io/File;)Ljava/lang/String;
   at org.xith3d.test.particles.ParticleSystemTest.loadParticleSystemHandle(ParticleSystemTest.java:255)
   at org.xith3d.test.particles.ParticleSystemTest.loadParticleSystemHandle(ParticleSystemTest.java:270)
   at org.xith3d.test.particles.ParticleSystemTest.initParticleSystem(ParticleSystemTest.java:284)
   at org.xith3d.test.particles.ParticleSystemTest.<init>(ParticleSystemTest.java:321)
   at org.xith3d.test.particles.ParticleSystemTest.main(ParticleSystemTest.java:345)
Caused by: java.lang.NoSuchMethodError: particle.ParticleManager.loadFile(Ljava/io/File;)Ljava/lang/String;
   at org.xith3d.test.particles.ParticleSystemTest.loadParticleSystemHandle(ParticleSystemTest.java:248)
   ... 4 more

I have reverted these changes as well as the joal sound impl changes. The jops code was fine without the changes. And the joal changes even produced errors. I guess you have some outdated jars in your workspace. Please check that. And please ask next time before doing such changes.

About the xith-tk, you're right, the jar is called xith-tk if built using the xith-tk.jardesc.

As I used the build.xml for ant, it produced a jars folder with the xith3d-tk.jar in it. So i guess the build.xml file from the xith-tk project should be changed then to maintain consistency.

Hmm. yeah. It should be changed. Didn't know about this name inconsistency.

Marvin
Logged
kukanani
Fierce Warrior
****
Offline Offline

Posts: 504


My game is coming along fairly smoothly...


View Profile WWW
« Reply #14 on: 07. September 2007, 04:32:11 am »

Oh wow, sorry about the commit.  I was trying to help, but I guess I goofed, yet again.  Ugh.  I really need to start thinking things through  Undecided.

I wonder which JARs I have to update? I'm using Eclipse Europa (the newest one, AFAIK).
Logged

xith.setCoolnessLevel(10);
jMe.setCoolnessLevel(0);
xith.rock();
Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic