gp icon indicating copy to clipboard operation
gp copied to clipboard

Assignment1 shading

Open HerlinHe opened this issue 3 years ago • 3 comments

Hi Professor, I have a question about how to do the per_vertex_shading. I compute the exploded V and F, call "igl.per_vertex_normals" to get the per_vertex_normals, which is n, and plot the image using "meshplot.plot(exploded_v, exploded_f, n=n)". However, I got the exact same picture as per_face_normals. Is there anything wrong with my steps?

HerlinHe avatar Jan 28 '22 03:01 HerlinHe

This sounds like the same issue that I had. Assuming your normals calc. is right, just disabling flat shading, like so

meshplot.plot( ..., shading = {"flat": False})

should work IG.

harshaxnim avatar Jan 30 '22 14:01 harshaxnim

meshplot.plot( ..., shading = {"flat": False}) works for per_vertex_shading. But I still have a question about "exploding" the mesh. Exploding copies vertices and the number of faces does not change, right? I can draw the smooth shading without exploding by meshplot.plot(sphere_v, sphere_f, shading={"flat": False}), but still get flat shading with meshplot.plot(exploded_v, exploded_f, shading={"flat": False})

HerlinHe avatar Jan 31 '22 16:01 HerlinHe

Ah, I think the idea of the question is to get an "effect" of Flat Shading given a system that:

  • only supports per-vertex normals,
  • and the shader uses these normals for lighting calculations.

So, "flat": False for all parts of the shading question, but you get to play with vertices, faces and normals to achieve the desired style.

harshaxnim avatar Jan 31 '22 19:01 harshaxnim