Skip to content

Add bidirectional raster scan X-offset calibration #312

Merged
knipknap merged 3 commits into
barebaric:mainfrom
vyvcodd:feature/bidir-x-offset
Jul 15, 2026
Merged

Add bidirectional raster scan X-offset calibration #312
knipknap merged 3 commits into
barebaric:mainfrom
vyvcodd:feature/bidir-x-offset

Conversation

@vyvcodd

@vyvcodd vyvcodd commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Closes #307

Adds a bidir_x_offset_mm parameter to the Rasterizer producer plus a BidirScanOffsetTransformer, so a fixed mechanical or firing delay skew between left-to-right and right-to-left raster passes (visible as banding, especially on photo engraves) can be corrected directly instead of losing half your engraving speed to disabling bidirectional scanning. Also extends the Material Test Grid with a "Speed vs Offset" mode so the value can be calibrated empirically, using raygeo 1.21.1's native support for it.

Changes

  • Add bidir_x_offset_mm param to the Rasterizer producer (per engrave step, not a single machine-wide setting), plus BidirScanOffsetTransformer, which shifts each right-to-left raster pass along X by that offset during gcode generation, preserving per-pixel power values for variable-power (photo) engraving
  • Add a "Speed vs Offset" grid mode to the Material Test Grid (columns vary speed, rows vary offset) so the correction can be found by eye rather than guessed at
  • Double the auto-calculated overscan distance for individual material test blocks, so backlash settling happens outside the visible engrave area rather than muddying whatever parameter the grid is testing
  • Add Optimize to the Material Test Grid's default transformers, but disabled: its nearest-neighbor travel reordering has no concept of cell boundaries and can interleave lines from different cells instead of engraving each one fully before moving to the next. Left toggleable rather than removed, so it's easy to compare with/without
  • Update engrave.md, which described a "disable bidirectional scanning" toggle removed years ago when the raster producers were unified, and points at this offset as the actual fix for banding

Checks

pixi run test (5298 passed, 174 deselected)
pixi run lint (clean; 2 pre-existing, unrelated pyright errors on sys._MEIPASS in app.py/worker_init.py (probably macos specific))
pixi install (default environment solves against raygeo 1.21.1)
pixi run rayforge (launches, loads machine config, initializes addons - no crash)

vyvcodd added 3 commits July 15, 2026 18:25
Fixed-corner mechanical/firmware skew between left-to-right and
right-to-left raster passes misaligns alternate scan rows on some
machines, regardless of speed (a different case from the
timing-delay skew LightBurn's speed table addresses).

- Adds a bidir_x_offset_mm param to the Rasterizer producer (UI
  control + serialization), per engrave step rather than a single
  machine-wide value, since different jobs may want different
  corrections, and this may need to vary by speed in the future
- Adds BidirScanOffsetTransformer, which shifts each right-to-left
  raster pass along X by that offset during gcode generation,
  preserving per-pixel power values for variable-power (photo)
  engraving
- Tests the producer -> settings -> transformer wiring end-to-end,
  not just each piece in isolation
- Doubles the auto-calculated overscan distance for individual test
  blocks, so backlash settling happens outside the visible engrave
  area rather than muddying whatever parameter the grid is testing
- Adds Optimize to the default transformers, but disabled: its
  nearest-neighbor travel reordering has no concept of cell
  boundaries and was interleaving lines from different cells
  instead of engraving each one fully before moving to the next.
  Left toggleable rather than removed, so it's easy to compare
  with/without
Extends the material test grid so users can calibrate bidir_x_offset_mm
empirically: columns vary speed, rows vary offset. raygeo's
generate_material_test_grid already supports grid_mode="Speed vs
Offset" plus min_offset/max_offset (including scaling power with speed
so darkness stays comparable across a row) -- this just plumbs an
offset_range param through the producer, its preview, and the step
settings widget.
@knipknap
knipknap merged commit cf65c60 into barebaric:main Jul 15, 2026
29 checks passed
@vyvcodd
vyvcodd deleted the feature/bidir-x-offset branch July 15, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Calibrate bidirectional scan X-offset per engrave step

2 participants