filament: Shadows not displaying for certain GLTF models

Describe the bug When rendering a model (in tandem with AR core for surface detection and positioning), certain GLTF models (loaded with the AssetLoader class from gltfio) doesn’t cast a shadow on the planes that are rendered. Here are the different models used:

  1. Non-shadow casting model: trex.zip

  2. Shadow casting model: scooter.zip

To Reproduce Steps to reproduce the behavior:

  1. Load the gltf asset using AssetLoader.
  2. Render a flat plane below the asset that will be loaded (set receive shadows to true)
  3. Set directional lighting and cast shadows to true.
  4. Place the gltf model on top of the plane
  5. Assert that the scooter model renders a shadow but the trex model doesnt.

Expected behavior Both models should be rendering shadows

Screenshots 17e8de6a482 jpeg 17e8de6ff9a jpeg

Smartphone (please complete the following information):

  • Device: Pixel 4XL
  • OS: Android 12

Additional context

  • The t-rex model itself is receiving shadows from the direct lighting, it just doesn’t seem to want to cast shadows.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22 (5 by maintainers)

Most upvoted comments

I figured out the lighting problem, it was indeed an existing bug in OpenGLProgram, I’ll fix it tomorrow. The bug would happen when a SamplerInterfaceBlock was defined on a program but not used/set.

Thank you all for all the help!

@daemyung Is it possible to post this scaled down model?

No problem. Test scaled.glb.zip.

@pixelflinger Do you have some tips to render bawanglong well? It is too big.

Yes, use the -s option, it makes things better: e.g.: gltf_viewer -s -a opengl bawanglong.glb