c++blenderopenscenegraph

osgexport for Blender: Imported meshes impact scene ( possibly the lighting? )


Blender Version 2.79

OSG Version: 3.4.0-9

Operating System: Fedora

I have been using Blender's export utility to export obj files and then using osgconv to convert them to osg files. The files are then imported and rendered into a scene that looks like: Image of the working scene before using the export tool

Today I installed osgexport by Cedric Pinson ( Github page: https://github.com/cedricpinson/osgexport ) to directly export from Blender to osgt files. I get the following results when I import those files and render them. Image of the scene where everything goes dark and the lighting is wierd

Additional Details:

Any ideas? I saw the effect and I don't really even know where to start. The only difference is the outputted file from the converter. Everything else is the same. Also, if there is a newer/better way to export blender files into files that OSG can read, then I'm open to any and all suggestions.

Thank you in advance,


Solution

  • For what it's worth, the OSG forum/mailing list is usually pretty good about answering questions, and I believe I've seen Cedric's name there regularly, along with all the main contributors: http://forum.openscenegraph.org/

    New users usually have to have their questions go through moderation, to cut down on spam, so just have some patience.

    On this specific question, I have 3 suggestions:

    1. Convert both files to osgt and run a diff. Ignore any numerical differences, look for things like node arrangement, material types, etc.

    2. Try opening your exported model in osgviewer, just to see how the default settings display it. You can also easily play with things like backfaces, lighting settings, clipping planes, before dropping it into your application - press h to see all the run-time options.

    3. Instantiate your light with all 3 types of lighting enabled. Particularly, I have found some models depend heavily on specular lighting, but some of the examples don't turn it on. Of course, if you use the full-white values shown here, you may oversaturate, but this is for an example:

      osg::Light *light = new osg::Light;
      light->setAmbient(osg::Vec4(1.0,1.0,1.0,1.0));
      light->setDiffuse(osg::Vec4(1.0,1.0,1.0,1.0));
      light->setSpecular(osg::Vec4(1.0,1.0,1.0,1.0));  // some examples don't have this one