spimort / TerraBrush

MIT License
698 stars 27 forks source link

Low resolution texture paint #145

Closed lucasthomaz97 closed 1 month ago

lucasthomaz97 commented 1 month ago

image

i'm making a proof of concept of my game graphics, i'm using clear colors since my game is going towards a cel-shaded art style. i'm setting the textures as gradient textures 1d with 1px width, just to handpaint a color, but it's getting this darken transition between the colors and it's pretty pixelated, how can i pass through it? I'm also using a really simple custom shader that just adds fresnel effect and cartoon lightning to the terrain. Can i raise the resolution of this texture? Can i get rid of this filtering in any configuration of the addon?

spimort commented 1 month ago

Not "built in" but there are ways! With a custom shader, what you could do is to change the filter on the splatmaps :

For example, this is the regular Terrain : image

If I change the filter on the splatmaps : image

Your custom shader should be based on the file "heightmap_clipmap_shader_include.gdshaderinc".

Instead of having this :

uniform sampler2DArray Splatmaps : repeat_disable;

It should be like this :

uniform sampler2DArray Splatmaps : repeat_disable, filter_nearest_mipmap;

Let me know if this helps!

lucasthomaz97 commented 1 month ago

well, it helps, but not fully. the filter is gone, but the texture is too pixelated, how can i raise only the albedo texture resolution? image

spimort commented 1 month ago

It's because when you paint, the brush has transparency. If you hold the paint brush for a longer time, it will fill out the transparent blocks.

You could use this brush which does not really have transparency : image

If needed, you can create custom brushes. You can configure the custom brushes folder here : image

Let me know if this helps!

lucasthomaz97 commented 1 month ago

image By using the square brush it really made the color merge disapear, but it keeps being pixelated as you can notice in this print. is there anywhere in code i can raise the resolution?

spimort commented 1 month ago

I just realized what you meant by raising the resolution, my bad! But no, sadly, right now the splatmaps are 1px per meter, it's not possible to change the resolution right now 🫤

It would not be impossible to add, but it would requires some changes that's for sure.

lucasthomaz97 commented 1 month ago

Ok, thanks.

spimort commented 1 month ago

I think for now, we can close the issue right? You can always open a dedicated one for terrain resolution if this is something you really need (it does not mean we'll do it but we will have it logged)! 🙂

lucasthomaz97 commented 1 month ago

Where in the code you set the resolution?

spimort commented 1 month ago

In the file ZoneUtils.cs, the size of the image is being decided with the size of the zones. For example, the function CreateSplatmapImage create an image the size of each zones (so 1px = 1meter).

But that's half of the problem because we also need to make sure that we can paint on each pixels if we change the resolution. And that the shaders works fine as well.

lucasthomaz97 commented 1 month ago

Ok, i'll check it