You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When loading wavefront (.obj) files with associated .mtl materials using group_material = False and skip_materials = False and exporting it afterwards, not all material properties from the .mtl file are exported.
Currently, only ambient (Ka), diffuse (Kd), specular (Ks), and glossiness (Ns) properties are supported and exported by SimpleMaterial. Other properties, such as the index of refraction (Ni), are parsed and stored in SimpleMaterial.kwargs but not exported by SimpleMaterial.to_obj(). Furthermore, the hash generation for unique material names only considers the exported properties, potentially leading to naming conflicts for materials differing by unexported properties.
The index of refraction is officially supported and even used in some of the models /models/box.mtl. Loading the corresponding .obj file and exporting it would result in lost information.
Proposed Solutions:
Enhanced material support: Add support for the (optional) index of refraction (Ni) to SimpleMaterial similar to the optional SimpleMaterial.image.
Flexible export option: Introduce a flag export_all: bool = False to SimpleMaterial.to_obj(), allowing for the export of all parsed material properties from kwargs. Note: This requires careful handling of hash generation to accommodate non-hashable types.
Setting the material names during import
I was also wondering why the material names are parsed but not used in the generation of the SimpleMaterial instances? All materials are called material_0. Extending it as follows would make the names available before export.
This would store the original material names (instead of material_0) in the .obj file and allow re-using the original .mtl file.
When loading wavefront (
.obj
) files with associated.mtl
materials usinggroup_material = False
andskip_materials = False
and exporting it afterwards, not all material properties from the.mtl
file are exported.Currently, only ambient (
Ka
), diffuse (Kd
), specular (Ks
), and glossiness (Ns
) properties are supported and exported bySimpleMaterial
. Other properties, such as the index of refraction (Ni
), are parsed and stored inSimpleMaterial.kwargs
but not exported bySimpleMaterial.to_obj()
. Furthermore, the hash generation for unique material names only considers the exported properties, potentially leading to naming conflicts for materials differing by unexported properties.The index of refraction is officially supported and even used in some of the models /models/box.mtl. Loading the corresponding
.obj
file and exporting it would result in lost information.Proposed Solutions:
Ni
) to SimpleMaterial similar to the optionalSimpleMaterial.image
.export_all: bool = False
toSimpleMaterial.to_obj()
, allowing for the export of all parsed material properties from kwargs. Note: This requires careful handling of hash generation to accommodate non-hashable types.Setting the material names during import
I was also wondering why the material names are parsed but not used in the generation of the
SimpleMaterial
instances? All materials are calledmaterial_0
. Extending it as follows would make the names available before export.This would store the original material names (instead of
material_0
) in the.obj
file and allow re-using the original.mtl
file.The text was updated successfully, but these errors were encountered: