I'm trying to use the fragment_shader_ATI extension but I'm having
trouble understanding how to access and output the texture coordinates and texture data. I don't understand these glPassTextureCoordATI and glSampleMapATI functions.

I want to do per pixel diffuse bump mapping with texture0 being the base map, texture1 the bump map and texture2 the normalization cube map.

I tryed something like this for understanding the functions (examples and papers are very rare to find):

But rendering doesn't work with this shader. There is also NO gl error. The base map is correctly bound to texture unit 0. Looks like I don't understand the principles of this extension http://www.opengl.org/discussion_boards/ubb/frown.gif

I don't understand these glPassTextureCoordATI and glSampleMapATI functions.

OK, glPassTextureCoordATI is used when you want the texture coordinate from a particular texture unit/map to be stored in a register.

glSampleMapATI is used when you want to actually use a particular texture coordinate to access a texture map. The return value is the color accessed from the texture map at the specified texture coordinates.

Since basic diffuse bump-mapping doesn't require anything truly special, it's just a simple matter of the following (assuming your conventions for the textures and their coordinates):

Now, you simply do a Dot3 with reg2 and reg1, and multiply that result into reg0.

Humus

03-15-2002, 11:45 AM

Reg0 is where you put the shader output btw.

Jens Scheddin

03-15-2002, 01:26 PM

OK,

thanks to Korval and Humus.
However, it looks like I understood the principles of how to use the functions correctly.

But sadly I'm still running into the same problem:

Even if I only output the base map into register 0 it still renders nothing. Writing the bump map directly into the same register works fine. The texture is correctly bound to texture unit 0! And everything works fine when rendering the basemap with the fragment shader disabled (w/o bump mapping, of course)

May this be a bug in the driver?
I'm using win2k with version 5.13.01.6032 drivers

Thanks again http://www.opengl.org/discussion_boards/ubb/smile.gif

Humus

03-15-2002, 02:26 PM

Are you sure you're providing texture coordinates for all textures and that GL_TEXTURE_2D is enabled for all units etc?

Jens Scheddin

03-15-2002, 02:32 PM

Humus,

yes, I'm completely sure. That was the second thing I thought about.

Another funny thing is that passing GL_TEXTURE0_ARB to register 1 and moving this to the output register works. But then I have my bump map in the register1 (?!). This is very odd to me

Humus

03-15-2002, 05:05 PM

Hmm ... odd.
I suppose you should try to update the drivers. There are 6043 driver floating around, go to rage3d.com for instance to grab them.

Jens Scheddin

03-16-2002, 06:06 AM

Well,

now you may understand why I had doubts on myself http://www.opengl.org/discussion_boards/ubb/smile.gif

After downloading the leaked drivers you told me and running the program I had the same strange results. The I decided to switch everything except the first texture (base map) off and, surprisingly, it worked (rendering the base map only via the fragment shader)!
Then I switched everything step by step on again and it run fine. At least I did the dot3 operations and voila: nice bump mapping on the surface

I can't find any explanation for this phenomina but I'm glad it works now http://www.opengl.org/discussion_boards/ubb/biggrin.gif.
I always did a clean rebuild so that can't be the problem...