m

mesa

@preview

Draw semiconductor devices and fabrication process flows from GDS layouts

v0.5.1
MIT

Package Information

Last Updated
Minimum Typst Version
0.14.0
Categories
visualizationscriptingintegration
Disciplines
engineeringphysics

1. Get the package

Download the package using the TPIX CLI:

tpix get @preview/mesa:0.5.1

2. Import in your Typst file

Add this to your .typ file:

#import "@preview/mesa:0.5.1": *

Version History

0.5.10.14.0
ad2fc41f195d...
0.5.00.14.0
8a86d0e60712...
0.4.00.14.0
33721a0796f6...
0.2.00.14.0
b1b881abc9c3...
0.1.00.14.0
11e2dd7c1990...

Mesa

Draw 2D and 3D semiconductor devices and fabrication processes with
CeTZ, including patterned geometry
loaded from GDS.

#import "@preview/mesa:0.5.1" as semi

#set page(width: auto, height: auto, margin: 8mm)

#let sample = {
  import semi: *

  layer(
    "substrate",
    thickness: 30,
    material: "substrate",
    label: [Si],
  )
  layer(
    "oxide",
    thickness: 5,
    material: "dielectric",
    label: [SiO#sub[2]],
  )
  layer(
    "gate",
    thickness: 15,
    material: "metal",
    label: [Al],
  )
}

#semi.layer-stack(
  sample,
  camera: (azimuth: 35deg, elevation: 35deg),
  shading: "fancy",
)

A material stack rendered with Mesa

GDS layouts can also be used to produce process-flow steps.

A transistor fabrication process rendered with Mesa

Usage

To use this package you can simply import in your typst document:

#import "@preview/mesa:0.5.1"

// Your drawing code here

It is recommended to start from the various example files.
Also see the usage manual for the complete API reference.

DISCLAIMER: >80% of Typst code and 100% of Rust code was LLM-written, guided by me at a high level. I'm not fluent in Rust and I couldn't have justified writing this package otherwise. Since this is only a visualization tool, I felt that vibe coding it could be justified. Nonetheless, I have been using it for my own projects and have been happy with the results.

In case of any bugs or missing features, please open an issue on GitHub.

Changelog

0.5.1

This release corrects some edge case handling for conformal coatings and sloped etches.

  • Conformal layers with edge-profile rounding now follow a more physical model
    handling upward-facing edges and undercuts.
  • Inward-sloping etches stop where their sidewalls meet instead of failing or
    leaving a visible opening.

0.5.0

Mesa now recompiles complex scenes much faster, particularly after camera and
lighting changes. The renderer reuses prepared geometry and writes the visible
scene directly as an SVG image rather than CeTZ blocks.
CeTZ annotations and styling still works as before, with some bug fixes.

Performance

  • Scene geometry, projected surfaces, and shadow occluders are reused across
    incremental compilations whenever their inputs have not changed.
  • Visibility work rejects distant surfaces and edges early, reducing both
    general compile time and the cost of camera changes in finely faceted scenes.

Rendering fixes

  • Outlines and material seams around faceted geometry are assembled into
    continuous paths, avoiding broken or uneven strokes around round profiles.
  • Debug overlays are now more consistent with regular rendering.

API and validation

  • edge-accent is now decoupled from shading, and works analogously to other styling options.
    shading now accepts only "none", "flat", or "fancy".
  • Relative label positions follow the device axes when the camera is tilted.
  • Clearer error messages for various common situations.

0.4.0

It is now possible to produce real sloped geometry and conformally deposit
or isotropically etch around it. Etching can undercut or taper sidewalls.
There have been minor changes to the mask, label, and material APIs.

New features

  • edge-profile chamfers or rounds the exposed upper edges of a deposition.
    Later layers and etches follow those slopes. A round profile approximates a
    quarter-circle with facets (default 6).
  • remove deletes named layers completely, ignoring masks, blockers, and
    depth. You may use it to strip resist layers, for example.
  • etch accepts isotropic for a circular or elliptical lateral etch, or
    sidewall for a straight wall angle. Unselected layers stop the etch locally.
    An isotropic etch can wrap around a zero-rate layer without casting an
    anisotropic shadow beneath it.
  • stroke, internal-stroke, and edge-accent-stroke can be set per
    material, on the stack, or in the palette.

API changes

  • The former bevel option is now edge-accent on the material or stack.
  • mask: none now covers the complete sample. The previous default,
    mask: auto, is no longer accepted.
  • Layer style and labels are set on the layer itself: material may be a
    dictionary of family, variant, and overrides, and label may be a
    dictionary of draw.content options.
  • debug: true replaces the render with a topology view, or a pieces view
    of a cross-section. semi.debug.topology and semi.debug.section attach
    a legend.

Other changes

  • crease-angle now defaults to 15deg.

0.3.0

Mesa now supports conformal and planar depositions, arbitrary sidewall coverage,
and selective etching of specified layers only. These operations can be combined
to build more complex vertical devices, trenches, and overhangs.

  • conformal-layer coats every exposed surface with equal thickness, including
    sidewalls and downward-facing surfaces.
  • layer can deposit a controlled fraction of its top-surface thickness on
    vertical sidewalls, useful for partially conformal processes.
  • planar-layer fills topography to a height measured from the substrate,
    suitable for resist and planarization steps.
  • etch can target named layers. Unselected materials are ignored, allowing
    buried layers to be removed. Depth is now optional: depth: auto etches down
    to the substrate. Numeric depths can continue into it and form trenches.
  • Transparent materials now work as intended, with proper shadow interactions.
  • Improvements to outline stroke and internal/external stroke disambiguation.
    Coplanar faces of the same material now render as continuous surfaces.
  • More performance improvements, around 20× faster in the worst-performing example file.

0.2.0

Improved support for larger and more complex GDS layouts.
Paths are now supported, lateral x and y layout dimensions can be
rescaled on import to improve visual presentation clarity, and the renderer
has been improved and optimized to render hundreds of faces within a second.

  • GDS PATH elements are imported with their widths and end styles.
    Dense paths may be simplified with path-tolerance to optimize document
    compile times.
  • Imported layouts retain their declared physical unit and can be converted to
    nanometres, micrometres, millimetres, or a custom unit. Independent x and
    y scaling can make large devices legible without changing vertical process
    dimensions, while configurable padding provides room around the layout.
  • Fancy shading now projects the actual shape of cast shadows onto receiving
    surfaces. Narrow gates and patterned features can cast "proper" shadows.
    Flat shading does not project shadows, as before.
  • Rectangular and patterned layers now share the same rendering path. Lighting,
    bevels, fades, cuts, outlines, and debug views therefore behave consistently
    when both kinds of geometry appear in one sample.
  • Complex and finely segmented layouts render more efficiently. crease-angle
    was added to visually smooth curves, and rounded stroke caps prevent
    small gaps where outline segments meet.
  • A stack-level stroke sets a common exterior-outline style while preserving
    per-layer overrides.
  • GDS coordinates now use the file's declared unit by default. A preferred unit
    can be specified and layout coordinates will be converted to it.
  • Layouts can be padded to extend the substrate around the mask automatically.

0.1.0

Initial release