Last active
July 10, 2025 22:23
-
-
Save DenisBelmondo/916985710eb4a127e1a787b1e0308cf1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// by Mason "Belmondo" | |
// based off of Mohsen Zare's implementation | |
shader_type spatial; | |
render_mode cull_back, depth_draw_always, specular_disabled; | |
uniform sampler2D albedo_texture : filter_nearest, repeat_enable, source_color; | |
uniform vec2 uv1_offset; | |
varying vec3 pos; | |
varying vec3 normal; | |
varying vec2 uv; | |
void vertex() { | |
pos = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz; | |
normal = abs(normalize(MODEL_NORMAL_MATRIX * NORMAL)); | |
uv = mix(pos.xy, pos.zy, round(normal.x)); | |
uv = mix(uv, pos.xz, round(normal.y)); | |
uv.x *= sign(dot(NORMAL, vec3(-1, 1, 1))); | |
uv.y *= sign(dot(normal, vec3(-1, 1, -1))); | |
uv += uv1_offset; | |
} | |
void fragment() { | |
vec4 color = texture(albedo_texture, uv); | |
ALBEDO = color.rgb; | |
if (color.a < 1.0) { | |
ALPHA = color.a; | |
} | |
} | |
//void light() { | |
// // Called for every pixel for every light affecting the material. | |
// // Uncomment to replace the default light processing function with this one. | |
//} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment