Page 1 of 4

IrrPhysx 0.3 - Nvidia Physx 2.8.1 wrapper

Posted: Mon Dec 29, 2008 5:58 pm
by sio2
EDIT: Added another demo using Blindside's water droplet shader. See below.

This release of IrrPhysx - v0.3 - has added support for Fluids, both in hardware (given a compliant GPU) and software (cpu). I also removed a mesh called "platform" from the GameExample that crashed the Release exe when not running through MSVC. This is an initial release; there are many tweaks that could be made to the fluid system - source code is supplied, allowing people to modify as required.

Please note: v0.3 was developed on an nVidia GPU with hardware PhysX support. Although software (cpu) fluids are possible with v0.3 the GameExample expects hw PhysX support.

Image

Please note: adding fluid support to your apps will require a little bit of work. The GameExample is just that - an example of adding fluids to a scene. In the GameExample fluids are rendered as particles - a full shader system will be required and much tweaking of fluid/emitter parameters to obtain your desired look.

IrrPhysx 0.3 Source:
http://sio2.g0dsoft.com/IrrPhysx-v0_3.zip

IrrPhysx 0.3 GameExample Source:
http://sio2.g0dsoft.com/IrrPhysx-v0_3-GameExample.zip

IrrPhysx 0.3 GameExample Source (with Blindside's water droplet shader):
http://sio2.g0dsoft.com/IrrPhysx-v0_3-G ... action.zip

A big thanks to JP for v0.2, without which I could not have made v0.3. :D

Posted: Mon Dec 29, 2008 11:12 pm
by BlindSide
Nice work sio2!

Anyone who might find the shader part a hurdle could use something like this for the effect:

http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=27054

Image

Posted: Tue Dec 30, 2008 1:46 am
by christianclavet
Wow! The frame rate is incredible! Got more than 500FPS with more than 110 physic objects, the scene and the "fluid".

Posted: Tue Dec 30, 2008 2:35 am
by DtD
4-6 (And random jumps to 101?) FPS without fancy NVidia physics acceleration :cry: I knew itd probably be slow on my ATI card...but not that slow!

BTW> The liquid "spouts" didn't follow the bottles when I shot them, but I suppose that was because you just didn't program it, no biggie...

BTW2> This is a little off topic, but does ATI have some equivalent to PhysX?

BTW3> I noticed the fluid stops eventually, after that the speed shoots up to around 350 FPS, so I got to have fun destroying the flag and blowing up spheres =)

~DtD

Posted: Tue Dec 30, 2008 10:47 am
by sio2
Blindside: Very, very nice. It doesn't model a fluid surface so it's not as complex as the shader as I had in mind, but I'll implement the raindrop shader in the GameExample.

Christian: The more objects you have the more you should benefit from hw acceleration. Note that you can have thousands of particles and they all collide with static and dynamic objects.

DtD: I could have spent another month - or more - on it before releasing it. I solved the biggest issues, such as it crashing every time you run the Release exe. :wink: The fluid emitter is anchored in worldspace at the moment - needs a bit of work. You're right: the fluid emitter reservoir runs out when it's supposed to be continuous from what the docs say. I haven't figured that one out yet.

BTW I believe that PhysX acceleration is possible on ATI cards. I don't know the details so if someone could find out then those with ATI cards would be most grateful, I imagine. :wink:

Posted: Tue Dec 30, 2008 10:53 am
by sio2
christianclavet wrote:Wow! The frame rate is incredible! Got more than 500FPS with more than 110 physic objects, the scene and the "fluid".
One of the changes I made to JP's code was to run the physics in parallel with Irrlicht's beginScene()/endScene(). This gives the GPU the possibility to be doing stuff when normally it would be idle. My frame rate quadrupled with 10000 fluid particles.

This can be dangerous - as JP points out in a comment in GameExample - but should be fine as long as you don't move/update physics objects while the simulation is running.

Posted: Tue Dec 30, 2008 10:57 am
by sio2
BlindSide wrote:Anyone who might find the shader part a hurdle could use something like this for the effect:
I'm going to add this to the GameExample. I'll convert the shaders I need to HLSL so the example can run in GL/D3D.

I notice that when the large refractive quad intersects the lowest edge of the viewport there's some nasty stretching. I remember seeing the same thing - and commenting on it - in Elvman's "realistic" water scene node. :?

Posted: Tue Dec 30, 2008 11:11 am
by Carama
Very nice work!
Do objects swimming?

Posted: Tue Dec 30, 2008 1:32 pm
by Nerexis
I try to use it in Irrlicht 1.5 and i created 'convexMeshObject' which works fine but it crash in function 'createHeightfieldObject'.

Posted: Tue Dec 30, 2008 3:42 pm
by sio2
Nerexis wrote:I try to use it in Irrlicht 1.5 and i created 'convexMeshObject' which works fine but it crash in function 'createHeightfieldObject'.
I've had IrrPhysx working with Irrlicht 1.5. I can't remember what I did, I just did a Debug build and fixed every issue as it came up. You'll either have to do the same or wait until I update to Irrlicht 1.5.

It seems that some of the model loaders were fixed for Irrlicht 1.5. Great, except that scenes made in IrrEdit 1.4.2 now load and look wrong because the models were orientated based on the previously broken loaders. :?

Posted: Tue Dec 30, 2008 11:31 pm
by sio2
Nerexis wrote:I try to use it in Irrlicht 1.5 and i created 'convexMeshObject' which works fine but it crash in function 'createHeightfieldObject'.
Irrlicht 1.5 runs OK for me (the MilkShape models are backwards and the camera is ultra fast, but it runs). Are you sure you've replaced the Irrlicht 1.4.2 dll with a 1.5 dll?

Posted: Wed Dec 31, 2008 3:58 pm
by sio2
I've made a version of the GameExample that uses Blindside's water droplet shader. You can get the exe and source here:
http://sio2.g0dsoft.com/IrrPhysx-v0_3-G ... action.zip

It looks good, but still looks like each separate droplet is a piece of glass or something, as the fluid particles don't merge together (that's an altogether more involved shader). Also, it seems each droplet refracts the whole background.

It's a nice starting point for people anyway. :wink:

Oh, with Vista, OpenGL in a window seems to give me a lower frame rate than D3D9: GL give 60fps whereas D3D9 give 180fps (Irrlicht 1.4.2). This is the original GameExample demo (without refraction) though the demo with refraction is the same frame rate. VSync should be off, unless there's some driver issues...

Posted: Wed Dec 31, 2008 4:36 pm
by omaremad
Impressive speed!

You could render the blobs to a low res rtt so they merge together(also allows blur) then defer their shading.

Posted: Wed Dec 31, 2008 8:12 pm
by JP
Right well i guess this shits all over IrrPhysx as done by me doesn't it? Gonna be a bit confusing if i release a 0.3 right? Would have been nice if you'd whispered a word in my ear before doing this...

Posted: Thu Jan 01, 2009 7:50 pm
by MasterGod
[...]