godot_heightmap_plugin icon indicating copy to clipboard operation
godot_heightmap_plugin copied to clipboard

Update multisplat16.shader

Open QbieShay opened this issue 3 years ago • 3 comments

My own attempt at more organic blending for the multisplat plugin and preventing hard cuts when painting with low opacity

QbieShay avatar Feb 03 '22 19:02 QbieShay

Could you add comparison screenshots between the old and new shader?

Calinou avatar Feb 03 '22 21:02 Calinou

The pow in the function is to alleviate issues when there are more than 4 textures blending at the same time. If you paint with low opacity brushes with more than 4 textures you'll see abrupt cuts starting to show.

I can't show the assets i tested with but I can show in a clean project later.

As for the names, i have no idea either exactly what they do :D that's why they are not very descriptive. I'm open to any name you will propose ^^

QbieShay avatar Feb 04 '22 12:02 QbieShay

When I have 5+ textures in one area, I often get lines like the dashed line across textures as you can see on the rock faces on the right and left (not the rock cracks). By pushing around the textures more I can eventually brush these out.

image

I inserted the changes to bump into my get_depth_blended_weights() function, however none of them, nor any other parameter in that function affected those line artifacts. They did change other blended edges, but I have no issue with the default blend.

Regarding the functions:

  • 1-sqrt(1-x) is indeed equivalent to 1-pow(1-x,0.5) shown on graphtoy below.
  • x*x is indeed preferable to pow() for reasons discussed here: https://community.khronos.org/t/pow-x-2-different-then-x-x/70839/3
  • x*x*x and x*x*x*x are probably also better than pow for the above reasons.
  • Graphtoy shows the shape of all curves used. 1-sqrt(1-x) is basically a slow linear line with an ease in ending. https://graphtoy.com/?f1(x,t)=1-pow(1-x,0.5)&v1=true&f2(x,t)=1-sqrt(1-x)&v2=true&f3(x,t)=xx&v3=true&f4(x,t)=xxx&v4=true&f5(x,t)=xxxx&v5=true&f6(x,t)=0&v6=false&grid=1&coords=0,0,2.3741360268016223

TokisanGames avatar Feb 09 '22 21:02 TokisanGames