field lookup on GPU ??

Joost Rekveld's icon

Hi gurus,

I'm preparing a new project and when surveying the options I was wondering if such a thing as field lookup is possible on the GPU.
I was imagining some kind of agents based model where agents can be gently pushed by a field that they are helping to shape. For this to work on the GPU I'd need some way that the output of a fragment shader can be input to a vertex shader, ideally in the form of texture values at vertex locations.
Am I imagining a holy grail here ? I suppose this is not possible because I'd imagine it would have been all over the place ?

kind regards,

Joost.

efe's icon

Hello Joost:
there is this thread discussing particle systems inside shaders:

For what you want to do I would rather use java or c. Do you want to apply any specific algorithm to the model?

Emmanuel

nesa's icon

Hi Joost,

what you need is probably not what I imagine, but on the modern nvidia/ati graphic cards it's totally possible to sample a texture within a vertex shader.

It works the same way it works in fragment shader - vec4 c = texture2DRect(tex0, texcoord0).

let me know if you need more info!

efe's icon

Hello Nesa:
I would declare textures on the vertex shader in the case of a displacement map(correct me if I am wrong please!) but I am not sure if that is the best way to get an agent based model.
Otherwise, using texturing within the vertex shader is called 'Vertex Texture Fetch'
http://developer.nvidia.com/object/using_vertex_textures.html
using HLSL:
http://catalinzima.spaces.live.com/blog/cns%213D9ECAE1F2DC56EF%21193.entry

Emmanuel