#How to apply shader

2 messages · Page 1 of 1 (latest)

mental pond
#

uniform sampler2D dissolve_texture : source_color;
uniform float dissolve_value : hint_range(0,1);
uniform float burn_size: hint_range(0.0, 1.0, 0.01);
uniform vec4 burn_color: source_color;

void fragment(){
    vec4 main_texture = texture(TEXTURE, UV);
    vec4 noise_texture = texture(dissolve_texture, UV);
    
    // This is needed to avoid keeping a small burn_color dot with dissolve being 0 or 1
    // is there another way to do it?
    float burn_size_step = burn_size * step(0.001, dissolve_value) * step(dissolve_value, 0.999);
    float threshold = smoothstep(noise_texture.x-burn_size_step, noise_texture.x, dissolve_value);
    float border = smoothstep(noise_texture.x, noise_texture.x + burn_size_step, dissolve_value);
    
    COLOR.a *= threshold;
    COLOR.rgb = mix(burn_color.rgb, main_texture.rgb, border);
}```
So I tried  to use the dissolve effect i found in this video https://youtu.be/Alwy-TH0WzE?si=8y6Ubjo_BfgLn-S7
But when I attach the shader to sprite2D the texture is just gone and idk how to even play the dissolve effect

Balatro is a super cool and juicy game and I wanted to recreate some of his effects in Godot

Checkout the source code: https://github.com/MrEliptik/godot_ui_components

🎓 Learn how to make JUICY games 👇
https://shorturl.at/eIT36

👤 SOCIALS

💰 One time donation: https://ko-fi.com/mreliptik
💰 Support me on Patreon: http...
▶ Play video
sturdy seal
#

the shader seems to utilize a texture for the shape of the dissolve. and that texture can't really be included in the shader code. So you should look at the tutorial and find what texture they used inside the uniform dissolve_texture.