<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
OK, I was able to isolate the source of the streakings when a trianglated concave polygon is rendering by vtkActor2D. The streaking are result of very narrow triangles and these streaking appears only when the polygon is rendering over gray or other colors. In the attached picture, I embedded a very narrow triangle within three larger triangles (left) and the narrow triangle itself (right). The streak line at the left appears only at magifications when (but not always) the triangle at the right is shown.<BR><BR>
Any suggestions?<BR>
<BR>
Below the code that constructs the polygon:<BR>
<BR><FONT size=2 face=Consolas><FONT size=2 face=Consolas>
vtkPoints* points = vtkPoints::New();<BR>
points->SetNumberOfPoints(8);<BR>
points->SetPoint(0, -8.66, -5.0, 0.0);<BR>
points->SetPoint(1, 3.0, 10.0, 0.0);<BR>
points->SetPoint(2, 8.66, -5.0, 0.0);<BR>
points->SetPoint(3, 0.0, 0.0, 0.0);<BR></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>
points->SetPoint(4, -0.38, -0.17, 0.0); // 1-4-5 makes a narrow triangle<BR>
points->SetPoint(5, -0.40, -0.20, 0.0);<BR></FONT></FONT>
<BR><FONT size=2 face=Consolas><FONT size=2 face=Consolas>
vtkTriangleFilter* filter = vtkTriangleFilter::New();<BR>
vtkCellArray* cells = vtkCellArray::New();<BR>
</FONT></FONT><FONT color=#008000 size=2 face=Consolas><FONT color=#008000 size=2 face=Consolas><FONT color=#008000 size=2 face=Consolas>// create a concave polygon (equilateral with a cutout at the bottom)<BR></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>
vtkPoints* points = GetPoints();<BR>
cells->Allocate(1, 7);<BR>
cells->InsertNextCell(7);<BR>
cells->InsertCellPoint( 0);<BR>
cells->InsertCellPoint( 1);<BR>
cells->InsertCellPoint( 2);<BR>
cells->InsertCellPoint( 3);<BR>
cells->InsertCellPoint( 4);<BR>
cells->InsertCellPoint( 5);</FONT></FONT><FONT color=#008000 size=2 face=Consolas><FONT color=#008000 size=2 face=Consolas><FONT color=#008000 size=2 face=Consolas><BR></FONT></FONT></FONT><FONT size=2 face=Consolas><FONT size=2 face=Consolas>
cells->InsertCellPoint(0);<BR>
vtkPolyData* poly = vtkPolyData::New();<BR>
poly->Initialize();<BR>
poly->SetGlobalWarningDisplay(1);<BR>
poly->SetPoints(points);<BR>
poly->SetPolys(cells);<BR>
points->Delete();<BR>
cells->Delete();<BR></FONT></FONT>
<BR>
Xiaofeng<BR><BR><BR> <BR>
<HR id=stopSpelling>
From: xf10036@hotmail.com<BR>To: david.gobbi@gmail.com<BR>CC: dave.demarle@kitware.com; vtkusers@vtk.org<BR>Subject: RE: [vtkusers] Bug or Design: Rendering concave polygons with vtkActor2D<BR>Date: Tue, 11 May 2010 19:50:51 -0400<BR><BR>
<STYLE>
.ExternalClass .ecxhmmessage P
{padding:0px;}
.ExternalClass body.ecxhmmessage
{font-size:10pt;font-family:Verdana;}
</STYLE>
Hi David,<BR> <BR>Thanks for your suggestion. I tried vtkCleanPolyData but it does not make markable improvements.<BR> <BR>From some example I saw of OpenGL tessellation, it appears the process of tessellation and rendering must be interwoven. I wonder if that is to ensure no pixel overlapping in the neibghouring triangles.<BR><BR>Xiaofeng<BR><BR><BR> <BR>> From: david.gobbi@gmail.com<BR>> Date: Tue, 11 May 2010 17:05:20 -0600<BR>> Subject: Re: [vtkusers] Bug or Design: Rendering concave polygons with vtkActor2D<BR>> To: xf10036@hotmail.com<BR>> CC: dave.demarle@kitware.com; vtkusers@vtk.org<BR>> <BR>> Hi Xiaofeng,<BR>> <BR>> These are because vtkPolygon::Triangulate() has trouble when points<BR>> are nearly coincident or when points are co-linear. I had to deal<BR>> with this when I was writing vtkClipClosedSurface and almost decided<BR>> to write my own triangulation code... until I found out how hard it is<BR>> to write robust triangulation code.<BR>> <BR>> The easiest thing is to use vtkCleanPolyData to merge points that are<BR>> very close together. You'll probably still see the triangulation fail<BR>> sometimes, but it should fail less often.<BR>> <BR>> David<BR>> <BR>> <BR>> On Tue, May 11, 2010 at 4:39 PM, Xiaofeng Z <xf10036@hotmail.com> wrote:<BR>> > Hello,<BR>> ><BR>> > As suggested by some, I tried vtkTriangleFilter to tessellate concave<BR>> > polygons. It almost works, except some bright pixels appearing within the<BR>> > polygon forming streak like lines as well as some at the boundary. Attached<BR>> > is a typical example of such a streak. This streaks appear or disappear<BR>> > as the magnification changes. I think they come from overlapped pixels from<BR>> > neighouring triangles. I need suggestions in how to remove them.<BR>> ><BR>> > Thanks!<BR>> ><BR>> > Xiaofeng<BR>> ><BR>> ><BR>> ><BR>> >> From: dave.demarle@kitware.com<BR>> >> Date: Thu, 6 May 2010 11:15:23 -0400<BR>> >> Subject: Re: [vtkusers] Bug or Design: Rendering concave polygons with<BR>> >> vtkActor2D<BR>> >> To: xf10036@hotmail.com<BR>> >> CC: vtkusers@vtk.org<BR>> >><BR>> >> Try vtkTriangleFilter.<BR>> >><BR>> >> If there is a better alternative hopefully someone on list with more<BR>> >> mesh experience than I will fill in the details.<BR>> >><BR>> >> David E DeMarle<BR>> >> Kitware, Inc.<BR>> >> R&D Engineer<BR>> >> 28 Corporate Drive<BR>> >> Clifton Park, NY 12065-8662<BR>> >> Phone: 518-371-3971 x109<BR>> >><BR>> >><BR>> >><BR>> >> On Thu, May 6, 2010 at 11:06 AM, Xiaofeng Z <xf10036@hotmail.com> wrote:<BR>> >> > David,<BR>> >> ><BR>> >> > I am thinking of using GLU to perform Tessellation. I wonder how<BR>> >> > involved<BR>> >> > it would be if I try to do it inside VTK.<BR>> >> ><BR>> >> > I would appreciate it if you can provide some insight.<BR>> >> ><BR>> >> > Thanks!<BR>> >> ><BR>> >> > Xiaofeng<BR>> >> ><BR>> >> ><BR>> >> ><BR>> >> ><BR>> >> >> From: dave.demarle@kitware.com<BR>> >> >> Date: Wed, 5 May 2010 07:51:40 -0400<BR>> >> >> Subject: Re: [vtkusers] Bug or Design: Rendering concave polygons with<BR>> >> >> vtkActor2D<BR>> >> >> To: xf10036@hotmail.com<BR>> >> >> CC: vtkusers@vtk.org<BR>> >> >><BR>> >> >> I suspect that is because OpenGL doesn't render concave polygons<BR>> >> >> properly, thus VTK, which uses GL to render, doesn't either. So<BR>> >> >> unfortunately you have to tesselate that into a set convex polygons in<BR>> >> >> order to have it drawn properly.<BR>> >> >><BR>> >> >> David E DeMarle<BR>> >> >> Kitware, Inc.<BR>> >> >> R&D Engineer<BR>> >> >> 28 Corporate Drive<BR>> >> >> Clifton Park, NY 12065-8662<BR>> >> >> Phone: 518-371-3971 x109<BR>> >> >><BR>> >> >><BR>> >> >><BR>> >> >> On Tue, May 4, 2010 at 11:38 AM, Xiaofeng Z <xf10036@hotmail.com><BR>> >> >> wrote:<BR>> >> >> > Concave polygons are not rendered as expected with vtkPolyDataMapper<BR>> >> >> > and<BR>> >> >> > vtkActor2D (see below). Is it by design or is it a bug? If it's by<BR>> >> >> > design,<BR>> >> >> > is there any flag can be set to alter the rendering behaviour?<BR>> >> >> ><BR>> >> >> > Thanks!<BR>> >> >> ><BR>> >> >> > Xiaofeng<BR>> >> >> ><BR>> >> >> > Hi all,<BR>> >> >> ><BR>> >> >> > How do I make uniform transparency in a concave polygon, instead of<BR>> >> >> > getting<BR>> >> >> > multiple shades, e.g. in the attached graph?<BR>> >> >> ><BR>> >> >> > The polygon are created with:<BR>> >> >> ><BR>> >> >> > vtkPoints* points = vtkPoints::New();<BR>> >> >> > vtkCellArray* cells = vtkCellArray::New();<BR>> >> >> > points->SetNumberOfPoints(4);<BR>> >> >> ><BR>> >> >> > // create a concave polygon (equilateral with a cutout at the bottom)<BR>> >> >> ><BR>> >> >> > points->SetPoint(0, 10.0, 10.0, 0.0);<BR>> >> >> > points->SetPoint(1, 110.0, 183.2, 0.0);<BR>> >> >> > points->SetPoint(2, 210.0, 10.0, 0.0);<BR>> >> >> > points->SetPoint(3, 110.0, 110.0, 0.0);<BR>> >> >> > cells->Allocate(1, 5);<BR>> >> >> > cells->InsertNextCell(5);<BR>> >> >> > cells->InsertCellPoint(0);<BR>> >> >> > cells->InsertCellPoint(1);<BR>> >> >> > cells->InsertCellPoint(2);<BR>> >> >> > cells->InsertCellPoint(3);<BR>> >> >> > cells->InsertCellPoint(0);<BR>> >> >> > vtkPolyData* poly = vtkPolyData::New();<BR>> >> >> > poly->Initialize();<BR>> >> >> > poly->SetGlobalWarningDisplay(1);<BR>> >> >> > poly->SetPoints(points);<BR>> >> >> > poly->SetPolys(cells);<BR>> >> >> ><BR>> >> >> > A vtkActor2D and a vtkPolyDataMapper2D was used for the rendering.<BR>> >> >> ><BR>> >> >> > Many thanks!<BR>> >> >> > Xiaofeng<BR>> >> >> ><BR>> >> >> ><BR>> >> >> ><BR>> >> >> > ________________________________<BR>> >> >> > The New Busy think 9 to 5 is a cute idea. Combine multiple calendars<BR>> >> >> > with<BR>> >> >> > Hotmail. Get busy.<BR>> >> >> > ________________________________<BR>> >> >> > Hotmail has tools for the New Busy. Search, chat and e-mail from your<BR>> >> >> > inbox.<BR>> >> >> > Learn more.<BR>> >> >> > _______________________________________________<BR>> >> >> > Powered by www.kitware.com<BR>> >> >> ><BR>> >> >> > Visit other Kitware open-source projects at<BR>> >> >> > http://www.kitware.com/opensource/opensource.html<BR>> >> >> ><BR>> >> >> > Please keep messages on-topic and check the VTK FAQ at:<BR>> >> >> > http://www.vtk.org/Wiki/VTK_FAQ<BR>> >> >> ><BR>> >> >> > Follow this link to subscribe/unsubscribe:<BR>> >> >> > http://www.vtk.org/mailman/listinfo/vtkusers<BR>> >> >> ><BR>> >> >> ><BR>> >> ><BR>> >> > ________________________________<BR>> >> > The New Busy think 9 to 5 is a cute idea. Combine multiple calendars<BR>> >> > with<BR>> >> > Hotmail. Get busy.<BR>> ><BR>> > ________________________________<BR>> > Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.<BR>> > Learn more.<BR>> > _______________________________________________<BR>> > Powered by www.kitware.com<BR>> ><BR>> > Visit other Kitware open-source projects at<BR>> > http://www.kitware.com/opensource/opensource.html<BR>> ><BR>> > Please keep messages on-topic and check the VTK FAQ at:<BR>> > http://www.vtk.org/Wiki/VTK_FAQ<BR>> ><BR>> > Follow this link to subscribe/unsubscribe:<BR>> > http://www.vtk.org/mailman/listinfo/vtkusers<BR>> ><BR>> ><BR><BR>
<HR>
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. <A href="http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5">Get busy.</A> <br /><hr />The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. <a href='http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5' target='_new'>Get busy.</a></body>
</html>