Instanced object (in GN) not textured. #87746

Closed
opened 2021-04-23 12:32:23 +02:00 by Martijn Versteegh · 21 comments

System Information
Operating system: Linux-5.4.0-72-generic-x86_64-with-glibc2.31 64 Bits
Graphics card: GeForce RTX 2060 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 450.102.04

Blender Version
Broken: version: 2.93.0 Beta, branch: master, commit date: 2021-04-23 08:04, hash: 2f6219c48d
Worked:2.92

Short description of error
Texture or material not conserved when instancing object in geometry nodes.

Exact steps for others to reproduce the error
Open the attached .blend. The source object (leaf) is textured, but the instanced plant leaves are not.

texture-bug-v2.93.blend

**System Information** Operating system: Linux-5.4.0-72-generic-x86_64-with-glibc2.31 64 Bits Graphics card: GeForce RTX 2060 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 450.102.04 **Blender Version** Broken: version: 2.93.0 Beta, branch: master, commit date: 2021-04-23 08:04, hash: `2f6219c48d` Worked:2.92 **Short description of error** Texture or material not conserved when instancing object in geometry nodes. **Exact steps for others to reproduce the error** Open the attached .blend. The source object (leaf) is textured, but the instanced plant leaves are not. [texture-bug-v2.93.blend](https://archive.blender.org/developer/F10033657/texture-bug-v2.93.blend)
Author
Member

Added subscriber: @Baardaap

Added subscriber: @Baardaap

#88031 was marked as duplicate of this issue

#88031 was marked as duplicate of this issue

#88007 was marked as duplicate of this issue

#88007 was marked as duplicate of this issue
Martijn Versteegh self-assigned this 2021-04-23 12:33:19 +02:00
Author
Member

I'll start to do a bisect myself. But if anybody knows what's going on I'm all ears.

I'll start to do a bisect myself. But if anybody knows what's going on I'm all ears.
Author
Member

I bisected it to
[a4baedea91] Geometry Nodes: Make instances real on-demand

But I don't understand enough of the code (for now) to do anything more useful.

I bisected it to [a4baedea91196176cb07d15a4d8acfab52cf9f83] Geometry Nodes: Make instances real on-demand But I don't understand enough of the code (for now) to do anything more useful.
Martijn Versteegh removed their assignment 2021-04-23 16:37:35 +02:00
Member

Added subscriber: @Calra

Added subscriber: @Calra
Member

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

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

I can confirm this issue on Windows 10.

Thanks for bisecting.

I can confirm this issue on Windows 10. Thanks for bisecting.
Author
Member

Funny thing is: some material properties are carried over correctly. In the example you can see that the green subsurface color is still present. (thought this may be a a consequence of my messing around with all the possible settings).

Funny thing is: some material properties *are* carried over correctly. In the example you can see that the green subsurface color is still present. (thought this may be a a consequence of my messing around with all the possible settings).
Author
Member

I've experimented some more. In 2.92 applying the modifier in this example file has the effect of removing the modifier. So only the pre-GN vertices remain. in 2.93 applying the modifier does what you expect, But any traces of the original materials are then gone completely (no more SS color either).

If I look at the 'material index' property in the spreadsheet window, and they are all set to 0.

It's not completely clear to me how this could/should work. Obviously you want to preserve the materials in an instanced object, but this would mean the materials should be linked in extra slots in the GN object? And then the material indices updated in the clones accordingly? Ideally I'd think you'd want nothing to change in the state of the resulting (final) object when applying the modifier. So something like this should happen I think.

I've experimented some more. In 2.92 applying the modifier in this example file has the effect of *removing* the modifier. So only the pre-GN vertices remain. in 2.93 applying the modifier does what you expect, But any traces of the original materials are then gone completely (no more SS color either). If I look at the 'material index' property in the spreadsheet window, and they are all set to 0. It's not completely clear to me how this could/should work. Obviously you want to preserve the materials in an instanced object, but this would mean the materials should be linked in extra slots in the GN object? And then the material indices updated in the clones accordingly? Ideally I'd think you'd want nothing to change in the state of the resulting (final) object when applying the modifier. So something like this should happen I think.
Author
Member

I found out that the culprit is the (mistaken) 'point rotate' node after the 'point instance' node. (It was meant to go before the instancer node). The point rotate probably causes the instanced object to be realized and then lose it's material.

So this is probably not really a bug, though it is rather confusing behaviour. A related problem is that if you apply the modifier you lose all materials from instanced objects. I have the feeling this needs some design thought...

I leave it open for now, because I think it's useful if someone knowlegable about this code has a look at this. If you are, feel free to close it after thinking about it ;-)

I found out that the culprit is the (mistaken) 'point rotate' node after the 'point instance' node. (It was meant to go *before* the instancer node). The point rotate probably causes the instanced object to be realized and then lose it's material. So this is probably not really a bug, though it is rather confusing behaviour. A related problem is that if you apply the modifier you lose all materials from instanced objects. I have the feeling this needs some design thought... I leave it open for now, because I think it's useful if someone knowlegable about this code has a look at this. If you are, feel free to close it after thinking about it ;-)
Author
Member

On second thought, I consider this a bug after all.

If you put a simple deform or curve modifier after the GN modifier (or maybe any modifier? don't know, I tested those 2) you lose the materials.

On second thought, I consider this a bug after all. If you put a simple deform or curve modifier after the GN modifier (or maybe *any* modifier? don't know, I tested those 2) you lose the materials.
Member

Added subscriber: @HooglyBoogly

Added subscriber: @HooglyBoogly
Member

Changed status from 'Confirmed' to: 'Archived'

Changed status from 'Confirmed' to: 'Archived'
Member

Thanks for the report and the investigation, but this is not a bug.

Materials are stored on the original objects or their data. When you use instancing, the render engine knows about the original objects for the instance geometry, therefore it can know the materials, etc.

However, when you want to change instanced geometry, it has to be "made real". In other words, the instances are not instances anymore, they are just more geometry data in the object with the modifier.

The proper way to do this is to add any materials you need in the final result to the modifier object (not the original mesh), and use the material index attribute. Either that or avoid making the instances real.

The reason another modifier changes the result is that the instances need to be made real for the next modifier.

We know that material handling is a sore spot in the usability of the system, but it's not a bug.

Thanks for the report and the investigation, but this is not a bug. Materials are stored on the original objects or their data. When you use instancing, the render engine knows about the original objects for the instance geometry, therefore it can know the materials, etc. However, when you want to change instanced geometry, it has to be "made real". In other words, the instances are not instances anymore, they are just more geometry data in the object with the modifier. The proper way to do this is to add any materials you need in the final result to the modifier *object* (not the original mesh), and use the material index attribute. Either that or avoid making the instances real. The reason another modifier changes the result is that the instances need to be made real for the next modifier. We know that material handling is a sore spot in the usability of the system, but it's not a bug.
Author
Member

Hm. it's maybe not a bug, but it is a very large damper on the usability if you manually have to update all the material indices. I've been busy generating plants using GN, and it's an extremely logical thing to create 'twigs' with GN, and then instance those in 'plants' and then instance those in a 'bush', for example. If you need to 'manually' keep track of all the materials and material indices it gets complicated real quick.

It would be extremely handy if there was an option to automate this process. It is possible to automate this. The join operator does it as well...

Hm. it's maybe not a bug, but it is a very large damper on the usability if you manually have to update all the material indices. I've been busy generating plants using GN, and it's an extremely logical thing to create 'twigs' with GN, and then instance those in 'plants' and then instance those in a 'bush', for example. If you need to 'manually' keep track of all the materials and material indices it gets complicated real quick. It would be extremely handy if there was an option to automate this process. It *is* possible to automate this. The join operator does it as well...
Contributor

Added subscriber: @Rawalanche

Added subscriber: @Rawalanche
Contributor

In #87746#1152454, @HooglyBoogly wrote:
The proper way to do this is to add any materials you need in the final result to the modifier object (not the original mesh), and use the material index attribute. Either that or avoid making the instances real.

This is not a "proper way". This opens entire another tree of problems. There's simply no proper way at the moment. The fact something can not be done at all (not even with a workaround) is not a bug, it's actually much larger issue than just a bug, and should receive adequate attention.

> In #87746#1152454, @HooglyBoogly wrote: > The proper way to do this is to add any materials you need in the final result to the modifier *object* (not the original mesh), and use the material index attribute. Either that or avoid making the instances real. This is not a "proper way". This opens entire another tree of problems. There's simply no proper way at the moment. The fact something can not be done at all (not even with a workaround) is not a bug, it's actually much larger issue than just a bug, and should receive adequate attention.
Member

And it will, likely fairly soon actually.

And it will, likely fairly soon actually.
Member

Added subscriber: @blenderrocket

Added subscriber: @blenderrocket
Member

Added subscriber: @AnityEx

Added subscriber: @AnityEx
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
5 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#87746
No description provided.