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

Open
opened 6 years ago by jacknimble · 14 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)
Poster

Changed status to: 'Open'

Changed status to: 'Open'
Poster

Added subscriber: @jacknimble

Added subscriber: @jacknimble
Collaborator

#61580 was marked as duplicate of this issue

#61580 was marked as duplicate of this issue
mont29 commented 6 years ago
Owner

Added subscriber: @mont29

Added subscriber: @mont29
GaiaClary was assigned by mont29 6 years ago
mont29 commented 6 years ago
Owner

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.
Collaborator

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...
Poster

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.
Collaborator

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 :)
Collaborator

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
brecht commented 4 years ago
Owner

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

Added subscribers: @Choliy, @GaiaClary, @ColeReed, @ihoran777
GaiaClary was unassigned by dfelinto 3 years ago
lichtwerk removed the
legacy module/Pipeline, Assets & IO
label 6 hours ago
lichtwerk removed the
Interest/Pipeline, Assets & I/O
label 6 hours ago
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/Collada
Interest/Compositing
Interest/Core
Interest/Cycles
Interest/Dependency Graph
Interest/Development Management
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/Modeling
Interest/Modifiers
Interest/Motion Tracking
Interest/Nodes & Physics
Interest/Overrides
Interest/Performance
Interest/Performance
Interest/Physics
Interest/Pipeline, Assets & I/O
Interest/Platforms, Builds, Tests & Devices
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
legacy module/Animation & Rigging
legacy module/Core
legacy module/Development Management
legacy module/Eevee & Viewport
legacy module/Grease Pencil
legacy module/Modeling
legacy module/Nodes & Physics
legacy module/Pipeline, Assets & IO
legacy module/Platforms, Builds, Tests & Devices
legacy module/Python API
legacy module/Rendering & Cycles
legacy module/Sculpt, Paint & Texture
legacy module/Triaging
legacy module/User Interface
legacy module/VFX & Video
legacy project/1.0.0-beta.2
legacy project/Asset Browser (Archived)
legacy project/BF Blender: 2.8
legacy project/BF Blender: After Release
legacy project/BF Blender: Next
legacy project/BF Blender: Regressions
legacy project/BF Blender: Unconfirmed
legacy project/Blender 2.70
legacy project/Code Quest
legacy project/Datablocks and Libraries
legacy project/Eevee
legacy project/Game Animation
legacy project/Game Audio
legacy project/Game Data Conversion
legacy project/Game Engine
legacy project/Game Logic
legacy project/Game Physics
legacy project/Game Python
legacy project/Game Rendering
legacy project/Game UI
legacy project/GPU / Viewport
legacy project/GSoC
legacy project/Infrastructure: Websites
legacy project/LibOverrides - Usability and UX
legacy project/Milestone 1: Basic, Local Asset Browser
legacy project/Nodes
legacy project/OpenGL Error
legacy project/Papercut
legacy project/Pose Library Basics
legacy project/Retrospective
legacy project/Tracker Curfew
legacy project/Wintab High Frequency
Meta/Good First Issue
Meta/Papercut
migration/requires-manual-verification
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 & Devices
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 Information 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
7 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#50807
Loading…
There is no content yet.