rdeioris / glTFRuntime-docs

Official Documentation for the glTFRuntime Unreal Engine Plugin
MIT License
97 stars 16 forks source link

Khronos glTF-Sample-Models BrainStem renders improperly #13

Closed jacky-young closed 4 months ago

jacky-young commented 4 months ago

Hi, I just a new beginner on your glTFRuntime plugin(a great project for me at least). I tried a lot of models with it, then I found this one 'BrainStem' its materials can't be rendered properly and I can't find why. Could you help to look at it?

image

BrainStem model url: https://github.com/KhronosGroup/glTF-Sample-Models/raw/main/2.0/BrainStem/glTF-Binary/BrainStem.glb

BTW, Can you consider to add some smoke tests or sanity tests at least covering all these Khronos sample models?

Thanks.

jacky-young commented 4 months ago

p.s. I have added the glTFRuntime Content directory to 'Additional Asset Directories to Cook' but still not fixing. My engine version is 5.3.2.

rdeioris commented 4 months ago

How you are loading the model? can you paste the blueprint nodes you are using? which platform?

jacky-young commented 4 months ago

JUST in PIE on Windows. I tried Actor menu -> Load GLTF Asset from File and following your guide very simple blueprint just the standard glTF Load Asset from Url or Filename. No fancy stuff.

jacky-young commented 4 months ago

image

rdeioris commented 4 months ago

Check the logs, and paste the material objects assigned to the model (you can get it just by double clicking on it). This model is one of the most tested ones (and one of the simpler around) so it is definitely some setup problem.

jacky-young commented 4 months ago

yeah. it's weird. I also tried model CesiumMan.glb and it works well. From logs I can't find any suspicious. All these materials and skeletal Mesh are generated automatically when I import. Any other settings or stpes I need to notice. image

rdeioris commented 4 months ago

The only thing i can think of is some light issue. Try setting the SkeletalmeshConfig to force normals and tangents regeneration and check if the normals are correctly oriented in the skeletal mesh editor.

Thys setting the light mode to unlit in the viewport to see if the colors are honoured.

jacky-young commented 4 months ago

Turn off light do help to show the model. 'setting the SkeletalmeshConfig to force normals and tangents regeneration' can't. Why this happened? I have same model in Content which is imported by the UE engine glTFImporter. After importing all those meterials are generated in folder. What's the difference between UE's and those based on glTFRuntimeBase? Do you have any idea to fix?

you mean setting these two config, correct? image

jacky-young commented 4 months ago

image

After turning off light the model looks.

rdeioris commented 4 months ago

@jacky-young the only way i was able to reproduce the problem was by disabling any form of global illumination and reflection. If it is your case, try pulling from master i have added a special logic for it.

jacky-young commented 4 months ago

image

hi @rdeioris get to know why. As I am developing on target of Meta Quest device, so Meta XR plugins are enabled, its XR Performance Window has some settings/fixes which I have applyed. Above is what it has on Renderring.

jacky-young commented 4 months ago

But with your master patch, still it doesn't work. Any better idea to make it workable?

jacky-young commented 4 months ago

I still have a little confused. Below is what I get from UE inside glTFImporter which renders normally(Meta XR plugin is enabled). I suppose glTFRuntime uses similar component to render the mesh texture. So what's the difference and why glTFRuntime gets such effect(I mean UE also has global illumination and reflection disabled)? image

Also I have built an APK deployed in Quest3 which just shows three BrainStem models animating in scene. It works fine(even the light reflection do has some problem). Still want to know the gap.

rdeioris commented 4 months ago

There is no correlation between the editor importers and the runtime one. They are two completely different beasts (with glTFRuntime supporting way more features than the epic one and having way more constraints, especially from the performance point of view). I have made a test with the MetaXR plugin and with the latest patch it works reliably. Can you double check you applied this one ? https://github.com/rdeioris/glTFRuntime/commit/6f6339e0372b7f32a166287d329af45c8a802de4

image

Check if you are not using the marketplace version (it is pretty common to have it winning over the project plugins directory)

jacky-young commented 4 months ago

@rdeioris thanks a lot for helping debug. Finally I found out it's caused by this Rendering Settings 'Forward Shading'. It should be enabled after you apply the Meta XR Performance Settings on its window(same from Meta's Unreal demo). It should be for optimizing the oculus performance. Can you have a look at it?

rdeioris commented 4 months ago

@jacky-young just retried with forward shading: same result with the commit i linked (can you please check you applied it ?). You should notice in the screenshot the highlighted speculars that are forward rendering only

image

jacky-young commented 4 months ago

Some settings may be still mismatched. Could you paste your full Rendering Setting picture? And applying the commit I just copy the latest master file glTFRuntimeParserSkeletalMeshes.cpp into the Plugins/glTFRuntime\Source\glTFRuntime\Private folder. Do I need to re-package to generate?

jacky-young commented 4 months ago

@rdeioris sorry, my bad. Just beginning the UE developing for few days. The patch works well. Thanks again. 👍