[gd_scene load_steps=20 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/material_preview.gd" type="Script" id=4] [ext_resource path="res://addons/procedural_material/nodes/godot_logo.png" type="Texture" id=5] [sub_resource type="ProceduralSky" id=1] radiance_size = 4 sky_top_color = Color( 0.0470588, 0.454902, 0.976471, 1 ) sky_horizon_color = Color( 0.556863, 0.823529, 0.909804, 1 ) sky_curve = 0.25 sky_energy = 1.0 ground_bottom_color = Color( 0.101961, 0.145098, 0.188235, 1 ) ground_horizon_color = Color( 0.482353, 0.788235, 0.952941, 1 ) ground_curve = 0.01 ground_energy = 1.0 sun_color = Color( 1, 1, 1, 1 ) sun_latitude = 35.0 sun_longitude = 0.0 sun_angle_min = 1.0 sun_angle_max = 100.0 sun_curve = 0.05 sun_energy = 16.0 texture_size = 2 [sub_resource type="Environment" id=2] background_mode = 2 background_sky = SubResource( 1 ) 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="World" id=3] environment = SubResource( 2 ) [sub_resource type="CubeMesh" id=4] 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=5] code = "" [sub_resource type="ShaderMaterial" id=6] render_priority = 0 shader = SubResource( 5 ) [sub_resource type="CylinderMesh" id=7] 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="Animation" id=8] length = 1.0 loop = true step = 0.1 tracks/0/type = "value" tracks/0/path = NodePath("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="ProceduralSky" id=9] radiance_size = 4 sky_top_color = Color( 0.0470588, 0.454902, 0.976471, 1 ) sky_horizon_color = Color( 0.556863, 0.823529, 0.909804, 1 ) sky_curve = 0.25 sky_energy = 1.0 ground_bottom_color = Color( 0.101961, 0.145098, 0.188235, 1 ) ground_horizon_color = Color( 0.482353, 0.788235, 0.952941, 1 ) ground_curve = 0.01 ground_energy = 1.0 sun_color = Color( 1, 1, 1, 1 ) sun_latitude = 35.0 sun_longitude = 0.0 sun_angle_min = 1.0 sun_angle_max = 100.0 sun_curve = 0.05 sun_energy = 16.0 texture_size = 2 _sections_unfolded = [ "Sky" ] [sub_resource type="Environment" id=10] background_mode = 2 background_sky = SubResource( 9 ) 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=11] code = "shader_type canvas_item; void fragment() { COLOR = vec4(1.0); } " _sections_unfolded = [ "Resource" ] [sub_resource type="ShaderMaterial" id=12] render_priority = 0 shader = SubResource( 11 ) [sub_resource type="Shader" id=13] code = "shader_type canvas_item; float hash1(vec2 p) { float q = dot(p,vec2(127.1,311.7)); return fract(sin(q)*43758.5453); } vec2 hash2(vec2 p) { vec2 q = vec2( dot(p,vec2(127.1,311.7)), dot(p,vec2(269.5,183.3)) ); return fract(sin(q)*43758.5453); } vec3 hash3(vec2 p) { vec3 q = vec3( dot(p,vec2(127.1,311.7)), dot(p,vec2(269.5,183.3)), dot(p,vec2(419.2,371.9)) ); return fract(sin(q)*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 iqnoise(vec2 uv, float s, float u, float v) { uv *= s; vec2 p = floor(uv); vec2 f = fract(uv); float k = 1.0+63.0*pow(1.0-v,4.0); float va = 0.0; float wt = 0.0; for( int j=-2; j<=2; j++ ) for( int i=-2; i<=2; i++ ) { vec2 g = vec2( float(i),float(j) ); vec3 o = hash3( p + g )*vec3(u,u,1.0); vec2 r = g - f + o.xy; float d = dot(r,r); float ww = pow( 1.0-smoothstep(0.0,1.414,sqrt(d)), k ); va += o.z*ww; wt += ww; } return va/wt; } float perlin_old(vec2 uv, vec2 scale, int iterations, float turbulence) { float f = 0.0; float c = 1.0; float m = 0.0; for(int i = 0; i < iterations; i++) { vec2 uv2 = scale * mod(uv, vec2(1.0, 1.0)); vec2 uv2_floor = floor(uv2); vec2 uv2_fract = fract(uv2); f += c * ( (1.0 - uv2_fract.x) * ((1.0 - uv2_fract.y) * hash1(uv2_floor) + uv2_fract.y * hash1(uv2_floor+vec2(0.0, 1.0))) + uv2_fract.x * ((1.0 - uv2_fract.y) * hash1(uv2_floor+vec2(1.0, 0.0)) + uv2_fract.y * hash1(uv2_floor+vec2(1.0, 1.0)))); m += c; scale *= 2.0; c *= turbulence; } return f/m; } float noise(vec2 p, vec2 freq ){ vec2 unit = vec2(1.0)/freq; vec2 ij = floor(p/unit); vec2 xy = mod(p,unit)/unit; float a = hash1((ij+vec2(0.0,0.0))); float b = hash1((ij+vec2(1.0,0.0))); float c = hash1((ij+vec2(0.0,1.0))); float d = hash1((ij+vec2(1.0,1.0))); return mix(mix(a, b, xy.x), mix(c, d, xy.x), xy.y); } float perlin(vec2 p, vec2 scale, int iterations, float persistance) { float n = 0.0; float normK = 0.0; vec2 f = scale; float amp = 1.0; for (int i = 0; i