Skip to content

Attentuation for Directional/Sun Lights when importing Blender files #120

@amras0000

Description

@amras0000
_importer = _manager.loadAndInstantiate("BlenderImporter");
_importer->openFile("lights.blend")
Containers::Optional<Trade::LightData> l = _importer->light(0);

Blender 3.0.0 allows for 4 types of light by default: Point, Sun, Spot, and Area. Here are the results when I run the importer on each of these lights:

Loading point.blend ...
Found a light of type Trade::LightData::Type::Point !
Loading spot.blend ...
Found a light of type Trade::LightData::Type::Spot !
Loading area.blend ...
Trade::AssimpImporter::light(): light type 5 is not supported
No light Found !
Loading sun.blend ...
Trade::LightData: attenuation has to be (1, 0, 0) for an ambient or directional light but got Vector(0, 0, 0)
Aborted (core dumped)

Area lights are not supported, and gracefully pass with a warning and a NullOpt. Directional (ie. sun) lights however, note a different attenuation notation and crash before light() exits - meaning the user has no opportunity to fix the attenuation to the expected value.

Test code and blender files are attached.

magnum-blender-directional-light.zip

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions