Page 1 of 1

How to enable texture filtering on one texture, but not others in a material

Posted: Sun Dec 11, 2022 2:49 pm
by LuckyLMJ
I've been working on a little model of the earth. I have a shader which reads a texture to figure out what country is at a specific spot of the world, and recolour it based on that. However, in order for this to work, I have to disable filtering on the textures of the material (as I'm just using a map of each country with their ID as a colour, and filtering would break this).
However, it does make the terrain look pretty bad without the filtering (here's a picture of Italy to show what I mean): https://imgur.com/a/sAJdLSb

Is there a way to disable filtering on one texture in a material, but not others? Alternately, is there a way to pass a texture to a shader without putting it on the material first (and thereby making it not run through the filtering)? A third solution I've considered is filtering the texture in the shader but I have absolutely no idea how to do that.

Re: How to enable texture filtering on one texture, but not others in a material

Posted: Sun Dec 11, 2022 9:04 pm
by LuckyLMJ
Nevermind, I've figured out a solution.

I simply rounded the texture coordinates when fetching the texture at a position in my shader, so that it always gets the centre of the pixel (and thus disables any filtering that may exist).