Dynamic pixel art skin

Hmm that doesn’t seem right… Have you modified the shader at all?

no? this is the script
shader_type canvas_item;

uniform sampler2D Skin; // assign skin sprite in inspector
uniform vec2 SkinDimension; // assign length and width of skin sprite in editor

void fragment()
vec4 map = texture(TEXTURE, UV); // collect RGBA of pixel from sprite texture
vec2 scaledUV = (map.rg * 255.0 + 0.5) / SkinDimension; // scale the UV to the 64 x 64 “skin” sprite
vec4 color = texture(Skin, scaledUV); // collect the rgba from the ‘skin’ sprite based on the scaledUV
color.a = map.a; // set original sprite transparency
COLOR = color; // set new color

Alright well something else seems to be going wrong here. Skin dimensions’ parameter definitely should be at 24x24. What are you using that UV gradient for?

this is at 24x24

the UV gradient is used for me to draw less

Ok that looks like it might actually be working. What does your sprite sheet look like at this point?




Try this sprite sheet:

is not perfect but a can fixit but what exaxtly did you do

o and thank you so muche
edit just found a way do make this with python

The UV gradient you were using was too broad. The top right corner of yours was (0, 0, 0, 255), which is correct. However, the bottom right of yours was (255, 255, 0, 255). Since your texture only is 24x24, you want the bottom right corner of you UV to be (23, 23, 0, 255)

thank you so much this will save me so much time in 2d and 3d games

Glad its working for you! Here’s a 64x64 pixel gradient from (0, 0, 0, 255) on the top left to (63, 63, 0, 255) on the bottom right.


This would be used for a skin texture that is 64x64 in resolution, but can be cut down to any smaller resolution. Simply copy an area that matches your resolution starting from the top left.

This is more a resource for anyone else who stumbles on this post.

man you need to be a youtuber your great at this you have talent