» Particle water
This site relies heavily on Javascript. You should enable it if you want the full experience. Learn more.

Particle water

effect gpu particle shader sph
Credits: dottore sanch


Particle water effect could be improve probably.


16.07.14 [16:24 UTC] by sanch | 1495 downloads
dx11 version
Show 1 older revisions

Older Revisions

29.05.12 [02:02 UTC] by sanch | 1374 downloads

androsyn 29/05/2012 - 02:49

great! having lot of fun with this patch ^^

Desaxismundi 29/05/2012 - 08:05

cool one!

sebl 29/05/2012 - 12:51

really awesome

lasal 29/05/2012 - 19:17

Grande Sanch!

m4d 30/05/2012 - 01:19

neat stuff :)

sanch 30/05/2012 - 02:49

Thanks guy
Surface tension could be add to the particle , but i didn't get it to work both at the same time yet , should'nt be that hard. http://en.wikipedia.org/wiki/Surface_tension
For other purpose it could use also different shape like quad , but then particle rotation should be add also ... not sure if it will work the same way with rotation.
also independant mass relative to syze would be nice and easy to implement.
To finish the Navier-Stokes things to get the nice curly things to get some kind of moving flow like in the fluid solver but i don't know if that's possible and navier stoke equation is still too complicate for me.

milo 30/05/2012 - 09:16

amazing stuff!

io 02/06/2012 - 14:41

At work already with special thanks to Dottore, Sanch and Unc, and no I won t buy ATI anymore

robi_h 01/08/2012 - 15:17

hey david, very cool and clever!!!

I modified your shader a litte just to tidy things up. Instead of writing the values for the circular spread i compute them.

const float PI = 3.14159265;
    const int samples = 12;
    float2 pNew ={0,0};
    float2 d_1n ={0,0};
    for (int i =0; i<samples ;i++){
        pNew.x = cos(((1.0f/samples)*i*2*PI))*0.5*radius;
        pNew.y = sin(((1.0f/samples)*i*2*PI))*0.5*radius;
        d_1n +=  pNew  * tex2Dlod(SampFields, mul(float4(posQueue.x+pNew.x ,posQueue.y+pNew.y,0,0), FieldsTransform)+ 0.5).b;

instead of

float2 p1 = ( float2(0.5000 ,  0.0000)*radius);
float2 p2 = ( float2(0.4330 ,  0.2500)*radius);
float2 p3 = ( float2(0.2500 ,  0.4330)*radius);
float2 p4 = ( float2(0.0000 ,  0.5000)*radius);
float2 p5 = ( float2(-0.2500 ,  0.4330)*radius);
float2 p6 = ( float2(-0.4330 ,  0.2500)*radius);
float2 p7 = ( float2(-0.5000 ,  0.0000)*radius);
float2 p8 = ( float2(-0.4330 ,  -0.2500)*radius);
float2 p9 = ( float2(-0.2500 ,  -0.4330)*radius);
float2 p10 = ( float2(0.0000 ,  -0.5000)*radius);
float2 p11 = ( float2(0.2500 ,  -0.4330)*radius);
float2 p12 = ( float2(0.4330 ,  -0.2500)*radius);
    ////// add  brightness of all point arround particle position an multiply with direction from circular spread
    float2 d_1n  =  p1  * tex2Dlod(SampFields, mul(float4(posQueue.x+p1.x ,posQueue.y+p1.y,0,0), FieldsTransform)+ 0.5).b;
           d_1n +=  p2  * tex2Dlod(SampFields, mul(float4(posQueue.x+p2.x ,posQueue.y+p2.y,0,0), FieldsTransform)+ 0.5).b;
           d_1n +=  p3  * tex2Dlod(SampFields, mul(float4(posQueue.x+p3.x ,posQueue.y+p3.y,0,0), FieldsTransform)+ 0.5).b;
           d_1n +=  p4  * tex2Dlod(SampFields, mul(float4(posQueue.x+p4.x ,posQueue.y+p4.y,0,0), FieldsTransform)+ 0.5).b;
           d_1n +=  p5  * tex2Dlod(SampFields, mul(float4(posQueue.x+p5.x ,posQueue.y+p5.y,0,0), FieldsTransform)+ 0.5).b;
           d_1n +=  p6  * tex2Dlod(SampFields, mul(float4(posQueue.x+p6.x ,posQueue.y+p6.y,0,0), FieldsTransform)+ 0.5).b;
           d_1n +=  p7  * tex2Dlod(SampFields, mul(float4(posQueue.x+p7.x ,posQueue.y+p7.y,0,0), FieldsTransform)+ 0.5).b;
           d_1n +=  p8  * tex2Dlod(SampFields, mul(float4(posQueue.x+p8.x ,posQueue.y+p8.y,0,0), FieldsTransform)+ 0.5).b;
           d_1n +=  p9  * tex2Dlod(SampFields, mul(float4(posQueue.x+p9.x ,posQueue.y+p9.y,0,0), FieldsTransform)+ 0.5).b;
           d_1n +=  p10  *tex2Dlod(SampFields, mul(float4(posQueue.x+p10.x ,posQueue.y+p10.y,0,0), FieldsTransform)+ 0.5).b;
           d_1n +=  p11  *tex2Dlod(SampFields, mul(float4(posQueue.x+p11.x ,posQueue.y+p11.y,0,0), FieldsTransform)+ 0.5).b;
           d_1n +=  p12  *tex2Dlod(SampFields, mul(float4(posQueue.x+p12.x ,posQueue.y+p12.y,0,0), FieldsTransform)+ 0.5).b;

Or is it more performant to write the values directly and save the calculations?
greetings from Vienna Robi

elliotwoods 01/08/2012 - 16:17

@robi - the compiler unwraps the loops, and any calculations based on constants will be pre-computed.

sanch 09/08/2012 - 16:21

@ robi , i tried to do it in a loop when i started , but i couldn't manage to have the shader compiling , so i did the loop by hand, feel free to upload your version.

princemio 17/07/2014 - 13:17

Really NICE!!! Dx11 is getting more and more interesting stuff to play with. I might have one suggestion. The map which is used to define boundaries is the same map which holds the particles. Hence the particle interaction with each other is the same as the particles interaction with the boundaries. Im not sure but do you think that a seperation of two different maps (particles and Boundaries) would make more sense. Think of oil or gas that holds together but pushes from the wall. Please correct me if im wrong.

Anyway thank you very much!!!


Noir 17/07/2014 - 15:23

thanks sanch

anonymous user login


~10h ago

~10h ago

joreg: @jib watch this howto manage items in a spread for a start: https://youtu.be/tiFLGTrDagc

~20h ago

jib: Hi guys ! in Gamma, what's the way to do things that Buffer node does in Beta ?

~2d ago

david: Reminder: vvvv meetup is starting in 10 mins. https://www.youtube.com/watch?v=LzqaoN7QCSg

~3d ago

joreg: Reminder: 6th worldwide #vvvv meetup tomorrow, Nov 24: 6.-worldwide-vvvv-meetup with presentations by u7angel and team, texone and baxtan

~5d ago

tonfilm: That's going to be interesting, let's hope Intel is doing something similar: https://www.tomshardware.com/news/amd-allows-SAM-on-nvidia-gpus

~6d ago

neuston: THX @joreg and sorry for late reply as I left vl for a while. I've responded to related (UI performance issues) thread, no worry

~7d ago

~10d ago

schack: I need some help and hints to realise Text-To-Speech within beta 40 x64!!! THX