Open Darkproduct opened 3 years ago
@Darkproduct you might find some clues if you compare the original to the meshlab-scaled .OBJ mesh in a text editor.
meshlab could be introducing an encoding change to the obj file, or is handling the SCALE argument infitesimaly. does meshlab use Meters (gazebo unit) or centimeters?
I've debugged this and found a solution. You have to edit your .mtl file.
The Blender-generated file (working in Gazebo) has this line:
d 1.0
The Meshlab-generated file (broken in Gazebo) has this line:
Tr 1.000000
This defines transparency, see Wikipedia:
Materials can be transparent. This is referred to as being dissolved. Unlike real transparency, the result does not depend upon the thickness of the object. A value of 1.0 for "d" is the default and means fully opaque, as does a value of 0.0 for "Tr". Dissolve works on all illumination models.
# some implementations use 'd'
d 0.9
# others use 'Tr' (inverted: Tr = 1 - d)
Tr 0.1
In other words, the Meshlab export specifies full transparency, which Gazebo correctly renders as "invisible".
Solution: Remove the "Tr 1.000000" line (or better yet, copy the complete lines from the original Blender file) and the error is fixed.
TLDR:
Scaling any
.obj
mesh with meshlab will make it not visible without any error output even with--verbose
.Steps to reproduce:
Creating the model
I`m using this simple stone model: https://sketchfab.com/3d-models/rock-stone-02-0455747c7ac848269830ed0dca33726c
After downloading, extracting and some renaming my folder structure looks like this:
model.sdf
:Loading the original model
The stone will be loadable with its texture, but I'm not sure if the ambient_occlusion_map and the normal_map is working properly. But still. There is a model with texture. Output from starting with
rosrun gazebo_ros gazebo --verbose
and adding the model from theinsert
tab.Scaling the model
Scaling with meshlab. Load the
.obj
file into meshlab. UseFilters ⇒ Normals, Curvatures and Orientation ⇒ Transform: Scale, Normalize
. Change the values for each axis (I used 0.5 on each) and click apply. Now go toFile ⇒ Export Mesh…
and hit ok.Loading the scaled model
Trying to load the
.obj
file now will result in nothing, but you'll be able to select it which shows an empty bounding box: Output from starting withrosrun gazebo_ros gazebo --verbose
and adding the model from theinsert
tab.The new mesh will still be loadable by meshlab and other 3D applications.
What I tried:
.stl
or.dae
will load in gazeboI'm using Ubuntu 20.04 LTS with ROS Noetic, Gazebo 11.4.0, MeshLab_64bit_fp v2020.03+dfsg1.