Problem of vsgimgui of vsgExamples load models

29 views
Skip to first unread message

徐林

unread,
Sep 17, 2022, 4:39:40 AM9/17/22
to 'DC' via vsg-users : VulkanSceneGraph Developer Discussion Group

 

 

Hi, Robert Osfield:

 

I am an OSG programming enthusiast from China and have been following VSG for a long time. Recently I tried to port an OSG-based application to VSG, but I encountered some problems as follows:

Using vsgimgui in vsgExamples loaded some obj, Blender, glb (converted with vsgconv) format model, the result appears no light, no map phenomenon, but using vsgViewer open model can be displayed normally. Another phenomenon is that vsgimgui will display correctly when loading models you provided in vsgExamples such as lz.vsgt and teapor.vsgt. Is this a model problem or a vsgimgui problem? How do I handle this?

 

cmd: vsgimgui uvTest.vsgt

cmd: vsgviewer uvTest.vsgt

 

For my best wishes.

XuLin

 

Models.7z
vsgimgui_uvTest.png
vsgviewer_uvTest.png

徐林

unread,
Sep 17, 2022, 4:45:16 AM9/17/22
to 'DC' via vsg-users : VulkanSceneGraph Developer Discussion Group
Models.zip
vsgimgui_uvTest.png
vsgviewer_uvTest.png

Robert Osfield

unread,
Sep 17, 2022, 5:55:03 AM9/17/22
to vsg-users : VulkanSceneGraph Developer Discussion Group
Hi XuLin,

I haven't had a chance to test your model with vsgimgui yet, so can't so definately what the issue is. However, if the rendering of a model that has shaders that do lighting like to one that vsgXchange::Assimp loader provides they require light sources in the View or Scene to illuminate the scene, if the set up in vsgimgui doesn't add one then the scene will be black.

The viewer setup convenience functions can add a default head light for you, and vsgviewer is uses this, perhaps vsgimgui isn't using the same functions.

I can check this when I get back to my desktop system.

Cheers,
Robert.

Robert Osfield

unread,
Sep 17, 2022, 7:37:00 AM9/17/22
to vsg-...@googlegroups.com
My suspicion was right - it was simply that the vsgimgui example wasn't adding a headlight to the 3d view so the 3d scene wasn't illuminated.  I've checked in the following addition to the vsgimgui example:

$ git diff
diff --git a/examples/ui/vsgimgui/vsgimgui.cpp b/examples/ui/vsgimgui/vsgimgui.cpp
index 183c1c7..db9474f 100644
--- a/examples/ui/vsgimgui/vsgimgui.cpp
+++ b/examples/ui/vsgimgui/vsgimgui.cpp
@@ -172,7 +172,11 @@ int main(int argc, char** argv)
        commandGraph->addChild(renderGraph);
 
        // create the normal 3D view of the scene
-        renderGraph->addChild(vsg::View::create(camera, vsg_scene));
+        auto view = vsg::View::create(camera);
+        view->addChild(vsg::createHeadlight());
+        view->addChild(vsg_scene);
+
+        renderGraph->addChild(view);
 
        if (fontFile)
        {

This is checked in vsgExamples master.
Reply all
Reply to author
Forward
0 new messages