[gd_resource type="ShaderMaterial" load_steps=4 format=2] [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; // 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; } void fragment() { ALBEDO = vec3(0.33, 0.81, 0.95); }" [sub_resource type="Image" id=4] data = { "data": PoolByteArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ), "format": "RGBAFloat", "height": 1, "mipmaps": false, "width": 8 } [sub_resource type="ImageTexture" id=3] flags = 0 flags = 0 image = SubResource( 4 ) size = Vector2( 8, 1 ) [resource] shader = SubResource( 1 ) shader_param/canvas_transform = null shader_param/table = SubResource( 3 )