gazebosim / gz-common

An audio-visual library supports processing audio and video files, a graphics library can load a variety 3D mesh file formats into a generic in-memory representation, and the core library of Gazebo Common contains functionality that spans Base64 encoding/decoding to thread pools.
https://gazebosim.org
Apache License 2.0
16 stars 40 forks source link

Potential bug in Collada importer #245

Open caguero opened 3 years ago

caguero commented 3 years ago

Environment

Description

I have two almost exact .dae meshes. One of them loads and the other doesn't with the following error message:

[GUI] [Err] [Ogre2MeshFactory.cc:559] Cannot load mesh with zero sub-meshes
[GUI] [Err] [Ogre2MeshFactory.cc:125] Failed to get Ogre item for [file:///home/caguero/vrx2022_ws/src/vrx/vrx_gazebo/models/placard_2022/meshes/Placard.dae]
[GUI] [Err] [SceneManager.cc:382] Failed to load geometry for visual: visual

placard.zip

See the attached .zip containing two meshes. placard_2022.dae loads but Placard.dae doesn't load. I recommend to run meld to see the differences. The diff shows just a difference in scene id name and <instance_visual_scene url=.

Steps to reproduce

  1. Drag and drop placard_2022.dae into the scene. The mesh should load.
  2. Drag and drop Placard.dae into the scene. The mesh doesn't load.
mjcarroll commented 3 years ago

Source or binary build? Source, compiled from main (f48085bc5d72b312f4ed0d1721a13565d4f13eb7)

Are you compiling from main or ign-common4? I'm having trouble locating this specific commit on either branch:

git show f48085bc --stat
fatal: ambiguous argument 'f48085bc': unknown revision or path not in the working tree.
mjcarroll commented 3 years ago

I just did a quick test with the ColladaLoader class and the difference seems to be:

 RUN      ] ColladaLoader.LoadPlacard
[       OK ] ColladaLoader.LoadPlacard (0 ms)
[ RUN      ] ColladaLoader.LoadPlacard_2022
[Err] [SystemPaths.cc:467] Could not resolve file [Placard.png]
[Err] [Material.cc:164] Unable to find texture [Placard.png] as a locally cached texture or in path [/home/mjcarroll/workspaces/ign_fortress/src/ign-common/test/data]
[       OK ] ColladaLoader.LoadPlacard_2022 (1 ms)

Is there an image that is missing here?

caguero commented 3 years ago

Source or binary build? Source, compiled from main (f48085bc5d72b312f4ed0d1721a13565d4f13eb7)

Are you compiling from main or ign-common4? I'm having trouble locating this specific commit on either branch:

git show f48085bc --stat
fatal: ambiguous argument 'f48085bc': unknown revision or path not in the working tree.

Sorry, wrong commit. The good one is e70a75d107ba86bb3d1a68690e1d33bfaa4cbb29 . I'm using ign-common4.

caguero commented 3 years ago

I just did a quick test with the ColladaLoader class and the difference seems to be:

 RUN      ] ColladaLoader.LoadPlacard
[       OK ] ColladaLoader.LoadPlacard (0 ms)
[ RUN      ] ColladaLoader.LoadPlacard_2022
[Err] [SystemPaths.cc:467] Could not resolve file [Placard.png]
[Err] [Material.cc:164] Unable to find texture [Placard.png] as a locally cached texture or in path [/home/mjcarroll/workspaces/ign_fortress/src/ign-common/test/data]
[       OK ] ColladaLoader.LoadPlacard_2022 (1 ms)

Is there an image that is missing here?

Not sure if it's related because one of the meshes loads but just in case I have included the texture in the zip file.

mjcarroll commented 3 years ago

Added these models as a test here: https://github.com/ignitionrobotics/ign-common/tree/placard_test

Can confirm that it fails:

[ RUN      ] ColladaLoader.LoadPlacard
/home/mjcarroll/workspaces/ign_fortress/src/ign-common/graphics/src/ColladaLoader_TEST.cc:499: Failure
Expected equality of these values:
  6u
    Which is: 6
  mesh->VertexCount()
    Which is: 0
/home/mjcarroll/workspaces/ign_fortress/src/ign-common/graphics/src/ColladaLoader_TEST.cc:500: Failure
Expected equality of these values:
  6u
    Which is: 6
  mesh->NormalCount()
    Which is: 0
/home/mjcarroll/workspaces/ign_fortress/src/ign-common/graphics/src/ColladaLoader_TEST.cc:501: Failure
Expected equality of these values:
  6u
    Which is: 6
  mesh->IndexCount()
    Which is: 0
/home/mjcarroll/workspaces/ign_fortress/src/ign-common/graphics/src/ColladaLoader_TEST.cc:502: Failure
Expected equality of these values:
  6u
    Which is: 6
  mesh->TexCoordCount()
    Which is: 0
/home/mjcarroll/workspaces/ign_fortress/src/ign-common/graphics/src/ColladaLoader_TEST.cc:503: Failure
Expected equality of these values:
  2u
    Which is: 2
  mesh->SubMeshCount()
    Which is: 0
[  FAILED  ] ColladaLoader.LoadPlacard (0 ms)
[ RUN      ] ColladaLoader.LoadPlacard_2022
[       OK ] ColladaLoader.LoadPlacard_2022 (1 ms)

And the diff is as you say:

9c9
<     <created>2021-08-31T22:23:17Z</created>
---
>     <created>2021-08-31T21:25:29Z</created>
11c11
<     <modified>2021-08-31T22:23:17Z</modified>
---
>     <modified>2021-08-31T21:25:29Z</modified>
577c577
<     <visual_scene id="placard_2022" name="placard_2022">
---
>     <visual_scene id="Placard" name="Placard">
605c605
<     <instance_visual_scene url="#placard_2022"/>
---
>     <instance_visual_scene url="#Placard"/>
fmrico commented 1 month ago

Hi,

I can confirm the problem persists in Gazebo Sim, version 8.6.0 (binary package for Jazzy)