Summary: | Dropouts in rendering Coons patch meshes | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | Raph Levien <raph.levien> |
Component: | Graphics Library | Assignee: | Raph Levien <raph.levien> |
Status: | NOTIFIED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | master | ||
Hardware: | All | ||
OS: | All | ||
Customer: | Word Size: | --- |
Description
Raph Levien
2000-10-27 16:27:43 UTC
Comment originally by raph@users.sourceforge.net The following patch (intended more as a test to probe the bug rather than a proposed solution) eliminates the symptoms. It works by "fattening" the filling of triangles. Index: src/gsptype2.c =================================================================== RCS file: /cvsroot/ghostscript/gs/src/gsptype2.c,v retrieving revision 1.3 diff -c -r1.3 gsptype2.c *** src/gsptype2.c 2000/09/19 19:00:32 1.3 --- src/gsptype2.c 2000/10/28 05:44:22 *************** *** 167,173 **** rect.q.y = int2fixed(y + h); /* We don't want any adjustment of the box. */ gs_currentfilladjust(pgs, &save_adjust); ! gs_setfilladjust(pgs, 0.0, 0.0); /****** DOESN'T HANDLE RASTER OP ******/ code = gs_shading_fill_path(pinst->template.Shading, NULL, &rect, dev, (gs_imager_state *)pgs, true); --- 167,173 ---- rect.q.y = int2fixed(y + h); /* We don't want any adjustment of the box. */ gs_currentfilladjust(pgs, &save_adjust); ! gs_setfilladjust(pgs, 0.25, 0.25); /****** DOESN'T HANDLE RASTER OP ******/ code = gs_shading_fill_path(pinst->template.Shading, NULL, &rect, dev, (gs_imager_state *)pgs, true); Index: src/gxshade4.c =================================================================== RCS file: /cvsroot/ghostscript/gs/src/gxshade4.c,v retrieving revision 1.3 diff -c -r1.3 gxshade4.c *** src/gxshade4.c 2000/09/19 19:00:40 1.3 --- src/gxshade4.c 2000/10/28 05:44:22 *************** *** 133,139 **** (*pcs->type->remap_color)(&fcc, pcs, &dev_color, pis, pfs->dev, gs_color_select_texture); /****** SHOULD ADD adjust ON ANY OUTSIDE EDGES ******/ ! #if 0 { gx_path *ppath = gx_path_alloc(pis->memory, "Gt_fill"); --- 133,139 ---- (*pcs->type->remap_color)(&fcc, pcs, &dev_color, pis, pfs->dev, gs_color_select_texture); /****** SHOULD ADD adjust ON ANY OUTSIDE EDGES ******/ ! #if 1 { gx_path *ppath = gx_path_alloc(pis->memory, "Gt_fill"); Comment originally by raph@users.sourceforge.net After a little more digging, I now see that there are two sources of dropouts. Pixel roundoffs in triangulation, as discussed previously, do seem to contribute to dropouts. However, a more significant source seems to be inconsistent flattening of edges. In particular, each edge is subdivided according to the flatness criteria for that edge and the one on the opposite side of the patch. Thus, the coinciding edge of two adjoining patches is likely to be flattened differently. This is the largest source of dropouts, and becomes even more pronounced when the flatness parameter is increased. A general solution of triangulating a mesh of patches is thus quite difficult. Some mechanism will be needed to deal with changes in subdivision fineness from one patch to the next. This will have to wait for a substantial rework of the shading machinery. In the meantime, increasing fill_adjust should be a reasonable stopgap. Comment originally by raph@users.sourceforge.net The workaround posted here: http://www.ghostscript.com/pipermail/gs-code-review/2000-November/000023.html ...and committed here: http://www.ghostscript.com/pipermail/gs-cvs/2000-November/000147.html http://www.ghostscript.com/pipermail/gs-cvs/2000-November/000148.html ...works around the problem. Thus, I am closing the bug. However, there remains considerable room for improvement in both performance and quality. I expect to rework shadings considerably. |