Scenery (all procedural, seeded, no imported assets): - Terrain shader: grass/dry grass/dirt/sand/rock strata/snow + detail normals - 5 tree types, faceted mossy rocks, cliff outcrops, sea stacks, bushes, logs and stumps, batched as MultiMesh per 48 m cell - Wind-animated grass and flowers streamed in tiles around the player - Lake (depth-shaded water with shore foam), ocean to the horizon, cloud sky shader, volumetric fog, glow, softer shadows - Swimming: float at the surface, swim-jump to climb out World bounds: - Steep mountain rim with an invisible wall partway up; one side opens to a sheer sea cliff with the wall 1 m inside the edge; whole chunk is an island so the mesh edge is never visible - Respawn safety net if the player leaves the walkable area or the map - Fix: the cliff edge now tracks the wall in the headlands (it used to drop away inside the wall, leaving a pit with lake water hanging over it) Tests: tests/test_boundary.gd (24-direction escape attempt) and tests/test_terrain_edges.gd (no ground below waterline near the wall). Upgrades the project to Godot 4.7 (project.godot rewritten by the 4.7 importer, .uid files added) and documents it in the setup guide.
24 lines
806 B
Plaintext
24 lines
806 B
Plaintext
// Shared helpers for the world shaders.
|
|
// Declares `noise_tex` (a seamless NoiseTexture2D set from terrain.gd) so every
|
|
// shader samples the same noise, which keeps grass, terrain and rock colour
|
|
// variation lined up with each other.
|
|
|
|
uniform sampler2D noise_tex : filter_linear_mipmap, repeat_enable;
|
|
|
|
float nz(vec2 p) {
|
|
return texture(noise_tex, p).r;
|
|
}
|
|
|
|
// Triplanar noise: samples along all three axes so steep faces (cliffs, rock
|
|
// sides) don't show the stretched streaks a top-down projection would give.
|
|
float tri_nz(vec3 p, vec3 n, float s) {
|
|
vec3 w = pow(abs(n), vec3(4.0));
|
|
w /= (w.x + w.y + w.z);
|
|
return nz(p.zy * s) * w.x + nz(p.xz * s) * w.y + nz(p.xy * s) * w.z;
|
|
}
|
|
|
|
// Vertex colours are authored as sRGB; lighting needs linear.
|
|
vec3 to_linear(vec3 c) {
|
|
return pow(c, vec3(2.2));
|
|
}
|