Marcis
(Marcis)
1
Hi,
How to vertex paint pixelated textures without having the gradient visible? Adjusting the contrast doesn’t help it just creates artifacts.
This example was achieved with height lerp. Ideally I would only want the edges of the painted areas to be pixelated without any gradient whatsoever.
This plane is 400 units in size and I can not increase polygon count.
Thanks in advance
Hi, I know this is really old but maybe someone will find this useful.
I found this post: unity - Cutout fragment shader pixels arent square - Game Development Stack Exchange (someone had similar problem in unity)
and I basically just copied code in that post and pasted it into custom node, here is the result:
It isn’t perfect but still better than nothing.
For anyone interested, this is the code, you just need to create 3 inputs: UVMap,VertexCol and TextureRes;
float2 texelPos = UVMap*TextureRes;
float2 texelCenter = floor(texelPos) + 0.5f;
float2 delta = (texelCenter - texelPos) * (1.0f/TextureRes);
float2 gradient = float2(ddx(VertexCol), ddy(VertexCol));
float2x2 uvToScreen;
uvToScreen[0]=ddx(UVMap);
uvToScreen[1]=ddy(UVMap);
float determinant = uvToScreen[0][0] * uvToScreen[1][1] - uvToScreen[0][1] *uvToScreen[1][0];
float2x2 result = {uvToScreen[1][1], -uvToScreen[0][1], -uvToScreen[1][0],uvToScreen[0][0]};
float2x2 ScreenToUV;
ScreenToUV = result * 1.0f/determinant;
gradient = mul(ScreenToUV, gradient);
return VertexCol+dot(gradient,delta);
Here is the setup:
Hope this helps!