f3d icon indicating copy to clipboard operation
f3d copied to clipboard

OBJ Incorrect coloring with vertex colors

Open mwestphal opened this issue 2 years ago • 7 comments

Describe the bug A obj dataset with vertex colors is incorrectly textured

To Reproduce Steps to reproduce the behavior: 0. female02.zip

  1. Open the file using f3d --dry-run female02_vertex_colors.obj

a

Expected behavior

a

System Information:

  • OS: Linux and Windows

F3D Information Paste the content of f3d --version:1.3.1 and master

mwestphal avatar Feb 05 '23 15:02 mwestphal

This one may not be about the vertex colors.

  • female02_vertex_colors.obj has both textures and seemingly random vertex colors. F3D renders only the vertex colors
  • female02.obj has only textures. F3D does not render the textures.

If we change some vertex colors to known values, for example make all vertices with positive coords red (sed -r 's/(v [.0-9]+ [.0-9]+ [.0-9]+) [.0-9]+ [.0-9]+ [.0-9]+/\1 1 0 0/g' female02/female02_vertex_colors.obj > female02/female02_vertex_colors_red.obj f3d will render this: f3d-female02_vertex_colors_red obj which makes sense, except for the lack of textures, which would be the actual bug

meshlab render for comparison: meshlab-female02_vertex_colors_red obj

snoyer avatar Feb 06 '23 08:02 snoyer

Ha ! then VTK does not suport both texture and color, but it should, is that correct ?

mwestphal avatar Feb 06 '23 09:02 mwestphal

Honestly no idea. According to http://paulbourke.net/dataformats/mtl/: "During rendering, the map_Kd value is multiplied by the Kd value." Assuming the per-vertex colors in the .obj are to be considered equivalent to the per-face Kd values in the .mtl then they should indeed be blended but I don't know what the correct output would be. It could also be another unspecified corner-case.

snoyer avatar Feb 06 '23 10:02 snoyer

There is a similar ParaView issue for this here: https://gitlab.kitware.com/paraview/paraview/-/issues/21257

With an actual VTK code in it to make it work.

mwestphal avatar Feb 11 '23 06:02 mwestphal

Do you think this one matters @Meakk ?

mwestphal avatar Feb 11 '23 18:02 mwestphal

@Meakk

mwestphal avatar Feb 13 '23 18:02 mwestphal

Blending between texture and vertex color makes sense, so there's a bug here in my opinion. However, it's definitely not critical.

Meakk avatar Feb 13 '23 22:02 Meakk