Skip to content

Instantly share code, notes, and snippets.

@zmarcos
Last active August 13, 2020 18:24
Show Gist options
  • Save zmarcos/606a37a15373ab0783cd1847b855643b to your computer and use it in GitHub Desktop.
Save zmarcos/606a37a15373ab0783cd1847b855643b to your computer and use it in GitHub Desktop.
Godot XRay 3D
[gd_scene load_steps=13 format=2]
[ext_resource path="res://xray_material.tres" type="Material" id=2]
[sub_resource type="GDScript" id=1]
script/source = "extends Spatial
func _ready():
#($Spatial2/CSGBox.material as SpatialMaterial).albedo_color = Color(1.0,1.0,1.0)
pass
"
[sub_resource type="OpenSimplexNoise" id=2]
[sub_resource type="NoiseTexture" id=3]
noise = SubResource( 2 )
[sub_resource type="OpenSimplexNoise" id=4]
seed = 1
[sub_resource type="NoiseTexture" id=5]
noise = SubResource( 4 )
[sub_resource type="SpatialMaterial" id=6]
albedo_color = Color( 0.803922, 0.101961, 0.101961, 1 )
albedo_texture = SubResource( 3 )
metallic = 0.48
metallic_texture = SubResource( 5 )
[sub_resource type="ProceduralSky" id=7]
[sub_resource type="Environment" id=8]
background_mode = 2
background_sky = SubResource( 7 )
ambient_light_color = Color( 1, 1, 1, 1 )
dof_blur_far_enabled = true
dof_blur_near_enabled = true
dof_blur_near_amount = 0.15
[sub_resource type="Animation" id=9]
length = 8.0
tracks/0/type = "value"
tracks/0/path = NodePath("Camera:transform")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 6, 8 ),
"transitions": PoolRealArray( 0.277392, 1, -2 ),
"update": 0,
"values": [ Transform( -3.09086e-08, 3.09086e-08, -1, 0.707107, 0.707107, 0, 0.707107, -0.707107, -4.37114e-08, -1.58548, 0, 0 ), Transform( 0.241845, -0.241845, -0.939693, 0.707107, 0.707107, 0, 0.664463, -0.664463, 0.34202, 0.5, 1, 1 ), Transform( -3.09086e-08, 3.09086e-08, -1, 0.707107, 0.707107, 0, 0.707107, -0.707107, -4.37114e-08, -15, 0, 2 ) ]
}
[sub_resource type="SpatialMaterial" id=10]
next_pass = ExtResource( 2 )
[sub_resource type="SpatialMaterial" id=11]
next_pass = ExtResource( 2 )
[node name="Spatial" type="Spatial"]
transform = Transform( 1, 0, 0, 0, 0.71934, -0.694658, 0, 0.694658, 0.71934, 0, 0, 0 )
script = SubResource( 1 )
[node name="Spatial2" type="Spatial" parent="."]
transform = Transform( 1, 0, 0, 0, 0.927184, -0.374607, 0, 0.374607, 0.927184, 0, 0, 0 )
[node name="CSGBox" type="CSGBox" parent="Spatial2"]
transform = Transform( 0.984766, -0.173883, 0, 0.173883, 0.984766, 0, 4.47035e-08, 2.98023e-08, 1, 2, 2.22778, 1.80559 )
height = 2.46879
material = SubResource( 6 )
[node name="Camera" type="Camera" parent="."]
transform = Transform( -2.38419e-07, 8.9407e-08, -1, 0.707107, 0.707107, -2.98023e-08, 0.707107, -0.707107, -2.38419e-07, -1.58548, 0, 0 )
environment = SubResource( 8 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "anim1"
anims/anim1 = SubResource( 9 )
[node name="CSGSphere" type="CSGSphere" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 2.98023e-08, 0, -2.98023e-08, 1, 8.08803, 3.05699, 2.63762 )
radial_segments = 16
rings = 8
material = SubResource( 10 )
[node name="CSGPolygon" type="CSGPolygon" parent="."]
transform = Transform( 0.117029, -0.195911, -0.973613, 0.564894, 0.819444, -0.0969882, 0.816823, -0.538638, 0.206567, -4.80545, 0.358809, 0.371558 )
polygon = PoolVector2Array( 0, 0, 0, 1, 0.710254, 1.3649, 0.982245, 1.32165, 2, 1, 1, 0, 1, 0 )
mode = 1
spin_degrees = 180.5
spin_sides = 8
material = SubResource( 11 )
[gd_resource type="ShaderMaterial" load_steps=12 format=2]
[sub_resource type="VisualShaderNodeVectorDecompose" id=1]
[sub_resource type="VisualShaderNodeScalarSwitch" id=2]
default_input_values = [ 0, false, 1, 0.25, 2, 0.0 ]
[sub_resource type="VisualShaderNodeColorConstant" id=3]
constant = Color( 1, 1, 0, 1 )
[sub_resource type="VisualShaderNodeColorOp" id=4]
[sub_resource type="VisualShaderNodeFresnel" id=5]
[sub_resource type="VisualShaderNodeScalarOp" id=6]
default_input_values = [ 0, 0.0, 1, 0.9999 ]
operator = 2
[sub_resource type="VisualShaderNodeTexture" id=7]
source = 4
[sub_resource type="VisualShaderNodeInput" id=8]
input_name = "screen_uv"
[sub_resource type="VisualShaderNodeCompare" id=9]
default_input_values = [ 0, 0.0, 1, 0.99, 2, 1e-05 ]
function = 4
[sub_resource type="VisualShaderNodeInput" id=10]
input_name = "fragcoord"
[sub_resource type="VisualShader" id=11]
code = "shader_type spatial;
render_mode depth_test_disable, unshaded, shadows_disabled, ambient_light_disabled;
void vertex() {
// Output:0
}
void fragment() {
// Fresnel:15
bool n_in15p2 = false;
float n_in15p3 = 1.00000;
float n_out15p0 = n_in15p2 ? (pow(clamp(dot(NORMAL, VIEW), 0.0, 1.0), n_in15p3)) : (pow(1.0 - clamp(dot(NORMAL, VIEW), 0.0, 1.0), n_in15p3));
// Color:12
vec3 n_out12p0 = vec3(1.000000, 1.000000, 0.000000);
float n_out12p1 = 1.000000;
// ColorOp:13
vec3 n_out13p0 = vec3(1.0) - (vec3(1.0) - vec3(n_out15p0)) * (vec3(1.0) - n_out12p0);
// Input:4
vec3 n_out4p0 = vec3(SCREEN_UV, 0.0);
// Texture:3
float n_out3p0;
float n_out3p1;
{
float _depth = texture(DEPTH_TEXTURE, n_out4p0.xy).r;
n_out3p0 = _depth;
n_out3p1 = 1.0;
}
// Input:7
vec3 n_out7p0 = FRAGCOORD.xyz;
// VectorDecompose:10
float n_out10p0 = n_out7p0.x;
float n_out10p1 = n_out7p0.y;
float n_out10p2 = n_out7p0.z;
// ScalarOp:20
float n_in20p1 = 0.99990;
float n_out20p0 = n_out10p2 * n_in20p1;
// Compare:5
bool n_out5p0 = n_out3p0<n_out20p0;
// ScalarSwitch:11
float n_in11p1 = 0.25000;
float n_in11p2 = 0.00000;
float n_out11p0;
if(n_out5p0)
{
n_out11p0 = n_in11p1;
}
else
{
n_out11p0 = n_in11p2;
}
// Output:0
ALBEDO = n_out13p0;
ALPHA = n_out11p0;
}
void light() {
// Output:0
}
"
graph_offset = Vector2( 0, 64.8225 )
flags/ambient_light_disabled = true
flags/depth_test_disable = true
flags/shadows_disabled = true
flags/unshaded = true
nodes/vertex/0/position = Vector2( 400, 200 )
nodes/fragment/0/position = Vector2( 1060, 40 )
nodes/fragment/3/node = SubResource( 7 )
nodes/fragment/3/position = Vector2( 260, 200 )
nodes/fragment/4/node = SubResource( 8 )
nodes/fragment/4/position = Vector2( 20, 200 )
nodes/fragment/5/node = SubResource( 9 )
nodes/fragment/5/position = Vector2( 560, 200 )
nodes/fragment/7/node = SubResource( 10 )
nodes/fragment/7/position = Vector2( 20, 340 )
nodes/fragment/10/node = SubResource( 1 )
nodes/fragment/10/position = Vector2( 260, 340 )
nodes/fragment/11/node = SubResource( 2 )
nodes/fragment/11/position = Vector2( 780, 240 )
nodes/fragment/12/node = SubResource( 3 )
nodes/fragment/12/position = Vector2( 680, 120 )
nodes/fragment/13/node = SubResource( 4 )
nodes/fragment/13/position = Vector2( 840, 40 )
nodes/fragment/15/node = SubResource( 5 )
nodes/fragment/15/position = Vector2( 400, 60 )
nodes/fragment/20/node = SubResource( 6 )
nodes/fragment/20/position = Vector2( 480, 400 )
nodes/fragment/connections = PoolIntArray( 4, 0, 3, 0, 5, 0, 11, 0, 11, 0, 0, 1, 13, 0, 0, 0, 7, 0, 10, 0, 3, 0, 5, 0, 10, 2, 20, 0, 20, 0, 5, 1, 15, 0, 13, 0, 12, 0, 13, 1 )
[resource]
shader = SubResource( 11 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment