Open rhabacker opened 2 years ago
I've transferred this Issue to vsgXchange as it's an OSG->VSG converter issue.
The lack of lighting is down to the OSG scene graph not enabling lighting so the vsgXchange/OSG converter just honours that and creates shader that doesn't light the scene. If you enable lighting on an osg::StateSet decorating the scene it should light, albeit with a headlight.
You don't see this lack of lighting in the OSG as by default the global StateSet that the Viewer uses enables GL_LIGHTING by default. If you set the global StateSet to not enable GL_LIGHTING then you'd also see a flat shaded scene.
The vsgXchange/OSG ReaderWriter has support for setting the defaults that the OSG->VSG converter should use, and this provides a mechanism for forcing on lighting via a .vsgt asiii file hold the osg2vsg::BuildOptions structure. An example that defaults to lighting:
#vsga 0.2.0
Root id=1 osg2vsg::BuildOptions
{
insertCullGroups 1
insertCullNodes 1
useBindDescriptorSet 1
billboardTransform 0
geometryTarget 1
supportedGeometryAttributes 4095
supportedShaderModeMask 1023
overrideGeomAttributes 0
overrideShaderModeMask 1
useDepthSorted 1
mapRGBtoRGBAHint 1
copyNames 1
vertexShaderPath ""
fragmentShaderPath ""
extension "vsgb"
}
r
You can pass this file to the loader using:
vsgviewer myfile.osgb --read_build_options settings.vsgt
You can also write out the settings that is used by the loader via:
vsgviewer myfile.osgb --write_build_options settings.vsgt
You can list this options (you can also pass them in via vsg::Options) by running vsgconv --features, in the OSG section you'll see:
vsg::Options::Value type
------------------- ----
original_converter bool
read_build_options string
write_build_options string
Perhaps it might make sense to add a enable_lighting option to this list so you don't have to create and edit a BuildOptions .vsgt as above.
With this setting I get
Describe the error Loading the file attached to vsg-dev/VulkanSceneGraph#308 or the files robot.osg or spaceship.osgt with vsgviewer, you can see drawing problems on the right side in the attached screenshot. The illuminations looks different.
Reproduce Steps to reproduce the behavior:
LD_LIBRARY_PATH=~/src/vsgFramework-build/lib64 VSG_FILE_PATH=~/src/vsgFramework-build/src/vsgExamples/data ~/src/vsgFramework-build/bin/vsgviewer ~/src/demo.osgt
.Expected behavior The viewer should display similar illuminations as the reference image created with osgviewer on the left.
Screenshots
Desktop (please fill in the following information):
Additional context Vulkan 1.2.189 has been installed