ramakarl / fluids3 Goto Github PK
View Code? Open in Web Editor NEWfluids v.3
fluids v.3
Hi, thank you so much for sharing this with everyone! It has been a great learning experience while porting it over to the Unity engine. I looked into the problem of particle clustering and I think I figured out the bug. I'm still quite new to this, so correct me if I'm wrong or you have a reason behind the code being this way.
The fix: In the "contributePressure" function in "fluid_system_kern.cu", just remove the " && dsq > 0.0" part in the distance check.
This avoids particles flying out of control and clustering to each other unnaturally. It also seems to make the distribution of particles at the surface uniform with the rest of the body; before it had a higher concentration of particles at the surface. The reason I believe this " && dsq > 0.0" check is a bug, apart from the results after the fix looking more natural, is that ignoring a particle's own mass when calculating the density at its spot just is physically incorrect (again, correct me if I'm wrong and there's a reason behind this in this particular case). When many particles are around, the density converges to a more natural value, but when few particles are around it becomes pretty unnatural. Take for example a cluster of two particles. One particle will only consider the other's mass for density, not its own, which is kind of strange when you think about it.
I've been attempting to port 3.1 over to Linux (Ubuntu). However, I am experiencing compiling issues with a number of different types that seem to be reliant on Windows.
HND and HGLRC appear to be declared in wglew.h which is only included for win32 compilations
HWND is defined in WinDef.h for handling windows
Probably unrelated, but the other problems are that _getch, va_start and va_end are not recognized.
This is admittedly not my strength, but it appears that some code rewriting will be necessary; it's not simply a matter of setting the right compiling options, etc.
Hi,
I am a college student from Beijing Forestry University,China. I want to learn something about fluid simulation for graphics and have been studing your code for sometime.I have left a message on your website but didn't recieve youe reply. Guess you didn't check you website for a long time, so i leave my questions here.
The first thing i have to say is , it's really a fantastic work and i have learned a lot through reading it.
However, i am faced with a question that , the particles are not showing up unless the display mode is sprite, in other words, all i can see is black backgounds when the DRAWMODE is not 1.besides, the 2D parts are showing well.
Another program developed based on this using glee and freeglut is running well. I am using win7 and CUDA5.5, Opengl4.3.Can you help me solving this ?
thank you very much !
Jerry Liu
I downloaded the windows binary from your site (http://www.rchoetzlein.com/fluids3/) extracted and tried to run. It shows an error window that states "The program can't start because cudart32_50_35.dll is missing from your computer...". I just updated to the latest Nvidia drivers and I am running Windows 10 Pro build 10240 with a Intel i7 @ 2.93GHz and an Nvidia GeForce GTX 960 with 2 gigs of ram.
I cannot run it under 64 bit Windows 7, bacause cudart32_50_35.dll is missing. Could you please compile it on CUDA Toolkit 7 or send me that missing dll? Thanks.
I know, you don't have time for fuids3 development but maybe you can provide a quick tip: how to make fluids3 particles more like real water? I mean, maybe, changing particles color and opacity (make em bluish and semi-transparent) and apply some post effect to the final scene will make render looks more realistic?
I know, NVIDIA has perfect water demo (I already tried and it's perfect) but will be great to have ability to build similar effect at home :)
Did some testing with your/harris prefix sum code. I'm wondering if cuda does something different here:
Line 24 in 95ebd2c
Should be changed to:
#define CONFLICT_FREE_OFFSET(index) (((index) >> LOG_NUM_BANKS) + ((index) >> (2*LOG_NUM_BANKS)))
due to C++ Operator Precedence of + over >>.
Ran this code to test it:
#include <iostream>
#define NUM_BANKS 32
#define LOG_NUM_BANKS 5
#define CONFLICT_FREE_OFFSET_ONCE(n) ((n) >> LOG_NUM_BANKS)
#define CONFLICT_FREE_OFFSET_TWICE(n) (((n) >> LOG_NUM_BANKS) + ((n) >> (2 * LOG_NUM_BANKS)))
#define CONFLICT_FREE_OFFSET_HARRIS(n) ((n) >> LOG_NUM_BANKS + (n) >> (2 * LOG_NUM_BANKS))
int main(){
for(int i=0 ; i<1024;i++){
int ai = i;
int bi = i+1024;
std::cout<< i << " bankOffsetA: " << CONFLICT_FREE_OFFSET_ONCE(ai)<< " bankOffsetB: " << CONFLICT_FREE_OFFSET_ONCE(bi) <<" Fluids" <<std::endl;
std::cout<< i << " bankOffsetA: " << CONFLICT_FREE_OFFSET_TWICE(ai)<< " bankOffsetB: " << CONFLICT_FREE_OFFSET_TWICE(bi) <<" Test" <<std::endl;
std::cout<< i << " bankOffsetA: " << CONFLICT_FREE_OFFSET_HARRIS(ai)<< " bankOffsetB: " << CONFLICT_FREE_OFFSET_HARRIS(bi) <<" Harris" <<std::endl;
std::cout<<std::endl;
}
return 0;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.