Poisson Disk Seed Repeats distribution every 125 values #87217

Closed
opened 2021-04-05 19:10:28 +02:00 by Erindale · 15 comments

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: GeForce RTX 2070 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 461.92

Blender Version
Broken: version: 2.93.0 Alpha, branch: master, commit date: 2021-04-03 16:32, hash: 8681504f06
Worked: (newest version of Blender that worked as expected)

Short description of error
Poisson Disk distribution isn't properly randomising. Every 125 values or so the pattern will repeat with a slight offset. Changing the seed value doesn't change the distribution so much as slide the pattern over the surface.
This only seems to be an issue particularly with a subdivided mesh either via subdiv modifier or the subdivide nodes.

Exact steps for others to reproduce the error
Open a new file, add a plane and add a geo node tree.
Add a Point Distribute node set to poisson disk and change the Seed value.

2021-04-05 18-02-00.mp4
PoissonSeedBug.blend

**System Information** Operating system: Windows-10-10.0.19041-SP0 64 Bits Graphics card: GeForce RTX 2070 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 461.92 **Blender Version** Broken: version: 2.93.0 Alpha, branch: master, commit date: 2021-04-03 16:32, hash: `8681504f06` Worked: (newest version of Blender that worked as expected) **Short description of error** Poisson Disk distribution isn't properly randomising. Every 125 values or so the pattern will repeat with a slight offset. Changing the seed value doesn't change the distribution so much as slide the pattern over the surface. This only seems to be an issue particularly with a subdivided mesh either via subdiv modifier or the subdivide nodes. **Exact steps for others to reproduce the error** Open a new file, add a plane and add a geo node tree. Add a Point Distribute node set to poisson disk and change the Seed value. [2021-04-05 18-02-00.mp4](https://archive.blender.org/developer/F9920735/2021-04-05_18-02-00.mp4) [PoissonSeedBug.blend](https://archive.blender.org/developer/F9920742/PoissonSeedBug.blend)
Author

Added subscriber: @Erindale

Added subscriber: @Erindale

Added subscriber: @victorlouis

Added subscriber: @victorlouis

The problem is this line in sample_mesh_surface():

    const int looptri_seed = BLI_hash_int(looptri_index + seed);

Increasing seed by 1 thus effectively decreases the looptri indices that will receive a point by 1:
image.png

By multiplying with the seed instead of adding it, the behavior is more random for successive seeds:
image.png

I'm not sure how this change could be made without breaking backwards compatibility though.

The problem is this line in `sample_mesh_surface()`: ``` const int looptri_seed = BLI_hash_int(looptri_index + seed); ``` Increasing `seed` by 1 thus effectively decreases the looptri indices that will receive a point by 1: ![image.png](https://archive.blender.org/developer/F9920884/image.png) By multiplying with the seed instead of adding it, the behavior is more random for successive seeds: ![image.png](https://archive.blender.org/developer/F9920886/image.png) I'm not sure how this change could be made without breaking backwards compatibility though.

Another solution would be to create a single RandomNumberGenerator rng(seed); outside the loop over looptris, instead of creating a new rng for each looptri.

Also, this might be more correct than the proposal from my previous comment:

const int looptri_seed = BLI_hash_int(looptri_index + seed * amount_of_looptris);
Another solution would be to create a single `RandomNumberGenerator rng(seed);` outside the loop over looptris, instead of creating a new rng for each looptri. Also, this might be more correct than the proposal from my previous comment: ``` const int looptri_seed = BLI_hash_int(looptri_index + seed * amount_of_looptris); ```
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

Can sort of confirm, also thx @victorlouis for taking the time and investigate!

Can sort of confirm, also thx @victorlouis for taking the time and investigate!

Added subscriber: @dfelinto

Added subscriber: @dfelinto

Confirmed bugs need to be tagged to one of the modules to show in the queries.

Confirmed bugs need to be tagged to one of the modules to show in the queries.

I used the wrong option when setting Nodes & Physics projects. I didn't mean to remove BF Blender and the Geomtry Nodes projects.

I used the wrong option when setting Nodes & Physics projects. I didn't mean to remove BF Blender and the Geomtry Nodes projects.
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Member

Another solution would be to create a single RandomNumberGenerator rng(seed); outside the loop over looptris, instead of creating a new rng for each looptri.

The issue with that is that we loose all stability afaik.

Multiplying the seed with some large number seems to be the way to go here imo. Unfortunately, you are right and this changes the distribution pattern. I don't think there is a good way around that at this point, also not sure if it is worth it to make the code more complicate so that old patterns remain the same. One way to keep old distributions intact is to add a bool to the node storage that remembers whether the old or new behavior should be used.

> Another solution would be to create a single RandomNumberGenerator rng(seed); outside the loop over looptris, instead of creating a new rng for each looptri. The issue with that is that we loose all stability afaik. Multiplying the seed with some large number seems to be the way to go here imo. Unfortunately, you are right and this changes the distribution pattern. I don't think there is a good way around that at this point, also not sure if it is worth it to make the code more complicate so that old patterns remain the same. One way to keep old distributions intact is to add a bool to the node storage that remembers whether the old or new behavior should be used.

Ah yes indeed, forgot about that. Just tried it with the rng outside the loop and it causes the points to shift around while weight painting.

Ah yes indeed, forgot about that. Just tried it with the rng outside the loop and it causes the points to shift around while weight painting.

This issue was referenced by ca37d8485c

This issue was referenced by ca37d8485c73ebc050e49c6bce2f73756c7578e3
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Jacques Lucke self-assigned this 2021-04-16 11:43:50 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#87217
No description provided.