diff --git a/README.md b/README.md index b6b21b1..e63df6f 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,18 @@ ![Rain](./docs/images/particles/rain.png) +## Camera Effects + +These effects are mostly to be placed as a child of Camera object + +### Pixelate + +![Pixelate](./docs/images/camera-effects/pixelate.png) + +### Vignette (danger) + +![Vignette](./docs/images/camera-effects/vignette.png) + ## License * Kenney Particle Pack is copyrighted by Kenney, and can be found at https://kenney.nl/assets/particle-pack diff --git a/addons/kenney_prototype_tools/tool_gen.tscn b/addons/kenney_prototype_tools/tool_gen.tscn index 245e0d2..5e052d1 100644 --- a/addons/kenney_prototype_tools/tool_gen.tscn +++ b/addons/kenney_prototype_tools/tool_gen.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=3 uid="uid://bn4ahbc65y07q"] -[ext_resource type="Script" path="res://tool_generator.gd" id="1_icvd2"] +[ext_resource type="Script" path="res://addons/kenney_prototype_tools/tool_generator.gd" id="1_icvd2"] [node name="ToolGen" type="Node"] script = ExtResource("1_icvd2") diff --git a/camera-effects.tscn b/camera-effects.tscn index e82a07b..49f1182 100644 --- a/camera-effects.tscn +++ b/camera-effects.tscn @@ -1,4 +1,13 @@ -[gd_scene load_steps=4 format=3 uid="uid://18cjinf3642k"] +[gd_scene load_steps=12 format=3 uid="uid://c051w6upl0t16"] + +[ext_resource type="PackedScene" uid="uid://dgv546pcp176" path="res://camera-effects/camera-pixelate.tscn" id="1_1s7cw"] +[ext_resource type="PackedScene" uid="uid://bydyult2k5rcb" path="res://addons/kenney_prototype_tools/scenes/green/green_01.tscn" id="1_61jfr"] +[ext_resource type="PackedScene" uid="uid://b3fmmgvf3owwy" path="res://camera-effects/camera-vignette.tscn" id="2_c86ci"] +[ext_resource type="PackedScene" uid="uid://bjupt5nu14hth" path="res://addons/kenney_prototype_tools/scenes/dark/dark_05.tscn" id="2_xlmfj"] +[ext_resource type="PackedScene" uid="uid://bhuxup1cbugbw" path="res://addons/kenney_prototype_tools/scenes/orange/orange_06.tscn" id="3_xj16f"] +[ext_resource type="PackedScene" uid="uid://ct0k1os3fx251" path="res://addons/kenney_prototype_tools/scenes/purple/purple_03.tscn" id="4_paly4"] +[ext_resource type="PackedScene" uid="uid://d23c4qtufdpk7" path="res://addons/kenney_prototype_tools/scenes/red/red_02.tscn" id="5_dra7r"] +[ext_resource type="PackedScene" uid="uid://npssehgc2462" path="res://addons/kenney_prototype_tools/scenes/light/light_06.tscn" id="6_y7myb"] [sub_resource type="Environment" id="Environment_tln01"] glow_blend_mode = 4 @@ -13,19 +22,131 @@ size = Vector2(20, 20) [node name="Node3D" type="Node3D"] [node name="Camera3D" type="Camera3D" parent="."] -transform = Transform3D(0.707107, -0.40558, 0.579228, 0, 0.819152, 0.573576, -0.707107, -0.40558, 0.579228, 30, 30, 30) +transform = Transform3D(0.707107, -0.40558, 0.579228, 0, 0.819152, 0.573577, -0.707107, -0.40558, 0.579228, 29.8522, 29.8536, 29.8522) environment = SubResource("Environment_tln01") projection = 1 current = true -fov = 3.8 -size = 3.0 +fov = 13.5 +size = 13.34 + +[node name="Pixelate" parent="Camera3D" instance=ExtResource("1_1s7cw")] + +[node name="Vignette" parent="Camera3D" instance=ExtResource("2_c86ci")] [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] transform = Transform3D(1, 0, 0, 0, 0.5, 0.866025, 0, -0.866025, 0.5, 0, 2, 0) -light_energy = 3.0 +light_energy = 2.0 [node name="Scene" type="Node3D" parent="."] [node name="Ground" type="MeshInstance3D" parent="Scene"] mesh = SubResource("PlaneMesh_wx71g") skeleton = NodePath("../..") + +[node name="Cube" parent="Scene" instance=ExtResource("1_61jfr")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, 5) + +[node name="Cube2" parent="Scene" instance=ExtResource("1_61jfr")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4, 0, 5) + +[node name="Cube3" parent="Scene" instance=ExtResource("1_61jfr")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 0, 5) + +[node name="Cube4" parent="Scene" instance=ExtResource("1_61jfr")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, 5) + +[node name="Cube5" parent="Scene" instance=ExtResource("1_61jfr")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7, 0, 5) + +[node name="Cube6" parent="Scene" instance=ExtResource("2_xlmfj")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8, 0, 4) + +[node name="Cube7" parent="Scene" instance=ExtResource("2_xlmfj")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7, 0, 4) + +[node name="Cube12" parent="Scene" instance=ExtResource("2_xlmfj")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, 4) + +[node name="Cube13" parent="Scene" instance=ExtResource("2_xlmfj")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, 4) + +[node name="Cube14" parent="Scene" instance=ExtResource("2_xlmfj")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4, 0, 4) + +[node name="Cube8" parent="Scene" instance=ExtResource("3_xj16f")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, 6) + +[node name="Cube9" parent="Scene" instance=ExtResource("3_xj16f")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, 6) + +[node name="Cube10" parent="Scene" instance=ExtResource("3_xj16f")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4, 0, 6) + +[node name="Cube11" parent="Scene" instance=ExtResource("4_paly4")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, 7) + +[node name="Cube15" parent="Scene" instance=ExtResource("5_dra7r")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7, 0, 3) + +[node name="Cube16" parent="Scene" instance=ExtResource("5_dra7r")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, 3) + +[node name="Cube17" parent="Scene" instance=ExtResource("5_dra7r")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 0, 3) + +[node name="Cube18" parent="Scene" instance=ExtResource("6_y7myb")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, 2) + +[node name="Cube19" parent="Scene" instance=ExtResource("1_61jfr")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, -5) + +[node name="Cube20" parent="Scene" instance=ExtResource("1_61jfr")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7, 0, -5) + +[node name="Cube21" parent="Scene" instance=ExtResource("1_61jfr")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8, 0, -5) + +[node name="Cube22" parent="Scene" instance=ExtResource("1_61jfr")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, -5) + +[node name="Cube23" parent="Scene" instance=ExtResource("1_61jfr")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0, -5) + +[node name="Cube24" parent="Scene" instance=ExtResource("2_xlmfj")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 0, -6) + +[node name="Cube25" parent="Scene" instance=ExtResource("2_xlmfj")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0, -6) + +[node name="Cube26" parent="Scene" instance=ExtResource("2_xlmfj")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, -6) + +[node name="Cube27" parent="Scene" instance=ExtResource("2_xlmfj")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, -6) + +[node name="Cube28" parent="Scene" instance=ExtResource("2_xlmfj")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7, 0, -6) + +[node name="Cube29" parent="Scene" instance=ExtResource("3_xj16f")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, -4) + +[node name="Cube30" parent="Scene" instance=ExtResource("3_xj16f")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, -4) + +[node name="Cube31" parent="Scene" instance=ExtResource("3_xj16f")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7, 0, -4) + +[node name="Cube32" parent="Scene" instance=ExtResource("4_paly4")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, -3) + +[node name="Cube33" parent="Scene" instance=ExtResource("5_dra7r")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 0, -7) + +[node name="Cube34" parent="Scene" instance=ExtResource("5_dra7r")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, -7) + +[node name="Cube35" parent="Scene" instance=ExtResource("5_dra7r")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6, 0, -7) + +[node name="Cube36" parent="Scene" instance=ExtResource("6_y7myb")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5, 0, -8) diff --git a/camera-effects/camera-pixelate.tscn b/camera-effects/camera-pixelate.tscn new file mode 100644 index 0000000..f58e41d --- /dev/null +++ b/camera-effects/camera-pixelate.tscn @@ -0,0 +1,26 @@ +[gd_scene load_steps=5 format=3 uid="uid://dgv546pcp176"] + +[sub_resource type="Gradient" id="Gradient_hmc0v"] +offsets = PackedFloat32Array(0.225256, 0.703072) +colors = PackedColorArray(0, 0, 0, 0, 0, 0, 0, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_1cjfc"] +gradient = SubResource("Gradient_hmc0v") +width = 256 +height = 256 +fill = 1 +fill_from = Vector2(0.5, 0.5) + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_q043q"] +transparency = 1 +albedo_texture = SubResource("GradientTexture2D_1cjfc") +roughness = 0.0 + +[sub_resource type="QuadMesh" id="QuadMesh_002xp"] +material = SubResource("StandardMaterial3D_q043q") +size = Vector2(24, 14) + +[node name="Pixelate" type="MeshInstance3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.820396) +visible = false +mesh = SubResource("QuadMesh_002xp") diff --git a/camera-effects/camera-vignette.tscn b/camera-effects/camera-vignette.tscn new file mode 100644 index 0000000..bcb628f --- /dev/null +++ b/camera-effects/camera-vignette.tscn @@ -0,0 +1,47 @@ +[gd_scene load_steps=8 format=3 uid="uid://b3fmmgvf3owwy"] + +[sub_resource type="Curve" id="Curve_kdxx2"] +max_value = 1.5 +_data = [Vector2(0, 1.5), 0.0, 0.0, 0, 0, Vector2(0.498361, 1.28219), 0.0, 0.0, 0, 0, Vector2(1, 1.5), 0.0, 0.0, 0, 0] +point_count = 3 + +[sub_resource type="CurveTexture" id="CurveTexture_ts23d"] +curve = SubResource("Curve_kdxx2") + +[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_a08vp"] +gravity = Vector3(0, 0, 0) +scale_curve = SubResource("CurveTexture_ts23d") + +[sub_resource type="Gradient" id="Gradient_0ankm"] +offsets = PackedFloat32Array(0.430605, 0.733096) +colors = PackedColorArray(0, 0, 0, 0, 0.392157, 0, 0, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_s3frb"] +gradient = SubResource("Gradient_0ankm") +width = 256 +height = 256 +fill = 1 +fill_from = Vector2(0.5, 0.5) + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_8laxd"] +transparency = 1 +vertex_color_use_as_albedo = true +albedo_texture = SubResource("GradientTexture2D_s3frb") +roughness = 0.0 +billboard_mode = 3 +billboard_keep_scale = true +particles_anim_h_frames = 1 +particles_anim_v_frames = 1 +particles_anim_loop = false + +[sub_resource type="QuadMesh" id="QuadMesh_hh0er"] +material = SubResource("StandardMaterial3D_8laxd") +size = Vector2(24, 14) + +[node name="Vignette" type="GPUParticles3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.5) +amount = 1 +lifetime = 3.0 +fixed_fps = 60 +process_material = SubResource("ParticleProcessMaterial_a08vp") +draw_pass_1 = SubResource("QuadMesh_hh0er") diff --git a/camera-effects/pixelate.gdshader b/camera-effects/pixelate.gdshader new file mode 100644 index 0000000..47a3fea --- /dev/null +++ b/camera-effects/pixelate.gdshader @@ -0,0 +1,17 @@ +shader_type spatial; +uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear; +uniform int pixel_size = 1; +uniform float alpha = 0.1; + +void fragment() { + // a variant of nearest neighbour fragment shader_type + float x = float(int(FRAGCOORD.x) % pixel_size); + float y = float(int(FRAGCOORD.y) % pixel_size); + + x = FRAGCOORD.x + floor(float(pixel_size) / 2.0) - x; + y = FRAGCOORD.y + floor(float(pixel_size) / 2.0) - y; + + // set albedo value on the current coordinate based on vec2(x,y) / viewport_size + ALBEDO = texture(SCREEN_TEXTURE, vec2(x, y) / VIEWPORT_SIZE).xyz; + ALPHA = alpha; +} diff --git a/docs/images/camera-effects/pixelate.png b/docs/images/camera-effects/pixelate.png new file mode 100644 index 0000000..7bb0371 Binary files /dev/null and b/docs/images/camera-effects/pixelate.png differ diff --git a/docs/images/camera-effects/pixelate.png.import b/docs/images/camera-effects/pixelate.png.import new file mode 100644 index 0000000..95c181a --- /dev/null +++ b/docs/images/camera-effects/pixelate.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://420ltcu7fwsb" +path="res://.godot/imported/pixelate.png-4b2e3fe399b478ade8ffb450738b9e5c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://docs/images/camera-effects/pixelate.png" +dest_files=["res://.godot/imported/pixelate.png-4b2e3fe399b478ade8ffb450738b9e5c.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/docs/images/camera-effects/vignette.png b/docs/images/camera-effects/vignette.png new file mode 100644 index 0000000..8ac58dc Binary files /dev/null and b/docs/images/camera-effects/vignette.png differ diff --git a/docs/images/camera-effects/vignette.png.import b/docs/images/camera-effects/vignette.png.import new file mode 100644 index 0000000..e59ee6c --- /dev/null +++ b/docs/images/camera-effects/vignette.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://1y8c1qmf2auy" +path="res://.godot/imported/vignette.png-949d21e93bc075e39574352c2022e6ee.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://docs/images/camera-effects/vignette.png" +dest_files=["res://.godot/imported/vignette.png-949d21e93bc075e39574352c2022e6ee.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/environments/black-environment.tres b/environments/black-environment.tres index 4b4abca..c1eb86a 100644 --- a/environments/black-environment.tres +++ b/environments/black-environment.tres @@ -4,6 +4,5 @@ background_mode = 1 glow_enabled = true glow_blend_mode = 4 -fog_enabled = true fog_light_energy = 0.82 fog_sun_scatter = 0.15