Using a manually built model, the shadow is wrong
Describe the bug Using a manually built model, the shadow is wrong.
I constructed a ground bound {{-10, 0, -15}, {10, 0, 15}} and a wall bound {{-0.5, 0, -10}, {0.5, 10, 10}} And set the bounding boxes correctly, add a directional light of { -1, -1 ,0 },the shadow is wrong. At first I thought it was a problem with bounding boxes, but I still have this problem after setting the correct bounding boxes. Please let me know if I need to add any other information, thank you.
code: {
Entity ground = utils::EntityManager::get().create();
RenderableManager::Builder(1)
.boundingBox({{-10, 0, -15}, {10, 0, 15}})
.material(0, mat->getDefaultInstance())
.geometry(0, RenderableManager::PrimitiveType::TRIANGLES, vb, ib)
.culling(false)
.receiveShadows(true)
.castShadows(true)
.build(*engine, ground);
scene->addEntity(ground);
Entity wall = utils::EntityManager::get().create();
RenderableManager::Builder(1)
.boundingBox({{-0.5, 0, -10}, {0.5, 10, 10}})
.material(0, mat->getDefaultInstance())
.geometry(0, RenderableManager::PrimitiveType::TRIANGLES, vb, ib)
.culling(false)
.receiveShadows(true)
.castShadows(true)
.build(*engine, wall);
scene->addEntity(wall);
Entity sun = EntityManager::get().create();
LightManager::Builder(LightManager::Type::SUN)
.color(Color::cct(6500.0f))
.intensity(150000.0f)
.castShadows(true)
.direction({-1, -1, 0})
.build(*engine, sun);
scene->addEntity(sun);
}
material {
name : bakedColor,
requires : [
color,
tangents
],
shadingModel : lit
}
fragment {
void material(inout MaterialInputs material) {
prepareMaterial(material);
material.baseColor = getColor();
}
}
Screenshots https://github.com/google/filament/assets/26623108/4d09cee4-e47c-41a0-8b5c-edf0b73456c5
Smartphone (please complete the following information):
- Device: iphone14pro
- OS: iOS 16.6.1
If I change the wall to a glb model, still have the same problem This doesn't look like a shadow, but as far as I can test bounding boxes affect its range
https://github.com/google/filament/assets/26623108/cfb892d2-121e-439b-b81e-81dcdcb1bf1f
It looks like this is affected by bounding boxes and lighting direction https://github.com/google/filament/assets/26623108/833b6b7d-420c-441c-9902-532bb8624b7c
would you please also specify what filament version you're using? thanks.
{ -1, -1 ,0 } is not a unit vector for the light direction.
Can you share the project?
would you please also specify what filament version you're using? thanks.
version is 1.14.0