Page 1 of 1

[2.1.14] voronoi_cell_id generates repeated cell ids near (0,0)

Posted: Mon Aug 10, 2026 9:43 pm
by Hanodest
voronoi_cell_id seems to always assign the same exact ids to the cells directly top-left and bottom-right from (0,0). Same for the bottom-left and top-right pair. The other ids seem to be randomized properly.

Test expression:

Code: Select all

  {
    type = "noise-expression",
    name = "cell_id",
    expression = [[
      if (
        abs(x) < 200 & abs(y) < 200, 
        voronoi_cell_id {
          x = x,
          y = y,
          seed0 = map_seed,
          seed1 = 0,
          grid_size = 50,
          distance_type = 1,
          jitter = 0.2
        },
        0
      )
    ]],
  },
Visualisation from noise-tools:
noise_vis.png
noise_vis.png (14.92 KiB) Viewed 224 times
Raw noise values:
noise_values.png
noise_values.png (39.9 KiB) Viewed 224 times

Re: [2.1.14] voronoi_cell_id generates repeated cell ids near (0,0)

Posted: Thu Aug 13, 2026 8:15 am
by Genhis
Thanks for the report. I was going to fix it for 2.1 but eventually decided not to because it would significantly alter Fulgora map generation and cause hard borders for old save files. The hash function which picks random values isn't very good unfortunately, I recommend offsetting or multiplying one dimension to get better results.

Code: Select all

Math::hash(regionPosition.x) ^ Math::hash(std::rotr(uint32_t(regionPosition.y), 16)) ^ voronoi.seed