Viewport gets stuck when two group instances are emitted from one face using dupli-verts #48913

Closed
opened 2016-07-21 04:37:14 +02:00 by GiantCowFIlms · 13 comments

System Information
Windows 8.1 Enterprise 64-bit
GPU: Nvidia GTX 670

Blender Version
Broken: 2.77a abf6f08

Short description of error
view port render gets stuck in loop of restarting, either during caching the BVH or on the first sample, depending on how large the scene is. Note that F12 render still works.

Gif:
Chat22.gif

Exact steps for others to reproduce the error

Full reproduction steps (from beginning):
Start with a clean .blend
follow the steps in this post:
http://blender.stackexchange.com/a/58304/3127
then grab the group instance empty, shift-D copy it, and move it over.
Switch to view port render mode, the bug will appear.

Blend file based reproduction steps:
Switch to view port render mode, the bug will appear.

Blend file
Stuck Viewport Demo.blend

**System Information** Windows 8.1 Enterprise 64-bit GPU: Nvidia GTX 670 **Blender Version** Broken: 2.77a abf6f08 **Short description of error** view port render gets stuck in loop of restarting, either during caching the BVH or on the first sample, depending on how large the scene is. Note that F12 render still works. Gif: ![Chat22.gif](https://archive.blender.org/developer/F325695/Chat22.gif) **Exact steps for others to reproduce the error** Full reproduction steps (from beginning): Start with a clean .blend follow the steps in this post: http://blender.stackexchange.com/a/58304/3127 then grab the group instance empty, shift-D copy it, and move it over. Switch to view port render mode, the bug will appear. Blend file based reproduction steps: Switch to view port render mode, the bug will appear. Blend file [Stuck Viewport Demo.blend](https://archive.blender.org/developer/F325699/Stuck_Viewport_Demo.blend)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @GiantCowFIlms

Added subscriber: @GiantCowFIlms
Member

Added subscriber: @gandalf3

Added subscriber: @gandalf3

Added subscribers: @Sergey, @mont29

Added subscribers: @Sergey, @mont29
Sergey Sharybin was assigned by Bastien Montagne 2016-07-21 20:08:27 +02:00

Can confirm the issue…

Cycles keeps aborting its update (synchronize) call back because either session->ready_to_reset() or session->scene->mutex.try_lock() fail (line 813 of blender_session.cpp).

Will let Cycles/depsgraph guy dig further here, @sergey. ;)

Can confirm the issue… Cycles keeps aborting its update (synchronize) call back because either `session->ready_to_reset()` or `session->scene->mutex.try_lock()` fail (line 813 of blender_session.cpp). Will let Cycles/depsgraph guy dig further here, @sergey. ;)

Developer note.

it's nothing really to do with dependency graph or the locking/notification mechanism mentioned here. It is to do with how dupli_object.c generates persistent ID: there are two object parented to the plane, yeah of them duplicates two suzannes. This makes the persistent IDs be the following:

Via Monkey:

0 0 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647
1 0 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647

Via Monkey.001

0 0 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647
1 0 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647

This makes two different instances to have different transformation matrix but same persistent ID, which confuses Cycles.

So this issue is to be solved on object_dupli,c level with some careful thoughts how to avoid unnecessary persistent ID changes when geometry changes over the time.

Developer note. it's nothing really to do with dependency graph or the locking/notification mechanism mentioned here. It is to do with how dupli_object.c generates persistent ID: there are two object parented to the plane, yeah of them duplicates two suzannes. This makes the persistent IDs be the following: ``` Via Monkey: ``` 0 0 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 1 0 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 ``` Via Monkey.001 ``` 0 0 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 1 0 2147483647 2147483647 2147483647 2147483647 2147483647 2147483647 This makes two different instances to have different transformation matrix but same persistent ID, which confuses Cycles. So this issue is to be solved on `object_dupli,c` level with some careful thoughts how to avoid unnecessary persistent ID changes when geometry changes over the time.

This issue was referenced by blender/cycles@29de8bb2a8

This issue was referenced by blender/cycles@29de8bb2a8a8fcc6c2138cc8564bbf1bda970e40

This issue was referenced by c0161a1bab

This issue was referenced by c0161a1bab71331f518bd5c8c1b091df7ee12074

Added subscriber: @brecht

Added subscriber: @brecht

Here's a simple patch that solves it, making the persistent ID longer to take into account the group/base index.
P385: (An Untitled Masterwork)

diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h
index d5dbaba..e79f2bb 100644
--- a/intern/cycles/blender/blender_util.h
+++ b/intern/cycles/blender/blender_util.h
@@ -698,7 +698,7 @@ protected:
 
 /* Object Key */
 
-enum { OBJECT_PERSISTENT_ID_SIZE = 8 };
+enum { OBJECT_PERSISTENT_ID_SIZE = 16 };
 
 struct ObjectKey {
 	void *parent;
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c
index 21a0246..3a0222b 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -221,31 +221,39 @@ static void make_child_duplis(const DupliContext *ctx, void *userdata, MakeChild
 
 	if (ctx->group) {
 		unsigned int lay = ctx->group->layer;
+		unsigned int groupid = 0;
 		GroupObject *go;
-		for (go = ctx->group->gobject.first; go; go = go->next) {
+		for (go = ctx->group->gobject.first; go; go = go->next, groupid++) {
 			Object *ob = go->ob;
 
 			if ((ob->lay & lay) && ob != obedit && is_child(ob, parent)) {
+				DupliContext pctx;
+				copy_dupli_context(&pctx, ctx, ctx->object, NULL, groupid, false);
+
 				/* mballs have a different dupli handling */
 				if (ob->type != OB_MBALL)
 					ob->flag |= OB_DONE;  /* doesnt render */
 
-				make_child_duplis_cb(ctx, userdata, ob);
+				make_child_duplis_cb(&pctx, userdata, ob);
 			}
 		}
 	}
 	else {
 		unsigned int lay = ctx->scene->lay;
+		unsigned int baseid = 0;
 		Base *base;
-		for (base = ctx->scene->base.first; base; base = base->next) {
+		for (base = ctx->scene->base.first; base; base = base->next, baseid++) {
 			Object *ob = base->object;
 
 			if ((base->lay & lay) && ob != obedit && is_child(ob, parent)) {
+				DupliContext pctx;
+				copy_dupli_context(&pctx, ctx, ctx->object, NULL, baseid, false);
+
 				/* mballs have a different dupli handling */
 				if (ob->type != OB_MBALL)
 					ob->flag |= OB_DONE;  /* doesnt render */
 
-				make_child_duplis_cb(ctx, userdata, ob);
+				make_child_duplis_cb(&pctx, userdata, ob);
 			}
 		}
 	}
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index d53c836..d24c7fa 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -331,7 +331,7 @@ typedef struct DupliObject {
 
 	/* persistent identifier for a dupli object, for inter-frame matching of
 	 * objects with motion blur, or inter-update matching for syncing */
-	int persistent_id- [x]; /* MAX_DUPLI_RECUR */
+	int persistent_id[16]; /* 2*MAX_DUPLI_RECUR */
 
 	/* particle this dupli was generated from */
 	struct ParticleSystem *particle_system;

In 2.8 we might consider changing dupliverts and duplifaces so that duplicators use a group or object specified in a property, rather than through parenting. That dependency has always been in the wrong direction I think, and then as a side effect we could shorten the persistent ID again.

Here's a simple patch that solves it, making the persistent ID longer to take into account the group/base index. [P385: (An Untitled Masterwork)](https://archive.blender.org/developer/P385.txt) ```diff diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index d5dbaba..e79f2bb 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -698,7 +698,7 @@ protected: /* Object Key */ -enum { OBJECT_PERSISTENT_ID_SIZE = 8 }; +enum { OBJECT_PERSISTENT_ID_SIZE = 16 }; struct ObjectKey { void *parent; diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c index 21a0246..3a0222b 100644 --- a/source/blender/blenkernel/intern/object_dupli.c +++ b/source/blender/blenkernel/intern/object_dupli.c @@ -221,31 +221,39 @@ static void make_child_duplis(const DupliContext *ctx, void *userdata, MakeChild if (ctx->group) { unsigned int lay = ctx->group->layer; + unsigned int groupid = 0; GroupObject *go; - for (go = ctx->group->gobject.first; go; go = go->next) { + for (go = ctx->group->gobject.first; go; go = go->next, groupid++) { Object *ob = go->ob; if ((ob->lay & lay) && ob != obedit && is_child(ob, parent)) { + DupliContext pctx; + copy_dupli_context(&pctx, ctx, ctx->object, NULL, groupid, false); + /* mballs have a different dupli handling */ if (ob->type != OB_MBALL) ob->flag |= OB_DONE; /* doesnt render */ - make_child_duplis_cb(ctx, userdata, ob); + make_child_duplis_cb(&pctx, userdata, ob); } } } else { unsigned int lay = ctx->scene->lay; + unsigned int baseid = 0; Base *base; - for (base = ctx->scene->base.first; base; base = base->next) { + for (base = ctx->scene->base.first; base; base = base->next, baseid++) { Object *ob = base->object; if ((base->lay & lay) && ob != obedit && is_child(ob, parent)) { + DupliContext pctx; + copy_dupli_context(&pctx, ctx, ctx->object, NULL, baseid, false); + /* mballs have a different dupli handling */ if (ob->type != OB_MBALL) ob->flag |= OB_DONE; /* doesnt render */ - make_child_duplis_cb(ctx, userdata, ob); + make_child_duplis_cb(&pctx, userdata, ob); } } } diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index d53c836..d24c7fa 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -331,7 +331,7 @@ typedef struct DupliObject { /* persistent identifier for a dupli object, for inter-frame matching of * objects with motion blur, or inter-update matching for syncing */ - int persistent_id- [x]; /* MAX_DUPLI_RECUR */ + int persistent_id[16]; /* 2*MAX_DUPLI_RECUR */ /* particle this dupli was generated from */ struct ParticleSystem *particle_system; ``` In 2.8 we might consider changing dupliverts and duplifaces so that duplicators use a group or object specified in a property, rather than through parenting. That dependency has always been in the wrong direction I think, and then as a side effect we could shorten the persistent ID again.

@brecht, any reason why not to commit this?

@brecht, any reason why not to commit this?

I haven't had the time to test this properly yet, just wanted to post something so no one wastes time trying to fix this.

I haven't had the time to test this properly yet, just wanted to post something so no one wastes time trying to fix this.

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
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#48913
No description provided.