I’ve been playing around with 3D textures to produce color effects, but the edges of 2D textures with a 3D texture pass produce odd extra coloring artifacts, especially when not horizontal or vertical. Attached I have an image of two shaders with the same texture, the first one the default texture unlit and the second the same texture sampled through the identity 3D texture.
Nothing wrong with the shader. But you need to disable the mipmaps on your 3D texture.
GPUs determine the appropriate mipmap to use when sampling a texture by how much its UVs change within each 2x2 pixel group. At the edge of a color change, the color value from the original texture is changing significantly, thus the “UVs” for the 3D texture are changing significantly, and it’s dropping to a lower mip map. Since you’re going from white (1,1,1) to a solid color or black (0,0,0), ands UVs use the largest change within the pixel quad to determine the mip map, you’re always sampling from the smallest mip. So basically a 1x1 middle grey.
That worked! Just had to change that boolean in the constructor. Thanks for your help and for all your other posts helping other people (that also later helped me)