Sign in to follow this  
MindGames

[.net] Shader problem

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this