Zylann/godot_heightmap_plugin

How can I set smooth texture transitions using Classic4/Lite shader by code?

Opened this issue · 2 comments

I'm still using Godot 3 if that matters.

I would like to have smooth texture transitions from one texture to another, or even mix textures using Classic4 or Classic4Lite shader.

This works as expected and colors a specific position with the first texture:

splatmap.set_pixel(x, z, Color(1,0,0,0));

and this with the second texture:

splatmap.set_pixel(x, z, Color(0,1,0,0));

Now I want to mix both textures and tried something like this:

splatmap.set_pixel(x, z, Color(0.5,0.5,0,0));

but thats not working. I always get the texture with the highest value if I mix them, or if both have the same value, I get the first one (in this case the first texture).

In this case I would get the second texture:

splatmap.set_pixel(x, z, Color(0.2,0.8,0,0));

Any help appreciated :)

I'm still using Godot 3 if that matters.

It matters, as I stopped updating this version for years, which is very old at this point.

splatmap.set_pixel(x, z, Color(0.5,0.5,0,0));

Assuming you use Classic4, that should work. I don't know why it doesn't in your case.
Maybe one thing that could affect it is depth blending: if both textures have the same weight but different heights, then equal weights doesnt necessarily mean there will be 50% of each visible. The one with the highest depth will remain visible for longer.
But if you don't use that feature, then I don't know.

I'm still using Godot 3 if that matters.

It matters, as I stopped updating this version for years, which is very old at this point.

I see, thx for taking your time to help me with that old version :)

splatmap.set_pixel(x, z, Color(0.5,0.5,0,0));

Assuming you use Classic4, that should work. I don't know why it doesn't in your case. Maybe one thing that could affect it is depth blending: if both textures have the same weight but different heights, then equal weights doesnt necessarily mean there will be 50% of each visible. The one with the highest depth will remain visible for longer. But if you don't use that feature, then I don't know.

I gave it a try with either different weights (like 40% / 60%). Also I don't use depth blending.
And I tried it with both Classic4 and Classic4Lite shader.