Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PulsGameJam2025
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fabian Keßler
PulsGameJam2025
Commits
31c2d495
Commit
31c2d495
authored
3 weeks ago
by
Fabian Keßler
Browse files
Options
Downloads
Patches
Plain Diff
Enhance water
parent
4e6edc22
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pulsjam2025/schollen_spektakel.tscn
+3
-3
3 additions, 3 deletions
pulsjam2025/schollen_spektakel.tscn
pulsjam2025/water/water.gdshader
+15
-18
15 additions, 18 deletions
pulsjam2025/water/water.gdshader
pulsjam2025/water/water.tscn
+5
-3
5 additions, 3 deletions
pulsjam2025/water/water.tscn
with
23 additions
and
24 deletions
pulsjam2025/schollen_spektakel.tscn
+
3
−
3
View file @
31c2d495
...
...
@@ -34,9 +34,9 @@ script = ExtResource("1_ij3xc")
[node name="Water" parent="." instance=ExtResource("2_hycu0")]
offset_left = -160.0
offset_top = -145.0
offset_right =
17
52.0
offset_bottom =
979
.0
scale = Vector2(
0.8, 0.8
)
offset_right = 5
2
2.0
offset_bottom =
302
.0
scale = Vector2(
2, 2
)
[node name="IceFloe" parent="." instance=ExtResource("2_ij3xc")]
position = Vector2(559, 304)
...
...
This diff is collapsed.
Click to expand it.
pulsjam2025/water/water.gdshader
+
15
−
18
View file @
31c2d495
shader_type canvas_item;
uniform vec2 center = vec2(50.0, 50.0); // Set this to your polygon's center in local space.
uniform float amplitude : hint_range(0.0, 1.0) = 0.1;
uniform float frequency = 1.0;
uniform float tile_factor = 10.0;
uniform float aspect_ratio = 0.5;
void vertex() {
// Translate vertex position so the center is at (
0, 0)
.
vec2 pos = VERTEX - center
;
uniform vec2 time_factor = vec2(2.0, 3.0);
uniform vec2 offset_factor = vec2(5.
0,
2.
0)
;
uniform vec2 amplitude = vec2(0.05, 0.05)
;
// Compute the angle of the vertex relative to the center.
// This angle will be used to offset the sine wave phase.
float angle = atan(pos.y, pos.x);
void fragment() {
vec2 tiled_uvs = UV * tile_factor;
tiled_uvs.y *= aspect_ratio;
vec2 wave_uv_offset;
wave_uv_offset.x += sin(TIME * time_factor.x + (tiled_uvs.x + tiled_uvs.y) * offset_factor.x);
wave_uv_offset.y += cos(TIME * time_factor.y + (tiled_uvs.x + tiled_uvs.y) * offset_factor.y);
// Create a sine wave where each vertex is offset by its angle.
// You can adjust the formula as desired.
float wave = sin(TIME * frequency - angle);
COLOR = texture(TEXTURE, tiled_uvs + wave_uv_offset * amplitude);
// Use the wave value to scale the vertex's distance from the center.
pos *= 1.0 + amplitude * wave;
// Move the vertex back to the original coordinate space.
VERTEX = pos + center;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
pulsjam2025/water/water.tscn
+
5
−
3
View file @
31c2d495
...
...
@@ -5,9 +5,11 @@
[sub_resource type="ShaderMaterial" id="ShaderMaterial_doghl"]
shader = ExtResource("1_wjap7")
shader_parameter/center = Vector2(50, 50)
shader_parameter/amplitude = 0.005
shader_parameter/frequency = 2.0
shader_parameter/tile_factor = 7.51
shader_parameter/aspect_ratio = 0.975
shader_parameter/time_factor = Vector2(1, 1.5)
shader_parameter/offset_factor = Vector2(2.5, 1)
shader_parameter/amplitude = Vector2(0.05, 0.05)
[node name="Water" type="TextureRect"]
material = SubResource("ShaderMaterial_doghl")
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment