Hello, i’ve downloaded and played a bit with the ParticlesGPU shader by dottore. I am interested in particular in the ParticlesGPU_2d_Dynamic_FieldTexture.
In this example i understood that the dynamic texture is responsible of the interacion with the particles but i really can’t manage to “duplicate” the default interaction field (the moving rectangle that moves the particles).
My final goal would be to interact with those particles with my hand tracked by a cam, and if more than 1 hand is detected more fields should be added to interact with the particles.
Also i can’t really understand how the dynamic texture interacts with the particles but for now that’s a minor problem…
in this first field texture implementation you have only 1 field texture for all the particles.
but in your case this is not a problem: multiple interaction points doesn’t mean multiple force fields (for example if you look at our work Genesi, in the beginning: there are multiple ripples, and i’m using a single field texture there…).
Everything will be clear if we understand how these texture fields work:
A 2d field texture is a 2d vector field. look at this link: http://en.wikipedia.org/wiki/Vector_field
as you can see from the image on wiki, all depends on the direction and the length of the vector of each space point.
each particle samples the texture (like with the pipet node) and looks how is the force vector in that space point, then moves consequently.
A single 2d vector (http://en.wikipedia.org/wiki/Vector_%28geometry%29)is described by two cartesian coordinates: X and Y.
I store these 2 values in the field texture:
R channel for the x
G channel for the y
so the field texture will be a matrix of vectors/pixels with XY/RG informations.
look at this image: http://cims.nyu.edu/~donev/Teaching/PHY201/worksheet7.3.png
here there is a unique vector field (the whole image), but vectors are set to create many “interaction” points.
this is the way: if you want to interact on a fullscreen particle system you may have to create a field texture that covers the entire render area and then edit the vectors of the field texture using many tracking points (for example using something like the GridPick node).
in the end:
1-track the hands
2- use the tracking position to edit (gridpick > setslice) the vector grid with the velocity (for exmple) of the tracking point itself (framedifference).
3- apply the field texture to the particle system
hope this will help you.
bye
Natan
…damn! i really have to do a good pdf for this ParticlesGPU library… :)
bella Natan, thx very much…
ok i understood the theory… i was trying to help me out by drawing some arrows to indicate the flow of the vector field but indeed i’m doing something wrong…
i’ve posted the patch if you or someone could take a look it would be great :)
the arrow part is on the bottom of the patch near the renderer node!!
thanks again
here i am again, ok i managed to do something more… i did a field that is as big as the renderer and then i sort of modify it’s vectors depending on the position of the hands using as dottore said the gridpick node…
The first problem is that i have a fixed field that covers all the renderer and the only thing that i can modify is the lenght of the vector, i’d like to do a more interesting interaction when the hand passes through the field (for example orient the vector in the direction where the hand in moving or draw an eliptical field, as the default one of this patch, where the hand is)…
The second big problem is that now the renderer is playing at more or less 20 fps…and the particles and all the movement are really slow, i think i’ve complicated something and now everything is soo slow…
I have posted the patch i’ve modified so far and commented the various things i’ve done, can you please have a look at it and point me in the right direction to solve the two above probs??
some updates:
i managed to modify the vector intensity and direction depending on the direction and velocity of the movement of the object/mouse tracked but still i cannot achieve the default effect this patch comes with (the spiral force field) in the point where the hand would interact…
the other big problem is that while using contour to do the tracking (i’m using the help file method for now) everything becomes extremely slow…
i post the patch if someone wants to have a look and maybe give some help, tips&tricks :)
the cause of low performance is video texture to quad to render part. instead of doing this, use a VideoOut (DShow9 Shared Memory) directly connected to the video output of the contour…
look at the patch, it’s faster… :)
Did anyone of you ever find a 3d magnetic-field simulation algorithm that is working in real-time? I cannot find any code about that… But a dynamic plugin would be nice to have.