<div dir="ltr">I was able to duplicate your problem. I believe the problem is trying to approximate the unsigned char 3-component colors. Butterfly is an approximating subdivision scheme, while loop is an interpolating scheme. I think if you assigned scalar float, single component values and mapper them through a lookup table you would get good results. But I'm not sure that would accomplish what you want.<div>
<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Apr 20, 2013 at 2:23 PM, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">This better. Just to be sure, I assume this code also produces bad results?<br><br></div><div class="gmail_extra">
<div><div class="h5"><br><br><div class="gmail_quote">On Sat, Apr 20, 2013 at 1:39 PM, DivyaS <span dir="ltr"><<a href="mailto:div.anand141@gmail.com" target="_blank">div.anand141@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Sure, please check this code - I have removed all the unnecessary code. I<br>
have added comments for each of the steps.<br>
<br>
//Defining a cylinder source.<br>
vtkCylinderSource cylinderSource = vtkCylinderSource.New();<br>
cylinderSource.Update();<br>
<br>
vtkTriangleFilter triangles = vtkTriangleFilter.New();<br>
triangles.SetInput(cylinderSource.GetOutput());<br>
<div> triangles.Update();<br>
vtkPolyData originalMesh;<br>
originalMesh = triangles.GetOutput();<br>
<br>
vtkUnsignedCharArray colors = vtkUnsignedCharArray.New();<br>
colors.SetNumberOfComponents(3);<br>
colors.SetNumberOfTuples(originalMesh.GetNumberOfPolys());<br>
colors.SetName("Colors");<br>
<br>
</div> //Creating an array to store the values according to which the<br>
colors are selected.<br>
//Values are inserted for each of the points in the polydata<br>
int[] colorAT = new int[originalMesh.GetNumberOfPolys()];<br>
for (int i = 0; i < originalMesh.GetNumberOfPolys(); i++)<br>
{<br>
colorAT[i] = i;<br>
}<br>
<br>
int activationTime;<br>
//Loop to select colors for each of the points in the polydata.<br>
for (int i = 0; i < originalMesh.GetNumberOfPolys(); i++)<br>
{<br>
activationTime = colorAT[i];<br>
if (activationTime > 0 && activationTime < 5)<br>
{<br>
//Black<br>
colors.InsertTuple3(i, 255, 255, 0);<br>
}<br>
else if (activationTime > 4 && activationTime < 10)<br>
<div> {<br>
//Blue<br>
colors.InsertTuple3(i, 0, 0, 255);<br>
}<br>
</div> else if (activationTime > 9 && activationTime < 300)<br>
<div> {<br>
//Red<br>
colors.InsertTuple3(i, 255, 0, 0);<br>
}<br>
}<br>
originalMesh.GetPointData().SetScalars(colors);<br>
<br>
</div> //Subdivision.<br>
int numberOfSubdivisions = 4;<br>
vtkPolyDataAlgorithm subdivisionFilter =<br>
vtkButterflySubdivisionFilter.New();<br>
<br>
((vtkButterflySubdivisionFilter)subdivisionFilter).SetNumberOfSubdivisions(numberOfSubdivisions);<br>
subdivisionFilter.SetInput(originalMesh);<br>
subdivisionFilter.Update();<br>
<br>
vtkRenderWindow renderWindow =<br>
renderWindowControl1.RenderWindow;<br>
vtkRenderer renderer = vtkRenderer.New();<br>
<div><br>
//Create a mapper and actor<br>
vtkPolyDataMapper mapper = vtkPolyDataMapper.New();<br>
mapper.SetInputConnection(subdivisionFilter.GetOutputPort());<br>
vtkActor actor = vtkActor.New();<br>
actor.SetMapper(mapper);<br>
<br>
renderer.AddActor(actor);<br>
</div> renderer.SetBackground(0, 0, 0);<br>
renderer.ResetCamera();<br>
renderWindow.AddRenderer(renderer);<br>
renderWindow.Render();<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Uneven-colors-after-the-vtkButterflySubdivisionFilter-tp5720205p5720234.html" target="_blank">http://vtk.1045678.n5.nabble.com/Uneven-colors-after-the-vtkButterflySubdivisionFilter-tp5720205p5720234.html</a><br>
<div><div>Sent from the VTK - Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div></div></blockquote></div><br><br clear="all"><br></div></div><div class="im">-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Unpaid intern in BillsBasement at noware dot com<br>
</div>