libIGL strange shading on mesh faces

589 views Asked by At

I'm using libIGL to generate a tet-mesh, and would like to visualize this mesh with colors. Each vertex has a different value (result of using the Graph Laplacian to minimize the quadratic energy), and these values have been converted to colors using igl::jet. I would like to "slice" my tet-mesh at different z-values, and have followed Example 605 to do so.

When this is visualized, the colors are all right, but the shading is all wrong (as can be seen in the image below). Is there an (easy) way to fix the shading? I've tried using both bfs_orient and embree::reorient_faces_raycast to no avail.

coloring of tetmesh with strange shading

To reproduce the problem, just lines 52-54 of Example 605 to be:

    Eigen::VectorXd C = V_temp.col(2);
    Eigen::MatrixXd Col;
    igl::jet(C, true, Col);
    viewer.data.clear();
    viewer.data.set_mesh(V_temp,F_temp);
    viewer.data.set_colors(Col);
    viewer.data.set_face_based(false);

Edit: I can turn off the lighting by adding

    viewer.core.lighting_factor = 0;

The resulting image is: image with dating turned off However, this doesn't have any lighting, and I can't help but feel there's a better way that will preserve the lighting. Perhaps something that exposes the OpenGL_Shader?

0

There are 0 answers