0 votes

So I set the blend mode of a texture to overlay using shaders and here it is

shader_type canvas_item;
uniform sampler2D overlayTexture;
vec4 overlay(vec4 base, vec4 blend){
 vec4 limit = step(0.5, base);
 return mix(2.0 * base * blend, 1.0 - 2.0 * (1.0 - base) * (1.0 - blend), limit);

void fragment() {
   vec4 base = textureLod(SCREEN_TEXTURE, SCREEN_UV, 0.0);
   vec4 blend = textureLod(overlayTexture, UV, 0.0); 
   COLOR = overlay(base, blend); // overlay the two textures
Godot version v3.5.stable
in Engine by (12 points)

Please log in or register to answer this question.

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.