Increase consistency of random function in atmosphere
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
The random function in the [fragment shader of atmosphere](https://github.com/mapbox/mapbox-gl-js/blob/de549c6bb4aa7ce96bb3fb1770b417222d847369/src/shaders/atmosphere.fragment.glsl#L17) is producing different results depending on the host machine. This is especially problematic in gl-native, which uses the same shader on several different platforms and it breaks the render test results due to the different placement of the stars:

We should look for an alternative implementation that produces similar results across different platforms. As @aleksigron pointed out we could try to generate the input on the CPU side, which generally increases the consistency.
ATM the render test differences are handled with expectation overrides, so the issue is not high priority.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/shaders/atmosphere.fragment.glsl at the random function around line 17, then inspect the render-test expectation overrides mentioned in the issue. Compare the shader's results across host platforms and evaluate an alternative that keeps star placement consistent. Done means the atmosphere render tests no longer need platform-specific differences for this random function.
Written by the indexing model from the issue text.
Assessment
- Domain
- computer-graphics, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100