• Advertisement
Sign in to follow this  

[.net] Shader problem

This topic is 3578 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

I have a vertex shader that I want to use to set the height component of my terrain mesh using an image. The problem is how do I get the pixel data from the image. I was going to use tex2d but it turns out you can only use it in a pixel shader. Thanks

Share this post


Link to post
Share on other sites
Advertisement
From the top of my head, I'd go with one of the following approaches:

1. Preprocess the vertex stream on the CPU before rendering. (perhaps best if texture is static)
2. Pass the coordinates you want to sample from VS to PS and sample there (more overhead, interpolated, dunno if suits you)
3. google Vertex Texture Fetch (requires modern shader capabilities)

Share this post


Link to post
Share on other sites
Thanks for your suggestions. I have looked into the Vertex Texture Fetch and it looks like the way to go. The only problem being that it works differently on ATI & NVidia. It's a pity that the two main manufacturers couldn't keep the interface the same. I am not sure how I am to test the ATI stuff, I don't have one and am not planning on getting one.

Share this post


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

  • Advertisement