• Advertisement
Sign in to follow this  

Vertex Shader Question

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi This might not be the right forum, but I'd like to ask a question about vertex shaders. I'd like to get access to a texture or bitmap from within a vertex shader function. I'd like to get the colour value of the texel at the texcoord position of the vertex and use it in the vertex shader for something else. Does anyone know if this is possible? Thanks

Share this post


Link to post
Share on other sites
Advertisement
vertex texture fetches are available on modern hardware (sm3 hw). however it is a slow operation.

Share this post


Link to post
Share on other sites
What I'm investigating is whether I can put most of the work of terrain height calculation (for a geo clipmap implementation) onto the card in the form of a vertex shader.

If I have, for instance, a 65x65 patch as the most detailed patch around the viewer (ignoring all the distant patches for clarity), I'd like the x and z coords of them to stay static and the y coord to be gotten from a texture heightmap lookup within the shader.

Then, I can supply a different texture each frame for the lookup. When the camera moves (translates), it will move around the texture using some kind of wrapping or scrolling technique in the texture. The shader will calculate the height vertices from the texel colour in the texture at the vertex' tex coords.

Does that sound like it might be fast or am I barking up the wrong tree? It means the vertex buffers or index buffers never have to change wherever you are on the map, other than inside the shader. When you come to the edge of a texture, you could just swap a new one in for continuity.

Does anyone know what the current best way to achieve a detailed and fast terrain is? I know there are dozens of methods, but what are the lastest next-gen games using?

Share this post


Link to post
Share on other sites
What next gen games are using isn't common knowledge.

Texture access in shaders is slow on GeForce 6x00 and 7x00, and isn't supported on Radeon X1x00 or earlier. My guess is that it'd be reasonably fast on the DX10 cards (GeForce 8x00, Radeon 2x00), since they share pixel and vertex computational resources.

You can simulate this to an extent in a way that's compatible with older hardware using a second stream of Y data, which you can offset into.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement