graphics - In gouraud shading, what is the T-junction issure and how to demonstrate it with OpenGL -


i noticed here in gouraud shading part, said "t-junctions adjoining polygons can result in visual anomalies. in general, t-junctions should avoided".

it seems t-junction 3 surfaces in picture below share edges , point may have different normal vector due belongs different surfaces.

enter image description here

but effect when t-junction happened , how use opengl implement it? tried set different normal each vertex of each rectangle , put light in scene, however, didn't see strange in junction point a.

here code:

glcolor3f(1.0f, 0.0f, 0.0f); glbegin(gl_quads); glnormal3f(0, 0,1); glvertex3f(-5.0f, 5.0f, 0.0f); glnormal3f(0, 1,1); glvertex3f(5.0f, 5.0f, 0.0f); glnormal3f(1, 1,1); glvertex3f(5.0f, 0.0f, 0.0f); glnormal3f(0, -1,1); glvertex3f(-5.0f, 0.0f, 0.0f); glend();  glcolor3f(0.0f, 1.0f, 0.0f); glbegin(gl_quads); glnormal3f(1, 0,1); glvertex3f(-5.0f, 0.0f, 0.0f); glnormal3f(1, 2,1); glvertex3f(0.0f, 0.0f, 0.0f); glnormal3f(0, 0,1); glvertex3f(0.0f, -5.0f, 0.0f); glnormal3f(0, 1, 2); glvertex3f(-5.0f, -5.0f, 0.0f); glend();  glcolor3f(0.0f, 0.0f, 1.0f); glbegin(gl_quads); glnormal3f(1, 1, 3); glvertex3f(0.0f, 0.0f, 0.0f); glnormal3f(0, -2, 5); glvertex3f(5.0f, 0.0f, 0.0f); glnormal3f(-1, 1, 1); glvertex3f(5.0f, -5.0f, 0.0f); glnormal3f(1, -2, 0); glvertex3f(0.0f, -5.0f, 0.0f); glend(); 

the point light in (0, 0, 10) camera. result below has no visual anomaly think. maybe normals should kind of special?

is there wrong did? give me hints make happen?

enter image description here

t-junction bad gouraud shading , in geometry in general.

first remember goraud shading, method light interpolation used in fixed pipeline era light interpolated accross vertices, making mesh tesselation (the number , connectivity) of vertices directly affect shading. having t-junction give sudden discontinuity in how final interpolated color looks (keep in mind gouraud shading has other problems, under-sampling).

gouraud shading directly use vertex normals unlike phong shading, , note don't confuse phong shading phong lighting different

note case presenting t-junction won't notice shading problem because mesh not tessellated enough , (it seems) not using light. try testing on sphere t-junction.

regarding geometry t-junction considered degenerate case. because @ edge/polygon geometric mesh loses consistency, no longer have 2 edges connected @ ends, , lose polygon loop property (read: directed edges). it's tricky problem solve, solution triangulate polygons t-juction edge connected.

http://en.wikipedia.org/wiki/gouraud_shading


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -