gpvigano / AsImpL

Asynchronous Importer and run-time Loader for Unity
MIT License
212 stars 37 forks source link

Support for the Ke parameter in mtl file #17

Closed Lesliehdezg closed 6 years ago

Lesliehdezg commented 6 years ago

In the material library file (mtl) the parameter Ke (emissive coefficient) represents the amount of light emitted by a material. In Unity could be somehow mapped to the Emission value of Material.

gpvigano commented 6 years ago

I just added the support for emission color to the last version of AsImpL in this commit.

A new field emissiveColor is defined in MaterialData. The Ke parameter is read from mtl file (LoaderObj) and imported to Unity materials (ObjectBuilder). The DiffBump material in objtest.mtl now has a new Ke parameter to test emissive color.

Notice that in addition to setting the emission color of the material I had to enable the _EMISSION keyword. An hint about implementing new features: right click in the Inspector tab label and select Debug from the context menu (to switch back to normal view just right click again and select Normal). In this way you have a full overview on the real component parameters. I found this way very useful to discover Unity materials internal configuration.

Lesliehdezg commented 6 years ago

For now it works!!! My object is complete with the .mtl file.

gpvigano commented 6 years ago

Fine. Thank you for your feedback, I can close this issue.