Slipgate texture warp

This is a shader I made in an attempt to recreate the slipgates from Quake. There is also an option to warp the screen UVs if you want to make something that looks a bit more like a portal.

Shader code
shader_type spatial;
render_mode unshaded, depth_draw_always; // NO LIGHTING!, "depth_draw_always" to 'fix' Z-ordering

uniform bool warp_ScreenSpace = false;
uniform sampler2D texture_albedo : source_color, filter_nearest;

void fragment() {
	vec2 uv = vec2(0.0);
	
	if(warp_ScreenSpace){
		uv = SCREEN_UV;
	}else{
		uv = UV;
	}
		
	// TODO: ADD NOISE SAMPLER INSTEAD OF USING TRIG?
	
	// TWEAK THE COEFFS AND/OR EQUATION FOR A DIFFERENT WARP PATTERN
	uv.x += sin(uv.y * 1.54 * PI + TIME) * cos(uv.y * 1.31 * PI + TIME) * 0.1; 
	uv.y += cos(uv.x * 1.74 * PI + TIME) * -sin(uv.y * 1.64 * PI + TIME) * 0.1; 

	vec4 color = texture(texture_albedo, uv * 2.0);

	ALBEDO = color.xyz;
	ALPHA = color.a;
}
Tags
quake, slime, slipgate, warp
The shader code and all code snippets in this post are under MIT license and can be used freely. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from Creatorbyte

Pixel Text Shader

Related shaders

Perspective Warp/Skew Shader

FPS view shader with color/texture and metallic

Volumetric Billboards (3D Texture sampled by plane stacking)

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments