SPARK open-source advanced particle engine

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Darktib
Posts: 167
Joined: Sun Mar 23, 2008 8:25 pm
Location: France

Post by Darktib »

The project settings are not set up properly to compile, even for the SPARK engine. Only 4 of the projects compile as they are
Weird... What are the outputted errors ? Did you try the Code::Blocks projects (if you have Code::Blocks installed).

And for Irrlicht : If you want to compile the Irrlicht example, you have to manually say to the linker where Irrlicht libs are - but you already know that I think
Even though I can get the BasicDemo compiled along with some other demos, they exit the application right away, nothing happens
You mean, the precompiled binaries crash directly ? You could try to launch them by command line, ie start cmd.exe, cd to the path where SPARK is, and launch demos. Maybe there will be some helpful output.

Which version of SPARK are you using ? I advise you to use the SVN version here, because all packages located on the website are outdated...
https://sparkengine.svn.sourceforge.net ... ine/trunk/
Ulf
Posts: 281
Joined: Mon Jun 15, 2009 8:53 am
Location: Australia

Post by Ulf »

I updated to the latest svn version and I fixed the project settings so that all the engine and demo projects compile in debug mode, except for the DXUT9 projects so far. (using msvc2008)
The release versions of any demo using the FTGL library will not compile as it says the FTGL lib file was created with an older version compiler and requests a newer version. So I downloaded FTGL and FreeType to compile it.

So far I have most debug versions of the demos compiled and running. But they only run from outside the debugger/compiler.
Even though I can get the BasicDemo compiled along with some other demos, they exit the application right away, nothing happens
You mean, the precompiled binaries crash directly ? You could try to launch them by command line, ie start cmd.exe, cd to the path where SPARK is, and launch demos. Maybe there will be some helpful output.
No I meant "my" compiled (debug) binaries. When I try to run them from the compiler (Visual Studio), they exit right away. I discovered later that the binaries do work if run externally by clicking the file.

Are there any ideas why this could be happening?
I can hear birds chirping
:twisted:

I live in the Eye of Insanity.
Darktib
Posts: 167
Joined: Sun Mar 23, 2008 8:25 pm
Location: France

Post by Darktib »

For DXUT : You need to have the DirectX SDK... It can be downloaded from MS's website, by it is a big sdk (several hundred of megabytes...)

[quote=Ulf]When I try to run them from the compiler (Visual Studio), they exit right away.[/quote]
Does Visual Studio returns the exit code ?

Normally, the code 3 means 'runtime error', maybe it can help... For the rest, I don't know, maybe cleaning the project... but I'm note sure....
Ulf
Posts: 281
Joined: Mon Jun 15, 2009 8:53 am
Location: Australia

Post by Ulf »

Darktib wrote:For DXUT : You need to have the DirectX SDK
Yea I know, I didn't realise at the time but I do have it installed. Thanks anyway.
Darktib wrote:Does Visual Studio returns the exit code ?
Yes 1.
The output is

Code: Select all

'SPARK Demo Basic_debug.exe': Loaded 'F:\Coding\Resources\Irrlicht Community Projects\User Contributions\Juff\sparkengine\demos\bin\SPARK Demo Basic_debug.exe', Binary was not built with debug information.
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\opengl32.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\secur32.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\user32.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\glu32.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\ddraw.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\dciman32.dll'
'SPARK Demo Basic_debug.exe': Loaded 'F:\Coding\Resources\Irrlicht Community Projects\User Contributions\Juff\sparkengine\demos\bin\SDL.dll', Binary was not built with debug information.
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\winmm.dll'
'SPARK Demo Basic_debug.exe': Loaded 'F:\Coding\Resources\Irrlicht Community Projects\User Contributions\Juff\sparkengine\demos\bin\SPARK_debug.dll', Symbols loaded.
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_f863c71f\msvcp90d.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.DebugCRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_f863c71f\msvcr90d.dll'
'SPARK Demo Basic_debug.exe': Loaded 'F:\Coding\Resources\Irrlicht Community Projects\User Contributions\Juff\sparkengine\demos\bin\SPARK_GL_debug.dll', Symbols loaded.
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\imm32.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\lpk.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\usp10.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\ctwdm32.dll'
'SPARK Demo Basic_debug.exe': Unloaded 'C:\WINDOWS\system32\ctwdm32.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\msctf.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\version.dll'
'SPARK Demo Basic_debug.exe': Unloaded 'C:\WINDOWS\system32\version.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\msctfime.ime'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\ole32.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\clbcatq.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\comres.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\oleaut32.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\version.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\kbdus.dll'
'SPARK Demo Basic_debug.exe': Unloaded 'C:\WINDOWS\system32\kbdus.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\kbdus.dll'
'SPARK Demo Basic_debug.exe': Unloaded 'C:\WINDOWS\system32\kbdus.dll'
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\nvoglnt.dll'
The thread 'Win32 Thread' (0x3b4) has exited with code 0 (0x0).
'SPARK Demo Basic_debug.exe': Loaded 'C:\WINDOWS\system32\mcd32.dll'
'SPARK Demo Basic_debug.exe': Unloaded 'C:\WINDOWS\system32\mcd32.dll'
The thread 'Win32 Thread' (0x4d0) has exited with code 1 (0x1).
The program '[3148] SPARK Demo Basic_debug.exe: Native' has exited with code 1 (0x1).
I can hear birds chirping
:twisted:

I live in the Eye of Insanity.
freetimecoder
Posts: 226
Joined: Fri Aug 22, 2008 8:50 pm
Contact:

Post by freetimecoder »

Hi,

I ran a few tests with your great engine, but it seems the spheric emitter does not work as described. I used the code from the IRRBasicDemo. When creating the emitter with the angles 0,0 it goes straight up, when using PI,PI it goes straight right and when using different values e.g. 0,PI it just creates particles with no velocity at all.
I use the precompiled mingw libs on windows xp. What could cause this behaviour?

greetings
Juff
Posts: 18
Joined: Fri Oct 30, 2009 7:53 pm

Post by Juff »

Ulf, Thats strange, I will check the configs setups. Have you tried running the example of the in-development version 2 of spark in debug directly in visual studio ? This should work normally.

freetimecoder, I guess it is because the seed of the pseudo random generator of spark is not correctly set. Do you initialize it in your code ? and if yes, are you using static or dynamic libs ?
Darktib
Posts: 167
Joined: Sun Mar 23, 2008 8:25 pm
Location: France

Post by Darktib »

@freetimecoder : which version of SPARK do you use ? there has been a lot of improvements in the SVN version, I've posted the link before.
If you already use this version, then I cannot help you because I'm not the author of this lib (just the guy who ported it to Irrlicht). But you could find help on this forum: http://spark.forum0.net/forum.htm

@Ulf: Could you post the whole code (I don't know which version of SPARK you have) ?
According to the code, it's neither a C++ exception nor a SEH exception. I've never encountered this code...

For the moment, my best advice is to re-download the svn, recompile the whole lib and demos, if you have not already done this.
freetimecoder
Posts: 226
Joined: Fri Aug 22, 2008 8:50 pm
Contact:

Post by freetimecoder »

I used the latest precompiled download. I have now compiled the svn version, but it does not change anything.

Here is the code I use:

Code: Select all

	SPK::System::setClampStep(true,0.1f);
	SPK::System::useAdaptiveStep(0.01f,0.01f);
	SPK::Vector3D gravity(0.0f,-0.8f,0.0f);

	SPK::IRR::IRRQuadRenderer* particleRenderer = SPK::IRR::IRRQuadRenderer::create(device);
	articleRenderer->setTexture(driver->getTexture("data/flare.bmp"));
	particleRenderer->setTexturingMode(SPK::TEXTURE_2D);
	particleRenderer->setScale(0.05f,0.05f);
	particleRenderer->setBlending(SPK::BLENDING_ADD);
	particleRenderer->enableRenderingHint(SPK::DEPTH_WRITE,false);

	// Model
	SPK::Model* particleModel = SPK::Model::create(SPK::FLAG_RED | SPK::FLAG_GREEN | SPK::FLAG_BLUE | SPK::FLAG_ALPHA);
	particleModel->setParam(SPK::PARAM_ALPHA,0.8f);
	particleModel->setLifeTime(8.0f,8.0f);

	// Emitter
    float PI = 3.14159265358979323846f;
	SPK::SphericEmitter *particleEmitter = SPK::SphericEmitter::create(SPK::Vector3D(0.0f,1.0f,0.0f),0,PI);
	particleEmitter->setZone(SPK::Point::create(SPK::Vector3D(0.0f,0.02f,0.0f)));
	particleEmitter->setFlow(250);
	particleEmitter->setForce(1.5f,1.5f);

	// Group
	SPK::Group* particleGroup = SPK::Group::create(particleModel,2100);
	particleGroup->addEmitter(particleEmitter);
	particleGroup->setRenderer(particleRenderer);
	particleGroup->setGravity(gravity);
	particleGroup->enableAABBComputing(true);

	SPK::System *particleSystem = SPK::IRR::IRRSystem::create(smgr->getRootSceneNode(),smgr);
	particleSystem->addGroup(particleGroup);
	particleSystem->enableAABBComputing(true);
It is pretty much the same like in the IRRBasicDemo. I also tried it with recompiling the lib with both irrlicht 1.6 and 1.71 but it is the same result.

greetings
Darktib
Posts: 167
Joined: Sun Mar 23, 2008 8:25 pm
Location: France

Post by Darktib »

I've tested your code (just changing some code lines in IRRBasicDemo.cpp)... and it worked flawlessly...

Are you sure you have the good binaries alongside your exe (both release and debug)?
freetimecoder
Posts: 226
Joined: Fri Aug 22, 2008 8:50 pm
Contact:

Post by freetimecoder »

I solved the problem. It had nothing to do with old/buggy binaries or using wrong dlls etc, the engine works fine.
My code was "simply" missing one line

Code: Select all

randomSeed = device->getTimer()->getRealTime();
Because it didn't say SPK::randomSeed I thought it was some variable that was used for the color or something. I didn't realize that it is essential for the engine. This is one of the reason I generally don't use "using namespace" in my projects :lol:

greetings
Darktib
Posts: 167
Joined: Sun Mar 23, 2008 8:25 pm
Location: France

Post by Darktib »

Yes, currently I don't know why it may crash if this variable is not initialized, but it crash^^

Happy that you've found the solution :wink:

For SPARK version I think a good feature would to automatically initialize this variable.
Juff
Posts: 18
Joined: Fri Oct 30, 2009 7:53 pm

Post by Juff »

It doesnt crash but as the seed is initialized to 0, every random value generated will be 0. I set the initial value to 0 to force the user to initialize the seed. But maybe it is not the more convenient thing.

Anyway in the version 2, the seed is initialized based on the processor time so it wont be necessary to initialize it manually anymore (even if it is still possible).
Ulf
Posts: 281
Joined: Mon Jun 15, 2009 8:53 am
Location: Australia

Post by Ulf »

I solved my problem of not being able to run the demos in debug mode.
It was the project settings. I had to change the debug info. format to Program Database for Edit and Continue (/ZI)
Thanks for all your concern anyway.

I have some issues converting the demos to use Irrlicht. I converted Tuto1 to use Irrlicht.
Firstly I'll say that I don't know how to use camera perspective and projection properly yet as I have been using 2D drawing and not using Irrlicht scene manager until now. So although I can get the particles working, I can't get the same perspective as in Tuto1.

I don't understand the coordinate system used by SPARK.
For example does it use the video drivers coordinate system or does SPARK have its own coordinate system that must be mapped to the graphics engine.

Using Tuto1 as my example:
The particle systems are created between -2.0 and 2.0 on x,y and z axes.

Code: Select all

SPK::Vector3D color(SPK::random(0.0f,360.0f),0.8f,1.0f);
SPK::Vector3D position(SPK::random(-2.0f,2.0f),SPK::random(-2.0f,2.0f),SPK::random(-2.0f,2.0f));				particleSystems.push_back(createParticleSystem(position,convertHSV2RGB(color)));
How does that work? How does it work with Irrlicht? Has it got to do with the camera perspective?
When I try to map the mouse location when I click the button to create a particle system at the mouse location, I am getting messed up results.
Even if I try to directly create a system at a location, I don't understand the minimum and maximum coordinates.

After messing with perspective and not being able to zoom in close to the explosions (the particles were dots), I thought about the size of the particles.

Code: Select all

pointRenderer->setSize(0.1f);
quadRenderer->setScale(0.1f,0.1f);
With irrlicht I had to make the point renderer size near 16 to look similar to the particles in Tuto1. But it does look pretty good with and with fast FPS.

Code: Select all

pointRenderer->setSize( 16.0f );
Is the pointRenderer size the maximum size of a particle?
Same question for the scale of a quadRenderer? Is that the max. size?

So in the end I do get a similar look to the Tuto1 but it doesn't seem quite the same perspective.

I'm sure I need a lesson on camera perspective.
I can hear birds chirping
:twisted:

I live in the Eye of Insanity.
Juff
Posts: 18
Joined: Fri Oct 30, 2009 7:53 pm

Post by Juff »

Hi, for pointRenderer size, this is actually due to the way Irrlicht handles points. Basically when rendering with points (in either OpenGL or Direct3D), you can choose to render them in screen size (pixels) or apply a scale on their size function of their distance from the camera.

However in Irrlicht rendering points is always performed with a scale function (I think not sure about that) but the parameters of the scale function are not correctly set, this leads to points size not being scaled correctly as they were in the world.

It works correctly with SPARK when using OpenGL or DirectX render module as the parameters are defined in the modules but not with the Irrlicht one as it uses the underlying Irrlicht rendering of points.

So there is a bug fix to make to Irrlich core here in order to have points rendered with the right dimension.

With quadRenderer there should be no problem though.

Regarding the coordinate system of SPARK, it is the same coordinate system as the whole world. If your not familiar with 3D transformations, I think you ll have to learn a bit about them before trying to set up particle systems in 3D.
Darktib
Posts: 167
Joined: Sun Mar 23, 2008 8:25 pm
Location: France

Post by Darktib »

For information, Irrlicht and SPARK have the same coordinates system, with Y-axis up (this is important to know because some software use Z-axis up)
There are 2 convenience functions to convert irr coords to spk coords and reciproqual.

For Spark, a Vector3D is just a triplet of floats, which can be used for coordinates (x y z), color (r g b) or (h s v) or whatever you want whereas Irrlicht has its own SColor class.

All coordinates are independant from camera view (except if you update these coords according to the camra view^^), to get it in the camera view coordinates, you need to convert these coordinates by multiplying camera view matrix to the coords you want to convert (or smth like this).
Usually coordinates can be system-dependant or absolute.

I hope there are no mistakes in what I've wrote^^
Post Reply