A1: Style guide, palette and the woodcut print pass
docs/STYLE.md sets Tidewall's look: a drowned coast printed by hand. It has the palette, shape language, character proportions, shading, UI motifs, audio palette and a do-not-do list. - Palette (src/client/style/palette.gd) is the one table of client colours. Every colour that was scattered over the views now names its entry, with values unchanged. test_palette fails on a colour literal anywhere else in src/client or src/app, and on a palette colour the guide doesn't list. - Look sets up the sky, the salt-faded grading (saturation 0.86, contrast 1.05), the sun and the print pass, for the match view and the capture scenes. - folk_print.gdshader is one full-screen quad multiplied over the frame. It draws ink lines at depth jumps and creases (fading with distance, scaled with screen height), diagonal hatching cut into real shadow, and faint paper grain. Ground under the sea gets none. - make style-captures renders a hamlet and a dock with and without the pass. Closes #41 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Tidewall build entry points. Everything runs headless with the repo-local engine.
|
||||
GODOT := tools/godot.sh
|
||||
|
||||
.PHONY: check import parse test test-selfcheck smoke capture-test terrain-capture binaries verify-engine bot-matches match match-captures client-check client-captures discovery-check fuzz soak soak-selfcheck server-package-check
|
||||
.PHONY: check import parse test test-selfcheck smoke capture-test terrain-capture binaries verify-engine bot-matches match match-captures client-check client-captures style-captures discovery-check fuzz soak soak-selfcheck server-package-check
|
||||
|
||||
## Everything that must pass before a push.
|
||||
check: verify-engine binaries parse test test-selfcheck smoke
|
||||
@@ -65,6 +65,10 @@ discovery-check: import
|
||||
client-captures: import
|
||||
@for stage in barge glide landed basin build build_refused; do tools/capture.sh client_$$stage captures/client_$$stage.png; done
|
||||
|
||||
## A1: the woodcut print pass on and off, side by side scenes (captures/style_*.png). Needs Docker.
|
||||
style-captures: import
|
||||
@for scene in style_hamlet style_hamlet_plain style_dock style_dock_plain; do tools/capture.sh $$scene captures/$$scene.png; done
|
||||
|
||||
## Renders the capture test scenes in the offscreen container. Needs Docker.
|
||||
capture-test: import
|
||||
@tools/capture_selfcheck.sh
|
||||
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
# Tidewall style guide
|
||||
|
||||
Binding on every asset, view and sound Tidewall makes, alongside
|
||||
[ORIGINALITY.md](ORIGINALITY.md). Generated assets follow this guide, and new work is
|
||||
checked against it.
|
||||
|
||||
## The idea in one line
|
||||
|
||||
**A drowned coast, printed by hand.** Tidewall should look like a fisher community's
|
||||
own woodcut or painted sign: weathered wood, rope and tar, salt-bleached paint, cut
|
||||
with ink lines and hatched shadow. It should never look glossy, toy-bright or
|
||||
candy-coloured. The genre's mainstream look is saturated, rounded and clean. Ours is
|
||||
muted, angular and worn.
|
||||
|
||||
## Palette
|
||||
|
||||
Every colour the client draws with lives in
|
||||
[`src/client/style/palette.gd`](../src/client/style/palette.gd), and
|
||||
`test/project/test_palette.gd` fails on a colour literal anywhere else in `src/client`
|
||||
or `src/app`, and on any palette colour this table doesn't list. Values are sRGB.
|
||||
|
||||
**Rules**
|
||||
|
||||
- **Muted, never neon.** No channel combination brighter or more saturated than
|
||||
`OILSKIN` yellow. Saturation sits low; the environment grades the frame a further 14%
|
||||
greyer (`Look.SATURATION`).
|
||||
- **Warm darks.** The darkest colours are tar and ink, which lean brown. Nothing is
|
||||
pure black, and `INK` is never `#000`.
|
||||
- **One warm accent.** Oilskin yellow marks the local player and the HUD's few
|
||||
emphasised items. Rust red means danger or refusal, sea green means allowed. Both
|
||||
always come with a shape or a word, never colour alone.
|
||||
- **Paint is faded.** Painted things (ochre roofs, verdigris trim, chests) sit between
|
||||
a fresh colour and the grey of the wood beneath.
|
||||
|
||||
| Name | sRGB | What it is |
|
||||
|---|---|---|
|
||||
| `TAR` | 0.19, 0.16, 0.13 | Fresh pine tar: hulls, piles, sheds |
|
||||
| `TAR_WEATHERED` | 0.31, 0.26, 0.22 | Weathered tar: wrecks, old piles |
|
||||
| `PLANK` | 0.50, 0.45, 0.37 | Grey planking |
|
||||
| `PLANK_BLEACHED` | 0.64, 0.60, 0.52 | Salt-bleached planks: jetties, wreck ribs |
|
||||
| `DRIFTWOOD` | 0.62, 0.50, 0.36 | Driftwood, build material 1 |
|
||||
| `CRATE_WOOD` | 0.68, 0.55, 0.38 | Unpainted crate wood |
|
||||
| `BARK` | 0.40, 0.30, 0.22 | Pine bark |
|
||||
| `HOLD_SHADOW` | 0.22, 0.20, 0.18 | Inside an emptied chest or hold |
|
||||
| `CANVAS` | 0.84, 0.80, 0.68 | Rope and sailcloth |
|
||||
| `TANNED_SAIL` | 0.62, 0.44, 0.28 | Bark-tanned sails |
|
||||
| `STONE` | 0.56, 0.54, 0.49 | Field stone in walls and quays |
|
||||
| `BOULDER` | 0.56, 0.55, 0.51 | Loose boulders |
|
||||
| `DRESSED_STONE` | 0.60, 0.59, 0.55 | Dressed stone, build material 2 |
|
||||
| `LICHEN` | 0.62, 0.61, 0.45 | Lichen on high rock |
|
||||
| `SALVAGE_IRON` | 0.50, 0.34, 0.26 | Rusted salvage iron, build material 3 |
|
||||
| `SALT` | 0.90, 0.90, 0.86 | Salt pans and whitewash |
|
||||
| `OCHRE_RED` | 0.56, 0.27, 0.20 | Faded red ochre roofs and doors |
|
||||
| `SEA_PAINT` | 0.33, 0.55, 0.56 | Verdigris sea-green trim and sea chests |
|
||||
| `OILSKIN` | 0.86, 0.66, 0.16 | Oilskin yellow, the local player, the HUD's accent |
|
||||
| `OILSKIN_MOSS` | 0.36, 0.40, 0.30 | Moss oilskin |
|
||||
| `OILSKIN_SLATE` | 0.48, 0.46, 0.44 | Slate oilskin |
|
||||
| `OILSKIN_NAVY` | 0.30, 0.36, 0.48 | Faded navy oilskin |
|
||||
| `GILT` | 0.93, 0.80, 0.42 | Gilt and brass: loot glints, carvings |
|
||||
| `LAMP` | 0.98, 0.86, 0.55 | Lit lamp glass |
|
||||
| `SKIN` | 0.74, 0.58, 0.46 | Weathered skin |
|
||||
| `NEEDLES` | three greens | Pine needles, varied per tree |
|
||||
| `SCRUB` | two olive greens | Gorse and scrub |
|
||||
| `SKY_TOP` | 0.32, 0.50, 0.68 | Zenith |
|
||||
| `SKY_HAZE` | 0.82, 0.78, 0.68 | Salt-hazed horizon |
|
||||
| `SKY_BELOW` | 0.18, 0.20, 0.20 | Below the horizon |
|
||||
| `SEA_FOG` | 0.78, 0.78, 0.74 | Distance fog |
|
||||
| `INK` | 0.16, 0.13, 0.11 | Printer's ink: outlines, hatching |
|
||||
| `PAPER` | 0.91, 0.87, 0.78 | Unbleached paper: HUD panels and text |
|
||||
| `PAPER_DIM` | 0.66, 0.62, 0.54 | Paper in shadow: panel edges, dimmed text |
|
||||
| `OUTLINE` | 0.08, 0.08, 0.08 | Text outline on the HUD |
|
||||
| `GHOST_OK` | 0.46, 0.80, 0.70, 38% | Build ghost: allowed |
|
||||
| `GHOST_REFUSED` | 0.86, 0.32, 0.22, 38% | Build ghost: refused |
|
||||
| `WARNING` | 0.86, 0.32, 0.22 | HUD danger: the tide's next line, low health |
|
||||
| `SEA_INK` | 0.20, 0.34, 0.42 | The sea on the tide gauge and map |
|
||||
|
||||
The terrain shader's sand, marsh, grass, rock and summit colours and the sea shader's
|
||||
shallow, deep and foam colours are shader uniforms. They follow the same rules.
|
||||
|
||||
## Shading: the woodcut print pass
|
||||
|
||||
[`src/client/style/folk_print.gdshader`](../src/client/style/folk_print.gdshader), set
|
||||
up by `Look.add_print_pass(camera)`, is drawn over every frame:
|
||||
|
||||
- **Ink lines** where depth jumps (silhouettes) or bends (creases). They are drawn at
|
||||
full weight near the camera and fade with distance, so far hills stay quiet. Line
|
||||
weight scales with screen height, so 4K looks like 720p.
|
||||
- **Hatching cut into shadow:** diagonal lines whose width grows as the shadow
|
||||
deepens, the way a woodcut shows tone.
|
||||
- **Paper grain**, faint.
|
||||
- It only darkens (it is multiplied over the frame), so lit colours stay the palette's.
|
||||
- Ground under the sea gets no ink or hatching. The sea and the build ghost are drawn
|
||||
after the pass and carry their own looks.
|
||||
- `Look.environment()` grades the frame: saturation 0.86, contrast 1.05. The capture
|
||||
scenes and the match view share it, so captures show the game's real look.
|
||||
|
||||
Materials stay matte. Roughness is high (0.7 to 0.95) except lamp glass and wet stone.
|
||||
No shiny plastic, no rim lights, no bloom beyond lamps.
|
||||
|
||||
## Shape language
|
||||
|
||||
- **Hand-built and slightly off.** Planks are strips with seams, stone is in courses,
|
||||
roofs overhang. Edges are chamfered or blocky, not rounded or bubbly.
|
||||
- **Vertical and narrow.** Lighthouses, masts, drying racks, pines. The island reads
|
||||
as a climb, because height is safety.
|
||||
- **Boats and tide marks everywhere.** Hulls, nets, floats, posts with painted tide
|
||||
lines. The sea's reach is part of every place.
|
||||
- **Silhouettes first.** Every object reads by outline alone; the ink pass depends on
|
||||
it.
|
||||
|
||||
## Characters
|
||||
|
||||
- **Proportions:** about 6.5 heads tall, broad shoulders, heavy boots and coats, hands
|
||||
slightly large. Grounded working people, not heroes or mascots.
|
||||
- **Clothing:** oilskins, sou'westers, knitted jumpers, rope belts, canvas bags, sea
|
||||
boots. Variation comes from coat colour, hat, patches and knitwear patterns.
|
||||
- **Faces:** simple carved planes, like a ship's figurehead or a whittled figure. No
|
||||
big-eyed cartoon faces.
|
||||
- **Movement:** weight and effort. Climbing is a scramble, swimming is a struggle.
|
||||
- **Celebrations** (if any): small, local gestures such as raising a lantern or tipping
|
||||
a hat. Never dances.
|
||||
|
||||
## UI motifs
|
||||
|
||||
- **Paper and ink.** Panels are unbleached paper (`PAPER`) with ink text, or ink
|
||||
panels with paper text, edged like a torn chart or a painted board.
|
||||
- **Charts and tide tables.** The map is a hand-drawn nautical chart; the tide gauge
|
||||
is a painted tide post with notches, the most prominent thing on the HUD.
|
||||
- **Hand-lettered signs** in spirit, with Godot's bundled default font in practice (see
|
||||
ORIGINALITY.md). Small caps and wide spacing for labels.
|
||||
- **Rope and knots** as dividers; brass (`GILT`) for the rare highlight.
|
||||
- **Never colour alone.** Health uses a number and a bar; tiers use pips or roman
|
||||
numerals; danger uses a shape (a notch, a wave mark) as well as `WARNING`.
|
||||
- Layout is Tidewall's own. The tide gauge sits top centre, because the tide is the
|
||||
clock.
|
||||
|
||||
## Audio palette
|
||||
|
||||
All synthesized by scripts in the repository.
|
||||
|
||||
- **Sea and weather:** filtered noise for surf, wind and rain; low swells that rise
|
||||
with the tide.
|
||||
- **Wood and rope:** knocks, creaks and thumps from short resonant bursts. Building
|
||||
sounds like carpentry.
|
||||
- **Bells and horns:** a ship's bell for phases, a foghorn for the tide's rise, a
|
||||
lighthouse tone for the last circle of land.
|
||||
- **Weapons:** black-powder thumps and cracks, dull rather than sharp; no sci-fi zaps.
|
||||
- **Music:** folk instruments synthesized simply: drone, fiddle-like bowed tones,
|
||||
concertina chords, a bodhrán-like frame drum. Modal and sparse. Quiet in play,
|
||||
fuller in menus and results.
|
||||
- Mix: the sea is always present underneath. Loudness is calm; the tide is the
|
||||
loudest thing when it rises.
|
||||
|
||||
## Never
|
||||
|
||||
- Bright saturated primaries, candy colours, pastel gradients or glossy materials.
|
||||
- Rounded "toy" shapes, bubbly fonts, big-eyed faces, mascot characters.
|
||||
- Dances, emotes copied from anywhere, or celebration animations borrowed from any game.
|
||||
- Neon, glowing outlines, holograms, sci-fi panels or loot beams.
|
||||
- Rarity colour schemes from other games. Tidewall's tiers are told by pips and wear.
|
||||
- Any layout, icon, sound or name taken from or imitating a commercial game (see
|
||||
ORIGINALITY.md).
|
||||
- Third-party art, audio, fonts, sample packs or reference images.
|
||||
- Pure black, or ink lines so heavy the scene turns into a comic.
|
||||
|
||||
## Provenance
|
||||
|
||||
Every generated asset names its generator script in
|
||||
[`assets/PROVENANCE.md`](../assets/PROVENANCE.md) when the first asset lands.
|
||||
Colours, shaders and procedural meshes made in code are recorded by being in the
|
||||
repository.
|
||||
@@ -87,7 +87,7 @@ func _ready() -> void:
|
||||
_status = Label.new()
|
||||
_status.position = Vector2(24.0, 20.0)
|
||||
_status.add_theme_font_size_override("font_size", 22)
|
||||
_status.add_theme_color_override("font_outline_color", Color(0.08, 0.08, 0.08))
|
||||
_status.add_theme_color_override("font_outline_color", Palette.OUTLINE)
|
||||
_status.add_theme_constant_override("outline_size", 6)
|
||||
add_child(_status)
|
||||
if DisplayServer.get_name() != "headless" and not input.autoplay:
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
class_name BuildGhost
|
||||
extends Node3D
|
||||
|
||||
const VALID_COLOUR: Color = Color(0.46, 0.80, 0.70, 0.38)
|
||||
const INVALID_COLOUR: Color = Color(0.86, 0.32, 0.22, 0.38)
|
||||
const VALID_COLOUR: Color = Palette.GHOST_OK
|
||||
const INVALID_COLOUR: Color = Palette.GHOST_REFUSED
|
||||
|
||||
## Whether the last update showed a placement the server would accept.
|
||||
var valid: bool = false
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
## Builds meshes for structure pieces from their collision boxes, so what players see is
|
||||
## what blocks them. Faces are split into planks, stone courses or iron panels, each
|
||||
## with its own slight tint, in the weathered palette from docs/ORIGINALITY.md. This is
|
||||
## with its own slight tint, in the weathered palette from docs/STYLE.md. This is
|
||||
## a blockout look; the v0.6 art pass replaces it.
|
||||
class_name PieceMesher
|
||||
extends RefCounted
|
||||
|
||||
## Base colour per material code, in sRGB.
|
||||
const COLOURS: Array[Color] = [Color(0.62, 0.50, 0.36), Color(0.60, 0.59, 0.55), Color(0.50, 0.34, 0.26)]
|
||||
const COLOURS: Array[Color] = [Palette.DRIFTWOOD, Palette.DRESSED_STONE, Palette.SALVAGE_IRON]
|
||||
## Size of a plank, course or panel, in metres, per material code.
|
||||
const STRIP: Array[float] = [0.5, 0.5, 1.0]
|
||||
## Gap between strips, shown as a darker seam.
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
## Draws what moves in a match: players, the sky barge while it crosses, items lying
|
||||
## in the world and sea chests. `sync()` matches everything to the simulation as it is
|
||||
## now. These are stand-in shapes built in code, in the weathered seafaring palette of
|
||||
## docs/ORIGINALITY.md: an oilskin coat, a sou'wester and a canvas wing-sail. The art
|
||||
## docs/STYLE.md: an oilskin coat, a sou'wester and a canvas wing-sail. The art
|
||||
## pass replaces them. Nothing here is ever used for collision.
|
||||
class_name EntityView
|
||||
extends Node3D
|
||||
|
||||
## Oilskin colours. A player's is picked by entity ID; the local player wears the first.
|
||||
const OILSKINS: Array[Color] = [
|
||||
Color(0.86, 0.66, 0.16), Color(0.56, 0.27, 0.20), Color(0.33, 0.55, 0.56), Color(0.36, 0.40, 0.30),
|
||||
Color(0.48, 0.46, 0.44), Color(0.30, 0.36, 0.48), Color(0.62, 0.44, 0.28),
|
||||
Palette.OILSKIN, Palette.OCHRE_RED, Palette.SEA_PAINT, Palette.OILSKIN_MOSS,
|
||||
Palette.OILSKIN_SLATE, Palette.OILSKIN_NAVY, Palette.TANNED_SAIL,
|
||||
]
|
||||
const SKIN: Color = Color(0.74, 0.58, 0.46)
|
||||
const CANVAS: Color = Color(0.84, 0.80, 0.68)
|
||||
const TAR: Color = Color(0.19, 0.16, 0.13)
|
||||
const PLANK: Color = Color(0.50, 0.45, 0.37)
|
||||
const CHEST_SHUT: Color = Color(0.33, 0.55, 0.56)
|
||||
const CHEST_OPEN: Color = Color(0.22, 0.20, 0.18)
|
||||
const ITEM: Color = Color(0.93, 0.80, 0.42)
|
||||
const SKIN: Color = Palette.SKIN
|
||||
const CANVAS: Color = Palette.CANVAS
|
||||
const TAR: Color = Palette.TAR
|
||||
const PLANK: Color = Palette.PLANK
|
||||
const CHEST_SHUT: Color = Palette.SEA_PAINT
|
||||
const CHEST_OPEN: Color = Palette.HOLD_SHADOW
|
||||
const ITEM: Color = Palette.GILT
|
||||
## How far apart passengers stand on the barge's deck, in metres. The simulation
|
||||
## carries them all at one point; this only spreads them out to be seen.
|
||||
const DECK_SPACING: float = 1.3
|
||||
|
||||
@@ -17,37 +17,17 @@ var structures: StructureView
|
||||
var entities: EntityView
|
||||
var camera: Camera3D
|
||||
var rig: CameraRig = CameraRig.new()
|
||||
## The woodcut print pass over the camera (Look.add_print_pass).
|
||||
var print_pass: MeshInstance3D
|
||||
|
||||
|
||||
## Builds the scene for `simulation`. `local_id` is the player this client plays, or 0.
|
||||
func setup(simulation: Simulation, local_id: int = 0) -> void:
|
||||
sim = simulation
|
||||
var sky_material: ProceduralSkyMaterial = ProceduralSkyMaterial.new()
|
||||
sky_material.sky_top_color = Color(0.32, 0.5, 0.68)
|
||||
sky_material.sky_horizon_color = Color(0.82, 0.78, 0.68)
|
||||
sky_material.ground_bottom_color = Color(0.18, 0.2, 0.2)
|
||||
sky_material.ground_horizon_color = Color(0.82, 0.78, 0.68)
|
||||
var sky: Sky = Sky.new()
|
||||
sky.sky_material = sky_material
|
||||
var environment: Environment = Environment.new()
|
||||
environment.background_mode = Environment.BG_SKY
|
||||
environment.sky = sky
|
||||
environment.ambient_light_source = Environment.AMBIENT_SOURCE_SKY
|
||||
environment.ambient_light_energy = 0.45
|
||||
environment.tonemap_mode = Environment.TONE_MAPPER_FILMIC
|
||||
environment.fog_enabled = true
|
||||
environment.fog_light_color = Color(0.78, 0.78, 0.74)
|
||||
environment.fog_density = 0.0005
|
||||
environment.fog_aerial_perspective = 0.4
|
||||
var world: WorldEnvironment = WorldEnvironment.new()
|
||||
world.environment = environment
|
||||
world.environment = Look.environment()
|
||||
add_child(world)
|
||||
var sun: DirectionalLight3D = DirectionalLight3D.new()
|
||||
sun.rotation_degrees = Vector3(-35.0, -130.0, 0.0)
|
||||
sun.light_energy = 0.95
|
||||
sun.shadow_enabled = true
|
||||
sun.directional_shadow_max_distance = 400.0
|
||||
add_child(sun)
|
||||
add_child(Look.sun())
|
||||
|
||||
camera = Camera3D.new()
|
||||
camera.near = CameraRig.NEAR
|
||||
@@ -55,6 +35,7 @@ func setup(simulation: Simulation, local_id: int = 0) -> void:
|
||||
camera.fov = CameraRig.FOV
|
||||
add_child(camera)
|
||||
camera.make_current()
|
||||
print_pass = Look.add_print_pass(camera)
|
||||
|
||||
if sim.island != null:
|
||||
terrain = TerrainView.new()
|
||||
@@ -81,6 +62,7 @@ func setup(simulation: Simulation, local_id: int = 0) -> void:
|
||||
## Matches everything drawn to the simulation as it is now.
|
||||
func sync() -> void:
|
||||
water.follow(sim)
|
||||
Look.set_sea_level(print_pass, water.level)
|
||||
props.sync()
|
||||
structures.sync()
|
||||
entities.sync()
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
## Draws an island's points of interest from their parts: one MultiMesh of boxes per
|
||||
## look, so the whole set costs a handful of draw calls. Colours follow the weathered
|
||||
## seafaring palette in docs/ORIGINALITY.md: tarred wood, grey planks, stone, faded red
|
||||
## seafaring palette in docs/STYLE.md: tarred wood, grey planks, stone, faded red
|
||||
## roofs, salt-faded paint and white salt. No textures; the art pass replaces these.
|
||||
class_name PoiView
|
||||
extends Node3D
|
||||
|
||||
const LOOKS: Dictionary = {
|
||||
Poi.LOOK_TARRED_WOOD: {"colour": Color(0.19, 0.16, 0.13), "roughness": 0.7},
|
||||
Poi.LOOK_PLANK: {"colour": Color(0.50, 0.45, 0.37), "roughness": 0.9},
|
||||
Poi.LOOK_STONE: {"colour": Color(0.56, 0.54, 0.49), "roughness": 0.95},
|
||||
Poi.LOOK_ROOF: {"colour": Color(0.56, 0.27, 0.20), "roughness": 0.85},
|
||||
Poi.LOOK_PAINT: {"colour": Color(0.33, 0.55, 0.56), "roughness": 0.8},
|
||||
Poi.LOOK_SALT: {"colour": Color(0.90, 0.90, 0.86), "roughness": 0.6},
|
||||
Poi.LOOK_LAMP: {"colour": Color(0.98, 0.86, 0.55), "roughness": 0.3, "glow": 1.6},
|
||||
Poi.LOOK_TARRED_WOOD: {"colour": Palette.TAR, "roughness": 0.7},
|
||||
Poi.LOOK_PLANK: {"colour": Palette.PLANK, "roughness": 0.9},
|
||||
Poi.LOOK_STONE: {"colour": Palette.STONE, "roughness": 0.95},
|
||||
Poi.LOOK_ROOF: {"colour": Palette.OCHRE_RED, "roughness": 0.85},
|
||||
Poi.LOOK_PAINT: {"colour": Palette.SEA_PAINT, "roughness": 0.8},
|
||||
Poi.LOOK_SALT: {"colour": Palette.SALT, "roughness": 0.6},
|
||||
Poi.LOOK_LAMP: {"colour": Palette.LAMP, "roughness": 0.3, "glow": 1.6},
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,14 +23,14 @@ const FADE: float = 30.0
|
||||
## How far an instance's colour may stray from white, per channel.
|
||||
const TINT: float = 0.12
|
||||
|
||||
const BARK: Color = Color(0.40, 0.30, 0.22)
|
||||
const NEEDLES: Array[Color] = [Color(0.22, 0.36, 0.28), Color(0.26, 0.40, 0.30), Color(0.31, 0.44, 0.32)]
|
||||
const SCRUB: Array[Color] = [Color(0.45, 0.48, 0.30), Color(0.53, 0.53, 0.34)]
|
||||
const STONE: Color = Color(0.56, 0.55, 0.51)
|
||||
const LICHEN: Color = Color(0.62, 0.61, 0.45)
|
||||
const TAR: Color = Color(0.31, 0.26, 0.22)
|
||||
const PLANK: Color = Color(0.64, 0.60, 0.52)
|
||||
const CRATE: Color = Color(0.68, 0.55, 0.38)
|
||||
const BARK: Color = Palette.BARK
|
||||
const NEEDLES: Array[Color] = Palette.NEEDLES
|
||||
const SCRUB: Array[Color] = Palette.SCRUB
|
||||
const STONE: Color = Palette.BOULDER
|
||||
const LICHEN: Color = Palette.LICHEN
|
||||
const TAR: Color = Palette.TAR_WEATHERED
|
||||
const PLANK: Color = Palette.PLANK_BLEACHED
|
||||
const CRATE: Color = Palette.CRATE_WOOD
|
||||
|
||||
## Props drawn and props hidden since setup.
|
||||
var drawn: int = 0
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
// Tidewall's woodcut print pass (docs/STYLE.md, "Shading"). One full-screen quad, drawn
|
||||
// last and multiplied over the frame, adds what a hand-cut print has and a render
|
||||
// doesn't:
|
||||
// - ink lines where depth jumps (silhouettes) or bends (creases), thick near the
|
||||
// camera and fading with distance so far hills stay quiet;
|
||||
// - diagonal hatching cut into shadow, its lines thickening as the shadow deepens;
|
||||
// - a faint grain of unbleached paper.
|
||||
// It only darkens (blend_mul), so lit colours stay the palette's own. Colour grading
|
||||
// (salt-faded saturation, contrast) is done by the Environment in Look. Ground under
|
||||
// the sea gets no ink or hatching, because the water is drawn over it. No textures:
|
||||
// every pattern is generated here.
|
||||
shader_type spatial;
|
||||
render_mode unshaded, blend_mul, depth_test_disabled, depth_draw_never, cull_disabled, fog_disabled, shadows_disabled;
|
||||
|
||||
uniform sampler2D depth_texture : hint_depth_texture, filter_nearest;
|
||||
uniform sampler2D screen_texture : hint_screen_texture, filter_linear_mipmap;
|
||||
uniform vec3 ink_colour : source_color = vec3(0.16, 0.13, 0.11);
|
||||
// 0 turns the pass off without removing it.
|
||||
uniform float strength : hint_range(0.0, 1.0) = 1.0;
|
||||
// Line weight, in pixels at 720 lines of screen; scales with the screen's height.
|
||||
uniform float line_pixels = 1.0;
|
||||
// Relative depth jump that counts as a silhouette, and depth bend that counts as a crease.
|
||||
uniform float silhouette_threshold = 0.035;
|
||||
uniform float crease_threshold = 0.010;
|
||||
// Lines are full strength out to ink_near metres and fade to ink_far_strength by ink_far.
|
||||
uniform float ink_near = 35.0;
|
||||
uniform float ink_far = 260.0;
|
||||
uniform float ink_far_strength = 0.2;
|
||||
// Hatching: spacing in pixels at 720 lines, and the scene luminance (linear, before
|
||||
// tone mapping) below which it begins: only real shadow, never lit ground.
|
||||
uniform float hatch_spacing = 5.0;
|
||||
uniform float hatch_start = 0.055;
|
||||
uniform float hatch_depth = 0.28;
|
||||
uniform float grain = 0.035;
|
||||
// The sea's height: ground below it gets no ink.
|
||||
uniform float sea_level = -1000.0;
|
||||
uniform float camera_far = 2500.0;
|
||||
|
||||
float hash(vec2 p) {
|
||||
p = fract(p * vec2(123.34, 456.21));
|
||||
p += dot(p, p + 45.32);
|
||||
return fract(p.x * p.y);
|
||||
}
|
||||
|
||||
void vertex() {
|
||||
POSITION = vec4(VERTEX.xy, 1.0, 1.0);
|
||||
}
|
||||
|
||||
vec3 view_position(vec2 uv, mat4 inv_projection) {
|
||||
float depth = textureLod(depth_texture, uv, 0.0).r;
|
||||
#if CURRENT_RENDERER == RENDERER_COMPATIBILITY
|
||||
vec4 ndc = vec4(uv * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);
|
||||
#else
|
||||
vec4 ndc = vec4(uv * 2.0 - 1.0, depth, 1.0);
|
||||
#endif
|
||||
vec4 view = inv_projection * ndc;
|
||||
return view.xyz / view.w;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
vec2 uv = SCREEN_UV;
|
||||
float scale = VIEWPORT_SIZE.y / 720.0;
|
||||
vec2 step_uv = line_pixels * scale / VIEWPORT_SIZE;
|
||||
|
||||
vec3 centre = view_position(uv, INV_PROJECTION_MATRIX);
|
||||
float d = -centre.z;
|
||||
float d_l = -view_position(uv - vec2(step_uv.x, 0.0), INV_PROJECTION_MATRIX).z;
|
||||
float d_r = -view_position(uv + vec2(step_uv.x, 0.0), INV_PROJECTION_MATRIX).z;
|
||||
float d_u = -view_position(uv - vec2(0.0, step_uv.y), INV_PROJECTION_MATRIX).z;
|
||||
float d_d = -view_position(uv + vec2(0.0, step_uv.y), INV_PROJECTION_MATRIX).z;
|
||||
|
||||
bool sky = d > camera_far * 0.9;
|
||||
vec3 world = (INV_VIEW_MATRIX * vec4(centre, 1.0)).xyz;
|
||||
bool under_sea = world.y < sea_level - 0.15;
|
||||
|
||||
// Silhouettes: the nearer side of a depth jump gets the line, so outlines hug objects.
|
||||
float near_d = min(d, min(min(d_l, d_r), min(d_u, d_d)));
|
||||
float jump = max(max(abs(d_l - d), abs(d_r - d)), max(abs(d_u - d), abs(d_d - d))) / max(near_d, 0.001);
|
||||
float silhouette = smoothstep(silhouette_threshold, silhouette_threshold * 2.0, jump);
|
||||
// Creases: depth bending (second difference) on one surface.
|
||||
float bend = (abs(d_l + d_r - 2.0 * d) + abs(d_u + d_d - 2.0 * d)) / max(d, 0.001);
|
||||
float crease = smoothstep(crease_threshold, crease_threshold * 2.5, bend) * 0.7;
|
||||
float distance_fade = mix(1.0, ink_far_strength, smoothstep(ink_near, ink_far, near_d));
|
||||
float ink = max(silhouette, crease) * distance_fade;
|
||||
if (sky && near_d > camera_far * 0.9) {
|
||||
ink = 0.0;
|
||||
}
|
||||
// Samples past the screen's edge clamp to it and read as a depth jump: no frame.
|
||||
vec2 pixel = FRAGCOORD.xy;
|
||||
if (pixel.x < 2.0 * scale || pixel.y < 2.0 * scale || pixel.x > VIEWPORT_SIZE.x - 2.0 * scale || pixel.y > VIEWPORT_SIZE.y - 2.0 * scale) {
|
||||
ink = 0.0;
|
||||
}
|
||||
|
||||
// Hatching in shadow: diagonal lines in screen space whose width grows with darkness.
|
||||
float hatch = 0.0;
|
||||
if (!sky && !under_sea) {
|
||||
vec3 scene = textureLod(screen_texture, uv, 0.0).rgb;
|
||||
float luminance = dot(scene, vec3(0.2126, 0.7152, 0.0722));
|
||||
float shade = smoothstep(hatch_start, hatch_start * 0.25, luminance);
|
||||
float spacing = hatch_spacing * scale;
|
||||
float stripe = fract((FRAGCOORD.x + FRAGCOORD.y) / spacing);
|
||||
float width = shade * 0.55;
|
||||
float aa = 1.2 / spacing;
|
||||
hatch = shade > 0.0 ? (1.0 - smoothstep(width - aa, width + aa, abs(stripe - 0.5) * 2.0)) * hatch_depth * distance_fade : 0.0;
|
||||
} else if (under_sea) {
|
||||
ink = 0.0;
|
||||
}
|
||||
|
||||
float paper = 1.0 - grain * hash(floor(FRAGCOORD.xy / max(scale, 1.0)));
|
||||
vec3 multiplier = mix(vec3(1.0), ink_colour, clamp(ink, 0.0, 1.0));
|
||||
multiplier *= 1.0 - hatch;
|
||||
multiplier *= paper;
|
||||
ALBEDO = mix(vec3(1.0), multiplier, strength);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://ceub1y4rrplht
|
||||
@@ -0,0 +1,80 @@
|
||||
## The shared set-up of Tidewall's look (docs/STYLE.md): the salt-hazed sky, the
|
||||
## environment's colour grading, the low coastal sun and the woodcut print pass. The
|
||||
## match view and the capture scenes all use it, so they show the same picture.
|
||||
class_name Look
|
||||
extends RefCounted
|
||||
|
||||
const PRINT_SHADER: Shader = preload("res://src/client/style/folk_print.gdshader")
|
||||
|
||||
## Salt-faded grading: colours a little greyer and a little warmer than they render.
|
||||
const SATURATION: float = 0.86
|
||||
const CONTRAST: float = 1.05
|
||||
const BRIGHTNESS: float = 1.02
|
||||
|
||||
|
||||
## The sky, ambient light, fog and grading. `graded` false leaves colours as rendered,
|
||||
## for captures that compare against the old look.
|
||||
static func environment(graded: bool = true) -> Environment:
|
||||
var sky_material: ProceduralSkyMaterial = ProceduralSkyMaterial.new()
|
||||
sky_material.sky_top_color = Palette.SKY_TOP
|
||||
sky_material.sky_horizon_color = Palette.SKY_HAZE
|
||||
sky_material.ground_bottom_color = Palette.SKY_BELOW
|
||||
sky_material.ground_horizon_color = Palette.SKY_HAZE
|
||||
var sky: Sky = Sky.new()
|
||||
sky.sky_material = sky_material
|
||||
var environment: Environment = Environment.new()
|
||||
environment.background_mode = Environment.BG_SKY
|
||||
environment.sky = sky
|
||||
environment.ambient_light_source = Environment.AMBIENT_SOURCE_SKY
|
||||
environment.ambient_light_energy = 0.45
|
||||
environment.tonemap_mode = Environment.TONE_MAPPER_FILMIC
|
||||
environment.fog_enabled = true
|
||||
environment.fog_light_color = Palette.SEA_FOG
|
||||
environment.fog_density = 0.0005
|
||||
environment.fog_aerial_perspective = 0.4
|
||||
if graded:
|
||||
environment.adjustment_enabled = true
|
||||
environment.adjustment_saturation = SATURATION
|
||||
environment.adjustment_contrast = CONTRAST
|
||||
environment.adjustment_brightness = BRIGHTNESS
|
||||
return environment
|
||||
|
||||
|
||||
## The low afternoon sun from the sea side.
|
||||
static func sun(shadow_distance: float = 400.0) -> DirectionalLight3D:
|
||||
var light: DirectionalLight3D = DirectionalLight3D.new()
|
||||
light.rotation_degrees = Vector3(-35.0, -130.0, 0.0)
|
||||
light.light_energy = 0.95
|
||||
light.shadow_enabled = true
|
||||
light.directional_shadow_max_distance = shadow_distance
|
||||
return light
|
||||
|
||||
|
||||
## Adds the woodcut print pass to `camera`, as a full-screen quad drawn after
|
||||
## everything else. Returns the quad, whose material takes `sea_level` (see
|
||||
## set_sea_level) and `strength`.
|
||||
static func add_print_pass(camera: Camera3D) -> MeshInstance3D:
|
||||
var quad: QuadMesh = QuadMesh.new()
|
||||
quad.size = Vector2(2.0, 2.0)
|
||||
var material: ShaderMaterial = ShaderMaterial.new()
|
||||
material.shader = PRINT_SHADER
|
||||
material.render_priority = Material.RENDER_PRIORITY_MAX
|
||||
material.set_shader_parameter("ink_colour", Palette.INK)
|
||||
material.set_shader_parameter("camera_far", camera.far)
|
||||
quad.material = material
|
||||
var pass_node: MeshInstance3D = MeshInstance3D.new()
|
||||
pass_node.name = "PrintPass"
|
||||
pass_node.mesh = quad
|
||||
pass_node.cast_shadow = GeometryInstance3D.SHADOW_CASTING_SETTING_OFF
|
||||
# Never culled: the vertex shader puts it over the whole screen wherever it is.
|
||||
pass_node.extra_cull_margin = 16384.0
|
||||
pass_node.custom_aabb = AABB(Vector3(-1.0e5, -1.0e5, -1.0e5), Vector3(2.0e5, 2.0e5, 2.0e5))
|
||||
camera.add_child(pass_node)
|
||||
return pass_node
|
||||
|
||||
|
||||
## Tells the print pass where the sea is, so ground under it gets no ink.
|
||||
static func set_sea_level(pass_node: MeshInstance3D, level: float) -> void:
|
||||
if pass_node == null:
|
||||
return
|
||||
((pass_node.mesh as QuadMesh).material as ShaderMaterial).set_shader_parameter("sea_level", level)
|
||||
@@ -0,0 +1 @@
|
||||
uid://bolk1wkcixhy1
|
||||
@@ -0,0 +1,95 @@
|
||||
## Tidewall's one table of colours: the drowned-coast palette from docs/STYLE.md.
|
||||
## Every colour the client draws with comes from here, so the look stays one look; a
|
||||
## test (test_palette.gd) fails on a colour literal anywhere else in src/client or
|
||||
## src/app. All values are sRGB. Add a colour here, named for what it is in the world,
|
||||
## before using it, and add it to the table in docs/STYLE.md.
|
||||
class_name Palette
|
||||
extends RefCounted
|
||||
|
||||
# --- Wood, rope and tar -------------------------------------------------------------
|
||||
## Fresh pine tar on hulls, piles and sheds. The darkest thing in the world.
|
||||
const TAR: Color = Color(0.19, 0.16, 0.13)
|
||||
## Tar that has weathered grey-brown: wrecks and old piles.
|
||||
const TAR_WEATHERED: Color = Color(0.31, 0.26, 0.22)
|
||||
## Grey planking on walls and decks.
|
||||
const PLANK: Color = Color(0.50, 0.45, 0.37)
|
||||
## Planks bleached pale by salt and sun: wreck ribs, jetties.
|
||||
const PLANK_BLEACHED: Color = Color(0.64, 0.60, 0.52)
|
||||
## Driftwood, the first build material.
|
||||
const DRIFTWOOD: Color = Color(0.62, 0.50, 0.36)
|
||||
## Crates and chests' unpainted wood.
|
||||
const CRATE_WOOD: Color = Color(0.68, 0.55, 0.38)
|
||||
## Pine bark.
|
||||
const BARK: Color = Color(0.40, 0.30, 0.22)
|
||||
## The dark inside of an emptied chest or hold.
|
||||
const HOLD_SHADOW: Color = Color(0.22, 0.20, 0.18)
|
||||
## Hemp rope and sailcloth, unbleached.
|
||||
const CANVAS: Color = Color(0.84, 0.80, 0.68)
|
||||
## Sails tanned with bark, as working boats had them.
|
||||
const TANNED_SAIL: Color = Color(0.62, 0.44, 0.28)
|
||||
|
||||
# --- Stone, iron and salt -----------------------------------------------------------
|
||||
## Field stone in walls and quays.
|
||||
const STONE: Color = Color(0.56, 0.54, 0.49)
|
||||
## Loose boulders, a touch cooler than walls.
|
||||
const BOULDER: Color = Color(0.56, 0.55, 0.51)
|
||||
## Dressed stone, the second build material.
|
||||
const DRESSED_STONE: Color = Color(0.60, 0.59, 0.55)
|
||||
## Yellow-grey lichen on high rock.
|
||||
const LICHEN: Color = Color(0.62, 0.61, 0.45)
|
||||
## Rusted salvage iron, the third build material.
|
||||
const SALVAGE_IRON: Color = Color(0.50, 0.34, 0.26)
|
||||
## Salt pans and whitewash.
|
||||
const SALT: Color = Color(0.90, 0.90, 0.86)
|
||||
|
||||
# --- Salt-faded paint ---------------------------------------------------------------
|
||||
## Red ochre roofs and doors, faded.
|
||||
const OCHRE_RED: Color = Color(0.56, 0.27, 0.20)
|
||||
## Verdigris sea-green paint on trim, shutters and sea chests.
|
||||
const SEA_PAINT: Color = Color(0.33, 0.55, 0.56)
|
||||
## Oilskin yellow: the local player's coat, and the one warm accent of the HUD.
|
||||
const OILSKIN: Color = Color(0.86, 0.66, 0.16)
|
||||
## Moss-green oilskin.
|
||||
const OILSKIN_MOSS: Color = Color(0.36, 0.40, 0.30)
|
||||
## Slate-grey oilskin.
|
||||
const OILSKIN_SLATE: Color = Color(0.48, 0.46, 0.44)
|
||||
## Faded navy oilskin.
|
||||
const OILSKIN_NAVY: Color = Color(0.30, 0.36, 0.48)
|
||||
## Gilt on carved figureheads, loot glints and the lamp's brass.
|
||||
const GILT: Color = Color(0.93, 0.80, 0.42)
|
||||
## Lamp glass, lit.
|
||||
const LAMP: Color = Color(0.98, 0.86, 0.55)
|
||||
## Weathered skin.
|
||||
const SKIN: Color = Color(0.74, 0.58, 0.46)
|
||||
|
||||
# --- Growing things -----------------------------------------------------------------
|
||||
const NEEDLES: Array[Color] = [Color(0.22, 0.36, 0.28), Color(0.26, 0.40, 0.30), Color(0.31, 0.44, 0.32)]
|
||||
const SCRUB: Array[Color] = [Color(0.45, 0.48, 0.30), Color(0.53, 0.53, 0.34)]
|
||||
|
||||
# --- Sky and air --------------------------------------------------------------------
|
||||
const SKY_TOP: Color = Color(0.32, 0.50, 0.68)
|
||||
## The pale, salt-hazed horizon.
|
||||
const SKY_HAZE: Color = Color(0.82, 0.78, 0.68)
|
||||
const SKY_BELOW: Color = Color(0.18, 0.20, 0.20)
|
||||
const SEA_FOG: Color = Color(0.78, 0.78, 0.74)
|
||||
|
||||
# --- Print and paper (the woodcut pass and the HUD) ---------------------------------
|
||||
## Printer's ink: outlines and hatching, warm, never pure black.
|
||||
const INK: Color = Color(0.16, 0.13, 0.11)
|
||||
## Unbleached paper: HUD panels and text on dark ground.
|
||||
const PAPER: Color = Color(0.91, 0.87, 0.78)
|
||||
## Paper in shadow, for panel edges and dimmed text.
|
||||
const PAPER_DIM: Color = Color(0.66, 0.62, 0.54)
|
||||
## Dark text outline on the HUD.
|
||||
const OUTLINE: Color = Color(0.08, 0.08, 0.08)
|
||||
|
||||
# --- Signals ------------------------------------------------------------------------
|
||||
## "Allowed" in the build ghost: sea green.
|
||||
const GHOST_OK: Color = Color(0.46, 0.80, 0.70, 0.38)
|
||||
## "Refused" in the build ghost: rust red.
|
||||
const GHOST_REFUSED: Color = Color(0.86, 0.32, 0.22, 0.38)
|
||||
## Danger on the HUD: the tide's next line, low health. Paired with a shape or a word,
|
||||
## never alone.
|
||||
const WARNING: Color = Color(0.86, 0.32, 0.22)
|
||||
## The sea on the HUD's tide gauge and map.
|
||||
const SEA_INK: Color = Color(0.20, 0.34, 0.42)
|
||||
@@ -0,0 +1 @@
|
||||
uid://byqxsw564h4c2
|
||||
@@ -0,0 +1,8 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://test/capture/terrain_scene.gd" id="1"]
|
||||
|
||||
[node name="CaptureStyle" type="Node3D"]
|
||||
script = ExtResource("1")
|
||||
poi_kind = "dock"
|
||||
show_props = true
|
||||
@@ -0,0 +1,9 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://test/capture/terrain_scene.gd" id="1"]
|
||||
|
||||
[node name="CaptureStyle" type="Node3D"]
|
||||
script = ExtResource("1")
|
||||
poi_kind = "dock"
|
||||
show_props = true
|
||||
print_pass = false
|
||||
@@ -0,0 +1,8 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://test/capture/terrain_scene.gd" id="1"]
|
||||
|
||||
[node name="CaptureStyle" type="Node3D"]
|
||||
script = ExtResource("1")
|
||||
poi_kind = "hamlet"
|
||||
show_props = true
|
||||
@@ -0,0 +1,9 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://test/capture/terrain_scene.gd" id="1"]
|
||||
|
||||
[node name="CaptureStyle" type="Node3D"]
|
||||
script = ExtResource("1")
|
||||
poi_kind = "hamlet"
|
||||
show_props = true
|
||||
print_pass = false
|
||||
@@ -32,6 +32,9 @@ const CRACK_COLOUR: Color = Color(1.0, 0.0, 1.0)
|
||||
@export var prop_view: Vector3 = Vector3(10.0, 4.0, 14.0)
|
||||
## Destroy every `knock_out`th prop near the framed one, to show felled props vanish.
|
||||
@export var knock_out: int = 0
|
||||
## Draw with the woodcut print pass and graded colour (docs/STYLE.md). Off shows the
|
||||
## plain render, for before-and-after captures.
|
||||
@export var print_pass: bool = true
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -44,31 +47,13 @@ func _ready() -> void:
|
||||
environment.ambient_light_color = Color(0.5, 0.5, 0.5)
|
||||
environment.tonemap_mode = Environment.TONE_MAPPER_LINEAR
|
||||
else:
|
||||
var sky_material: ProceduralSkyMaterial = ProceduralSkyMaterial.new()
|
||||
sky_material.sky_top_color = Color(0.32, 0.5, 0.68)
|
||||
sky_material.sky_horizon_color = Color(0.82, 0.78, 0.68)
|
||||
sky_material.ground_bottom_color = Color(0.18, 0.2, 0.2)
|
||||
sky_material.ground_horizon_color = Color(0.82, 0.78, 0.68)
|
||||
var sky: Sky = Sky.new()
|
||||
sky.sky_material = sky_material
|
||||
environment.background_mode = Environment.BG_SKY
|
||||
environment.sky = sky
|
||||
environment.ambient_light_source = Environment.AMBIENT_SOURCE_SKY
|
||||
environment.ambient_light_energy = 0.45
|
||||
environment.tonemap_mode = Environment.TONE_MAPPER_FILMIC
|
||||
environment.fog_enabled = true
|
||||
environment.fog_light_color = Color(0.78, 0.78, 0.74)
|
||||
environment.fog_density = 0.0005
|
||||
environment.fog_aerial_perspective = 0.4
|
||||
environment = Look.environment(print_pass)
|
||||
var world: WorldEnvironment = WorldEnvironment.new()
|
||||
world.environment = environment
|
||||
add_child(world)
|
||||
|
||||
var sun: DirectionalLight3D = DirectionalLight3D.new()
|
||||
sun.rotation_degrees = Vector3(-35.0, -130.0, 0.0)
|
||||
sun.light_energy = 0.95
|
||||
var sun: DirectionalLight3D = Look.sun(600.0)
|
||||
sun.shadow_enabled = not crack_check
|
||||
sun.directional_shadow_max_distance = 600.0
|
||||
add_child(sun)
|
||||
|
||||
var camera: Camera3D = Camera3D.new()
|
||||
@@ -123,6 +108,8 @@ func _ready() -> void:
|
||||
add_child(camera)
|
||||
camera.look_at(look_at_point)
|
||||
camera.make_current()
|
||||
if print_pass and not crack_check:
|
||||
Look.set_sea_level(Look.add_print_pass(camera), sea_level if show_water else -1000.0)
|
||||
|
||||
var terrain: TerrainView = TerrainView.new()
|
||||
terrain.setup(island)
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
extends TestCase
|
||||
|
||||
## Issue A1: the shared look. The match view gets the graded environment and the
|
||||
## woodcut print pass, and the pass follows the sea.
|
||||
|
||||
|
||||
func test_environment_is_graded_and_uses_the_palette() -> void:
|
||||
var environment: Environment = Look.environment()
|
||||
assert_true(environment.adjustment_enabled)
|
||||
assert_near(environment.adjustment_saturation, Look.SATURATION, 0.0001)
|
||||
assert_true(Look.SATURATION < 1.0, "salt-faded: greyer than rendered")
|
||||
var sky: ProceduralSkyMaterial = environment.sky.sky_material as ProceduralSkyMaterial
|
||||
assert_eq(sky.sky_horizon_color, Palette.SKY_HAZE)
|
||||
assert_eq(environment.fog_light_color, Palette.SEA_FOG)
|
||||
assert_false(Look.environment(false).adjustment_enabled, "ungraded for comparisons")
|
||||
|
||||
|
||||
func test_match_view_draws_through_the_print_pass() -> void:
|
||||
var sim: Simulation = Simulation.new(3, SimGround.flat())
|
||||
var view: MatchView = MatchView.new()
|
||||
view.setup(sim)
|
||||
assert_not_null(view.print_pass)
|
||||
assert_eq(view.print_pass.get_parent(), view.camera, "it rides on the camera")
|
||||
var material: ShaderMaterial = (view.print_pass.mesh as QuadMesh).material as ShaderMaterial
|
||||
assert_eq(material.shader, Look.PRINT_SHADER)
|
||||
assert_eq(material.render_priority, Material.RENDER_PRIORITY_MAX, "drawn after everything it darkens")
|
||||
assert_eq(material.get_shader_parameter("ink_colour"), Palette.INK)
|
||||
sim.set_sea_level(6.5)
|
||||
sim.step()
|
||||
view.sync()
|
||||
assert_near(float(material.get_shader_parameter("sea_level")), view.water.level, 0.0001, "no ink under the sea")
|
||||
view.free()
|
||||
|
||||
|
||||
func test_print_shader_compiles() -> void:
|
||||
# A shader that fails to compile still loads; its code must at least parse into
|
||||
# uniforms, which an invalid one doesn't list.
|
||||
var names: Array[String] = []
|
||||
for uniform: Dictionary in Look.PRINT_SHADER.get_shader_uniform_list():
|
||||
names.append(String(uniform["name"]))
|
||||
for wanted: String in ["ink_colour", "strength", "sea_level", "hatch_spacing", "camera_far"]:
|
||||
assert_true(names.has(wanted), "uniform %s in %s" % [wanted, names])
|
||||
@@ -0,0 +1 @@
|
||||
uid://cfnbvdys6s8xm
|
||||
@@ -0,0 +1,61 @@
|
||||
extends TestCase
|
||||
|
||||
## A1: every colour the client draws with comes from Palette (docs/STYLE.md).
|
||||
|
||||
## Scripts allowed literal Color() values, and why.
|
||||
const ALLOWED: Dictionary = {
|
||||
"res://src/client/style/palette.gd": "the palette itself",
|
||||
"res://src/client/terrain/terrain_chunk_builder.gd": "splat weights carried in vertex colours, not colours",
|
||||
}
|
||||
## A Color() made only of number literals, or a named engine colour other than the
|
||||
## neutral ones used as multipliers.
|
||||
const LITERAL: String = "Color\\(\\s*-?[0-9.]+\\s*,\\s*-?[0-9.]+\\s*,\\s*-?[0-9.]+\\s*(,\\s*-?[0-9.]+\\s*)?\\)"
|
||||
const NAMED: String = "Color\\.(?!WHITE\\b|BLACK\\b|TRANSPARENT\\b)[A-Z_]+\\b|Color8\\(|Color\\.html\\("
|
||||
|
||||
|
||||
func test_client_colours_come_from_the_palette() -> void:
|
||||
var literal: RegEx = RegEx.create_from_string(LITERAL)
|
||||
var named: RegEx = RegEx.create_from_string(NAMED)
|
||||
var paths: Array[String] = _scripts_under("res://src/client")
|
||||
paths.append_array(_scripts_under("res://src/app"))
|
||||
assert_true(paths.size() > 10, "expected client scripts")
|
||||
for path: String in paths:
|
||||
if ALLOWED.has(path):
|
||||
continue
|
||||
for line: String in FileAccess.get_file_as_string(path).split("\n"):
|
||||
var code: String = line.get_slice("#", 0)
|
||||
if literal.search(code) != null or named.search(code) != null:
|
||||
fail("%s has a colour outside Palette: %s" % [path, code.strip_edges()])
|
||||
|
||||
|
||||
func test_scanner_catches_literals_and_named_colours() -> void:
|
||||
var literal: RegEx = RegEx.create_from_string(LITERAL)
|
||||
var named: RegEx = RegEx.create_from_string(NAMED)
|
||||
assert_not_null(literal.search("var c: Color = Color(0.5, 0.2, 0.1)"))
|
||||
assert_not_null(literal.search("Color(1, 0, 0, 0.5)"))
|
||||
assert_null(literal.search("Color(base.r + shift, 0.0, 1.0)"))
|
||||
assert_not_null(named.search("x = Color.RED"))
|
||||
assert_not_null(named.search("Color.html(\"#fff\")"))
|
||||
assert_null(named.search("tint = Color.WHITE"))
|
||||
|
||||
|
||||
func test_palette_matches_the_style_guide() -> void:
|
||||
# Each named colour is listed in docs/STYLE.md, so the guide can't fall behind.
|
||||
var guide: String = FileAccess.get_file_as_string("res://docs/STYLE.md")
|
||||
assert_true(not guide.is_empty(), "docs/STYLE.md should exist")
|
||||
var names: PackedStringArray = PackedStringArray()
|
||||
for constant: String in (Palette as Script).get_script_constant_map():
|
||||
names.append(constant)
|
||||
assert_true(names.size() > 20, "expected the palette's colours")
|
||||
for constant: String in names:
|
||||
assert_true(guide.contains("`%s`" % constant), "docs/STYLE.md should list `%s`" % constant)
|
||||
|
||||
|
||||
func _scripts_under(dir_path: String) -> Array[String]:
|
||||
var found: Array[String] = []
|
||||
for name: String in DirAccess.get_files_at(dir_path):
|
||||
if name.ends_with(".gd"):
|
||||
found.append(dir_path.path_join(name))
|
||||
for name: String in DirAccess.get_directories_at(dir_path):
|
||||
found.append_array(_scripts_under(dir_path.path_join(name)))
|
||||
return found
|
||||
@@ -0,0 +1 @@
|
||||
uid://dwcwolwyr3b4s
|
||||
Reference in New Issue
Block a user