Skip to content

Instantly share code, notes, and snippets.

@securas
Created July 16, 2017 11:28
Show Gist options
  • Save securas/5ca2ea11de844f348d92a4b16dc00f71 to your computer and use it in GitHub Desktop.
Save securas/5ca2ea11de844f348d92a4b16dc00f71 to your computer and use it in GitHub Desktop.
replicating Glass Bubbles (Texscreen)
[gd_scene load_steps=4 format=1]
[ext_resource path="res://bubble_shader.tres" type="Shader" id=1]
[ext_resource path="res://bubble.png" type="Texture" id=2]
[sub_resource type="CanvasItemMaterial" id=1]
shader/shader = ExtResource( 1 )
shader/shading_mode = 0
[node name="BackBufferCopy" type="BackBufferCopy"]
transform/pos = Vector2( 482.908, 346.807 )
copy_mode = 1
rect = Rect2( -100, -100, 200, 200 )
[node name="Sprite" type="Sprite" parent="."]
material/material = SubResource( 1 )
transform/pos = Vector2( 1.6427, -2.90363 )
texture = ExtResource( 2 )
[gd_resource type="CanvasItemShader" format=1]
[resource]
_code = {
"fragment": "vec4 normal = tex(TEXTURE,UV);
vec2 offset = normal.xy * 2.0 - vec2(1.0);
COLOR.rgb=texscreen(SCREEN_UV+offset*0.03);
COLOR.a=normal.a;
COLOR.rgb*=vec3(1.0,0.8,0.7);
",
"fragment_ofs": 0,
"light": "",
"light_ofs": 0,
"vertex": "",
"vertex_ofs": 0
}
[gd_scene load_steps=3 format=1]
[ext_resource path="res://Controxl.gd" type="Script" id=1]
[ext_resource path="res://burano.png" type="Texture" id=2]
[node name="Control" type="Control"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 0.0
margin/right = 40.0
margin/bottom = 40.0
script/script = ExtResource( 1 )
[node name="TextureFrame" type="TextureFrame" parent="."]
focus/ignore_mouse = true
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 0.0
margin/right = 40.0
margin/bottom = 40.0
texture = ExtResource( 2 )
stretch_mode = 0
extends Control
# class member variables go here, for example:
# var a = 2
# var b = "textvar"
var b
func _ready():
b = preload( "BackBufferCopy.tscn" ).instance()
add_child( b )
set_process( true )
pass
func _process(delta):
b.set_pos( get_global_mouse_pos() )
[application]
name="lowrezjam_test_shader"
main_scene="res://Control.tscn"
icon="res://icon.png"
[display]
width=800
height=600
stretch_mode="2d"
stretch_aspect="keep"
gen_mipmaps=false
[gd_scene load_steps=4 format=1]
[ext_resource path="res://bubble_shader.tres" type="Shader" id=1]
[ext_resource path="res://bubble.png" type="Texture" id=2]
[sub_resource type="CanvasItemMaterial" id=1]
shader/shader = ExtResource( 1 )
shader/shading_mode = 0
[node name="BackBufferCopy" type="BackBufferCopy"]
transform/pos = Vector2( 482.908, 346.807 )
copy_mode = 1
rect = Rect2( -100, -100, 200, 200 )
[node name="Sprite" type="Sprite" parent="."]
material/material = SubResource( 1 )
transform/pos = Vector2( 1.6427, -2.90363 )
texture = ExtResource( 2 )
[gd_resource type="CanvasItemShader" format=1]
[resource]
_code = {
"fragment": "vec4 normal = tex(TEXTURE,UV);
vec2 offset = normal.xy * 2.0 - vec2(1.0);
COLOR.rgb=texscreen(SCREEN_UV+offset*0.03);
COLOR.a=normal.a;
COLOR.rgb*=vec3(1.0,0.8,0.7);
",
"fragment_ofs": 0,
"light": "",
"light_ofs": 0,
"vertex": "",
"vertex_ofs": 0
}
[gd_scene load_steps=3 format=1]
[ext_resource path="res://Controxl.gd" type="Script" id=1]
[ext_resource path="res://burano.png" type="Texture" id=2]
[node name="Control" type="Control"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 0.0
margin/right = 40.0
margin/bottom = 40.0
script/script = ExtResource( 1 )
[node name="TextureFrame" type="TextureFrame" parent="."]
focus/ignore_mouse = true
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 0.0
margin/right = 40.0
margin/bottom = 40.0
texture = ExtResource( 2 )
stretch_mode = 0
extends Control
# class member variables go here, for example:
# var a = 2
# var b = "textvar"
var b
func _ready():
b = preload( "BackBufferCopy.tscn" ).instance()
add_child( b )
set_process( true )
pass
func _process(delta):
b.set_pos( get_global_mouse_pos() )
[application]
name="lowrezjam_test_shader"
main_scene="res://Control.tscn"
icon="res://icon.png"
[display]
width=800
height=600
stretch_mode="2d"
stretch_aspect="keep"
gen_mipmaps=false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment