basic checkered ground

This commit is contained in:
mehbark 2025-05-05 18:13:48 -04:00
parent bf4739f238
commit 99ee97c0c1
3 changed files with 25 additions and 5 deletions

14
ground.gdshader Normal file
View file

@ -0,0 +1,14 @@
shader_type spatial;
uniform vec2 dims;
uniform vec3 light_color : source_color;
uniform vec3 dark_color : source_color;
void fragment() {
vec2 p = UV*dims/2.0;
if (round(mod(p.x,1)) == round(mod(p.y,1))) {
ALBEDO = light_color;
} else {
ALBEDO = dark_color;
}
}

1
ground.gdshader.uid Normal file
View file

@ -0,0 +1 @@
uid://c7e17bwc7nrgt

View file

@ -1,9 +1,10 @@
[gd_scene load_steps=10 format=3 uid="uid://lrk2whqxl0w0"]
[gd_scene load_steps=11 format=3 uid="uid://lrk2whqxl0w0"]
[ext_resource type="Script" uid="uid://c707s0tgd88pg" path="res://main.gd" id="1_ig7tw"]
[ext_resource type="Texture2D" uid="uid://crahyipmcudoy" path="res://ui/undo.png" id="3_lquwl"]
[ext_resource type="Texture2D" uid="uid://dyj5el5iro1cb" path="res://ui/redo.png" id="4_7mycd"]
[ext_resource type="Texture2D" uid="uid://cbb1q0usxd6ex" path="res://ui/restart.png" id="5_272bh"]
[ext_resource type="Shader" uid="uid://c7e17bwc7nrgt" path="res://ground.gdshader" id="5_lquwl"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_1bvp3"]
sky_top_color = Color(0.467272, 0.753409, 0.87431, 1)
@ -19,11 +20,15 @@ background_mode = 2
sky = SubResource("Sky_lquwl")
tonemap_mode = 2
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_1bvp3"]
albedo_color = Color(0.250136, 0.493198, 0.284902, 1)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_lquwl"]
render_priority = 0
shader = ExtResource("5_lquwl")
shader_parameter/dims = Vector2(64, 64)
shader_parameter/light_color = Color(0.321254, 0.470959, 0.199863, 1)
shader_parameter/dark_color = Color(0.308333, 0.451677, 0.191453, 1)
[sub_resource type="PlaneMesh" id="PlaneMesh_1bvp3"]
material = SubResource("StandardMaterial3D_1bvp3")
material = SubResource("ShaderMaterial_lquwl")
size = Vector2(64, 64)
[node name="Main" type="Node3D"]
@ -100,7 +105,7 @@ horizontal_alignment = 1
vertical_alignment = 1
[node name="Ground" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.1, 0)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.01, 0)
mesh = SubResource("PlaneMesh_1bvp3")
[connection signal="pressed" from="UndoButton" to="." method="undo"]