rain in irrlicht + spark (time to give something back :) )

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Post Reply
EvIl_DeViL
Posts: 89
Joined: Tue Nov 06, 2007 4:49 pm

rain in irrlicht + spark (time to give something back :) )

Post by EvIl_DeViL »

I recently found an interesting particle engine called spark.
I saw it can be integrated with irrlicht but many examples were only for opengl. I really liked the rain example and I found that here http://spark.forum0.net/t30-spark-and-c, someone was trying to port it in irrlicht and had some issues, but never shared the final code. so I completed it and made a nice example to share with all of you :)
(use WASD to move and space to jump)
http://www.mediafire.com/?xie0j3yra0tx7xq

Image
chronologicaldot
Competition winner
Posts: 685
Joined: Mon Sep 10, 2012 8:51 am

Re: rain in irrlicht + spark (time to give something back :)

Post by chronologicaldot »

cool. Is it possible to thicken the raindrops / make the drops wider?
EvIl_DeViL
Posts: 89
Joined: Tue Nov 06, 2007 4:49 pm

Re: rain in irrlicht + spark (time to give something back :)

Post by EvIl_DeViL »

you have 3 kind of renders in spark:
IRRpointRender to draw points
IRRlineRender to drow 2d lines particle (like the rain here)
IRRQuadRender to draw "billboards" particle (like the drops here) with textures, alpha and so on.
As stated here http://spark.developpez.com/doc/class_s ... derer.html you could use setWidth to do so...
the example is kinda cheating on the drop collision and splash generation because it only check the Y attribute of the drop (here is because rainRenderer->setLength(-0.1f); (it's negative)) and if <= 0 it generate the splash and kill the particle but nothing keep you away from use triangle collision and use it to create a hill plane mesh with rain ;)
Darktib
Posts: 167
Joined: Sun Mar 23, 2008 8:25 pm
Location: France

Re: rain in irrlicht + spark (time to give something back :)

Post by Darktib »

Nice! A little clearer than the one in the demos (and for Irrlicht).

I think we can add it to the Irrlicht demos for SPARK 2.0 when it will be finished (soon, I hope).
EvIl_DeViL
Posts: 89
Joined: Tue Nov 06, 2007 4:49 pm

Re: rain in irrlicht + spark (time to give something back :)

Post by EvIl_DeViL »

would be nice! it should be cleaned up a bit (I left some commented out code and I could not get a better fog XD) but I really like the idea. irrlicht + spark it's a winning setup! ;)
I'd like to take this opportunity to to express my appreciation for your work darktib :D
netpipe
Posts: 669
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

Re: rain in irrlicht + spark (time to give something back :)

Post by netpipe »

im not sure it needed porting it comes default with examples but it looks close to the horde demo now we just need some models randomly walking around on bump mapped rock texture
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
EvIl_DeViL
Posts: 89
Joined: Tue Nov 06, 2007 4:49 pm

Re: rain in irrlicht + spark (time to give something back :)

Post by EvIl_DeViL »

every piece of code out there need a porting in irrlicht... windows 9 would be the greatest SO ever if it will be based on unix and irrlicht XD
anyway I got a couple of problem regarding the kill callback because directly calling KillRain() like in the OGL example cause irrlicht to crash here:

Code: Select all

splashGroup->addParticles(1,particle.position(),Vector3D());
I think because as stated here: http://spark.developpez.com/doc/class_s ... bbfcbe57f9
Particles will be added to the Group at the next call to update(unsigned int) or flushAddedParticles().
This is why any Emitter and Zone used to generate particles must be valid at the next call of either update(unsigned int) or flushAddedParticles().
so this is why I thought it would be a useful share :)

p.s. wich "horde demo" are you referring to?
netpipe
Posts: 669
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

Re: rain in irrlicht + spark (time to give something back :)

Post by netpipe »

Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
Post Reply