Geometry nodes: Wrong instance order when instancing a collection with more than 30 objects #93285

Closed
opened 2021-11-22 12:20:51 +01:00 by Ingo Clemens · 26 comments

System Information
Operating system: macOS-11.4-x86_64-i386-64bit 64 Bits
Graphics card: AMD Radeon Pro Vega 48 OpenGL Engine ATI Technologies Inc. 4.1 ATI-4.5.14

Blender Version
Broken: version: 3.1.0 Alpha, branch: master, commit date: 2021-11-14 00:26, hash: 7e82c840b7

Short description of error
When creating a collection instance with more than 31 separate children the resulting order doesn't match the named order of the objects from the collection, as shown in the attached screenshot 1. It also doesn't matter if the source of the points is a bezier curve or a mesh curve.
The index where the unmatched order occurs seems to depend on the scene and objects. In the attached scene the wrong sorting occurs at index 29. The screenshot 2 from another scene shows that the wrong index is 23. The cause for this is unknown and doesn't seem to be name related.
If all objects exeeding the count of 31 are deleted the correct order is retained.

Exact steps for others to reproduce the error
The attached scene should display the issue as shown in screenshot 1.

Steps based on a default scene:

  1. Create a new collection with more than 31 objects. To better see the order rename the objects in ascending order.
  2. Create a curve with more than 31 points.
  3. Create a new geometry node setup for the curve.
  4. Create a Instance in Points node and insert it to the geometry connection. Activate Pick Instance.
  5. Create a Collection Info node and connect the geometry output with the instance input of the Instance on Points node.
  6. Select the collection with the more than 31 objects.
  7. Activate Separate Children on the Collection Info node.
  8. Check the spreadsheet for the named order of the instances in relation to the curve point indices.

wrong_instance_order.blend

wrong_instance_order_1.png

wrong_instance_order_2.png

**System Information** Operating system: macOS-11.4-x86_64-i386-64bit 64 Bits Graphics card: AMD Radeon Pro Vega 48 OpenGL Engine ATI Technologies Inc. 4.1 ATI-4.5.14 **Blender Version** Broken: version: 3.1.0 Alpha, branch: master, commit date: 2021-11-14 00:26, hash: `7e82c840b7` **Short description of error** When creating a collection instance with more than 31 separate children the resulting order doesn't match the named order of the objects from the collection, as shown in the attached screenshot 1. It also doesn't matter if the source of the points is a bezier curve or a mesh curve. The index where the unmatched order occurs seems to depend on the scene and objects. In the attached scene the wrong sorting occurs at index 29. The screenshot 2 from another scene shows that the wrong index is 23. The cause for this is unknown and doesn't seem to be name related. If all objects exeeding the count of 31 are deleted the correct order is retained. **Exact steps for others to reproduce the error** The attached scene should display the issue as shown in screenshot 1. Steps based on a default scene: 1. Create a new collection with more than 31 objects. To better see the order rename the objects in ascending order. 2. Create a curve with more than 31 points. 4. Create a new geometry node setup for the curve. 5. Create a **Instance in Points** node and insert it to the geometry connection. Activate **Pick Instance**. 6. Create a **Collection Info** node and connect the geometry output with the instance input of the **Instance on Points** node. 7. Select the collection with the more than 31 objects. 8. Activate **Separate Children** on the **Collection Info** node. 9. Check the spreadsheet for the named order of the instances in relation to the curve point indices. [wrong_instance_order.blend](https://archive.blender.org/developer/F11842897/wrong_instance_order.blend) ![wrong_instance_order_1.png](https://archive.blender.org/developer/F11842898/wrong_instance_order_1.png) ![wrong_instance_order_2.png](https://archive.blender.org/developer/F11842900/wrong_instance_order_2.png)
Author

Added subscriber: @iclemens

Added subscriber: @iclemens

#97643 was marked as duplicate of this issue

#97643 was marked as duplicate of this issue

#96310 was marked as duplicate of this issue

#96310 was marked as duplicate of this issue

Added subscriber: @iss

Added subscriber: @iss

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'

Checked provided file with build 7e42ae7c1a, which is 1 day older than reported as broken and can't rerpoduce the issue. Please check if problem is 100% reproducible and if this is fixed in latest builds

Checked provided file with build 7e42ae7c1a, which is 1 day older than reported as broken and can't rerpoduce the issue. Please check if problem is 100% reproducible and if this is fixed in latest builds
Author

Changed status from 'Needs User Info' to: 'Needs Developer To Reproduce'

Changed status from 'Needs User Info' to: 'Needs Developer To Reproduce'
Author

I just downloaded and installed the latest version: 3.1.0 Alpha, branch: master, commit date: 2021-11-22 23:57, hash: d1a4e043bd
Opened the attached test scene and the problem still persists. I also tried with another scene and can reproduce the issue.
Maybe this issue is specific to system and OS version?

