Sign in to follow this  

Broken Fluid Solver

This topic is 1763 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

 

I am not sure if this is the correct place to post this because I working in OpenGL and CG to create a fluid solver based on the GPU Gems 3 chapter 

 

Real time Simulation and Rendering of 3D Fluids

 

The code I have at the moment is in CG, and is based on the Render To Volume example in the OpenGL 10 SDK by Nvidia. The example shows a simple solution to the wave equation so I thought it might be the correct place to start.

 

 I set point filtering in the C++ code, however I could not add the 0.5 to the texel coordinates because the fluid tended to diverge quickly in the direction of the corner of the box -I am not sure if CG needs to add the 0.5 to get the texel center.

 

Edit: I'm convinced its the texel center problem - I found a resource about CG that explains some stuff so I have removed the code for now, I'll repost the program if I can fix it.

Edited by ray_intellect

Share this post


Link to post
Share on other sites

Sorry for the double post, however I thought I should add this again

 

Using this code for each function I made a transformation of the coordinate "x" to "x + 0.5 * texelSize" and then relied on the float3(1.0f, 0.0f, 0.0f) * texelSize 

to look up the coordinates.

 

I tried some variations of this method, with no conclusive results, only a real problem in calculating the correct colour. I saw some fluid like effects with very clipped color, mostly the more realistic and wavy looking fluids seem to be an explosion - or perhaps the container seems to fill with fluid - this is after the transformations were applied (on my other computer I have windows xp and opengl 4.0 but on this pc I have windows 7 and directX 10). 

 

So I'm looking for an answer for the mathematics involved - i.e. what is this fluid supposed to be, how is the input supposed to be applied ? Is this an explosion ? etc

 

Also if anyone can make use of this then good luck :)

Share this post


Link to post
Share on other sites
Sign in to follow this