I used effect.Parameter[" "].SetValue(..) to set the value for vertexShaderInput. How can I get and set for the output since my output is the new position.. how can I get the output in my main program. Thanks.. jaja

Re: how to get output from vertex shadder?

CPU stores vertex data in a vertex buffer, or passes it to DrawUserPrimitives (btw. your vertex shader input comes from one of these vertex data sources: you cannot specify the vertex data using effect parameters)

Vertex shader runs

Vertex shader outputs are rasterized to form triangles

Triangles are rendered by the pixel shader

Pixel shader outputs are written to the framebuffer

There is no way to read any of these intermediate results back to the CPU. If you draw into a rendertarget, you can then GetData to fetch back the contents of this target after all your rendering has completed, but that will cause a pipeline stall, so is not usually a good idea if you care about performance.

Re: how to get output from vertex shadder?

Do you have any suggestion or example of collision among particles on GPU? I'm simulating deformable objects and I would like to detect collision on the GPU. I need some example how to setup to find the distance between each point to detect collision. What I understand is that vertexes are vertex data or vertex buffer. How can we loop to each point on GPU? Similar to this peice of code on CPU. Do I have to do multi-pass .. somehow? But how? please help..

Re: how to get output from vertex shadder?

This kind of thing is possible, at least on the more recent higher end GPUs, but far from trivial. I get the impression you're kind of new to shader programming? (my apologies if not...) in which case I probably wouldn't start with something as complicated as this - you really need a deep understanding of the GPU pipeline and shader capabilities before you can tackle something so complicated as simulating physics on the GPU.