Collada Export should create <instance_controller> elements for Blender Shape Keys on nodes without armature #50807

Open
opened 2017-02-27 22:44:48 +01:00 by Jon Allee · 15 comments

System Information
macOS Sierra 10.12.3

Blender Version
Broken: 2.76, 2.78
Worked: Unknown, most likely never.

Short description of error
If there is no armature applied to a node that has shape keys, Blender's Collada export will create an <instance_geometry>. Instead we should create an <instance_controller> of the morph type for the shape keys.

For a Collada node to use a morph controller (roughly mapped to a Blender shape key) it needs to have a <instance_controller> child. Blender writes such an element for a skin controller (roughly equivalent to armature). It does not write <instance_controller> elements for shape keys.

The reason why we don't probably relates to https://developer.blender.org/T42197
When both an armature and a shape key apply to a node, Collada would like us to chain them. Blender doesn't support this, so we don't have a good way to express this situation in Collada format.

Here's what we do now:
Blender only exports <library_controller> elements for shape keys. This is all Blender needs, because Blender shape keys apply to a geometry globally, not a node. Collada morph controllers are bound to geometry, but need to be explicitly bound to nodes.

In the absence of armature, we should export an instance controller for shape keys.

Here's a collada test case sample that shows the correct format for a simple morph (aka shape key): https://github.com/KhronosGroup/COLLADA-CTS/blob/master/StandardDataSets/collada/library_controllers/controller/morph/morph_one_target_normalized/morph_one_target_normalized.dae

CON: This can be considered a partial fix. Instead of always failing to correctly export instances of morph controllers, we fail only when we have both armature and shape key. This may be more confusing than the current behavior.

PRO: These people can finally use Blender to create a simple morph and import it into Apple's SceneKit:
https://forums.developer.apple.com/thread/62426
http://stackoverflow.com/questions/37516117/how-do-i-load-scnmorpher-targets-from-a-collada-dae-files-morph-controllers-in

The issue for the Apple SceneKit users with Blender's current behavior is that their (primitive) tools don't allow them to access either library_geometries or library_controllers directly. Currently, they can't access shape key / morph controllers in Blender exported .dae at all.

Exact steps for others to reproduce the error

  1. Delete starting elements.

  2. Import "adjusted_cube_with_shapekey.dae" - It contains xml like "Expected" below.

  3. Verify that blender displays a new startup cube. - Note: Blender import has handled the fact that we have an instance controller not an instance geometry. Presumably, this is because the code for converting skin controller to armature covers the morph controller as well.

  4. Select File, export, Collada.

  5. After export inspect the <visual_scene> element in the dae file. The cube node will contain a <instance_geometry> instead of an <instance_controller>.

Current:



<visual_scene id="Scene" name="Scene">
      <node id="Cube" name="Cube" type="NODE">
        <matrix sid="transform">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix>
        <instance_geometry url="#Cube-mesh" name="Cube">
          <bind_material>
            <technique_common>
              <instance_material symbol="Material-material" target="#Material-material"/>
            </technique_common>
          </bind_material>
        </instance_geometry>
      </node>
    </visual_scene>

Expected:

<visual_scene id="Scene" name="Scene">
      <node id="Cube" name="Cube" type="NODE">
        <matrix sid="transform">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix>
        <instance_controller url="#Cube-morph" name="Cube-morph">
          <bind_material>
            <technique_common>
              <instance_material symbol="Material-material" target="#Material-material"/>
            </technique_common>
          </bind_material>
        </instance_controller>
      </node>
    </visual_scene>

adjusted_cube_with_shapekey.dae

**System Information** macOS Sierra 10.12.3 **Blender Version** Broken: 2.76, 2.78 Worked: Unknown, most likely never. **Short description of error** If there is no armature applied to a node that has shape keys, Blender's Collada export will create an <instance_geometry>. Instead we should create an <instance_controller> of the morph type for the shape keys. For a Collada node to use a morph controller (roughly mapped to a Blender shape key) it needs to have a <instance_controller> child. Blender writes such an element for a skin controller (roughly equivalent to armature). It does not write <instance_controller> elements for shape keys. The reason why we don't probably relates to https://developer.blender.org/T42197 When both an armature and a shape key apply to a node, Collada would like us to chain them. Blender doesn't support this, so we don't have a good way to express this situation in Collada format. Here's what we do now: Blender only exports <library_controller> elements for shape keys. This is all Blender needs, because Blender shape keys apply to a geometry globally, not a node. Collada morph controllers are bound to geometry, but need to be explicitly bound to nodes. In the absence of armature, we should export an instance controller for shape keys. Here's a collada test case sample that shows the correct format for a simple morph (aka shape key): https://github.com/KhronosGroup/COLLADA-CTS/blob/master/StandardDataSets/collada/library_controllers/controller/morph/morph_one_target_normalized/morph_one_target_normalized.dae CON: This can be considered a partial fix. Instead of always failing to correctly export instances of morph controllers, we fail only when we have both armature and shape key. This may be more confusing than the current behavior. PRO: These people can finally use Blender to create a simple morph and import it into Apple's SceneKit: https://forums.developer.apple.com/thread/62426 http://stackoverflow.com/questions/37516117/how-do-i-load-scnmorpher-targets-from-a-collada-dae-files-morph-controllers-in The issue for the Apple SceneKit users with Blender's current behavior is that their (primitive) tools don't allow them to access either library_geometries or library_controllers directly. Currently, they can't access shape key / morph controllers in Blender exported .dae at all. **Exact steps for others to reproduce the error** 1) Delete starting elements. 2) Import "adjusted_cube_with_shapekey.dae" - It contains xml like "Expected" below. 3) Verify that blender displays a new startup cube. - Note: Blender import has handled the fact that we have an instance controller not an instance geometry. Presumably, this is because the code for converting skin controller to armature covers the morph controller as well. 4) Select File, export, Collada. 5) After export inspect the <visual_scene> element in the dae file. The cube node will contain a <instance_geometry> instead of an <instance_controller>. Current: ``` <visual_scene id="Scene" name="Scene"> <node id="Cube" name="Cube" type="NODE"> <matrix sid="transform">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix> <instance_geometry url="#Cube-mesh" name="Cube"> <bind_material> <technique_common> <instance_material symbol="Material-material" target="#Material-material"/> </technique_common> </bind_material> </instance_geometry> </node> </visual_scene> ``` Expected: ``` <visual_scene id="Scene" name="Scene"> <node id="Cube" name="Cube" type="NODE"> <matrix sid="transform">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix> <instance_controller url="#Cube-morph" name="Cube-morph"> <bind_material> <technique_common> <instance_material symbol="Material-material" target="#Material-material"/> </technique_common> </bind_material> </instance_controller> </node> </visual_scene> ``` [adjusted_cube_with_shapekey.dae](https://archive.blender.org/developer/F498222/adjusted_cube_with_shapekey.dae)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @jacknimble

Added subscriber: @jacknimble

#61580 was marked as duplicate of this issue

#61580 was marked as duplicate of this issue

Added subscriber: @mont29

Added subscriber: @mont29
Gaia Clary was assigned by Bastien Montagne 2017-03-03 09:23:13 +01:00

Thanks for the detailed report. :)

Not sure this is a bug or TODO or something else, though, will let @gaia decide here.

Thanks for the detailed report. :) Not sure this is a bug or TODO or something else, though, will let @gaia decide here.
Member

When you say:

"...Collada would like us to chain them. Blender doesn't support this, so we don't have a good way to express this situation in Collada format...."

Then i suspect that you actually mean that the Collada exporter does not support this, correct?
If that is so, then we should be able to solve this also when armatures and shape keys both are present...

When you say: *"...Collada would like us to chain them. Blender doesn't support this, so we don't have a good way to express this situation in Collada format...."* Then i suspect that you actually mean that the Collada exporter does not support this, correct? If that is so, then we should be able to solve this also when armatures and shape keys both are present...
Author

Yes. We should be able to solve both. It's quite possible to remove the "on nodes without armature" from the title and intent of the bug.

Perhaps I was trying to triage bugs for you. I apologize.

Thanks for reading.

Yes. We should be able to solve both. It's quite possible to remove the "on nodes without armature" from the title and intent of the bug. Perhaps I was trying to triage bugs for you. I apologize. Thanks for reading.
Member

No reason for apologize!!! Its the opposite:

I am so glad that i get such analyses like yours because i often do not know what is right and what is wrong and what is important and what not. So getting such hints is an invaluable information for me. Please continue with that if you like! I would become more efficient and more happy :)

No reason for apologize!!! Its the opposite: I am so glad that i get such analyses like yours because i often do not know what is right and what is wrong and what is important and what not. So getting such hints is an invaluable information for me. Please continue with that if you like! I would become more efficient and more happy :)

Added subscriber: @superpingu

Added subscriber: @superpingu

Hi,
I spent two hours to find out that this was my problem when importing blendshapes in Unity. I'm glad to see somebody already tracked out the problem and made a complete explanation of the problem :)

Hi, I spent two hours to find out that this was my problem when importing blendshapes in Unity. I'm glad to see somebody already tracked out the problem and made a complete explanation of the problem :)
Member

i must apologize for being so slow. I have fallen ill but i will resume as soon as i can.

i must apologize for being so slow. I have fallen ill but i will resume as soon as i can.

In #50807#440574, @GaiaClary wrote:
i must apologize for being so slow. I have fallen ill but i will resume as soon as i can.

You don't need to apologize. Take all the time you need to get better ;)

> In #50807#440574, @GaiaClary wrote: > i must apologize for being so slow. I have fallen ill but i will resume as soon as i can. You don't need to apologize. Take all the time you need to get better ;)

Added subscriber: @jtressle

Added subscriber: @jtressle

Added subscribers: @Choliy, @GaiaClary, @ColeReed, @ihoran777

Added subscribers: @Choliy, @GaiaClary, @ColeReed, @ihoran777
Gaia Clary was unassigned by Dalai Felinto 2019-12-23 16:36:48 +01:00
Philipp Oeser removed the
Interest
Pipeline, Assets & IO
label 2023-02-10 08:54:25 +01:00

Hi,
Is there any way to export Collada file which includes both armature and shape keys in a model? As the shape keys of my model can already be seen in Xcode after using ColladaMorphAdjuster, I realised that if I set parent from my model to the armature with automatic weights, there will be no shape keys appeared in Xcode and the "Nodes to modify" from ColladaMorphAdjuster will be count as zero. However, when I clear the parent between the object mesh and the armature, I can successfully export a dae.file with both armature and shape keys. But that's not what i expect because the joints are not connected to my model. Does anyone know what the problem is?

Hi, Is there any way to export Collada file which includes both armature and shape keys in a model? As the shape keys of my model can already be seen in Xcode after using ColladaMorphAdjuster, I realised that if I set parent from my model to the armature with automatic weights, there will be no shape keys appeared in Xcode and the "Nodes to modify" from ColladaMorphAdjuster will be count as zero. However, when I clear the parent between the object mesh and the armature, I can successfully export a dae.file with both armature and shape keys. But that's not what i expect because the joints are not connected to my model. Does anyone know what the problem is?
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
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#50807
No description provided.