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
Describe the issue
Tinyobjloader incorrectly populates the vertex color attribute with default values when vertex color does not exist in the file. It seems to be by design as shown in the comments below:
/// If vertex color is not present, its filled with default value.
/// false = no vertex color
/// This will increase memory of parsed .obj
bool vertex_color;
However, I want to argue that this behavior is really confusing (especially during debugging). It would better to leave color field empty if no vertex color exists in the file.
To Reproduce
Steps to reproduce the behavior:
Load any obj file that does not contain color. e.g.
v 1 0 0
v 0 1 0
v 0 0 1
Expected behavior
Tinyobject should not populate the color attribute.
The text was updated successfully, but these errors were encountered:
I cannot recall why default behavior is to create default vertex color. Probably to support parsing a .obj whose vertices partially have vertex colors, something like:
v 1 0 0 1 1 0
v 1 1 0
v 1 1 1
It'd be possible to add a condition(when all vertices does not have vertex color) to clear vertex colors here:
Hmm, turns out setting ObjReaderConfig::vertex_color to false produces the correct behavior (only populate the color attribute when it is available). ObjReaderConfig::vertex_color in v2.0 API is really the default_vcols_fallback in v1.x API, but its name and documentation feel a bit misleading.
Describe the issue
Tinyobjloader incorrectly populates the vertex color attribute with default values when vertex color does not exist in the file. It seems to be by design as shown in the comments below:
tinyobjloader/tiny_obj_loader.h
Lines 517 to 521 in cab4ad7
However, I want to argue that this behavior is really confusing (especially during debugging). It would better to leave color field empty if no vertex color exists in the file.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Tinyobject should not populate the color attribute.
The text was updated successfully, but these errors were encountered: