Home/Image Editing, Compression & Conversion Tools/Canvas 2D Shadow & Isometric Perspective Projector

Canvas 2D Shadow & Isometric Perspective Projector

Project 2D graphics, vector badges, and UI mockups into true 3D isometric perspectives with cast planar shadows and depth extrusions using client-side HTML5 Canvas matrix math.

Projection Controls

°
°
px
Planar Shadow & Light Source
125°
22px

Isometric Projector Stage

Matrix(1.15, -0.00, -0.43, 0.74)
Live Affine Transform Matrix SpecificationZ-Elevation: -45px
transform: matrix(1.1547, -0.0000, -0.4300, 0.7448, 0, -45);

The Mathematics of 2D Affine Transforms & Axonometric Projections

Axonometric perspective is an orthographic projection method where an object is rotated along its axes relative to the viewing plane, preserving parallel lines without visual vanishing point convergence. Rather than invoking computationally intensive 3D WebGL render passes, web interfaces and HTML5 Canvas engines construct these projections directly using 2D affine transformation matrices:

[x', y', 1]T = Maffine · [x, y, 1]T
x' = a · x + c · y + e  |  y' = b · x + d · y + f

True Isometric Angle

Separates all three spatial coordinates (X, Y, Z) by precisely 120°. The horizontal plane is rotated 30° and skewed by −30°, followed by a vertical scale factor of cos(30°) = √3 / 2 ≈ 0.8660 to maintain uniform dimensional proportionality.

Dimetric 2:1 Pixel Art

Standardized in classic video games and UI iconography, dimetric projection uses an angle whose tangent is 0.5 (arctan(0.5) ≈ 26.565°). This guarantees that diagonal isometric lines advance exactly 2 horizontal pixels for every 1 vertical pixel (ratio 2:1), eliminating raster stair-stepping.

Oblique Cavalier & Cabinet

Leaves the front elevation plane unrotated at a 1:1 scale while projecting receding depth axes at an angle of 30° or 45°. Cabinet projection foreshortens receding depth by 50% (scale = 0.5) to counteract optical elongation.

2D Affine Transformation Matrix Pipeline

Every coordinate (x, y) mapped onto the Canvas 2D isometric stage is multiplied by a composite 3 × 3 transformation matrix combining rotation (θ), shearing (ϕ), scale foreshortening (sx, sy), and Z-elevation offset (h):

a = (cos θ − sin θ · tan ϕ) · sx  |  b = (sin θ + cos θ · tan ϕ) · sx
c = −sin θ · sy  |  d = cos θ · sy  |  e = tx  |  f = ty − h
// Combined 2D Transformation Matrix Math const radRot = (angle * Math.PI) / 180; const radSkew = (skewX * Math.PI) / 180; // Canvas 2D ctx.transform(a, b, c, d, e, f) a = (Math.cos(radRot) - Math.sin(radRot) * Math.tan(radSkew)) * scaleX; b = (Math.sin(radRot) + Math.cos(radRot) * Math.tan(radSkew)) * scaleX; c = -Math.sin(radRot) * scaleY; d = Math.cos(radRot) * scaleY; e = translationX; f = translationY - elevationHeight;
Variable / ParameterSymbolCanvas 2D Matrix TermGeometric Formulation & Meaning
Planar Rotation Angleθcos θ, sin θRotates coordinate frame around normal viewing axis (30° for true isometric)
Axonometric Shear (Skew)ϕtan ϕDeforms square Cartesian tiles into 60°/120° rhomboid diamond grid (−30° for isometric)
Vertical Foreshortening ScalesyscaleY = cos(30°) ≈ 0.8660Compensates for perspective tilt so projected lengths equal true measurement units
Z-Altitude Elevationhf = ty − hFloating height above reference ground plane; determines cast shadow offset vector
Cast Shadow DisplacementΔx, Δy−d · cos(α), −d · sin(α) + hPlanar offset based on directional light azimuth angle α and throw distance d

Axonometric Projection Methods Compared

Selecting the appropriate axonometric projection depends on whether your design requires equal mathematical foreshortening, clean raster grid alignment, or distortion-free front faces:

Projection TypeHorizontal AnglesReceding Depth RatioPrimary Use Case
True Isometric30° / 30° (120° apart)1.0 : 1.0 : 1.0Engineering diagrams, modern SaaS mockup showcases
Dimetric (2:1 Pixel)26.565° / 26.565°1.0 : 1.0 : 0.5Pixel art games, retro UI graphics, isometric tiles
TrimetricVariable (e.g. 45° / 20°)All 3 scales varyDramatic product packaging renders and marketing heroes
Oblique Cavalier0° front, 45° depth1.0 full scale depthArchitectural sectional diagrams with true front measurements
Oblique Cabinet0° front, 30° / 45° depth0.5 half-scale depthFurniture design and technical manuals requiring realistic proportions

Production Guidelines for Isometric UI Mockups & Shadows

When integrating projected 2D isometric elements into modern web interfaces, adhering to these structural techniques guarantees maximum visual realism without sacrificing runtime performance:

Engineering Best Practices

  • • Anchor Shadows to Floor Plane Vectors: Cast shadows should always be projected using directional trigonometry relative to elevation altitude. As hover height increases, scale the penumbra blur radius and reduce density. If you are styling flat UI cards rather than axonometric projections, calibrate multi-layer elevation tokens using our CSS box shadow generator to match diffuse ambient light curves.
  • • Hardware Acceleration with `will-change: transform`: When animating isometric cards in responsive CSS, declare will-change: transform to prompt GPU layer compositing and prevent raster recalculations.
  • • Stack Multilayer 3D Ribbons: For realistic slab extrusions, render iterated layers stepped along the negative Z-altitude axis, progressively darkening edge fill colors to simulate ambient occlusion.

Visual Realism Checklist

  • • Align Floor Meshes with Camera Azimuth: Ensure the background perspective mesh aligns with the primary projection angles (30° / 150°) to avoid visual dissonance between the floor and floating cards.
  • • Avoid Inverted Light Normals: Maintain a consistent ambient light vector across all floating elements in a scene. Multiple conflicting shadow directions break the illusion of physical depth.
  • • Foreshorten Elliptical Radii: Circular UI elements like avatar badges or button pills must undergo identical matrix transformation to appear as proper planar ellipses rather than distorted circles.

Frequently Asked Questions (FAQ)

How does 2D Canvas matrix math project isometric perspective without WebGL?

True isometric projection preserves parallel lines without camera convergence. Using the standard 2D affine transformation matrix [a c e; b d f], rotating by 30 degrees, skewing the X-axis by -30 degrees, and scaling the Y-axis by 86.6% (cos 30°) converts flat Cartesian coordinates directly into an axonometric grid purely through 2D hardware-accelerated canvas context math.

What is the difference between isometric, dimetric, and oblique cavalier projections?

Isometric projection uses identical 120° angles between all three spatial axes with equal scale foreshortening. Dimetric projection divides two angles equally while varying the third (commonly 2:1 pixel art ratio). Oblique Cavalier preserves the true front-facing dimensions at 100% scale while projecting depth receding lines at a 45° angle.

How are real-time directional cast shadows computed on the floor plane?

The shadow is generated by projecting the source silhouette onto the floor plane origin using an offset vector derived from the light source azimuth angle and distance. The shadow geometry undergoes ground-plane shearing, vertical compression, and Gaussian convolution blurring to simulate physically accurate ambient ground shadows.

Can I export the transformation for direct use in web CSS or Tailwind?

Yes. The tool outputs both a native CSS matrix() / transform string and an HTML5 Canvas transform() method snippet with matching elevation offsets and box-shadow equivalents ready for production frontends.

Are uploaded graphics sent to an external rendering server?

No. The entire rendering, matrix projection, rasterization, and PNG export pipeline operates client-side inside your browser memory. No visual assets or telemetry data are ever transmitted across the network.

Related & Complementary Utilities

Explore more privacy-first client-side web tools.