Skip to content

[HTML5] Voronoi breaks if seed is too large #3

@player-03

Description

@player-03

As seeds get larger and larger, the Voronoi cells become more and more square. I'm not sure where the exact cutoff is, but after some trial and error, I settled on 1024 as a safe maximum seed.

I suspect this is caused by the ValueNoise3D function, which generates some very large integers as an intermediate step. On most platforms, these integers will cap out or wrap around if they overflow, but in JavaScript, ints are stored as 64-bit floating point numbers, which lose precision above 2^53. My guess is that once too much precision is lost, the center points all end up at (0, 0, 0) within their respective cells.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions