0 votes

I have a project where I want to have two separate materials fade into each other smoothly so it looks natural. What would be the best way to go about doing this? Is there a way to do it automatically with shaders or would I have to implement a solution from scratch? The terrain is procedurally generated so I can't make a new material for each transition, I want to be able to have biomes fade between each other but I want to keep my current chunk system in place. Example Terrain

I want the green and white materials to smoothly fade together

Godot version Godot 3.3.3 Windows 10 64-bit
in Engine by (15 points)

1 Answer

+1 vote
Best answer

I suspect you'll just have to bite the bullet and code yourself a shader.

Really though, it shouldn't be took difficult. You'll need a uniform with a value from 0-1 to control the transition. You'll then need to similarly import the two textures that you want to transition between and then just write yourself a linear interpolation function. Then output the result to your ALBEDO and you're done.

Honestly, it sounds daunting but it's really not that huge a task. Obviously, if you have normals, roughness and so forth then you'll need to repeat the process with that.

Oh, a nice shortcut for you: take your starting texture and convert it to a shader so most of the code will be there for you.

EDIT: silly me, I forgot godot has mix() built in so you don't even have to code the interpolation. And if you want to get fancy with the transition you can use a Tween cpu side.

by (2,156 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.