Skip to content

Commit

Permalink
Feat/scatter (#5)
Browse files Browse the repository at this point in the history
* Added addon Scatter 2.5.1

* Added glass

* Added glass to scene

* Rearranged platform nodes in scene; Made sensibility slider move in steps of 0.05

* Copied grass assets to 'art' folder

* Added a couple smaller platforms to the right

* Prevent child nodes in platforms from being modified by mistake

* Increased jump height

* Using asset from art folder

* Removed unnecessary node

* Using grass assets from folder 'art'

* Removed 'grass_1.glb'

* Updated CREDITS.md
  • Loading branch information
telmotrooper authored Jul 1, 2021
1 parent 8b28080 commit 05bbab0
Show file tree
Hide file tree
Showing 152 changed files with 8,579 additions and 32 deletions.
2 changes: 2 additions & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

* Model [Godot Logo](https://sketchfab.com/3d-models/godot-logo-5283bab731e74d3babad747a17622715) by [soundsbeard](https://sketchfab.com/soundsbeard)
* Skyboxes [4K Sky Series HDRi free Texture](https://www.cgtrader.com/free-3d-models/textures/natural/hdri-freebie-series) by [avianx](https://www.cgtrader.com/avianx)
* Sound [SlimeJump](https://freesound.org/people/Zuzek06/sounds/353250/) by [Zuzek06](https://freesound.org/people/Zuzek06/)
* [Grass sprites and shaders](https://github.com/HungryProton/scatter/tree/master/demos/assets) from the Scatter addon demo by [HungryProton](https://github.com/HungryProton) with assets from [textures.com](http://www.textures.com/) and [Kenney](https://kenney.nl/)
168 changes: 138 additions & 30 deletions my-3d-squash-the-creeps/Main.tscn

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion my-3d-squash-the-creeps/Pause.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extends Control

const sensitivity_text = "Mouse Sensitivity: %.1f"
const sensitivity_text = "Mouse Sensitivity: %.2f"

func _ready():
$VBoxContainer/SensitivityLabel.text = sensitivity_text % GameState.mouse_sensitivity
Expand Down
2 changes: 1 addition & 1 deletion my-3d-squash-the-creeps/Player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extends KinematicBody
signal hit

export var speed := 14.0
export var jump_impulse := 20.0
export var jump_impulse := 25.0
export var fall_acceleration := 75.0
export var bounce_impulse := 16.0

Expand Down
9 changes: 9 additions & 0 deletions my-3d-squash-the-creeps/addons/scatter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

# Godot-specific ignores
.import/
export.cfg
export_presets.cfg

# Mono-specific ignores
.mono/
*.import
21 changes: 21 additions & 0 deletions my-3d-squash-the-creeps/addons/scatter/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 HungryProton

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
66 changes: 66 additions & 0 deletions my-3d-squash-the-creeps/addons/scatter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Scatter
![scatter](https://user-images.githubusercontent.com/52043844/103457605-08084d80-4d01-11eb-98a3-3cdb523d5410.png)
Custom node for the Godot game engine to randomly place props or scenes using 3D curves. [See it in action here](https://twitter.com/HungryProton/status/1344623041620402176)

**Scatter V2 is not backward compatible with the first version**.
Use the tag selector to go back to older versions if needed.

## How to use it

### Check out the demos!
Two examples scenes are located in `res://addons/scatter/demos/`, make sure to check them both. This way you'll see how
you can setup your scenes and how this addon can be used.
![image](https://user-images.githubusercontent.com/52043844/103458397-d5158800-4d07-11eb-8e87-4a81d754c2ef.png)

### Installation guide
[This project's wiki pages](https://github.com/HungryProton/scatter/wiki) has all the information you should know
in order to use this plugin.
+ [Installation and basic setup](https://github.com/HungryProton/scatter/wiki/Installation-and-basic-setup)
+ [Modifiers](https://github.com/HungryProton/scatter/wiki/Modifiers)
+ [Using presets](https://github.com/HungryProton/scatter/wiki/Using-presets)

## Troubleshooting

### I can't open the demo scenes
Make sure the folder is named `scatter` exactly, nothing else. If you downloaded the archive from GitHub,
if probably renamed that into *scatter-master* or something else, this will break the import / scene paths.
+ Disable the plugin first.
+ Rename the folder into `scatter`.
+ Close the editor and open it again.
- If you don't Godot will probably complain about cyclic dependencies or something else.
+ Enable the plugin and it should work.

### My collisions are ignored
By default, instancing or batching is enabled (through a MultimeshInstance node) and doesn't support collisions. However
you can turn off instancing in the Scatter node and it will copy the entire source, including colliders, scripts and others.
![image](https://user-images.githubusercontent.com/52043844/110603386-3eda6400-8187-11eb-84d7-e8ec3fc15e4c.png)

### The addon is slow when editing a curve
When updating a `Scatter Path` object, a 2D polygon projected on the XZ plane is also generated internally.
This polygon is used to know if a point is inside the curve or not. If this polygon resolution is too high, regenerating
it will take time. To fix this, increase the `Bake Interval` on the Scatter node itself. (Not on the curve resource, this one
is not used). Values around 1 or 2 are usually enough, but if your path is really large, you don't need that much precision and
you can increase this value. However, if your path is really small, you can decrease this value.

### The 3D curves are modified at different places at once
[Please read this page](https://github.com/HungryProton/scatter/wiki/Warning-about-duplicating-nodes).
When you duplicate a `Scatter` node, the curve resource is duplicated automatically so this shoudn't happen.
If it does, click on the `Curve3D` resource and click on `Make Unique`.

### Project on floor ignores my colliders
There is [a known bug in Godot](https://github.com/godotengine/godot/issues/43744) when raycasting from a tool script.
After moving your colliders, the physic world is not synced with their new position, so you have to hit
the `Rebuild` button in the inspector, under the modifier stack. Hit it once after you made modifications to your
scene.


## Don't forget the wiki
If you can't find what you're looking for in this readme, please [check this project wiki](https://github.com/HungryProton/scatter/wiki).
If you're facing a bug, please [check the issues's tracker](https://github.com/HungryProton/scatter/issues) to see if someone else
already reported the issue. If not, feel free to open a new one.


## Licence
- This addon is published under the MIT licence.
- Most 2D and 3D assets in the demos folder are MIT, with a few exceptions.
Refer the the LICENCE.md in the assets folder for more details.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
+ One or more textures on this 3D model have been created with photographs from Textures.com. These photographs may not be redistributed by default; please visit www.textures.com for more information.
- This only applies to the modified tree bark textures under the materials folder
+ Other 3D assets and textures either comes from me under an MIT licence or from https://kenney.nl/ under a CC0 licence
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[gd_scene load_steps=3 format=2]

[ext_resource path="res://addons/scatter/demos/assets/fences/models/fence_planks.glb" type="PackedScene" id=1]
[ext_resource path="res://addons/scatter/demos/assets/fences/models/m_fence.tres" type="Material" id=2]

[node name="fence_planks" instance=ExtResource( 1 )]

[node name="fence_planks" parent="." index="0"]
material/0 = ExtResource( 2 )
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[gd_resource type="SpatialMaterial" format=2]

[resource]
resource_name = "wood"
vertex_color_use_as_albedo = true
albedo_color = Color( 0.568627, 0.466667, 0.372549, 1 )
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=2]

[ext_resource path="res://addons/scatter/demos/assets/grass/data/s_grass.shader" type="Shader" id=1]

[resource]
shader = ExtResource( 1 )
shader_param/alpha_scissor_threshold = null
shader_param/transmission = null
shader_param/secondary_color = null
shader_param/secondary_attenuation = 0.2
shader_param/grass_height = 1.0
shader_param/wind_direction = Vector2( 1, -0.5 )
shader_param/wind_speed = 1.0
shader_param/wind_strength = 2.0
shader_param/noise_scale = 20.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[gd_resource type="ShaderMaterial" load_steps=6 format=2]

[ext_resource path="res://addons/scatter/demos/assets/grass/data/sprite_0052.png" type="Texture" id=1]
[ext_resource path="res://addons/scatter/demos/assets/grass/data/s_grass.shader" type="Shader" id=2]
[ext_resource path="res://addons/scatter/demos/assets/grass/data/t_noise.png" type="Texture" id=3]

[sub_resource type="Gradient" id=1]
colors = PoolColorArray( 0.176471, 0.388235, 0.0901961, 1, 0.451898, 0.6, 0.174, 1 )

[sub_resource type="GradientTexture" id=2]
gradient = SubResource( 1 )

[resource]
shader = ExtResource( 2 )
shader_param/alpha_scissor_threshold = 0.8
shader_param/transmission = Color( 0.95, 0.95, 0.95, 1 )
shader_param/secondary_color = Color( 0.176471, 0.388235, 0.0901961, 1 )
shader_param/secondary_attenuation = 0.1
shader_param/grass_height = 0.5
shader_param/wind_direction = Vector2( 1, -0.5 )
shader_param/wind_speed = 0.25
shader_param/wind_strength = 1.0
shader_param/noise_scale = 20.0
shader_param/texture_albedo = ExtResource( 1 )
shader_param/texture_gradient = SubResource( 2 )
shader_param/texture_noise = ExtResource( 3 )
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[gd_resource type="ShaderMaterial" load_steps=6 format=2]

[ext_resource path="res://addons/scatter/demos/assets/grass/data/s_grass.shader" type="Shader" id=1]
[ext_resource path="res://addons/scatter/demos/assets/grass/data/t_grass_4.png" type="Texture" id=2]
[ext_resource path="res://addons/scatter/demos/assets/grass/data/t_noise.png" type="Texture" id=3]

[sub_resource type="Gradient" id=1]
colors = PoolColorArray( 0.546875, 0.33659, 0.00854492, 1, 0.945312, 0.931061, 0.0332336, 1 )

[sub_resource type="GradientTexture" id=2]
gradient = SubResource( 1 )

[resource]
shader = ExtResource( 1 )
shader_param/alpha_scissor_threshold = 0.8
shader_param/transmission = Color( 0.823529, 0.654902, 0, 1 )
shader_param/secondary_color = Color( 0.960784, 0.0431373, 0.0431373, 1 )
shader_param/secondary_attenuation = 0.5
shader_param/grass_height = 0.5
shader_param/wind_direction = Vector2( 1, -0.5 )
shader_param/wind_speed = 0.25
shader_param/wind_strength = 1.0
shader_param/noise_scale = 20.0
shader_param/texture_albedo = ExtResource( 2 )
shader_param/texture_gradient = SubResource( 2 )
shader_param/texture_noise = ExtResource( 3 )
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
shader_type spatial;

render_mode depth_draw_opaque, cull_disabled;

// Texture settings
uniform sampler2D texture_albedo : hint_albedo;
uniform sampler2D texture_gradient : hint_albedo;
uniform sampler2D texture_noise : hint_albedo;
uniform float alpha_scissor_threshold : hint_range(0.0, 1.0);
uniform vec4 transmission : hint_color;
uniform vec4 secondary_color : hint_color;
uniform float secondary_attenuation = 0.2;
uniform float grass_height = 1.0;

// Wind settings
uniform vec2 wind_direction = vec2(1, -0.5);
uniform float wind_speed = 1.0;
uniform float wind_strength = 2.0;
uniform float noise_scale = 20.0;

varying float color;
varying float height;

void vertex() {
height = VERTEX.y;
float influence = smoothstep(0, 1, height / 2.0);
vec4 world_pos = WORLD_MATRIX * vec4(VERTEX, 1.0);
vec2 uv = world_pos.xz / (noise_scale + 1e-2);
vec2 panning_uv = uv + fract(TIME * wind_direction * wind_speed);
float wind = texture(texture_noise, panning_uv).r * 2.0 - 0.4;
color = texture(texture_noise, uv).r;

vec2 wind_offset = -wind_direction * wind_strength * influence * wind;
world_pos.xz += wind_offset;
world_pos.y -= wind * influence * smoothstep(0.0, height, wind_strength);
vec4 local_pos = inverse(WORLD_MATRIX) * world_pos;
local_pos.x += influence * cos(TIME * 1.0) / 8.0;
local_pos.z += influence * sin(TIME * 1.5) / 8.0;

VERTEX = local_pos.xyz;
NORMAL = vec3(0.0, 1.0, 0.0);
}

void fragment() {
vec4 tex = texture(texture_albedo, UV);
if (tex.a < alpha_scissor_threshold) {
discard;
}

TRANSMISSION = transmission.rgb;
vec4 gradient = texture(texture_gradient, vec2(height / grass_height, 0.0));
float secondary_weight = smoothstep(0.0, 1.0, color - secondary_attenuation);
ALBEDO = tex.rbg * gradient.rgb;
ALBEDO = mix(ALBEDO, secondary_color.rgb, secondary_weight);
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[gd_scene load_steps=3 format=2]

[ext_resource path="res://addons/scatter/demos/assets/grass/data/grass_1.glb" type="PackedScene" id=1]
[ext_resource path="res://addons/scatter/demos/assets/grass/data/m_grass_52.tres" type="Material" id=2]

[node name="grass52" instance=ExtResource( 1 )]

[node name="Plane" parent="." index="0"]
material/0 = ExtResource( 2 )

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[gd_resource type="ShaderMaterial" load_steps=6 format=2]

[ext_resource path="res://addons/scatter/demos/assets/leaves/data/s_leaves.shader" type="Shader" id=1]
[ext_resource path="res://addons/scatter/demos/assets/leaves/data/sprite_0081.png" type="Texture" id=2]
[ext_resource path="res://addons/scatter/demos/assets/grass/data/t_noise.png" type="Texture" id=3]

[sub_resource type="Gradient" id=1]
offsets = PoolRealArray( 0, 0.996016 )
colors = PoolColorArray( 0.571198, 0.796875, 0.34552, 1, 0.645856, 0.765625, 0.0687866, 1 )

[sub_resource type="GradientTexture" id=2]
gradient = SubResource( 1 )

[resource]
shader = ExtResource( 1 )
shader_param/alpha_scissor_threshold = 0.8
shader_param/transmission = Color( 0.494118, 0.541176, 0.0666667, 1 )
shader_param/wind_direction = Vector2( 1, -0.5 )
shader_param/wind_speed = 0.25
shader_param/wind_strength = 0.5
shader_param/noise_scale = 20.0
shader_param/texture_albedo = ExtResource( 2 )
shader_param/texture_gradient = SubResource( 2 )
shader_param/texture_noise = ExtResource( 3 )
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
shader_type spatial;

render_mode depth_draw_opaque, cull_disabled;

// Texture settings
uniform sampler2D texture_albedo : hint_albedo;
uniform sampler2D texture_gradient : hint_albedo;
uniform sampler2D texture_noise : hint_albedo;
uniform float alpha_scissor_threshold : hint_range(0.0, 1.0);
uniform vec4 transmission : hint_color;

// Wind settings
uniform vec2 wind_direction = vec2(1, -0.5);
uniform float wind_speed = 1.0;
uniform float wind_strength = 2.0;
uniform float noise_scale = 20.0;

varying float color;
varying float height;

void vertex() {
height = VERTEX.y;
float influence = max(max(abs(VERTEX.x), abs(VERTEX.y)), abs(VERTEX.z)) / 6.0;
vec4 world_pos = WORLD_MATRIX * vec4(VERTEX, 1.0);
vec2 uv = world_pos.xz / (noise_scale + 1e-2);
vec2 panning_uv = uv + fract(TIME * wind_direction * wind_speed);
float wind = texture(texture_noise, panning_uv).r * 2.0 - 0.4;
color = texture(texture_noise, uv).r;

vec2 wind_offset = -wind_direction * wind_strength * influence * wind;
world_pos.xz += wind_offset;
world_pos.y -= wind * influence * smoothstep(-1.0, height, wind_strength);
vec4 local_pos = inverse(WORLD_MATRIX) * world_pos;
local_pos.x += influence * cos(TIME * 1.0) / 8.0;
local_pos.z += influence * sin(TIME * 1.5) / 8.0;

VERTEX = local_pos.xyz;
}

void fragment() {
vec4 tex = texture(texture_albedo, UV);
if (tex.a < alpha_scissor_threshold) {
discard;
}

TRANSMISSION = transmission.rgb;
vec4 gradient = texture(texture_gradient, UV2);
ALBEDO = tex.rbg * gradient.rgb;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[gd_scene load_steps=3 format=2]

[ext_resource path="res://addons/scatter/demos/assets/leaves/data/leaves_1.glb" type="PackedScene" id=1]
[ext_resource path="res://addons/scatter/demos/assets/leaves/data/m_leaves.tres" type="Material" id=2]

[node name="leaves_1" instance=ExtResource( 1 )]

[node name="Plane017" parent="." index="0"]
material/0 = ExtResource( 2 )
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[gd_resource type="Environment" load_steps=2 format=2]

[ext_resource path="res://addons/scatter/demos/assets/lighting/sky.tres" type="ProceduralSky" id=1]


[resource]
background_mode = 2
background_sky = ExtResource( 1 )
ambient_light_color = Color( 1, 1, 1, 1 )
ambient_light_energy = 0.5
ambient_light_sky_contribution = 0.5
fog_depth_end = 35.0
tonemap_mode = 2
tonemap_exposure = 1.1
ss_reflections_roughness = false
ssao_radius = 4.0
ssao_intensity = 1.2
ssao_color = Color( 0.133333, 0, 0.188235, 1 )
ssao_quality = 2
ssao_edge_sharpness = 0.0
dof_blur_far_distance = 25.0
dof_blur_far_transition = 10.0
dof_blur_far_amount = 0.08
dof_blur_far_quality = 0
glow_enabled = true
glow_blend_mode = 1
glow_bicubic_upscale = true
Loading

0 comments on commit 05bbab0

Please sign in to comment.