material-maker/addons/procedural_material/pm_editor.tscn
RodZill4 4c75ca8565 Added blend modes + minor fixed
Added blend modes (Dissolve, Multiply, Screen, Overlay, Hard Light, Soft Light).
Fixed color popup position in the GradientEditor.
Fixed initial panoram shown in preview.
2018-07-29 11:55:17 +02:00

724 lines
19 KiB
Plaintext

[gd_scene load_steps=19 format=2]
[ext_resource path="res://addons/procedural_material/pm_editor.gd" type="Script" id=1]
[ext_resource path="res://addons/procedural_material/graph_edit.gd" type="Script" id=2]
[ext_resource path="res://addons/procedural_material/nodes/material.tscn" type="PackedScene" id=3]
[ext_resource path="res://addons/procedural_material/preview.gd" type="Script" id=4]
[ext_resource path="res://addons/procedural_material/panoramas/night.hdr" type="Texture" id=5]
[sub_resource type="Animation" id=1]
length = 1.0
loop = true
step = 0.1
tracks/0/type = "value"
tracks/0/path = NodePath("MaterialPreview/Objects:rotation_degrees")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 1 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Vector3( 0, 0, 0 ), Vector3( 0, 360, 0 ) ]
}
[sub_resource type="CubeMesh" id=2]
custom_aabb = AABB( 0, 0, 0, 0, 0, 0 )
size = Vector3( 2, 2, 2 )
subdivide_width = 0
subdivide_height = 0
subdivide_depth = 0
[sub_resource type="Shader" id=3]
code = "shader_type spatial;
void fragment() {
ALBEDO=vec3(0.5);
}
"
[sub_resource type="ShaderMaterial" id=4]
render_priority = 0
shader = SubResource( 3 )
[sub_resource type="CylinderMesh" id=5]
custom_aabb = AABB( 0, 0, 0, 0, 0, 0 )
top_radius = 1.0
bottom_radius = 1.0
height = 2.0
radial_segments = 64
rings = 4
[sub_resource type="PanoramaSky" id=6]
radiance_size = 2
panorama = ExtResource( 5 )
[sub_resource type="Environment" id=7]
background_mode = 2
background_sky = SubResource( 6 )
background_sky_custom_fov = 0.0
background_color = Color( 0, 0, 0, 1 )
background_energy = 1.0
background_canvas_max_layer = 0
ambient_light_color = Color( 0, 0, 0, 1 )
ambient_light_energy = 1.0
ambient_light_sky_contribution = 1.0
fog_enabled = false
fog_color = Color( 0.5, 0.6, 0.7, 1 )
fog_sun_color = Color( 1, 0.9, 0.7, 1 )
fog_sun_amount = 0.0
fog_depth_enabled = true
fog_depth_begin = 10.0
fog_depth_curve = 1.0
fog_transmit_enabled = false
fog_transmit_curve = 1.0
fog_height_enabled = false
fog_height_min = 0.0
fog_height_max = 100.0
fog_height_curve = 1.0
tonemap_mode = 0
tonemap_exposure = 1.0
tonemap_white = 1.0
auto_exposure_enabled = false
auto_exposure_scale = 0.4
auto_exposure_min_luma = 0.05
auto_exposure_max_luma = 8.0
auto_exposure_speed = 0.5
ss_reflections_enabled = false
ss_reflections_max_steps = 64
ss_reflections_fade_in = 0.15
ss_reflections_fade_out = 2.0
ss_reflections_depth_tolerance = 0.2
ss_reflections_roughness = true
ssao_enabled = false
ssao_radius = 1.0
ssao_intensity = 1.0
ssao_radius2 = 0.0
ssao_intensity2 = 1.0
ssao_bias = 0.01
ssao_light_affect = 0.0
ssao_color = Color( 0, 0, 0, 1 )
ssao_quality = 0
ssao_blur = 3
ssao_edge_sharpness = 4.0
dof_blur_far_enabled = false
dof_blur_far_distance = 10.0
dof_blur_far_transition = 5.0
dof_blur_far_amount = 0.1
dof_blur_far_quality = 1
dof_blur_near_enabled = false
dof_blur_near_distance = 2.0
dof_blur_near_transition = 1.0
dof_blur_near_amount = 0.1
dof_blur_near_quality = 1
glow_enabled = false
glow_levels/1 = false
glow_levels/2 = false
glow_levels/3 = true
glow_levels/4 = false
glow_levels/5 = true
glow_levels/6 = false
glow_levels/7 = false
glow_intensity = 0.8
glow_strength = 1.0
glow_bloom = 0.0
glow_blend_mode = 2
glow_hdr_threshold = 1.0
glow_hdr_scale = 2.0
glow_bicubic_upscale = false
adjustment_enabled = false
adjustment_brightness = 1.0
adjustment_contrast = 1.0
adjustment_saturation = 1.0
_sections_unfolded = [ "Background" ]
[sub_resource type="Shader" id=8]
code = "shader_type canvas_item;
void fragment() {
COLOR = vec4(1.0);
}
"
_sections_unfolded = [ "Resource" ]
[sub_resource type="ShaderMaterial" id=9]
render_priority = 0
shader = SubResource( 8 )
[sub_resource type="Animation" id=10]
resource_name = "maximize"
length = 0.2
loop = false
step = 0.1
tracks/0/type = "value"
tracks/0/path = NodePath("SelectedPreview:rect_position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.2 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Vector2( 2, 194 ), Vector2( 2, 2 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("SelectedPreview:rect_size")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 0.2 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Vector2( 64, 64 ), Vector2( 256, 256 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("MaterialPreview:render_target_update_mode")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0.2 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 0 ]
}
[sub_resource type="Animation" id=11]
resource_name = "minimize"
length = 0.2
loop = false
step = 0.1
tracks/0/type = "value"
tracks/0/path = NodePath("SelectedPreview:rect_position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.2 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Vector2( 2, 2 ), Vector2( 2, 194 ) ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("SelectedPreview:rect_size")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 0.2 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Vector2( 256, 256 ), Vector2( 64, 64 ) ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("MaterialPreview:render_target_update_mode")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 3 ]
}
[sub_resource type="Shader" id=12]
code = "shader_type canvas_item;
float rand(vec2 x) {
return fract(sin(dot(x, vec2(13.9898, 8.141))) * 43758.5453);
}
vec2 rand2(vec2 x) {
return fract(sin(vec2(dot(x, vec2(13.9898, 8.141)),
dot(x, vec2(3.4562, 17.398)))) * 43758.5453);
}
vec3 rand3(vec2 x) {
return fract(sin(vec3(dot(x, vec2(13.9898, 8.141)),
dot(x, vec2(3.4562, 17.398)),
dot(x, vec2(13.254, 5.867)))) * 43758.5453);
}
float sine(vec2 uv, float count, float sharpness) {
return max(0.0, min(1.0, (0.5+sharpness*0.5*sin(count*3.1415928*2.0*uv.x))));
}
vec2 transform(vec2 uv, float rotate, float scale) {
vec2 rv;
uv -= vec2(0.5);
rv.x = cos(rotate)*uv.x + sin(rotate)*uv.y;
rv.y = -sin(rotate)*uv.x + cos(rotate)*uv.y;
rv /= scale;
rv += vec2(0.5);
return rv;
}
float bricks(vec2 uv, vec2 count, float offset, float mortar, float bevel) {
mortar /= max(count.x, count.y);
bevel /= max(count.x, count.y);
float fract_x = fract(uv.x*count.x+offset*step(0.5, fract(uv.y*count.y*0.5)));
float slope_x = 1.0/(bevel*count.x);
float off = 0.5*mortar/bevel;
float f1 = fract_x*slope_x-off;
float f2 = (1.0-fract_x)*slope_x-off;
float fract_y = fract(uv.y*count.y);
float slope_y = 1.0/(bevel*count.y);
float f3 = fract_y*slope_y-off;
float f4 = (1.0-fract_y)*slope_y-off;
return max(0.0, min(1.0, min(min(f1, f2), min(f3, f4))));
}
float colored_bricks(vec2 uv, vec2 count, float offset) {
float x = floor(uv.x*count.x+offset*step(0.5, fract(uv.y*count.y*0.5)));
float y = floor(uv.y*count.y);
return fract(x/3.0+y/7.0);
}
float perlin(vec2 uv, vec2 size, int iterations, float persistence) {
float rv = 0.0;
float coef = 1.0;
float acc = 0.0;
for (int i = 0; i < iterations; ++i) {
vec2 step = vec2(1.0)/size;
float f0 = rand(floor(fract(uv)*size));
float f1 = rand(floor(fract(uv+vec2(step.x, 0.0))*size));
float f2 = rand(floor(fract(uv+vec2(0.0, step.y))*size));
float f3 = rand(floor(fract(uv+vec2(step.x, step.y))*size));
vec2 mixval = fract(uv*size);
mixval = 0.5*(1.0-cos(3.1415928*mixval));
rv += coef * mix(mix(f0, f1, mixval.x), mix(f2, f3, mixval.x), mixval.y);
acc += coef;
size *= 2.0;
coef *= persistence;
}
return rv / acc;
}
vec2 voronoi(vec2 uv, vec2 size, float intensity) {
uv *= size;
float rv = 10.0;
vec2 point;
vec2 p0 = floor(uv);
for (int dx = -1; dx < 2; ++dx) {
for (int dy = -1; dy < 2; ++dy) {
vec2 p = p0+vec2(float(dx), float(dy));
p += rand2(mod(p, size));
float l = length((uv - p) / size);
l *= l;
if (rv > l) {
rv = l;
point = p;
}
}
}
return vec2(rand(point), rv*length(size)*intensity);
}
float Perlin_f(vec2 uv) { return perlin(uv, vec2(4, 4), 6, 0.35); }
float Bricks_f(vec2 uv) { return bricks(uv, vec2(3, 6), 0.5, 0.05, 0.6); }
vec3 Colorize3_gradient(float x) {
if (x < 0.000000000) {
return vec3(0.000000000,0.000000000,0.000000000);
} else if (x < 0.081818182) {
return vec3(0.000000000,0.000000000,0.000000000)+x*vec3(12.222222328,12.222222328,12.222222328);
}
return vec3(1.000000000,1.000000000,1.000000000);
}
void fragment() {
float Perlin_0_f = Perlin_f(UV+vec2(0.01, 0.0));
float Perlin_1_f = Perlin_f(UV-vec2(0.01, 0.0));
float Perlin_2_f = Perlin_f(UV+vec2(0.0, 0.01));
float Perlin_3_f = Perlin_f(UV-vec2(0.0, 0.01));
vec2 Warp_0_uv = UV+0.300000012*vec2((Perlin_0_f)-(Perlin_1_f), (Perlin_2_f)-(Perlin_3_f));
float Bricks_0_f = Bricks_f(Warp_0_uv);
vec3 Warp_0_rgb = vec3(Bricks_0_f);
float Warp_0_f = dot(vec3(Bricks_0_f), vec3(1.0))/3.0;
vec3 Colorize3_0_rgb = Colorize3_gradient(dot(Warp_0_rgb, vec3(1.0))/3.0);
COLOR = vec4(Colorize3_0_rgb, 1.0);
}
"
[sub_resource type="ShaderMaterial" id=13]
render_priority = 0
shader = SubResource( 12 )
[node name="ProceduralMaterialEditor" type="MarginContainer"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 1.0
anchor_bottom = 1.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
custom_constants/margin_left = 0
script = ExtResource( 1 )
[node name="GraphEdit" type="GraphEdit" parent="." index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 1024.0
margin_bottom = 600.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = true
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
right_disconnects = true
scroll_offset = Vector2( 0, 0 )
snap_distance = 20
use_snap = false
zoom = 1.0
script = ExtResource( 2 )
_sections_unfolded = [ "Mouse" ]
[node name="Material" parent="GraphEdit" index="0" instance=ExtResource( 3 )]
margin_right = 111.0
margin_bottom = 58.0
_sections_unfolded = [ "Anchor", "Margin", "Mouse", "Theme", "slot" ]
[node name="Timer" type="Timer" parent="GraphEdit" index="1"]
process_mode = 1
wait_time = 0.25
one_shot = true
autostart = false
[node name="TexturePreview" type="ColorRect" parent="." index="1"]
visible = false
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 1024.0
margin_bottom = 600.0
rect_min_size = Vector2( 256, 256 )
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
color = Color( 1, 1, 1, 1 )
_sections_unfolded = [ "Material", "Mouse", "Rect" ]
[node name="Preview" type="Container" parent="." index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 1024.0
margin_bottom = 600.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
_sections_unfolded = [ "Mouse" ]
[node name="Preview" type="ViewportContainer" parent="Preview" index="0"]
anchor_left = 1.0
anchor_top = 0.0
anchor_right = 1.0
anchor_bottom = 0.0
margin_left = -274.0
margin_top = 3.0
margin_right = -14.0
margin_bottom = 263.0
rect_min_size = Vector2( 260, 260 )
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
stretch = false
stretch_shrink = 1
script = ExtResource( 4 )
_sections_unfolded = [ "Anchor", "Grow Direction", "Margin", "Mouse", "Rect" ]
[node name="ObjectRotate" type="AnimationPlayer" parent="Preview/Preview" index="0"]
root_node = NodePath("..")
autoplay = "rotate"
playback_process_mode = 1
playback_default_blend_time = 0.0
playback_speed = 0.1
anims/rotate = SubResource( 1 )
blend_times = [ ]
_sections_unfolded = [ "Playback Options" ]
[node name="MaterialPreview" type="Viewport" parent="Preview/Preview" index="1"]
arvr = false
size = Vector2( 260, 260 )
own_world = true
world = null
transparent_bg = false
msaa = 0
hdr = true
disable_3d = false
usage = 2
debug_draw = 0
render_target_v_flip = false
render_target_clear_mode = 1
render_target_update_mode = 3
audio_listener_enable_2d = false
audio_listener_enable_3d = false
physics_object_picking = false
gui_disable_input = false
gui_snap_controls_to_pixels = true
shadow_atlas_size = 0
shadow_atlas_quad_0 = 2
shadow_atlas_quad_1 = 2
shadow_atlas_quad_2 = 3
shadow_atlas_quad_3 = 4
_sections_unfolded = [ "GUI", "Render Target" ]
[node name="Objects" type="Spatial" parent="Preview/Preview/MaterialPreview" index="0"]
transform = Transform( 0.277021, 0, -0.960862, 0, 1, 0, 0.960862, 0, 0.277021, 0, 0, 0 )
_sections_unfolded = [ "Transform" ]
[node name="Cube" type="MeshInstance" parent="Preview/Preview/MaterialPreview/Objects" index="0"]
layers = 1
material_override = null
cast_shadow = 1
extra_cull_margin = 0.0
use_in_baked_light = false
lod_min_distance = 0.0
lod_min_hysteresis = 0.0
lod_max_distance = 0.0
lod_max_hysteresis = 0.0
mesh = SubResource( 2 )
skeleton = NodePath("..")
material/0 = SubResource( 4 )
_sections_unfolded = [ "Geometry", "Transform", "material" ]
[node name="Cylinder" type="MeshInstance" parent="Preview/Preview/MaterialPreview/Objects" index="1"]
visible = false
layers = 1
material_override = null
cast_shadow = 1
extra_cull_margin = 0.0
use_in_baked_light = false
lod_min_distance = 0.0
lod_min_hysteresis = 0.0
lod_max_distance = 0.0
lod_max_hysteresis = 0.0
mesh = SubResource( 5 )
skeleton = NodePath("..")
material/0 = SubResource( 4 )
_sections_unfolded = [ "Geometry", "Transform", "material" ]
[node name="OmniLight" type="OmniLight" parent="Preview/Preview/MaterialPreview" index="1"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1.04729, 1.80471, -2.51024 )
layers = 1
light_color = Color( 1, 1, 1, 1 )
light_energy = 1.0
light_indirect_energy = 1.0
light_negative = false
light_specular = 0.5
light_bake_mode = 1
light_cull_mask = -1
shadow_enabled = false
shadow_color = Color( 0, 0, 0, 1 )
shadow_bias = 0.15
shadow_contact = 0.0
shadow_reverse_cull_face = false
editor_only = false
omni_range = 6.46518
omni_attenuation = 1.0
omni_shadow_mode = 1
omni_shadow_detail = 1
_sections_unfolded = [ "Shadow" ]
[node name="Camera" type="Camera" parent="Preview/Preview/MaterialPreview" index="2"]
transform = Transform( 1, 0, 0, 0, 0.766044, 0.642787, 0, -0.642787, 0.766044, 0, 1.83022, 2.2549 )
keep_aspect = 1
cull_mask = 1048575
environment = SubResource( 7 )
h_offset = 0.0
v_offset = 0.0
doppler_tracking = 0
projection = 0
current = true
fov = 70.0
size = 1.0
near = 0.05
far = 100.0
_sections_unfolded = [ "Transform" ]
[node name="WorldEnvironment" type="WorldEnvironment" parent="Preview/Preview/MaterialPreview" index="3"]
environment = SubResource( 7 )
[node name="Environment" type="OptionButton" parent="Preview/Preview" index="2"]
anchor_left = 1.0
anchor_top = 0.0
anchor_right = 1.0
anchor_bottom = 0.0
margin_left = -112.0
margin_top = 2.0
margin_right = -2.0
margin_bottom = 22.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = false
action_mode = 0
enabled_focus_mode = 2
shortcut = null
group = null
text = "Park"
flat = false
align = 0
items = [ "Experiment", null, false, -1, null, "Lobby", null, false, -1, null, "Night", null, false, -1, null, "Park", null, false, -1, null, "Schelde", null, false, -1, null ]
selected = 3
[node name="SelectedPreview" type="ColorRect" parent="Preview/Preview" index="3"]
material = SubResource( 9 )
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 2.0
margin_top = 194.0
margin_right = 66.0
margin_bottom = 258.0
rect_min_size = Vector2( 64, 64 )
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 8
size_flags_vertical = 0
color = Color( 1, 1, 1, 1 )
_sections_unfolded = [ "Material", "Mouse" ]
[node name="SelectedPreviewAnimation" type="AnimationPlayer" parent="Preview/Preview" index="4"]
root_node = NodePath("..")
autoplay = ""
playback_process_mode = 1
playback_default_blend_time = 0.0
playback_speed = 1.0
anims/maximize = SubResource( 10 )
anims/minimize = SubResource( 11 )
blend_times = [ ]
[node name="SaveViewport" type="Viewport" parent="." index="3"]
arvr = false
size = Vector2( 0, 0 )
own_world = true
world = null
transparent_bg = false
msaa = 0
hdr = true
disable_3d = false
usage = 2
debug_draw = 0
render_target_v_flip = true
render_target_clear_mode = 0
render_target_update_mode = 1
audio_listener_enable_2d = false
audio_listener_enable_3d = false
physics_object_picking = false
gui_disable_input = true
gui_snap_controls_to_pixels = true
shadow_atlas_size = 0
shadow_atlas_quad_0 = 2
shadow_atlas_quad_1 = 2
shadow_atlas_quad_2 = 3
shadow_atlas_quad_3 = 4
_sections_unfolded = [ "GUI", "Render Target" ]
[node name="ColorRect" type="ColorRect" parent="SaveViewport" index="0"]
material = SubResource( 13 )
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 40.0
margin_bottom = 40.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
color = Color( 1, 1, 1, 1 )
_sections_unfolded = [ "Material", "Rect" ]
[node name="Timer" type="Timer" parent="SaveViewport" index="1"]
process_mode = 1
wait_time = 0.0962963
one_shot = true
autostart = false
[connection signal="connection_request" from="GraphEdit" to="." method="_on_GraphEdit_connection_request"]
[connection signal="graph_changed" from="GraphEdit" to="." method="generate_shader"]
[connection signal="node_selected" from="GraphEdit" to="." method="_on_GraphEdit_node_selected"]
[connection signal="popup_request" from="GraphEdit" to="." method="_on_GraphEdit_popup_request"]
[connection signal="timeout" from="GraphEdit/Timer" to="GraphEdit" method="do_send_changed_signal"]
[connection signal="item_selected" from="Preview/Preview/Environment" to="Preview/Preview" method="_on_Environment_item_selected"]
[connection signal="gui_input" from="Preview/Preview/SelectedPreview" to="Preview/Preview" method="_on_SelectedPreview_gui_input"]