shader_type spatial; render_mode unshaded, fog_disabled, cull_disabled, depth_draw_never, depth_test_disabled; uniform float room_right=12.3; uniform sampler2D screen_tex:hint_screen_texture,filter_linear_mipmap; uniform sampler2D depth_tex:hint_depth_texture,filter_nearest; void vertex(){POSITION=vec4(VERTEX.xy,1.0,1.0);} void fragment(){ float depth=texture(depth_tex,SCREEN_UV).r; // Godot 4.3 has an orthographic INV_PROJECTION_MATRIX bug (#68878). vec4 view=inverse(PROJECTION_MATRIX)*vec4(SCREEN_UV*2.0-1.0,depth,1.0); view/=view.w; vec3 world=(INV_VIEW_MATRIX*view).xyz; // The full work room remains sharp at every camera orbit and zoom. float outside=max(max(-world.x-8.25,world.x-room_right),abs(world.z)-6.85); float mask=smoothstep(0.0,1.1,outside); mask=max(mask,1.0-smoothstep(-2.2,-1.2,world.y)); vec3 sharp=textureLod(screen_tex,SCREEN_UV,0.0).rgb; vec3 blur=textureLod(screen_tex,SCREEN_UV,5.0).rgb*.20; vec2 pixel=1.0/VIEWPORT_SIZE; for(int i=0;i<12;i++){ float a=float(i)*6.2831853/12.0; vec2 offset=vec2(cos(a),sin(a))*pixel*17.0; blur+=textureLod(screen_tex,SCREEN_UV+offset,4.4).rgb*(.8/12.0); } ALBEDO=mix(sharp,blur*.72,mask); }