wrong_instance_order.png

I just downloaded and installed the latest version: 3.1.0 Alpha, branch: master, commit date: 2021-11-22 23:57, hash: `d1a4e043bd` Opened the attached test scene and the problem still persists. I also tried with another scene and can reproduce the issue. Maybe this issue is specific to system and OS version? ![wrong_instance_order.png](https://archive.blender.org/developer/F11965876/wrong_instance_order.png)

Changed status from 'Needs Developer To Reproduce' to: 'Needs Triage'

Changed status from 'Needs Developer To Reproduce' to: 'Needs Triage'

Added subscriber: @ankitm

Added subscriber: @ankitm

It's possible, but at this point I can only speculate, will have to have closer look at implementation, but not sure how this would be handled on GPU exactly. Perhaps check with cycles CPU render.

@ankitm Can you repro?

It's possible, but at this point I can only speculate, will have to have closer look at implementation, but not sure how this would be handled on GPU exactly. Perhaps check with cycles CPU render. @ankitm Can you repro?
Member

image.png

Can't redo
Here's the file I created on 827c5b399e

T93285_my_attempt.blend

![image.png](https://archive.blender.org/developer/F12133276/image.png) Can't redo Here's the file I created on 827c5b399e0b [T93285_my_attempt.blend](https://archive.blender.org/developer/F12133494/T93285_my_attempt.blend)
Member

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
Author

Changed status from 'Needs User Info' to: 'Needs Developer To Reproduce'

Changed status from 'Needs User Info' to: 'Needs Developer To Reproduce'
Author

I just tested with the latest version:

3.1.0 Alpha, branch: master, commit date: 2021-11-25 09:22, hash: 5ffb9b6dc4
(download page hash: 5ffb9b6dc4)

and it still fails with the original scene attached as well as the attached scene from Ankit.
The scene T93285_my_attempt.blend appears to be working because it only has 31 objects in the collection. Which means occupying point indices 0-30.
If I duplicate one of them and give it the next number (32) (point index 31) the ordering issue occurs.
The modified scene is attached.

No failure with:
Operating system: Windows-10-10.0.19042-SP0 64 Bits
Graphics card: NVIDIA GeForce GTX TITAN X/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 471.41
version: 3.1.0 Alpha, branch: master, commit date: 2021-11-25 09:36, hash: 1e2376f41f
(download page hash: 1e2376f41f)

Which indicates that the issue is related to macOS.

Update:
Tested also with an older MacBookPro
Operating system: macOS-10.13.6-x86_64-i386-64bit 64 Bits
Graphics card: NVIDIA GeForce GT 650M OpenGL Engine NVIDIA Corporation 4.1 NVIDIA-10.32.0 355.11.10.10.40.102
3.1.0 Alpha, branch: master, commit date: 2021-11-25 09:22, hash: 5ffb9b6dc4

T93285_still_failing.png

T93285_still_failing.blend

I just tested with the latest version: 3.1.0 Alpha, branch: master, commit date: 2021-11-25 09:22, hash: `5ffb9b6dc4` (download page hash: 5ffb9b6dc45f) and it still fails with the original scene attached as well as the attached scene from Ankit. The scene T93285_my_attempt.blend appears to be working because it only has 31 objects in the collection. Which means occupying point indices 0-30. If I duplicate one of them and give it the next number (32) (point index 31) the ordering issue occurs. The modified scene is attached. **No failure with:** Operating system: Windows-10-10.0.19042-SP0 64 Bits Graphics card: NVIDIA GeForce GTX TITAN X/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 471.41 version: 3.1.0 Alpha, branch: master, commit date: 2021-11-25 09:36, hash: `1e2376f41f` (download page hash: 1e2376f41f5a) Which indicates that the issue is related to macOS. **Update:** Tested also with an older MacBookPro Operating system: macOS-10.13.6-x86_64-i386-64bit 64 Bits Graphics card: NVIDIA GeForce GT 650M OpenGL Engine NVIDIA Corporation 4.1 NVIDIA-10.32.0 355.11.10.10.40.102 3.1.0 Alpha, branch: master, commit date: 2021-11-25 09:22, hash: `5ffb9b6dc4` ![T93285_still_failing.png](https://archive.blender.org/developer/F12136806/T93285_still_failing.png) [T93285_still_failing.blend](https://archive.blender.org/developer/F12136822/T93285_still_failing.blend)
Member

Changed status from 'Needs Developer To Reproduce' to: 'Confirmed'

Changed status from 'Needs Developer To Reproduce' to: 'Confirmed'
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke
Member

I can't reproduce it unfortunately. Can someone check if the incorrect ordering exists in the Collection Info node already?

I can't reproduce it unfortunately. Can someone check if the incorrect ordering exists in the Collection Info node already?
Member

The diff:

diff --git a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc
--- a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc
@@ -131,12 +131,17 @@ static void node_geo_exec(GeoNodeExecParams params)
       }
       entries.append({handle, &(child_object->id.name[2]), transform});
     }
-
+    for (const InstanceListEntry &entry : entries) {
+      std::cout << "******" << entry.name;
+    }
     std::sort(entries.begin(),
               entries.end(),
               [](const InstanceListEntry &a, const InstanceListEntry &b) {
                 return BLI_strcasecmp_natural(a.name, b.name) <= 0;
               });
+    for (const InstanceListEntry &entry : entries) {
+      std::cout << "******" << entry.name;
+    }
     for (const InstanceListEntry &entry : entries) {
       instances.add_instance(entry.handle, entry.transform);
     }

The output:

******1******2******3******4******5******6******7******8******9******10******11******12******13******14******15******16******17******18******19******20******21******22******23******24******25******26******27******28******29******30******31******32******33******1******2******3******4******5******6******7******8******9******10******11******12******13******14******15******16******18******17******19******20******21******22******23******24******25******26******27******28******29******30******31******32******33

In #93285#1262440, @JacquesLucke wrote:
I can't reproduce it unfortunately. Can someone check if the incorrect ordering exists in the Collection Info node already?

@JacquesLucke so I'd guess yes ?

The diff: ``` diff --git a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc --- a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc @@ -131,12 +131,17 @@ static void node_geo_exec(GeoNodeExecParams params) } entries.append({handle, &(child_object->id.name[2]), transform}); } - + for (const InstanceListEntry &entry : entries) { + std::cout << "******" << entry.name; + } std::sort(entries.begin(), entries.end(), [](const InstanceListEntry &a, const InstanceListEntry &b) { return BLI_strcasecmp_natural(a.name, b.name) <= 0; }); + for (const InstanceListEntry &entry : entries) { + std::cout << "******" << entry.name; + } for (const InstanceListEntry &entry : entries) { instances.add_instance(entry.handle, entry.transform); } ``` The output: ``` ******1******2******3******4******5******6******7******8******9******10******11******12******13******14******15******16******17******18******19******20******21******22******23******24******25******26******27******28******29******30******31******32******33******1******2******3******4******5******6******7******8******9******10******11******12******13******14******15******16******18******17******19******20******21******22******23******24******25******26******27******28******29******30******31******32******33 ``` > In #93285#1262440, @JacquesLucke wrote: > I can't reproduce it unfortunately. Can someone check if the incorrect ordering exists in the Collection Info node already? @JacquesLucke so I'd guess yes ?
Member

Added subscribers: @simen, @lichtwerk, @mano-wii, @OmarEmaraDev

Added subscribers: @simen, @lichtwerk, @mano-wii, @OmarEmaraDev
Member

Added subscribers: @himalaya, @PratikPB2123

Added subscribers: @himalaya, @PratikPB2123

If nothing against, I'm tempted to commit the fix mentioned in #96310:

In #96310#1327141, @mano-wii wrote:
After a little more testing the problem seems to be in using less than or equal instead of less than:

diff --git a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc
index 68d42444afd..54a061993a3 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc
@@ -120,7 +120,7 @@ static void node_geo_exec(GeoNodeExecParams params)
     std::sort(entries.begin(),
               entries.end(),
               - [ ](const InstanceListEntry &a, const InstanceListEntry &b) {
-                return BLI_strcasecmp_natural(a.name, b.name) <= 0;
+                return BLI_strcasecmp_natural(a.name, b.name) < 0;
               });
     for (const InstanceListEntry &entry : entries) {
       instances.add_instance(entry.handle, entry.transform);

If nothing against, I'm tempted to commit the fix mentioned in #96310: > In #96310#1327141, @mano-wii wrote: > After a little more testing the problem seems to be in using `less than or equal` instead of `less than`: > > ``` > diff --git a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc > index 68d42444afd..54a061993a3 100644 > --- a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc > +++ b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc > @@ -120,7 +120,7 @@ static void node_geo_exec(GeoNodeExecParams params) > std::sort(entries.begin(), > entries.end(), > - [ ](const InstanceListEntry &a, const InstanceListEntry &b) { > - return BLI_strcasecmp_natural(a.name, b.name) <= 0; > + return BLI_strcasecmp_natural(a.name, b.name) < 0; > }); > for (const InstanceListEntry &entry : entries) { > instances.add_instance(entry.handle, entry.transform); > > ```
Member

Added subscriber: @HooglyBoogly

Added subscriber: @HooglyBoogly
Member

That seems fine to me. It would be nice to add this as a geometry nodes regression test afterwards.

That seems fine to me. It would be nice to add this as a geometry nodes regression test afterwards.

This issue was referenced by f3d5114c41

This issue was referenced by f3d5114c41352161d0dad7f30ef6b7dd1f28df85

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Germano Cavalcante self-assigned this 2022-04-27 16:20:07 +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
8 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#93285
No description provided.