pixelate to bulged grid

uses Squish Sprite by Mateus-Carmo31 (slightly edited) along with a pixelation filter to get a smooth bulge while still pixelating

how to use:

create a scene with a SubViewportContainer as the root, add a SubViewport as its child, and add your desired scene under the SubViewport (you might have to mess with the properties of the SubViewport). add the shader to your SubViewportContainer and mess with the values. (it might look weird in the editor)

Shader code
shader_type canvas_item;

uniform float bulge : hint_range(-1, 1);

uniform vec2 pixelate = vec2(160.0, 90.0);


float bulge_function(float y) {
	return sqrt(1.0 - y*y);
}


void fragment() {
	vec2 uv = UV * 2.0 - 1.0;

	float displacement = 1.0 + bulge * bulge_function(uv.y);
	uv.x /= displacement;

	uv = (uv + 1.0) / 2.0;

	COLOR = texture(TEXTURE, round(uv * pixelate) / pixelate);
}

Live Preview
Tags
bulge, pixelate, warp
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

Related shaders

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments