Welcome, Unregistered.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Reply
Old 27-Dec-2009, 13:02   #1
Voxilla
Member
 
Join Date: Jun 2007
Posts: 281
Default Fluid volume simulation

EDIT: New improved version 1.3 available

Here another volume simulator, this time simulating an incompressible fluid solving the Navier- Stokes differential equations. The simulation runs in a 200x200x200 voxel box

The calculations make use of a well known scheme of velocity advection, Jaccobi pressure solving and making the velocity divergence free by subtracting the gradient of the pressure.

This is the so called Semi-Lagrangian scheme. A more accurate solver makes use of the second order MacCormack technique. The simulation makes use of the latter. However it makes the simulation unstable and introduces artifacts. Limiting generated extremes can fix this, unfortunately I was not able to get this working, so the simulation runs without limiters, still the result is some visual interesting turbulent behavior.

The amplitude of the speed vectors are visualized. To make a 3d rendering, a simple ray maximum projection is used. This shoots rays through the volume searching the maximum speed along the ray. With a linear interpolation the speed is given some color.


Controls:
- mouse left drags a source on a plane through the center of the volume and parallel to the screen
- mouse right to rotate the volume
- mouse wheel to zoom in and out
- space bar to toggle between MacCormack and Semi-Lagrangian simulation

Last edited by Voxilla; 06-Jun-2010 at 14:54. Reason: New version
Voxilla is offline   Reply With Quote
Old 27-Dec-2009, 16:59   #2
fellix
Senior Member
 
Join Date: Dec 2004
Location: Varna, Bulgaria
Posts: 3,015
Send a message via Skype™ to fellix
Default

Works flawlessly here, on my 5870.
~28 FPS with the default settings.
__________________
Apple: China -- Brutal leadership done right.
Google: United States -- Somewhat democratic.
Microsoft: Russia -- Big and bloated.
Linux: EU -- Diverse and broke.
fellix is offline   Reply With Quote
Old 27-Dec-2009, 18:44   #3
CNCAddict
Member
 
Join Date: Aug 2005
Posts: 286
Default

Fellix, are you using the 9.12 hotfix drivers? I can't get my 5850 to run the application and I have all the latest drivers. I went to rerun all of Voxillas demos and QJulia4D is the only one that now works, the others crash immediately!!!
CNCAddict is offline   Reply With Quote
Old 27-Dec-2009, 19:16   #4
fellix
Senior Member
 
Join Date: Dec 2004
Location: Varna, Bulgaria
Posts: 3,015
Send a message via Skype™ to fellix
Default

I'm with the 9.12 hotfix and all the demos out there (DC/OCL) are trouble-free for me.

Could it be from the OS? Mine is Win7 x86 w/ all the pre-SP1 patches and hotfixes (~130 in count).
__________________
Apple: China -- Brutal leadership done right.
Google: United States -- Somewhat democratic.
Microsoft: Russia -- Big and bloated.
Linux: EU -- Diverse and broke.
fellix is offline   Reply With Quote
Old 28-Dec-2009, 04:17   #5
Forrest
Junior Member
 
Join Date: Jul 2008
Posts: 36
Default

Impressive demo, psychedelic stuff!
Getting 15 FPS on 5770 here.
Forrest is offline   Reply With Quote
Old 28-Dec-2009, 11:01   #6
Voxilla
Member
 
Join Date: Jun 2007
Posts: 281
Default

It's possible to make this quite a bit faster still. The Jacobi iterations are especially expensive. Now 20 of them are done, meaning 20 times reading and writing the whole volume per frame.

With vector maths, it could be made twice faster.
As the simulation is mostly limited by memory bandwidth, the Jacobi iterations seem like a nice candidate for shared memory. However due to the nature of the iterations I'm not sure this is possible.
Voxilla is offline   Reply With Quote
Old 29-Dec-2009, 23:03   #7
guardian
Junior Member
 
Join Date: Jul 2008
Posts: 12
Default

I'm really new to OpenCL and Direct Compute, would it be possible to implement this effect targeting D3D_FEATURE_LEVEL_10_1?

I'm asking because I only have a Radeon 4850 gpu.

Thank you.
guardian is offline   Reply With Quote
Old 30-Dec-2009, 00:39   #8
CNCAddict
Member
 
Join Date: Aug 2005
Posts: 286
Default

WOW, this looks great especially on the Semi-Lagrangian mode. The other mode has some strange artifacts along grid boundaries. Small marks aligned orthogonally?! It would be awesome to set this up as a screensaver with some random input. Great work Voxilla, you never cease to amaze!!!

P.S. Anyone running Windows 7 64bit RC will need 9.11 drivers. 9.12 drivers have severe problems with DX11 on the Release Candidate.
CNCAddict is offline   Reply With Quote
Old 30-Dec-2009, 08:13   #9
Voxilla
Member
 
Join Date: Jun 2007
Posts: 281
Default

The semi Lagrangian looks ok, but it is a bit too smooth as velocity gets dissipated quickly. That's where the second order MacCormack should make things better by adding more detail and less dissipation.
The artifacts you see are the result of using no limiters, there is one in the code but I could not get it working. If there is some computational fluids specialist around there, it would be great to get some hints.
I've got it running 40% faster now, also fluid bounces correctly of the walls, but I want correct MacCormack first before releasing something new.
Voxilla is offline   Reply With Quote
Old 30-Dec-2009, 08:34   #10
Voxilla
Member
 
Join Date: Jun 2007
Posts: 281
Default

Quote:
Originally Posted by guardian View Post
I'm really new to OpenCL and Direct Compute, would it be possible to implement this effect targeting D3D_FEATURE_LEVEL_10_1?
It would be more difficult to process volumes (3d textures) as CS 4 compute shaders can only be dispatched over 2d domains. Working around this and other limitations might be possible.
Voxilla is offline   Reply With Quote
Old 30-Dec-2009, 21:42   #11
guardian
Junior Member
 
Join Date: Jul 2008
Posts: 12
Default

So I assume that if it was OpenCL, it would have the same restrictions, needing a fairly recent GPU (DX11 class) right?
guardian is offline   Reply With Quote
Old 31-Dec-2009, 09:38   #12
Voxilla
Member
 
Join Date: Jun 2007
Posts: 281
Default

I did some tests with OpenCL, but even with a DX11 GPU there are currently limitations like not being able to sample textures, at least with ATI. This is something that will get fixed in drivers later on.
DX10 GPUs would have similar limitations as CS4 using OpenCL, it's not something that can be solved in software, the DX10 hardware simply lacks features.
Voxilla is offline   Reply With Quote
Old 31-Dec-2009, 12:42   #13
fellix
Senior Member
 
Join Date: Dec 2004
Location: Varna, Bulgaria
Posts: 3,015
Send a message via Skype™ to fellix
Default

Quote:
Originally Posted by Voxilla View Post
I did some tests with OpenCL, but even with a DX11 GPU there are currently limitations like not being able to sample textures, at least with ATI. This is something that will get fixed in drivers later on.
That would be the case of missing support for OpenGL interops, am I correct?
__________________
Apple: China -- Brutal leadership done right.
Google: United States -- Somewhat democratic.
Microsoft: Russia -- Big and bloated.
Linux: EU -- Diverse and broke.
fellix is offline   Reply With Quote
Old 31-Dec-2009, 13:32   #14
Voxilla
Member
 
Join Date: Jun 2007
Posts: 281
Default

No, you can do texture sampling in OpenCL without OpenGL.
Voxilla is offline   Reply With Quote
Old 31-Dec-2009, 13:51   #15
guardian
Junior Member
 
Join Date: Jul 2008
Posts: 12
Default

btw, do you have pointers to articles I should read to understand what's going on? (maybe something you read before implementing the effect)

thx
g.
guardian is offline   Reply With Quote
Old 31-Dec-2009, 15:21   #16
Voxilla
Member
 
Join Date: Jun 2007
Posts: 281
Default

Sure, GPU Gems had a couple of articles and demos.

http://http.developer.nvidia.com/GPU...gems_ch38.html
or
http://http.developer.nvidia.com/GPU...ems3_ch30.html

These were done via the graphics API, DirectCompute or OpenCL make these kind of simulations much more easy to implement.
Voxilla is offline   Reply With Quote
Old 31-Dec-2009, 20:28   #17
Voxilla
Member
 
Join Date: Jun 2007
Posts: 281
Default

I've added a new version 1.2 the artifacts are gone and speed is up by about 40%.

This new version has a more smoky aspect and smoke bounces off the wall.
Instead of visualizing the velocity an advected fire reaction coordinate is rendered.
Voxilla is offline   Reply With Quote
Old 31-Dec-2009, 20:34   #18
fellix
Senior Member
 
Join Date: Dec 2004
Location: Varna, Bulgaria
Posts: 3,015
Send a message via Skype™ to fellix
Default

~10 frames up for the new version.
Simulation is rendering much better now!
__________________
Apple: China -- Brutal leadership done right.
Google: United States -- Somewhat democratic.
Microsoft: Russia -- Big and bloated.
Linux: EU -- Diverse and broke.
fellix is offline   Reply With Quote
Old 06-Jan-2010, 06:06   #19
Talonman
Junior Member
 
Join Date: Jan 2010
Posts: 64
Default

FYI - I would love to run this on my Windows 7 64 bit, but cant seem to find enough .dll files to make it happy.
Talonman is offline   Reply With Quote
Old 06-Jan-2010, 06:41   #20
Voxilla
Member
 
Join Date: Jun 2007
Posts: 281
Default

You may have to install the VS 2008 runtime
http://www.microsoft.com/downloads/d...displaylang=en

I'll make an updated version, to fix this.
Voxilla is offline   Reply With Quote
Old 06-Jan-2010, 08:39   #21
Talonman
Junior Member
 
Join Date: Jan 2010
Posts: 64
Default

Thanks for your response...

I noticed it had:
System Requirements

  • Supported Operating Systems: Windows 2000 Service Pack 4; Windows Server 2003; Windows Vista; Windows XP
I am 7 64 bit, so is it safe for me to install?
Talonman is offline   Reply With Quote
Old 06-Jan-2010, 12:04   #22
Voxilla
Member
 
Join Date: Jun 2007
Posts: 281
Default

Should be ok.
Voxilla is offline   Reply With Quote
Old 06-Jan-2010, 12:11   #23
chavvdarrr
Senior Member
 
Join Date: Feb 2003
Location: Sofia, BG
Posts: 1,138
Default

Is it possible to run it on NV hardware?
__________________
"There are three types of lies - lies, damn lies, and statistics."
chavvdarrr is offline   Reply With Quote
Old 06-Jan-2010, 12:36   #24
fellix
Senior Member
 
Join Date: Dec 2004
Location: Varna, Bulgaria
Posts: 3,015
Send a message via Skype™ to fellix
Default

Quote:
Originally Posted by chavvdarrr View Post
Is it possible to run it on NV hardware?
Quote:
Originally Posted by Voxilla View Post
It would be more difficult to process volumes (3d textures) as CS 4 compute shaders can only be dispatched over 2d domains. Working around this and other limitations might be possible.
...probably.
__________________
Apple: China -- Brutal leadership done right.
Google: United States -- Somewhat democratic.
Microsoft: Russia -- Big and bloated.
Linux: EU -- Diverse and broke.
fellix is offline   Reply With Quote
Old 06-Jan-2010, 17:28   #25
Voxilla
Member
 
Join Date: Jun 2007
Posts: 281
Default

Quote:
Originally Posted by chavvdarrr View Post
Is it possible to run it on NV hardware?
Currently not as it is DX11 / Compute shader 5. On Fermi it should run quite well as the simulation is more limited by memory bandwidth than by FLOPs.
Voxilla is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:58.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.