Hello everyone. When I make a shader with GrabPass, resulting _GrabTexture has a bilinear filtering and I can’t make what I want. How to change texture filtering inside the shader?
I haven’t found the answer in the internet and in unity documentation. Hope you can help me.
You unfortunately can’t, unless you’re fine with limiting yourself to shader model 4.0+ and using Texture2D.Load(int3 location)
Your other options are replacing grab pass with the more customizable Command Buffers or simply making sure your sample locations fall on the exact center of texels, which can be best done by offseting the pixel’s position only by integer multiplies of the texel size.
No guarantees on this! But it’s an idea to try. On the other texture, set the settings to Point filtering. If it doesn’t work, you should be able to do the same with just sampler2D _GrabTexture, but as far as I remember, it’s defined that way…