Some instances are not rendered to scale one 0 #46937

Closed
opened 2015-12-07 16:06:51 +01:00 by Luis Miguel Pérez González · 10 comments

System Information
CPU: Intel Core i7-2600 3.40GHz
RAM: 16 GB
GFX: nVidia Geforce GTX 560 Ti
OS: Windows 7 Professional 64bits

Blender Version
Broken: 2.76b Hash: f337fea
Worked: (all win64) 2.76-rc3, 2.75a, 2.74rc2, 2.73a, 2.72b, 2.71, 2.70a, 2.69

  Note: in versions 2.71, 2.70a and 2.69 using the keyboard shortcut "s + 0" scale x, y, z 0.0001 (not 0)

Short description of error
To scale the last instance created to 0, the other instances (the same group) not be rendered.
*Anomaly detected: to put 2 values of the scale 0.0001, and the other to 0, only a few faces of other instances they are rendered. (scale example: x = 0.0001, y = 0.0001, z = 0)

Exact steps for others to reproduce the error

  • Create a group of geometry (ctrl g)
  • Create multiple instances of the group
  • Scale the last instance 0
  • Render the scene (the instance are not rendered)

last_instance_scale_0.blend

**System Information** CPU: Intel Core i7-2600 3.40GHz RAM: 16 GB GFX: nVidia Geforce GTX 560 Ti OS: Windows 7 Professional 64bits **Blender Version** Broken: 2.76b Hash: f337fea Worked: (all win64) 2.76-rc3, 2.75a, 2.74rc2, 2.73a, 2.72b, 2.71, 2.70a, 2.69 ``` Note: in versions 2.71, 2.70a and 2.69 using the keyboard shortcut "s + 0" scale x, y, z 0.0001 (not 0) ``` **Short description of error** To scale the last instance created to 0, the other instances (the same group) not be rendered. *Anomaly detected: to put 2 values of the scale 0.0001, and the other to 0, only a few faces of other instances they are rendered. (scale example: x = 0.0001, y = 0.0001, z = 0) **Exact steps for others to reproduce the error** - Create a group of geometry (ctrl g) - Create multiple instances of the group - Scale the last instance 0 - Render the scene (the instance are not rendered) [last_instance_scale_0.blend](https://archive.blender.org/developer/F264128/last_instance_scale_0.blend)

Changed status to: 'Open'

Changed status to: 'Open'

Added subscriber: @Wilson-14

Added subscriber: @Wilson-14

Added subscriber: @Sergey

Added subscriber: @Sergey
Sergey Sharybin self-assigned this 2015-12-08 09:48:41 +01:00

I'm not sure how this is possible to work in 2.72-2.76 actually, in own tests it never works since 2.72. The regression in behavior is caused by the following commit 1526620.

it is just a Blender Internal render code which isn't compatible with such kind of instancing. This depends on the order of objects listed in the scene and happens when "origin" object is created from the group scaled to zero. In this case re-scaling ti to non-zero group size does not work.

Will try to improve the instancing code, but it's already quite fragile so it might be just considered a TODO.

I'm not sure how this is possible to work in 2.72-2.76 actually, in own tests it never works since 2.72. The regression in behavior is caused by the following commit 1526620. it is just a Blender Internal render code which isn't compatible with such kind of instancing. This depends on the order of objects listed in the scene and happens when "origin" object is created from the group scaled to zero. In this case re-scaling ti to non-zero group size does not work. Will try to improve the instancing code, but it's already quite fragile so it might be just considered a TODO.

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Developer note:

Tried to make it so render object is created with unit matrix and being instanced by the instancing code. This turned up to be not so much striaghtforward because of how object data is stored (it's applying transform) and how other instances calculates offset matricies (relative to the original instance). Don't think running into such complexity is really something to happen as a bugfix, more like something what belongs to more major instancing code refactor in Blender Internal.

However, we might consider the following quick solution:

P298: Fix #46937

diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 846255b..94dbce2 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -5097,9 +5097,16 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp
 							}
 						}
 
-						if (obi==NULL)
-							/* can't instance, just create the object */
-							init_render_object(re, obd, ob, dob, dob_extra->obmat, timeoffset);
+						if (obi==NULL) {
+							/* Can't instance, just create the object.
+							 * Only do this if the instance size is not zero, otherwise
+							 * we'll have major issue with instancing the same render
+							 * object by other groups. See #46937 for the details.
+							 */
+							if (fabsf(mat4_to_scale(obd->obmat)) >= 1e-7f) {
+								init_render_object(re, obd, ob, dob, dob_extra->obmat, timeoffset);
+							}
+						}
 						
 						if (dob->type != OB_DUPLIGROUP) {
 							obd->flag |= OB_DONE;

Basically, we skip instances if they're too small and can't be visible anyway. Could break some corner cases perhaps.

@ideasman42, do you have strong opinion here?

Developer note: Tried to make it so render object is created with unit matrix and being instanced by the instancing code. This turned up to be not so much striaghtforward because of how object data is stored (it's applying transform) and how other instances calculates offset matricies (relative to the original instance). Don't think running into such complexity is really something to happen as a bugfix, more like something what belongs to more major instancing code refactor in Blender Internal. However, we might consider the following quick solution: [P298: Fix #46937](https://archive.blender.org/developer/P298.txt) ``` diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 846255b..94dbce2 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -5097,9 +5097,16 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp } } - if (obi==NULL) - /* can't instance, just create the object */ - init_render_object(re, obd, ob, dob, dob_extra->obmat, timeoffset); + if (obi==NULL) { + /* Can't instance, just create the object. + * Only do this if the instance size is not zero, otherwise + * we'll have major issue with instancing the same render + * object by other groups. See #46937 for the details. + */ + if (fabsf(mat4_to_scale(obd->obmat)) >= 1e-7f) { + init_render_object(re, obd, ob, dob, dob_extra->obmat, timeoffset); + } + } if (dob->type != OB_DUPLIGROUP) { obd->flag |= OB_DONE; ``` Basically, we skip instances if they're too small and can't be visible anyway. Could break some corner cases perhaps. @ideasman42, do you have strong opinion here?

Thank you for answering so quickly.
I think that any solution would be useful.
Make elements appear and disappear through scale is a useful resource in work "motion graphics". To have "instances" speeds up the work.

(sorry for my bad English)

Thank you for answering so quickly. I think that any solution would be useful. Make elements appear and disappear through scale is a useful resource in work "motion graphics". To have "instances" speeds up the work. (sorry for my bad English)

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'

Unfortunately, the proposed patch wouldn't work well -- it wouldn't render halos in the same way as they are in current Blender (scaling object to zero will still render halo on it's center, i.e.).

Here's another idea which kind of implements idea of having object in the database created with unit matrix:

P309: Another patch for #46937

diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 69e45fe..71f539d 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -4650,6 +4650,10 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject *
 
 	/* one render object for the data itself */
 	if (allow_render) {
+		float obmat- [x][4];
+		copy_m4_m4(obmat, ob->obmat);
+		unit_m4(ob->obmat);
+
 		obr= RE_addRenderObject(re, ob, par, index, 0, ob->lay);
 		if ((dob && !dob->animated) || (ob->transflag & OB_RENDER_DUPLI)) {
 			obr->flag |= R_INSTANCEABLE;
@@ -4659,7 +4663,7 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject *
 
 		/* only add instance for objects that have not been used for dupli */
 		if (!(ob->transflag & OB_RENDER_DUPLI)) {
-			obi = RE_addRenderInstance(re, obr, ob, par, index, 0, NULL, ob->lay, dob);
+			obi = RE_addRenderInstance(re, obr, ob, par, index, 0, obmat, ob->lay, dob);
 			if (dob) set_dupli_tex_mat(re, obi, dob, omat);
 		}
 		else
@@ -4670,6 +4674,8 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject *
 			if (ma && ma->material_type == MA_TYPE_VOLUME)
 				add_volume(re, obr, ma);
 		}
+
+		copy_m4_m4(ob->obmat, obmat);
 	}
 
 	/* and one render object per particle system */

This is better approach, but is quite hackish in implementation and wouldn't work well for particles, also texture space might be wrong.

Al this requires some more major changes in the render database which are rather a TODO. Meanwhile you can animate renderability/viewport visibility of the object instead. So thanks for the report, but it's now part of TODO (http://wiki.blender.org/index.php/Dev:Source/Development/Todo/Render#Render_Engine)

Unfortunately, the proposed patch wouldn't work well -- it wouldn't render halos in the same way as they are in current Blender (scaling object to zero will still render halo on it's center, i.e.). Here's another idea which kind of implements idea of having object in the database created with unit matrix: [P309: Another patch for #46937](https://archive.blender.org/developer/P309.txt) ```diff diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 69e45fe..71f539d 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -4650,6 +4650,10 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject * /* one render object for the data itself */ if (allow_render) { + float obmat- [x][4]; + copy_m4_m4(obmat, ob->obmat); + unit_m4(ob->obmat); + obr= RE_addRenderObject(re, ob, par, index, 0, ob->lay); if ((dob && !dob->animated) || (ob->transflag & OB_RENDER_DUPLI)) { obr->flag |= R_INSTANCEABLE; @@ -4659,7 +4663,7 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject * /* only add instance for objects that have not been used for dupli */ if (!(ob->transflag & OB_RENDER_DUPLI)) { - obi = RE_addRenderInstance(re, obr, ob, par, index, 0, NULL, ob->lay, dob); + obi = RE_addRenderInstance(re, obr, ob, par, index, 0, obmat, ob->lay, dob); if (dob) set_dupli_tex_mat(re, obi, dob, omat); } else @@ -4670,6 +4674,8 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject * if (ma && ma->material_type == MA_TYPE_VOLUME) add_volume(re, obr, ma); } + + copy_m4_m4(ob->obmat, obmat); } /* and one render object per particle system */ ``` This is better approach, but is quite hackish in implementation and wouldn't work well for particles, also texture space might be wrong. Al this requires some more major changes in the render database which are rather a TODO. Meanwhile you can animate renderability/viewport visibility of the object instead. So thanks for the report, but it's now part of TODO (http://wiki.blender.org/index.php/Dev:Source/Development/Todo/Render#Render_Engine)
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
3 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#46937
No description provided.