Balatro Background Shader

shader toys: https://www.shadertoy.com/view/XXtBRr

fire shader: here

Shader code
shader_type canvas_item;
//took it directly from balatro source code
//buy balatro now: https://www.playbalatro.com


uniform highp float spin_rotation_speed = 2.0;
uniform highp float move_speed = 7.0;
uniform highp vec2 offset = vec2(0., 0.);
uniform highp vec4 colour_1 : source_color = vec4(0.871, 0.267, 0.231, 1.0);
uniform highp vec4 colour_2 : source_color = vec4(0.0, 0.42, 0.706, 1.0);
uniform highp vec4 colour_3 : source_color = vec4(0.086, 0.137, 0.145, 1.0);
uniform highp float contrast = 3.5;
uniform highp float lighting = 0.4;
uniform highp float spin_amount = 0.25;
uniform highp float pixel_filter = 740.;
uniform bool is_rotating = false;
#define SPIN_EASE 1.0


vec4 effect(vec2 screenSize, vec2 screen_coords){

	highp float pixel_size = length(screenSize.xy) / pixel_filter;
    highp vec2 uv = (floor(screen_coords.xy*(1./pixel_size))*pixel_size - 0.5*screenSize.xy)/length(screenSize.xy) - offset;
    highp float uv_len = length(uv);


    highp float speed = (spin_rotation_speed*SPIN_EASE*0.2);
	if(is_rotating){
		speed = TIME * speed;
	}
	speed += 302.2;
    highp float new_pixel_angle = (atan(uv.y, uv.x)) + speed - SPIN_EASE*20.*(1.*spin_amount*uv_len + (1. - 1.*spin_amount));
    highp vec2 mid = (screenSize.xy/length(screenSize.xy))/2.;
    uv = (vec2((uv_len * cos(new_pixel_angle) + mid.x), (uv_len * sin(new_pixel_angle) + mid.y)) - mid);

    uv *= 30.;
    speed = TIME*(move_speed);
	highp vec2 uv2 = vec2(uv.x+uv.y);

	for(int i=0; i < 5; i++) {
		uv2 += sin(max(uv.x, uv.y)) + uv;
		uv  += 0.5*vec2(cos(5.1123314 + 0.353*uv2.y + speed*0.131121),sin(uv2.x - 0.113*speed));
		uv  -= 1.0*cos(uv.x + uv.y) - 1.0*sin(uv.x*0.711 - uv.y);
	}


    highp float contrast_mod = (0.25*contrast + 0.5*spin_amount + 1.2);
	highp float paint_res = min(2., max(0.,length(uv)*(0.035)*contrast_mod));
    highp float c1p = max(0.,1. - contrast_mod*abs(1.-paint_res));
    highp float c2p = max(0.,1. - contrast_mod*abs(paint_res));
    highp float c3p = 1. - min(1., c1p + c2p);
	
	highp float ligth = (lighting - 0.2) * max(c1p*5. - 4., 0.) + lighting * max(c2p*5. - 4., 0.); 
	highp vec4 ret_col = (0.3/contrast)*colour_1 + (1. - 0.3/contrast)*(colour_1*c1p + colour_2*c2p + vec4(c3p*colour_3.rgb, c3p*colour_1.a)) + ligth;
	return ret_col;
}


void fragment() {
    vec2 uv = UV;
	COLOR *= effect(TEXTURE_PIXEL_SIZE, uv);
}
Live Preview
Tags
balatro, canvas, game, GLSL
This shader is a port from an existing Shadertoy project. Shadertoy shaders are by default protected under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) license unless anything else has been stated by the author. For more info, see our License terms.

More from xxidbr9

Related shaders

guest

10 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
aplove
aplove
1 year ago

this didn’t work for me, says that polarcoords is not defined

this one does work though:
https://godotshaders.com/shader/balatro-paint-mix/

Woo.
Woo.
10 months ago

Hey OP, I’m new to Godot and I’m wondering if there’s an issue with this shader as it seems to crash my engine whenever I add it to the scene. I added it as a material of a meshinstance2d, a child of a canvaslayer. It shows up and works fine, it just keeps crashing my engine. (using 4.4.1 Stable)

Woo.
Woo.
10 months ago
Reply to  xxidbr9

Kk I’ll try,
*btw kamu org indo jg ya wkwkwk

Voidstack
10 months ago

https://enosistudio.com/unity-balatro-background-effet-with-shader-graph/
I adapted this shader for unity shader graph! thank you very much

阿尔玛不是一般人2

Twój blog pomógł mi rozwinąć się zawodowo.

足球比分
1 month ago

24小時即時更新nba比分、賽程表,以及NBA球星數據統計和表現分析。

aiyifan
5 days ago

Online casino Australia 2025 – latest legal updates and sites

足球比分
9 hours ago

Online casino Australia real money easy withdrawal – fast cashouts