diff options
author | Jonathan Moallem <jdmoallem@gmail.com> | 2020-01-30 13:46:39 +1100 |
---|---|---|
committer | Jonathan Moallem <jdmoallem@gmail.com> | 2020-01-30 13:46:39 +1100 |
commit | 3a73a96c38b6b23c6c6681f0cc73c388b413b1f6 (patch) | |
tree | 2f7093e028d9075f9c14deb34514a2136a0aa795 | |
parent | 1219dbfe58043616aa6b3cfa4783200b6d02813b (diff) | |
download | plugin-godot-simple-crt-shader-3a73a96c38b6b23c6c6681f0cc73c388b413b1f6.tar.gz plugin-godot-simple-crt-shader-3a73a96c38b6b23c6c6681f0cc73c388b413b1f6.tar.bz2 plugin-godot-simple-crt-shader-3a73a96c38b6b23c6c6681f0cc73c388b413b1f6.zip |
Updated CRT and ScanLine shaders to avoid redefinition of TIME shader variable
-rw-r--r-- | godot3/ShaderTestScreen.tscn | 168 | ||||
-rw-r--r-- | godot3/default_env.tres | 83 |
2 files changed, 32 insertions, 219 deletions
diff --git a/godot3/ShaderTestScreen.tscn b/godot3/ShaderTestScreen.tscn index 5440580..f4b1257 100644 --- a/godot3/ShaderTestScreen.tscn +++ b/godot3/ShaderTestScreen.tscn @@ -5,7 +5,6 @@ [ext_resource path="res://CRTFrame.png" type="Texture" id=3] [sub_resource type="Shader" id=1] - code = "shader_type canvas_item; uniform float BarrelPower =1.1; @@ -44,14 +43,10 @@ COLOR = texture(SCREEN_TEXTURE,xy); " [sub_resource type="ShaderMaterial" id=2] - -render_priority = 0 shader = SubResource( 1 ) shader_param/BarrelPower = 1.1 -_sections_unfolded = [ "Resource", "shader_param" ] [sub_resource type="Shader" id=3] - code = "shader_type canvas_item; uniform float color_bleeding = 0.9; @@ -68,15 +63,12 @@ void fragment() }" [sub_resource type="ShaderMaterial" id=4] - -render_priority = 0 shader = SubResource( 3 ) -shader_param/color_bleeding = null -shader_param/bleeding_range = null -shader_param/screen_width = null +shader_param/color_bleeding = 0.9 +shader_param/bleeding_range = 2.0 +shader_param/screen_width = 1024.0 [sub_resource type="Shader" id=5] - code = "shader_type canvas_item; uniform float lines_distance = 4.0; @@ -98,17 +90,14 @@ COLOR = c; }" [sub_resource type="ShaderMaterial" id=6] - -render_priority = 0 shader = SubResource( 5 ) -shader_param/lines_distance = null -shader_param/pixel_size = null -shader_param/size_screen = null -shader_param/scanline_alpha = null -shader_param/lines_velocity = null +shader_param/lines_distance = 4.0 +shader_param/pixel_size = 2.0 +shader_param/size_screen = 600.0 +shader_param/scanline_alpha = 0.9 +shader_param/lines_velocity = 30.0 [sub_resource type="Shader" id=7] - code = "shader_type canvas_item; uniform float screen_width = 1024; @@ -144,8 +133,8 @@ void get_color_bleeding(inout vec4 current_color,inout vec4 color_left){ color_left = color_left*vec4(0.25,0.5,color_bleeding,1); } -void get_color_scanline(vec2 uv,inout vec4 c,float TIME){ - float line_row = floor((uv.y * screen_height/scan_size) + mod(TIME*lines_velocity, lines_distance)); +void get_color_scanline(vec2 uv,inout vec4 c,float time){ + float line_row = floor((uv.y * screen_height/scan_size) + mod(time*lines_velocity, lines_distance)); float n = 1.0 - ceil((mod(line_row,lines_distance)/lines_distance)); @@ -180,161 +169,68 @@ COLOR = c; } " -_sections_unfolded = [ "Resource" ] [sub_resource type="ShaderMaterial" id=8] - -render_priority = 0 shader = SubResource( 7 ) -shader_param/screen_width = null -shader_param/screen_height = null -shader_param/BarrelPower = null -shader_param/color_bleeding = null -shader_param/bleeding_range_x = null -shader_param/bleeding_range_y = null -shader_param/lines_distance = null -shader_param/scan_size = null -shader_param/scanline_alpha = null -shader_param/lines_velocity = null -_sections_unfolded = [ "shader_param" ] - -[node name="Control" type="Control" index="0"] - -anchor_left = 0.0 -anchor_top = 0.0 -anchor_right = 0.0 -anchor_bottom = 0.0 +shader_param/screen_width = 1024.0 +shader_param/screen_height = 600.0 +shader_param/BarrelPower = 1.1 +shader_param/color_bleeding = 1.2 +shader_param/bleeding_range_x = 3.0 +shader_param/bleeding_range_y = 3.0 +shader_param/lines_distance = 4.0 +shader_param/scan_size = 2.0 +shader_param/scanline_alpha = 0.9 +shader_param/lines_velocity = 30.0 + +[node name="Control" type="Control"] 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 -_sections_unfolded = [ "Rect" ] - -[node name="Sprite" type="Sprite" parent="." index="0"] +[node name="Sprite" type="Sprite" parent="."] texture = ExtResource( 1 ) centered = false -_sections_unfolded = [ "Offset" ] -[node name="Shaders" type="Control" parent="." index="1"] - -anchor_left = 0.0 -anchor_top = 0.0 -anchor_right = 0.0 -anchor_bottom = 0.0 +[node name="Shaders" type="Control" parent="."] 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 - -[node name="Curvature" type="TextureRect" parent="Shaders" index="0"] +[node name="Curvature" type="TextureRect" parent="Shaders"] visible = false material = SubResource( 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 = 1 -mouse_default_cursor_shape = 0 -size_flags_horizontal = 1 -size_flags_vertical = 1 texture = ExtResource( 2 ) expand = true -stretch_mode = 0 -_sections_unfolded = [ "Material", "Mouse", "Rect" ] - -[node name="ColorBleeding" type="TextureRect" parent="Shaders" index="1"] +[node name="ColorBleeding" type="TextureRect" parent="Shaders"] visible = false material = SubResource( 4 ) -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 = 1 -mouse_default_cursor_shape = 0 -size_flags_horizontal = 1 -size_flags_vertical = 1 texture = ExtResource( 2 ) expand = true -stretch_mode = 0 -_sections_unfolded = [ "Material", "Rect" ] - -[node name="ScanLine" type="TextureRect" parent="Shaders" index="2"] +[node name="ScanLine" type="TextureRect" parent="Shaders"] visible = false material = SubResource( 6 ) -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 = 1 -mouse_default_cursor_shape = 0 -size_flags_horizontal = 1 -size_flags_vertical = 1 texture = ExtResource( 2 ) expand = true -stretch_mode = 0 -_sections_unfolded = [ "Material", "Rect" ] - -[node name="CRT" type="TextureRect" parent="Shaders" index="3"] +[node name="CRT" type="TextureRect" parent="Shaders"] material = SubResource( 8 ) -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 = 1 -mouse_default_cursor_shape = 0 -size_flags_horizontal = 1 -size_flags_vertical = 1 texture = ExtResource( 2 ) expand = true -stretch_mode = 0 -_sections_unfolded = [ "Material", "Rect" ] - -[node name="CRTFrame" type="TextureRect" parent="." index="2"] +__meta__ = { +"_edit_use_anchors_": false +} -anchor_left = 0.0 -anchor_top = 0.0 -anchor_right = 0.0 -anchor_bottom = 0.0 +[node name="CRTFrame" type="TextureRect" parent="."] margin_right = 1082.0 margin_bottom = 812.0 rect_scale = Vector2( 0.946396, 0.738916 ) -rect_pivot_offset = Vector2( 0, 0 ) -rect_clip_content = false -mouse_filter = 1 -mouse_default_cursor_shape = 0 -size_flags_horizontal = 1 -size_flags_vertical = 1 texture = ExtResource( 3 ) -stretch_mode = 0 -_sections_unfolded = [ "Rect" ] - - diff --git a/godot3/default_env.tres b/godot3/default_env.tres index ad86b72..0f8c712 100644 --- a/godot3/default_env.tres +++ b/godot3/default_env.tres @@ -1,101 +1,18 @@ [gd_resource type="Environment" load_steps=2 format=2] [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 [resource] - 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 - |