Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3d scene show lighting differences compared with osg #60

Open
rhabacker opened this issue Dec 23, 2021 · 2 comments
Open

3d scene show lighting differences compared with osg #60

rhabacker opened this issue Dec 23, 2021 · 2 comments

Comments

@rhabacker
Copy link
Contributor

rhabacker commented Dec 23, 2021

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:

  1. checkout git repo from vsg-dev/vsgFramework unter ~/src
  2. run
cmake -B ~/src/vsgFramework-build -S ~/src/vsgFramework -DBUILD_OpenSceneGraph=1 -DBUILD_assimp=0 -DBUILD_SHARED_LIBS=1
cmake --build ~/src/vsgFramework-build
  1. unpack the zip file attached to 3d scene shows drawing differences compared with osg VulkanSceneGraph#308 in ~/src
  2. run LD_LIBRARY_PATH=~/src/vsgFramework-build/lib64 VSG_FILE_PATH=~/src/vsgFramework-build/src/vsgExamples/data ~/src/vsgFramework-build/bin/vsgviewer ~/src/demo.osgt.
  3. see error

Expected behavior
The viewer should display similar illuminations as the reference image created with osgviewer on the left.

Screenshots
grafik

Desktop (please fill in the following information):

  • Operating system: openSUSE Linux
  • version 15.2

Additional context
Vulkan 1.2.189 has been installed

@robertosfield robertosfield transferred this issue from vsg-dev/VulkanSceneGraph Dec 23, 2021
@robertosfield
Copy link
Collaborator

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.

@rhabacker
Copy link
Contributor Author

With this setting I get grafik

@vsg-dev vsg-dev transferred this issue from vsg-dev/vsgXchange Jul 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants