ros-visualization / rviz

ROS 3D Robot Visualizer
BSD 3-Clause "New" or "Revised" License
822 stars 462 forks source link

Inverted normals after blender mirror tool #669

Open hydrophis-spiralis opened 11 years ago

hydrophis-spiralis commented 11 years ago

After blender mirror tool models, exported in collada, are being displayed with normals directed inside. I stuck into it while modelling palm part of robotic hand. What i did:

  1. Built model for right palm in blender 2.63.
  2. Than made a duplicate of palm and mirrored. I mean i used object mirroring, not mirroring in edit mode.
  3. Exported models into individual collada files.
  4. Attached models to urdf file with tag.

Right palm appeared as desired, but mirrored one appeared with wrong directed normals. Switching normals or normal recalculation in blender didnt work. p.s. not sure if it is rviz bug or blender.

hershwg commented 11 years ago

Can you give a link to a collada file that demonstrates this bug? I would like to fix it but my blender skills are almost non-existent.

hydrophis-spiralis commented 11 years ago

Yes, here it is: http://ge.tt/6Atgb0p/v/0?c

hershwg commented 11 years ago

Great, thanks for the file.

I think I may see the problem. I believe this line in the .dae file is ignored:

      <extra><technique profile="MAYA"><double_sided>1</double_sided></technique></extra>

mesh_loader.cpp does a bunch of checking of amat->Get(AI_MATKEY_<stuff>, ...), but it does not check AI_MATKEY_TWOSIDED which is mentioned on the assimp materials page: http://assimp.sourceforge.net/lib_html/materials.html .

So I think rviz needs to look for AI_MATKEY_TWOSIDED in mesh_loader.cpp and needs to call pass->setCullingMode(Ogre::CULL_NONE) if it is there.

I don't have time to work on this just now, so I'm just recording this guess for now.