Pixelart shader works bad on code generated texture

Hi,
I have been trying to make a shader to pixelate objects in shadergraph with some tutorials. The shader is simple and from what I’ve seen it’s a pretty common shader. I have tested this shader with noise nodes and it works perfectly but when I test it with a texture that I generate through code (perlin noise) it looks strange. the pixels are smaller than they should be and the texture colors fill in the spaces between them.

This is how the shadergraph looks:

I’m a bit worn off by the day but,

Shouldn’t it be:

-divide and floor
-then, multiply by the same number? (basically, modulo?)

I’d also check if the generated texture is actually of the proper size - those seams shouldn’t be there. Is it fully opaque?

EDIT: could it be a rounding error?

EDIT: I tested the same URP Sprite 2D ShaderGraph, and I don’t have any issues. I’d doublecheck the texture you’re generating. It’s either smaller or has a transparent border. Or, it’s getting sampled outside the coords and it’s not mirrored/repeating.

1 Like

You were right, changing the texture format to TextureFormat.RGB24 fixed my problem, somehow the Color.Lerp() algorithm was giving translucent colors to the texture.

The seams come from the other texture that I use to shape, they are somewhat ugly due to the unity scaling, in the game they look good.
8676540--1169463--upload_2022-12-20_18-15-38.png