microsoft / microsoft/DirectX-Graphics-Samples
Strange culling behaviour when loading a custom glTF
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 6.8k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
I am trying to render the Amazon Lumberyard Bistro scene that you can find on NVIDIA's ORCA site. The model comes with .FBX files and .DDS textures, I have managed to successfully convert the .fbx to a glTF and got it loading in the engine! The problem is that there seems to be inconsistent culling behaviour, perhaps relating to the mesh sorter, that I can't seem to pinpoint. I have attached some video examples that I think best demonstrate the effect but I will also embed some images here.
This is the view of the "back" half of the scene:
Note how the camera is tilted pretty far downward, this is because if you tilt any more upwards, you begin to get this effect:
I seem to have isolated it largely to moving the camera UP, however in certain parts of the scene, for example nearer to the center, the behaviour seems become more unpredictable, now clipping as you move the camera down aswell as left and right:
Interestingly, when switching to the OrbitalCamera, the clipping is significantly reduced, though still noticeable if you look for it. Here is an aerial view:
Please find video examples at the following links:
https://drive.google.com/file/d/1_8xUij-sasc6UGt2FIaO7md9AIWa-AjJ/view?usp=drive_link
https://drive.google.com/file/d/1rTDHt__CBC0KUoR2aTxRIe1bEmOqYFjx/view?usp=drive_link
I have tried messing around with different scales by resizing the model, as well as editing the near and far planes on the camera, but no luck so far. Any guidance here would be greatly appreciated
Related, I considered instead using the legacy renderer and loading the glTF instead of a .h3d there. I gave it an attempt, however certain textures don't apply correctly (I've narrowed atleast one issue down to not rendering cutout and transparency properly, such as for foliage and glass, but I'm unsure how to separate these using the ModelInstance class that glTFs get loaded as. Any advice here would also be appreciated!) and the model is rotated incorrectly. However, there is no clipping there! I wonder if that is a clue as to what is going on in the regular glTF renderer too!
One last helpful bit of info is that initially the scene loaded in with really busted glossiness values. It would appear pure chrome metallic unless the glossiness reduction value was set to 7 or higher, but this would result in the skybox turning black. I've since resolved that issue by removing the IBL bias from the globals struct when RenderMeshes is called, aswell as implementing the shadow map and frustum fix identified in this PR.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the Amazon Lumberyard Bistro glTF scene and inspect the glTF renderer's mesh sorter and camera culling paths mentioned in the report. Compare the regular renderer with OrbitalCamera and the legacy renderer; done means identifying and correcting the inconsistent clipping without relying on camera scale or near/far-plane adjustments.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100