Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
NoTitleGamesOfficial opened this issue Apr 29, 2024 · 2 comments

Comments

@NoTitleGamesOfficial
Copy link

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 :)

@Zylann
Copy link
Owner

Zylann commented Apr 29, 2024

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.

@NoTitleGamesOfficial
Copy link
Author

NoTitleGamesOfficial commented Apr 29, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants