classic-iso

Documents isometric coordinate math, depth formulas, and sprite occlusion for the classic-wgl Rust engine.

1|1|Updated Aug 18, 2021
One-click install
npx skills add https://github.com/guilledk/classic-wgl --skill classic-iso-guilledk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: classic-iso
Source: https://github.com/guilledk/classic-wgl/tree/main/.agents/skills/classic-iso
Command: npx skills add https://github.com/guilledk/classic-wgl --skill classic-iso-guilledk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Debugging isometric rendering issues in the classic-wgl Rust engine requires deep knowledge of its coordinate system, depth formulas, and render pipeline, which are spread across multiple crates and shaders. This Skill consolidates the authoritative reference for cartesian-to-iso transforms, the isoDepth formula, bilinear height interpolation, mouse-to-iso parallax solving, tilemap mesh generation, sprite ghost rendering, and render sort order. ## Core Features & Use Cases - Coordinate & Depth Reference: Canonical world-metre transforms (iso_world_pos, iso_camera_matrix, iso_view_depth) and the normalized window-depth formula with fixed DEPTH_NEAR/DEPTH_FAR bounds. - Rendering Pipeline Details: Tilemap mesh generation (vertex layout, wall faces, smooth normals), tile data texture encoding, IsoSprite two-pass ghost rendering with stencil groups, and nav mesh overlay. - Use Case: When a sprite is incorrectly occluded by terrain or the mouse selection cursor is offset on sloped terrain, use this Skill to trace the depth-corner interpolation, parallax solve, and sort order to find the mismatch between CPU and GPU coordinate spaces. ## Quick Start Ask the AI to explain why an IsoSprite is clipping through a slope or to debug a mouse-to-iso selection offset using the classic-iso reference.

Frequently Asked Questions about classic-iso

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How does the isometric depth formula work in classic-wgl?

Depth is the orthographic camera view depth dot(back, world) normalized to window [0,1] as (DEPTH_NEAR - view_depth) / (DEPTH_NEAR - DEPTH_FAR), with fixed bounds DEPTH_NEAR=220.0 and DEPTH_FAR=-220.0. There is no synthetic tile-space tx-ty term or height divisor.

How do I convert mouse screen position to iso tile coordinates?

Undo pan/zoom, intersect the camera view ray with the z=0 ground plane, then iterate a fixed-point parallax solve (8 passes) that shifts tile coordinates along the depth axis proportional to sampled terrain height. The result is stored in Tilemap.mouse_iso_pos as (x, y, z).

Why does a sprite ghost through terrain incorrectly on slopes?

Ghosting at slope corners happens when depth-relevant code uses bilinear_height instead of sample_height_mesh, which matches the rendered mesh's triangle-linear interpolation. Engine::height_at, vehicle terrain snapshots, and compute_iso_sprite_model all use sample_height_mesh to avoid this.

How does the two-pass ghost rendering for IsoSprites work?

The normal pass draws the full sprite with LEQUAL depth and writes its ghost_group id to the stencil buffer. The ghost pass then draws a 40%-alpha silhouette only where the sprite fails the GREATER depth test and the stencil differs, showing occluded units through walls without self-ghosting.

What determines the render sort order of isometric sprites?

IsoSprites sort descending by tf.position.x - tf.position.y, so larger values are farther and drawn first. The tilemap is fixed at 20000.0, the nav mesh at 19999.0, and non-UI sprites with ignore_cam get -20000.0 so they draw last on top.

When should I use bilinear_height versus sample_height_mesh?

Use sample_height_mesh for anything depth- or render-relevant since it matches the mesh's per-triangle linear interpolation exactly. bilinear_height remains acceptable for the mouse-to-iso solve and pathfinder, but bows on non-planar quads.