This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Node | |
""" | |
An autoload singleton for pixel perfect rendering of the game. | |
Set this script as an autoload. | |
`base_size` - Is the target size of the viewport. The viewport will scale up to fit the largest | |
possible integer multiple of this size within the window. | |
`expand` - If true the viewport will expand to the edges of the window after scaling up. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shader_type canvas_item; | |
uniform mat4 TRANSFORM; | |
uniform vec2 DEPTH; | |
uniform bool REPEAT_X; | |
uniform bool REPEAT_Y; | |
uniform bool FLIP; | |
void fragment() { | |
// Create the matrix. A workaround is used to modify the matrix's W column |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shader_type canvas_item; | |
uniform bool apply = true; | |
uniform float amount = 1.0; | |
uniform sampler2D offset_texture : hint_white; | |
void fragment() { | |
vec4 texture_color = texture(TEXTURE, UV); | |
vec4 color = texture_color; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on http://www.geeks3d.com/20140213/glsl-shader-library-fish-eye-and-dome-and-barrel-distortion-post-processing-filters/2/ | |
float PI = 3.1415926535; | |
uniform float BarrelPower; | |
vec2 distort(vec2 p) { | |
if(p.x > 0.0){ | |
float angle = p.y / p.x; | |
float theta = atan(angle); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on http://devlog-martinsh.blogspot.com/2011/03/glsl-dithering.html | |
shader_type canvas_item; | |
uniform float scale = 1.0; | |
float find_closest(int x, int y, float c0) | |
{ | |
mat4 dither = mat4(vec4( 1.0, 33.0, 9.0, 41.0), | |
vec4(49.0, 17.0, 57.0, 25.0), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shader_type canvas_item; | |
uniform sampler2D mask; | |
void fragment(){ | |
vec4 col = texture(mask, UV); | |
if(col.a == 0.0){ | |
COLOR = col; | |
} | |
else if (col.a > .99){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shader_type spatial; | |
render_mode skip_vertex_transform, unshaded; | |
//Albedo texture | |
uniform sampler2D albedoTex : hint_albedo; | |
//Geometric resolution for vert snap | |
uniform float snapRes = 15.0; | |
//vec4 for UV recalculation |