what I really want to do is making the scaled pixel (the width of the outline) fixed at some value , like 2 pixel across different zooming distance.
Actually I could just use glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
and draw the line with out modifing the mesh. but my mesh has many unclosed surface (like back of character sleeve,hair).
Well it still look the same (this time with picture).
zoom out (click to enlarge)
zoom in (click to enlarge)
May be I have to re-calculate scaleFactor based on camera position or something but I dont really care now since the result will look ugly anyway(The thin line look too jaggy).
Can you guy suggest me some line rendering technique that work well with anime style cell shading technique ?
I also try using edge detection on normal g-buffer but cannot manage to make line wide more than 1~2 pixel. and the same edge detection kernel produced and ugly result when use with anti-aliased (resolved to NOAA texture) normal g-buffer (resolved to NOAA texture) , the detected line still look jaggy which destroy the purpose of anti-aliasing.
Edge detection line (NOAA , blend with source image)
Edge detection line (2XAA , blend with source image)
noticed that the line still look very jaggy and there also color leak
That would be ideal solution (and should handle AA fine) but my mesh had many unclosed part (like sleeve , skirt and hair) which will result in visible wire frame and glLineWidth is also disable in OpenGL 3.2 core profile.
I am now try to improve my edge detection shader to better handle AA image (managed to fix color bleeding but still look jagged).
So you use GL3.2 core: use a geometry-shader to render only silhouette edges (triangle adjacency info required). Wide-lines were brought back in 3.2 . They are disabled not in “core” but “forward-compatibility” profile.
In all cases, the current approach with “scale along the normals” might do the trick, and you’re just a step away from it. Yet, edges with funky normals will probably become problematic.