field lookup on GPU ??

    Apr 25 2010 | 8:46 pm
    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,

    • Apr 26 2010 | 4:59 am
      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?
    • Apr 27 2010 | 12:49 am
      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!
    • Apr 27 2010 | 4:08 am
      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'
      using HLSL: