2021-12-26 11:39:56 +01:00
[gd_resource type="ShaderMaterial" load_steps=3 format=2]
[ext_resource path="res://Bullshit/THIS SHOULD FIX IThoefully.tres" type="Texture" id=1]
2021-12-15 20:58:46 +01:00
[sub_resource type="Shader" id=1]
code = "shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_disabled,skip_vertex_transform;
uniform mat3 canvas_transform;
uniform sampler2D table : hint_albedo;
vec4 indx(int i) {
//return vec4(1.0, 1.0, 0.0, 1.0);
return textureLod(table, vec2(float(i) * 0.125 + 0.0625), 0);
}
void vertex() {
vec4 row0;
vec4 row1;
vec4 row2;
vec4 row3;
if (VERTEX.z >= 0.0) {
row0 = vec4(indx(0).x, indx(0).y, indx(0).z, indx(0).w);
row1 = vec4(indx(1).x, indx(1).y, indx(1).z, indx(1).w);
row2 = vec4(indx(2).x, indx(2).y, indx(2).z, indx(2).w);
row3 = vec4(indx(3).x, indx(3).y, indx(3).z, indx(3).w);
}
else {
row0 = vec4(indx(4).x, indx(4).y, indx(4).z, indx(4).w);
row1 = vec4(indx(5).x, indx(5).y, indx(5).z, indx(5).w);
row2 = vec4(indx(6).x, indx(6).y, indx(6).z, indx(6).w);
row3 = vec4(indx(7).x, indx(7).y, indx(7).z, indx(7).w);
}
mat4 crank_matrix = mat4(row0, row1, row2, row3);
vec4 pre = vec4(VERTEX, 1.0) * crank_matrix;
vec3 transformed_xy = vec3(pre.xy, 1.0) * transpose(canvas_transform);
vec4 post = vec4(transformed_xy.x, transformed_xy.y, pre.z, pre.w);
POSITION = post;
VERTEX = (post / post.w).xyz;
2021-12-21 21:40:04 +01:00
// vec3 tran = vec3(VERTEX.xy, 1.0) * transpose(canvas_transform);
// vec4 pos_t = vec4(tran.x, tran.y, VERTEX.z, 1.0);
// POSITION = pos_t;
// VERTEX = (pos_t / pos_t.w).xyz;
2021-12-15 20:58:46 +01:00
}
void fragment() {
ALBEDO = vec3(0.33, 0.81, 0.95);
}"
[resource]
shader = SubResource( 1 )
2021-12-31 17:22:58 +01:00
shader_param/canvas_transform = Basis( 0.423164, 0.356665, -0.252057, 0.508395, -0.603185, -0.0647715, 0, 0, 1 )
2021-12-26 11:39:56 +01:00
shader_param/table = ExtResource( 1 )