ParticlesGPU Shader Library
Author: | dottore |
Date: | 08 Nov, 2010 |
Category: | effect |
Credits: | -Michael Mehling, who teached me many hlsl indispensable functions (holy tex2Dlod) while we were at Node08. -Viktor Vicsek, who let me discover GPU Sprites function. -Tonfilm, for many usefull HLSL transform functions taken from his ShaderTransform. |
Download
64bit
added 3 behaviours (2d queue, 2d verlet, 3d transform)
added 6 behaviours. Merry Xmas!
surfaces with texture, alpha and transform working
3 new behaviours. new utility folder
works in beta 27
new behaviour: ParticlesGPU_3d_Spline_ScreenSize
Description
This Shader Library comes from a research i did in these 2 years on possibilities offered by GPU. You will find classic particle systems via GPU but this is not the end, it's just the beginning: with a similar approach you are able to create many algorithms, shapes, behaviours...not just "particles".
Look into the Readme File for change log.
Here you find a sort of guide to the basic elements of this ParticlesGPU approach: particlesgpu-library-guide
Comments
Comments are no longer accepted.Please create a new topic in the vvvv beta forum to discuss this contribution.
scrumptious.
yeah man! i was waiting for something like this long time ;)
yeah big up! so good to finally use gpu power for translation, scaling and stuff without knowing hlsl!
Hi,
nothing works on my computer... (WIN7, big GPU and CPU). I have no idea why...
Black or white screen only.
@lecloneur: have you got the last vvvv release? it works with beta24.1
wow!!!!
forgot to say only patches in the folder Behaviour are working for me, those in Sprites don't (black renderer as lecloneur) beta24.1/ati
too bad... strange, i compiled both VS and PS with model 3.0, but seems the problem is not this for sprites... did you tried to set a lower number of particles? like 64 instead 512 (the default value in 2d sprite patch) ... i don't have any ATI card here, keep on with this updates, hope we'll fix it at the end.
ati cards cannot access texture data in the vertex shader. in theory they could, but it would need some nasty settings, which vvvv doesnt do...
uhm...strange, none of the library patches should work then, because in each particlesGPU shader there is texture access in VS... ...maybe the problem reported by aze has to do with Sprites draw function in hlsl (see the two lines in the technique of the shader), maybe ati has a different sintax...
couldn't help you on that.. but 64 instead of 512 doesn't change anything
Yes, sprites not work on my ati mobility 5650.
@ ATI users: Download "PointSprites.fx" from the old vvvvebsite (http://legacy.vvvv.org/tiki-index.php?page=User+Shaders). If not even this works, it means the Sprite function has a different sintax on ATI.
PointSprites.fx is working on mine.. (mobility 5850)
thanks for sharing!
Looks great, thanks for posting those!
I noticed that when I moved render window to second screen it freezes and I get a "range check error" come up in tty. Moving it back to the first screen lets it start up again. Not sure why?
sorry, my bad. Not sure why I'm getting this, but it's doing it with everything atm. Just first noticed when was playing with these.
SBAM
For me also most patches beside the Sprite stuff is working. ATI on notebook here, but will check on Nvidia tonight.
Thanks for these shaders, they can do really amazing things I guess. Now its just the question how to get them in motion.
yay for teh update!! mindblowing stuff, natan! :)
;)
oh nice update, I've got an odd problem though. In the new 3d Transform patch if I have OVER 9000! cubes the scaling is wrong, for instance if they're at uniform scale in xyz, and I have OVER 9000! then the Pitch input starts to affect scaling. Any ideas? I'm guessing it's to do with texture formats?
SBAM PT.2
@Bitminster: i have to say that that patch is really an experimental one i did just before posting. i didn't tested it enough and i know there are problems with it. i'll check it if have time. now I have other priorities... you will see...
@Noir: wait for SBAM PT.3 ;)
awesome.
SBAAAAM PT.3 BIG UP DOTTORE FOR THE XMAS PRESENT
It's like... SBAAAA-WTF!?!!
amazing stuff.
yea awsome sbambam! thx a lot mister
Cool stuff :D Been playing with the surfaces, is there any way to have the transform input transform the object, it just seems to affect the lighting of the surface at ther moment, is that a limitation of doing it in shader?
Hey Dottore,
there is any way to make textured surfaces?
thanks for the release, and waiting for more ;)
hi lasal, actually it's really easy to add an image texture on the Bicubic resampled surface (is that you mean?): in the shader just add a new texture+sampler. then in the pixel shader multiply the color (from Phong function) with the tex2D(sampler of your texture, texCoord). you can use the same texcoord i'm using to sample the position texture.
:)
Hi Dottore,
i´ve tried it but maybe (for sure) i´m missing something, could you check the pixel shader code? thanks again
Here i have the texture but it looks wrong...
your code is wrong: -you create a float4 and assign to it the color from texture; -but then you overwrite the rgb channels with the phong component. in this way there will be no blend between these and your texture. this is the correct way:
make shure the sampler (samp) is the one from your texture. and the texCoord are the same of the position texture.
Hey Natan, thanks for your response ;) with this code i can´t see the texture, only an alternate green-black fading color, have you check it?
thanks in advance
ari.
ParticlesGPU release 0.21 @catweasel: now transform works on surfaces @lasal: surfaces have texture now. look into the code to see your error ;)
You are my new hero ;)
Hello again,
i don´t know if i´m doing something wrong but the new shaders doesn´t show the texture and alpha pins, but they are in the code... weird
i´ve cleaned the cache and they are still with this problem.
i will try with my version and your code. thanks again
beta25? use that
of course
i´ll check it again at home
The same in the other computer, has anybody the same problem?
helo, thank you for the great contribution wow!
what is the difference between sprite3d and sprite2d? a scale with eg xscale=0 connected to the sprite3d does the same like sprite2d? or am i missing sth? the framerate is the same when using sprite2d
that is not a critic just for better understanding when to use what.. and if you already wrote this down in your mentioned .pdf ... ok i will wait for the documentation
Resolved, there was a conflict between the old and the new shaders. thanks
Thank you! I'll give them a go later :)
Hi Dottore,
only a question, in the 2d Dynamic field texture, is there any way to transform all the system? like in the new bicubic surface? or add to the shader a transform all pin?.
i want to make a symetrie and the only posible solution that i´ve found is to make the transform in the camera.
thanks again for your fantastic contribution.
yes you can easily add a transform to the shader. i could do it for you but it's better that you learn how to do it. ;) you have to declare a floa4x4 in the variables declaration part (the first part of the code) and call it as you want. like..
then in the vertex shader you must apply your input matrix transform to the vertices, after the particlesGPU transforms and just before passing the vertices to the pixel shader; vertex position come out from the vertex shader were there's the "Out." :
this means mul(Pos, tVP) is the last transformation before pixel shader (infact this transformation deform the vertex position using the viewProjection matrix, preparing them to fit into the 2d screen space) you just have to play before this last operation. "mul" is the function that allows you to transform vertices by a transform matrix: position = (position, transform); so..
good luck! :)
Thanks a lot Natan, you are very didactic, very apreciated your usefull comments. i´ll try it.
:)
I´ve got it!
my vertex shader now looks like this, thanks again, i owe you a beer ;)
Good to ear you did it ;) btw, the first Out.Pos is useless. this is better:
bye! :)
Thanks for the correction, ciao ;)
fantastic work!!!!
in my ParticlesGPU_3d_Dynamic_PosCycle help patch some connections seem to be broken. i tried to fix it, but it does not work...
allthevvvverybest,
dd
helo,
i tried to use the ParticlesGPU_Shader_Queue at the second graphicCard output and i got a lot of errors. TTY said: "access violation at adress 0043B4CA error in the layer ParticlesGPU_Shader_Queue.fx" and when closing vvvv: "Exception EInvalidPointer in module vvvv.exe at 000047C9" or "Exception EAccess violation in module ntdll.dll at 0001B21A access violation at adress 7C91B21A in module 'ntdll.dll'. Write of address 00000010." or "Exception EAccess violation in module vvvv.exe at 0000480C. access violation at adress 0040480C in module 'vvvv.exe' Read of address FFFFFFFC."
is it just me and my NVidia GeForce 8800GTX in DualViewMode (XP32bit) or someone else got the same problem?
when using the last renderer at screen1 it works
@sinus: strange, is this happening with beta25 plus addons pack?
@hrovac: because we are using directly the GPU, there are many problems related to each graphic card. in general i saw that ParticlesGPU on multiscreen is problematic: seams there's no way to share a rendered texture between two different screens; so if we evaluate the position texture (in your case the Queue shader+renderer) on the first monitor, we can't send this texture to the second screen (where there's the final render). Try to keep all the renderer in the same screen (moving the renderer windows), also if just one goes to fullscreen. As i said, it could also depend on your specific graphic card... hope this will help you. best
Natan
I have the same behavior in most of the particles help files (not in the surface one)
Saving the render window in the other monitor works, but not in the 3d particles field, it doesn´t work for me in dualview mode :(
nvidia geforce gtx 260m, xp32.
Hello Dottore, only a question, in the 3d surface shader, would it be possible to adapt it for using flat shading instead phong?
how?
thanks
ari.
hi dottore! yes, i am using the latest version of vvvv and addonpack.
@natan
thank you for explaining the graphiccard issue.
i have another question: can you please explain why the fogis not working?
thanks_alex.
how?
thanks
ari.
i mean if would it be possible to implement the flat shading in the 3d sufaces based in the original grid size?.
Other possibility (but not the same that flat shading) is using the normal map without bicubic interpolation, but when i use a texture on the shader it looks distorted.
thanks
ari.
ahhaha guys, there's a lot of requests coming on here... :D the problem is atm i have no time to customize particle Shaders for every one... that's why in these days i started to write a proper guide to this library and i hope will be ready in few days. in this way you will understand how everything works and will be able to modify and try new things without my help in every step. I thing it's better, it's also more rewarding for you. keep updated!
@sinus: i really don't know how is it possible.. try to reinstall vvvv and check if there's something missing (last directx,net 3.5,...).
Natan
There is a lot of requests because this is an amazing library ;) waiting for your guide to be more independent.
hi, for of all, vvvvery nice library, amazing. I'm triyng to use it in a multiscreen setup but it work only on the first monitor. I think it's something dx related, anyway, do you thing there's a workaround or something i can do to see the particles in all my monitors/projectors? i've tried to make a texture of the final rendering and use it splitted in 2 quads with different transforms, but nothing to do. thx for any hint ;))
@screamer: the only thing comes in my mind is to duplicate the particlesGPU system for each monitor you need. this means duplicate the whole patch containing all the shader cycles and the final renders and to place these duplicated patches one for each screen you need (also with the relative render window). It's not at all the optimized way (and if your particle system it's already heavy in single screen, the whole renderes could be really slow...)but you can try if it works. it would be a clear clue.
hi dottore, i thought the same thing, but i did'nt tried because of the heavy patch. anyway thx for the help, and compliments for the particlesgpu guide ;D
hi, i write here because this seems the much similar contribution to what i'll want to do. so probably dottore is the best one to tell me if it's possible (i tried for a day, then abandoned for my poor ability in hlsl). there's a fantastic fluidsolver (navier stokes) in the amd/ati collection (just a sample in rendermonkey). But the problem is that this shader is a complex multipass shader, with something like 50passes. Should be fantastic to split this passes in a patch with multiple shaders (something similar to the gpu transform approach i think). anyway rendermonkey can be downloaded here: http://developer.amd.com/archive/gpu/rendermonkey/pages/default.aspx#download
bye :)
hi screamer, you should start a new post in the forum about this idea. i spent some thoughts at node10 about a shader version of fluid solver. as you mentioned, it would take many passes... vux told me he's working on some GPGPU navier stroke solver in cuda, that would be really nice and easier... Make a post with all your ideas and online sources, we can have a look at it
thanks again!
Nice update- these are hot.
Sbaaam!
wow!!!
so badass man thankyou so much!
amazing great super yeah wow
magic stuff !
It would be interesting to adapt the new vux behaviours to multipoint attractor, i was checking the Fibo´s multipoint attractor but it use other way to do it...
any idea?
When are we getting this then Vux :)
Next release, got a 3d version i forgot to put as well, so gonna make spreadable too, plus another bonus ;)
Vux for president!
thanks a lot! this is so great. almost completely changed my live :>
is there a way to add a alpha-texture to "ParticlesGPU_SplineMesh" to control the opacity of each spline-geometry?
thx
does anyone have working version of SplineMesh behavior handy for beta 26?
@everyoneishappy:
you have to change 2 shader:
inside bicubic_yresample: all double to float
inside particleGPU_SplaneMesh: change the name of the techniques (PhongPoint, PhongDirectional)(as mentioned here:beta-26-shader-syntax-error))
hey please have a look in this thread: gpu-particles-wrong-clipping-z-buffer-problem
something is not rigth with the ParticlesGPU_3d_Constant_PPcolor.fx or for some oither reason particles are not drawn in the correct depth order.
@Screamer; I fixed the second monitor output by opening all render windows, moving to second monitor, and then minimising back to patch. With changing 'double' to 'float' and changing 'point' to 'pointy' and the other naming fixes, everything now appears to work perfectly on an ATI 4850. Fabulous stuff.
Edit : The first way I tried to fix second head output was DX9Texture > AsVideo > VideoTexture. Worked, halved the frame rate.
Edit 2 : No it doesn't :o/ At least I am having a good look at the actual shader code :oD
would be nice to have an update which works on all cards.
indeed, and also the multipoint attractor would be great...
update version per la 27 ...bravo natan!
@photropik; could you please share your knowledge (or code ;) how you got to work the sprites functions on your ATI?
I am struggling since a week on my HD4870...
cheers
never mind... found my own way. finally-‚gpu-particles-working-on-ati-cards‘#
Hi is it possible to spread the emitter ON/OFF ? Or do I need to create a single shader for each instance? S>
The Uberlibrary!
Hi, just a shout to bring this contribution on the top of the list...
Browsing youtube I found this video: http://www.youtube.com/watch?v=eSWm_VImgFQ
the behaviour of particles is simlar to vux "ParticlesGPU_2d_Dynamic_Attractor_Bounce"
I invite you to download the binary or the source code from the description or below and testing by yourself.
http://www.craigmouser.com/random/cudaparticles.zip http://www.craigmouser.com/random/ParticleEngine.zip
The fact is that this program works across mulpiple heads and multiple cards!
It would be possible to make this library multi-head? Is this a limit of shader architecture in VVVV? Is this a limit of VVVV?
Just to know Thanks for reply.
Wonderful! Thank you :)