Sign in to follow this  
mlt

ATI 1950 PRO no texture fetching?

Recommended Posts

I have an ATI 1950 PRO graphics card. I am trying to implement displacement mapping in the vertex shader and I therefore do a lookup in a height_map:
struct vertex_input
{
  float4 position  : POSITION;  
  float4 normal	   : NORMAL;
  float2 uv        : TEXCOORD0;  
};

struct vertex_output
{
  float4 position : POSITION;
  float tex1     : TEXCOORD1;  
};

vertex_output main(  
        vertex_input       IN 
      , uniform float4x4   ModelViewProj  
      , uniform float      du
      , uniform float      dv
      , uniform sampler2D  heightmap
)
{
	vertex_output OUT;
        float4 h = tex2D(heightmap, IN.uv);	
...
...
}

But I get an error at runtime that the vertex program could not be created. If I outcomment the call to tex2D it runs fine. I have heard that texture fetching are not working for some ATI cards, is that the reason that I get an error?

Share this post


Link to post
Share on other sites
Vertex texture fetch is not supported on the X1950. It's a required feature of DX10, but not DX9. As such, it's implemented as a proprietary extension on the Geforce 6/7 series. But from what I hear, it's far too slow to be of any real use anyway.

Share this post


Link to post
Share on other sites
Ok I have now inserted my old GF 7600 GS card and now it works (wierd since ATI X1950 PRO is a much better card). But I don't think my GF7600 GS is able to run DX10 so how come it works?

Share this post


Link to post
Share on other sites
Doing texture fetches in a shader to use a heightmap is the wrong way to go. Typically, the heightmap is turned into a mesh at load time. Since the heightmap doesn't change, there's no point in resampling it every frame in a vertex shader. And even if the heightmap does change, it'll likely be infrequent enough that you can just generate the mesh again.

Share this post


Link to post
Share on other sites
No. When you load your program, use the height map to displace the vertices in the mesh, and store the mesh somewhere. Then you can just render your pre-displaced mesh normally without having to do a texture lookup in the vertex shader.

Share this post


Link to post
Share on other sites
Ok but that just moves the displacement problem to the CPU instead of the GPU right? I thought the whole point was to make the process faster doing the displacement on the GPU.

Share this post


Link to post
Share on other sites
Quote:
Original post by mlt
Ok but that just moves the displacement problem to the CPU instead of the GPU right?

Yes

Quote:
I thought the whole point was to make the process faster doing the displacement on the GPU.

Yes. But this is NOT your case.

This is because that's when the CPU needs to do the displacement EACH AND EVERY frame. So translating the problem to the GPU speeds up the process.
However, you need to compute the displacement in only ONE frame (usually at start up).
The GPU doesn't suppport doing this once and saving the result forever. Therefore the only slowdown you will get for doing this in the CPU is when displaying the "Loading..." screen.
That's the whole idea of precomputing
Remember, usually "precomputing" is better than "real-time" (most cases and scenarios)

Cheers
Dark Sylinc

Edit: Sorry for the Caps Lock, but I think it highlights the point better, I didn't want to offend anybody

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