   CG: Disabling interpolation
  When a texture sampler is used, the color values of the coordinates are interpolated when the texture size is smaller than the area, it is projected onto.But is it possible to control this interpolation in the fragment shader somehow? Or probably disable or replace it by something own?   
Quote:Original post by SeikilosWhen a texture sampler is used, the color values of the coordinates are interpolated when the texture size is smaller than the area, it is projected onto.But is it possible to control this interpolation in the fragment shader somehow? Or probably disable or replace it by something own?If you are using OpenGL, you can set the texture minification and magnification filters to GL_NEAREST, which will disable interpolation of texture values. You don't do this inside the shader however, instead you set them as texture parameters (using glTexParameteri).I am sure you can do the same with D3D, but I don't know the specifics.   ;  In D3D you can do the same thing, see here:device->SetSamplerState( numberOfTextureSampler, D3DSAMP_MINFILTER, D3DTEXF_POINT );device->SetSamplerState( numberOfTextureSampler, D3DSAMP_MAGFILTER, D3DTEXF_POINT );;  It is, in fact, possible to implement your own texture filtering in pixel/fragment shader.Read me.In addition to what the article says, it is nowadays feasible to determine the mip level in the fragment shader by using the derivative instructions (ddx and ddy on D3D) on texture coordinates.If you simply want to disable filtering, set the nearest-point sampling like the other posters have said.   