Skip to content

Precision problem #8

Closed
Closed

Description

@shuding

When setting a high sample number (in practice > 17000), the precision error will be noticeable:

2F9D65B3-4C93-451B-8EC8-56F6A1494CB9

We’re already using highp float, but it would be great to reduce the precision error even more by optimizing the computation steps as much as possible.

An alternative way is to introduce some deterministic randomness to the sampling here.

Activity

  1. shuding commented on Dec 12, 2021

    @shuding
    OwnerAuthor
  2. shuding commented on Dec 12, 2021

    @shuding
    OwnerAuthor

    The fix here, is by changing the calculation of the theta in a Fibonacci sample point (https://observablehq.com/@mbostock/spherical-fibonacci-lattice) from:

    • i / Φ * 2π
    • → mod by 2π: i / Φ * 2π % 2π
    • → mod by 1: i / Φ % 1 * 2π
    • → scale it up a bit and use floor: (i / Φ - 3000 * floor(i / Φ / 3000)) * 2π

    To reduce the precision loss caused by sin and mod.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions