Thursday, December 29, 2005

[GPU] anisotropic settings and tex2D / tex2Dlod

I remembered that I had already encountered an issue with the ansiotropic filtering settings (see my previous post) and wanted to follow up on it.

I was doing texture lookups through indirections. The last texture was bilinearly interpolated but did not have a MIP-mapping pyramid (MIP-mapping was also disabled in the sampler). Using tex2D, strange artifacts were appearing along the texture coordinate discontinuities. (The coordinates were coming from a first texture sampled in nearest mode). It really looked as if the small explicit integration of anisotropic filtering was performed, even though filtering was disabled in the sampler. Of course, through indirection textures this integration could not work properly, thus producing artifacts. Now, the interesting part is that tex2Dlod was behaving properly. So replacing tex2D(Sampler,tc) by tex2Dlod(Sampler,float4(tc,0,0)), solved the problem. Unfortunately, tex2Dlod is usually a bit more expensive and also requires a few more instructions to set up the float4 before lookup. (A better solution might be to turn off anisotropic filtering in the driver settings - depending on whether you are planning to distribute your application or not).

No comments:

Post a Comment