Skip to content

WIP / POC: Parameterized voxelizer - #199

Draft
pyrollo wants to merge 5 commits into
mainfrom
pyr/voxelparam
Draft

WIP / POC: Parameterized voxelizer#199
pyrollo wants to merge 5 commits into
mainfrom
pyr/voxelparam

Conversation

@pyrollo

@pyrollo pyrollo commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

A POC for parameterized voxelizers

Idea

The (already discussed) idea is to merge multiple variants of a same task only differing by the way they voxelize models.

For example, renderSurfaces, renderLines, renderLines2d, renderPoints and renderPoints2d all does the same work: place something at a position resulting from a voxelizer. They all could be replaces by a place task with a voxelizer parameter (along with model selection and placeable parameters).

Status

This is a working example, with a lot of work still to be done. But the example works.

All existing voxelizers are usable:

  • Points2d/3d
  • Lines2d
  • Surface2d
  • ThickLines2d/3d

Two more have been added:

  • To2d: a 2d voxelizer that wraps a 3d voxelizer and flattens its results (no deduplication, probably not doable)
  • SetAltitude: a 3d voxelizer wrapping a 2d voxelizer and a heighmap, assigning heightmap altitude to each 2d voxel.

Reason

Because that's soo coool!

TODOS

1 - Have (sort of) scoped values

This is a bit out of scope but I already simplified some methods by adding a temporary Generation.current() that avoids to pass generation from class to class.

Code would be much simplified if usage of a scoped/global/static sort of variable (like current() method) could be generalized, not only in that PR but also:

  • In parameters create() methods;
  • In heightmapSpecs create() methods;
  • In Voxelizers voxelize() method, by intrinsically filter out voxels outside current tile;

2 - Improve parameters syntax

Temporary POC syntax is:

    type: place
    models: ...
    voxels:
      type: setAltitude
      voxels:
        type: surface
      altitude: ground
    place: ...

This places 2d buildings surfaces on ground heightmaps.

We may have something more concise like;

    type: place
    models: ...
    voxels:
      addAltitude: ground
      to: surface
    place: ...

3 - Model values

Voxelizers could use model values as parameter (for example, for line thickness).

4 - World Model

If we had a built-in "world" model that covers the entire world, we could also get rid of renderHeightmap task and replace it by a place task on that world model.

This would work only if voxelize() method gives results limited to current tile (or it would return way too many results).

Self-checks

  • The code has unit tests associated
  • The code has Javadoc Comments associated
  • Complex / Unexpected code is explained / justified with a small comment
  • Relevant documentation inside the /docs folder has been updated
  • All examples in examples/ work the same (or have been adapted if subject to changes in this PR)
  • Git history is clean (each commit accomplish a single task and describe it accordingly)
  • The texts have been proofread (documentation, error messages, logs, comments...)

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

[Maven Build Status]

📑 Commit: 7ad32a5525fcfece334d0c58e6c2847784aad9a8
⌚️ Date: 2026-07-09T17:12:56 (CEST)
🛠️ Status: ✅ Success

📦 Download artifact: Generator.jar

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.

1 participant