first examples

This commit is contained in:
Luca 2024-12-19 14:04:09 +01:00
parent a01a7a7acc
commit 2219e943da
33 changed files with 785 additions and 6 deletions

View file

@ -0,0 +1,25 @@
shader_type spatial;
/**
* This is a documentation comment.
* These lines will appear in the inspector when hovering over the shader parameters
* You can use [b]BBCode[/b] [i]formatting[/i] in the comment.
* The Offset From Ground shifts the model up and down.
*/
uniform float offset_from_ground = 0.5;
/**
* This parameter influcenes the amount of waves
*/
uniform float waves = 8.0;
uniform float speed = 2.0;
uniform float wave_height = 0.5;
void vertex() {
// Changing the waves parameter changes how warped the sphere is
VERTEX.y += offset_from_ground + sin(VERTEX.x * waves + TIME * speed) * wave_height;
}
void fragment() {
ALBEDO = vec3(0.1, 0.2, 0.6);
}

View file

@ -0,0 +1,19 @@
[gd_scene load_steps=4 format=3 uid="uid://5clduk3kph4t"]
[ext_resource type="Shader" path="res://shaders/006_variables/variables.gdshader" id="1_gh1k7"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_u3tcf"]
render_priority = 0
shader = ExtResource("1_gh1k7")
shader_parameter/offset_from_ground = 0.5
shader_parameter/waves = 8.0
shader_parameter/speed = 2.0
shader_parameter/wave_height = 0.5
[sub_resource type="SphereMesh" id="SphereMesh_sctja"]
material = SubResource("ShaderMaterial_u3tcf")
[node name="Variables" type="Node3D"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("SphereMesh_sctja")