vsg-dev / osg2vsg

Adapter library for converting OpenSceneGraph Images and 3D models to VulkanSceneGraph
MIT License
43 stars 15 forks source link

vsg has a problem with the selection of LOD nodes #61

Open rhabacker opened 2 years ago

rhabacker commented 2 years ago

VulkanSceneGraph and/or vsgXchange have a problem displaying scenes containing LOD nodes.

Steps to reproduce the behavior:

  1. Build vsg, vsgXchange and vsgExamples with osg support
  2. start osgviewer with this 3d model
  3. start vsgviewer with this 3d model
  4. Compare the displayed 3d scene of the two applications

Screenshots osgviewer showing LOD Level 1 grafik

osgviewer showing LOD Level 2 grafik

vsgviewer showing LOD Level 1 Screenshot 2022-01-27 112540

vsgviewer showing LOD level 2 Screenshot 2022-01-27 111523

Expected behavior vsgviewer should not show the nodes belonging to LOD level 1 if the camera is in LOD level 2 distance.

robertosfield commented 2 years ago

Once I've wrapped up the Light work I'll be tackling state/shader side and should be able to address the line/point issues in the vsgXchange::OSG loader, and at this time can look deeper into the LOD issues you are seeing.

My suspicion is that this LOD level issue is probably an vsgXchage::OSG loader issue rather than something in the code VSG. Converting the OSG models to .vsgt using vsgconv would be worth doing, then have a look at the vsg::LOD node settings, if the settings look sensible then a core VSG bug is more likely, but if they don't look sensible then it's more like a vsgXchange::OSG issue.

robertosfield commented 2 years ago

Hi @rhabacker I've finally had a chance to look at this. I've download the demo.osgt model and while there are plenty of rendering issues with the osg2vsg converted model the LOD switches look relatively close.

A few months back I made a fix to the the LOD range computation to address issues when the modelview matrix contained scaling so there is a chance that this has help things work better.

Could you please test the model out with the latest VSG/osg2vsg and let me know if the issue still persists.

rhabacker commented 2 years ago

The problem still exists. LOD level changes are visible, but the blocks are visible in LOD level 2, which should not be. grafik BTW:I used the lightning setting mentioned at https://github.com/vsg-dev/osg2vsg/issues/60

robertosfield commented 2 years ago

Thanks for checking. From the description it sounds like an issue with osg2vsg mapping of osg::LOD nodes.

What is needed is a rewrite of osg2vsg to use vsg::ShaderSet, as part of that rewrite how to map OSG nodes etc. to VSG will need to be completely redone.