GPU stretched particle

get the current velocity for your function instead.

That’s a very simple integral of your acceleration (gravity), -> startvelocity + acceleration * t = current velocity

some of it is correct, but some of them just spin randomly. is my rotation function correct?

They seem to turn in the right direction, but not the right amount.

@kosmonautgames @Alkher i still cant figure out how to make the stretched & rotation rite. pls help me

Question is why some of them point in the right direction and others rotates around their centers after a while ?
Did you succeed in getting the velocity ?

im still confusing what wrong is my calculation, someone told me im actual calculated in screenspace, so the rotation will rotate at screen space direction. I actually not good in calculation. i just ned someone help me modifier the existing shader with stretched particle and rotation with velocity. @Alkher could you help me? i willing to pay some allowance for your help, and also benefit to this community.

here is my souce

I’ll have a look in the evening when i’m at home :wink:

thank you very much :slight_smile:

I did not see your modifications apart from the texture disk wih an arrow.

If you want I can take look at it as well, but I would like to warn you, image you posted are GPU state aware particles using GPU collisions based on depth buffer and normal buffer, while using render targets to save their state which is then sampled in vertex shader to determine position in next update… it is COMPLETELY different ball game than stateless GPU example you posted… thus if http://community.monogame.net/uploads/default/original/2X/d/d789c3092994d01fd1ac15696576b2e0dbc5582e.png is your end game then you are for quite a ride and particle stretching is least of your problems, then again, if you want, I can take a look at stretching of 3d particles.

yeah the image that i posted involve particle collision, but what im looking now is the velocity rotation and stretching based of velocity. Can you help?

The velocity integral is already in the shader, in ComputeParticlePosition() (explanations are commented in it) where T is ‘normalizedAge’.
You can with all this get the position at current frame-1 and currentframe and as a result get the amount of mouvement between 2 frames.
Problem arises here with the fps you can display. But that 's another thing
The main question here is does your shader uses center of particles and creates quads to drax around this center, or is it fed with the vertices of a quad. The former would be easier to do the particle stretching. But this xna sample uses 4 vertices to feed each particles to the shader, nonetheless it is feasable but wastes computation power to me.

This should have behavior reasonably close to what you posted: http://community.monogame.net/uploads/default/original/2X/d/d789c3092994d01fd1ac15696576b2e0dbc5582e.png

(ofc talking just about stretching and polygon orientation)

If you want shader for this variant then let me know, if you dislike something about this let me know and I can take a look.

With settings closer to what you want:

I am not using data from previous frames, velocity vector is calculated inside shader for given step in world space (from velocity integral as Alkher mentioned), then projected on screen after which rest of vertex position is calculated in screen space. Thus using still same quite efficient system where whole vertex position is calculated purely on GPU.

@Ravendarke the 2nd image is what exactly i looking for. Can i have your email or do you mind to share your code over here?

I am fine with posting it here, I will do it later today, now I am kinda in rush.

Sorry to post a out of context message, but why ths post hav 1.2k views ???

Because it is up since November 2016 and might be something several people are interested in, is this problem for you somehow?

No i was just curious :yum:

I just come in here to see the pretty animations :heart_eyes:

1 Like

i think there is alot of ppl looking for the solution, just no 1 ask before.