# HLSL particle fountain - help

This topic is 3905 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello, I have a problem with HLSL vertex shader. It's responsible for showing a particle system - fountain of water drops that are thrown from one point and then fall under the gravity. It works for displaying the particles, however I would like to render the result to the texture as well, so that I could know where the water drops hits the ground (like top view of the fountain). The problem is that I don't know how to translate particles to this texture space :-( Maybe you could help. Thanks in advance Omi.
VS_OUTPUT vs_main(VS_INPUT In)
{
VS_OUTPUT Out;
float3 pos;
// The view matrix for right and up vectors.
pos = particleSize * (In.Pos.x * view_matrix[0] + In.Pos.y * view_matrix[1]);

// S = UT+AT^2/2
float T;  // Time for this particle
float3 U; // The starting velocity vector

// Clamp time to a range defined by the length of the effect
T = frac(In.Pos.z + 0.51 * Time_0_X);

// random startig speeds
U.x = cos(63 * In.Pos.z)*40*particleSpeed;
U.y = 100*particleSpeed;
U.z = sin(163 * In.Pos.z)*40*particleSpeed;

// Work out the acceleration component
float AT = (gravity*T*T)/2;

// Only apply the acceleration component to the y position
pos.y += U.y*T+AT;
pos.x += U.x*T;
pos.z += U.z*T;

// Converting to camera space
Out.Pos = mul(view_proj_matrix, float4(pos, 1));
return Out;
}

EDIT: Please remember to use 'source' tags. [Edited by - jollyjeffers on June 11, 2007 6:58:31 AM]

Any ideas ? :-(

##### Share on other sites
Cannot you just use a standard VS to xform the data?
Then set up an ortho projection with a very limited znear/zfar range (the small plane).
Everything that gets rendered it's hitting the plane.