vsg-dev / VulkanSceneGraph

Vulkan & C++17 based Scene Graph Project
http://www.vulkanscenegraph.org
MIT License
1.32k stars 212 forks source link

Cannot load with vsgviewer a gltf 2.0 model #434

Closed dsantxez closed 2 years ago

dsantxez commented 2 years ago

Describe the bug I am trying to load a gltf 2.0 model with the vsgviewer and it seems to failed with the following error:

[Exception] - Error: vsg::Pipeline::createGraphics(...) failed to create VkPipeline. result = -13

I have tried with different model from the glTF-Sample-Models from the khronos-group github repo (https://github.com/KhronosGroup/glTF-Sample-Models).

The tested files have been Avocado, FlightHelmet in binary format (.glb) or non binary format (.gltf)

Expected behavior Openning the model in a window

Hardware

Desktop:

I'm an old user of Openscenegraph and thank you for your effort in this new project.

robertosfield commented 2 years ago

I have just tried:

vsgviewer glTF-Sample-Models/2.0/FlightHelmet/glTF/FlightHelmet.gltf

Using VSG, vsgXchange and vsgExamples master, on Kubuntu 21.10 on my AMD 5700G system. It works fine. Running with -d command line option doesn't result in any Vulkan debug layer errors being reported. While it doesn't rule out an error on the VSG/Assimp(5.1.2) loader side it makes it less likely, so a driver issue would likely be something to look at.

I have a laptop with Ubuntu 21.10 Intel i7 with Xe graphics which isn't updated to the latest yet so I'll rebuild and test there to see if it works fine - previous tests it has worked fine so I'm not expecting problems.

dsantxez commented 2 years ago

MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0

VUID_Undefined(ERROR / SPEC): msgNum: 2044605652 - Validation Error: [ VUID_Undefined ] Object 0: handle = 0x2550970, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x79de34d4 | vkCreateShaderModule: parameter pCreateInfo->codeSize / 4 must be greater than 0. Objects: 1 [0] 0x2550970, type: 3, name: NULL UNASSIGNED-CoreValidation-Shader-InconsistentSpirv(ERROR / SPEC): msgNum: 7060244 - Validation Error: [ UNASSIGNED-CoreValidation-Shader-InconsistentSpirv ] Object 0: handle = 0x2550970, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6bbb14 | SPIR-V module not valid: Invalid SPIR-V magic number. Objects: 1 [0] 0x2550970, type: 3, name: NULL Violación de segmento (`core' generado)

I have launched with the -d option and that's what I get. I have build vsgXchange with Assimp version 5.0.1 if it gives you more info. I have tried in windows in the same laptop and it crashes as well, so it may be an issue regarding the graphic chip itself with Vulkan maybe.

I have installed spir-v tools, glslc, and libshaderc-dev just in case, but the same crash appears

robertosfield commented 2 years ago

I just built VSG, vsgXchange and vsgExamples on my Intel laptop with Xe graphics and it works fine, just like on my AMD system,

I get the same "MESA INTEL: warning: Performance support disabled...." but no issues. Running with -d doesn't reveal any problems, The Assimp version on my laptop is 5.1.4. It may be worth looking at your Assimp version.

Is your VSG built against glsLang? VulkanSDK comes with glsLang and the VSG uses this to compile GLSL shaders that the Assimp uses to SPIR-V/

dsantxez commented 2 years ago

I have checked the Vulkanscenegraph cmake config result in the GUI and I have found that SPIR-V tools is found but not the SPIR-V library or the include. I will download the Tar.gz file from lunarG of Vulkan and compile it against it and see if that fixes the problem.

Thank you for your time

robertosfield commented 2 years ago

On Sat, 23 Apr 2022 at 11:55, dsantxez @.***> wrote:

I have checked the Vulkanscenegraph cmake config result in the GUI and I have found that SPIR-V tools is found but not the SPIR-V library or the include. I will download the Tar.gz file from lunarG of Vulkan and compile it against it and see if that fixes the problem.Message ID: @.***>

It's glsLang rather that SPIR-V tools that the VSG uses to compile GLSL to SPIR-V. Modern versions of VulkanSDK should have gslLang libs and headers.

dsantxez commented 2 years ago

After compiling Vulkan from scratch and recompiling Vulkanscenegraph and vulkanXchange and so forth, now I'm able to load gltf model with vsgviewer. Thank you for your time and support.

The only issue now is that I don't see proper PBR rendering, the boombox does not show light in the display and the helmet looks plain, no PBR shaders working.

I will download the latest Assimp library compile it from scratch as see if that fixes it.

Once again, thank you for time and will be using vulkanscenegraph for many projects to come.

EDIT: No luck, will look further to see what it may be:

vsgViewer output

robertosfield commented 2 years ago

On Sun, 24 Apr 2022 at 12:15, dsantxez @.***> wrote:

After compiling Vulkan from scratch and recompiling Vulkanscenegraph and vulkanXchange and so forth, now I'm able to load gltf model with vsgviewer. Thank you for your time and support.

Good to hear it's functioning better, but best guess is that the new build has picked up on glsLang correctly this time. What VulkanSDK version did you start with? When you say you compiled Vulkan from scratch could you explain what parts you compiled?

The only issue now is that I don't see proper PBR rendering, the boombox does not show light in the display and the helmet looks plain, no PBR shaders working.

The PBR shaders may be working, just not with settings you were expecting. What are using a reference for what yo9u think is correct rendering of these models?

FYI, in the StateComposer branch of the VSG, vsgXchange and vsgExamples there is a new scheme for managing shaders when building new scene graphs, the vsgXchange::Assimp leverages that are adds support for recently add vsg::Light support. There is a thread on vsg-users googlegroup about this work.

If there are improvements that need to be made to vsgXchange::Assimp then the StateComposer branch will be the best place to start with.

I will download the latest Assimp library compile it from scratch as see if that fixes it.

There are various fixes to Assimp so updating it is worthwhile.

Once again, thank you for time and will be using vulkanscenegraph for many projects to come.

Thanks, best of luck with your projects.

Message ID: @.***>

dsantxez commented 2 years ago

You are right that it may be a settings thing. The flightHelmet model, in my case seems a bit plain and that's why I used the BoomBox model.

The way I see it, is the image linked in my previous post, and it should be seen as this according to screenshot example in the github project: boombox I understand that some effect will not be visible, but I expected to see the display of the boombox ON, let's say.

I have tried changing to StateComposer branch but I get the same result. I have read in a google group thread how vsgviewer should render pbr "enabled" models properly just using vsgviewer. (I can't find the thread in which you load all model into vsgviewer, but I have found this thread Water bottle but in my case the result is this one: Water Bootle

I will check if it's a light issue and not enabling something

VulkanSDK: Latest from LunarG The rest the head in each branch (Master and StateComposer)

robertosfield commented 2 years ago

On Sun, 24 Apr 2022 at 19:58, dsantxez @.***> wrote:

You are right that it may be a settings thing. The flightHelmet model, in my case seems a bit plain and that's why I used the BoomBox model.

The way I see it, is the image linked in my previous post, and it should be seen as this according to screenshot example in the github project: boombox https://github.com/KhronosGroup/glTF-Sample-Models/blob/master/2.0/BoomBox/screenshot/screenshot.jpg

I have tried changing to StateComposer branch but I get the same result. I have read in a google group thread how vsgviewer should render pbr "enabled" models properly just using vsgviewer. (I can't find the thread in which you load all model into vsgviewer, but I have found this thread Water bottle https://groups.google.com/g/vsg-users/c/VGtRO1H59tQ/m/ES_MSLtLEQAJ but in my case the result is this one: Water Bootle https://drive.google.com/file/d/1pSgsHk8Q3KOyjRB6Fd1RJrQ0fkldIl6o/view?usp=sharing

I will check if it's a light issue and not enabling something

The PBR shader is used for all the models that I've tried to use via the vsgXchange::Assimp loader, even before the StateComposer changes. There isn't a case of enabling PBR, it will already be used, it's just not creating the effect you are expecting.

Different models have different settings built into them so some will appear matt, others shiny, this is perfectly normal and exactly what should be expected with using PBR.

THere is a possibility that the vsgXchange:::Assimp loader isn't correctly setting up the materials and textures, the best way to establish this would be to find a 3rd party reference viewer and compare side by side to see if there are visual differences. One would need to make sure that on the VSG side the same lighting is used as the 3rd party viewer.

Message ID: @.***>