<div dir="ltr"><div><div></div>Have you tried to display "smoothed" instead of "triangleCellNormals"?<br></div>Are you sure smoothed consists of polygons?<div><div>If for example it had only lines triangleCellNormals would have nothing in.<br>
</div><div><br>Alex<br></div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 28, 2013 at 12:45 PM, ThinkFlow <span dir="ltr"><<a href="mailto:neto@caltech.edu" target="_blank">neto@caltech.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I am trying to render the polydata that results after passing in a<br>
vtkRectilinearGrid into vtkContourFilter. However, I keep getting a black<br>
screen. There were a few questions like mine that were already answered, but<br>
when I tried out those fixes, I still got a black screen. When I render the<br>
vtkRectilinearGrid data by itself without passing it through<br>
vtkContourFilter, it works.<br>
<br>
vtkRectilinearGridReader *reader = vtkRectilinearGridReader::New();<br>
<br>
reader->SetFileName(prefix_suffix);<br>
reader->Update();<br>
<br>
// Create a grid<br>
vtkSmartPointer<vtkRectilinearGrid> grid = reader->GetOutput();<br>
<br>
vtkContourFilter* contour = vtkContourFilter::New();<br>
<br>
contour->SetInput(grid);<br>
<br>
contour->SetNumberOfContours(3);<br>
<br>
contour->ComputeNormalsOn();<br>
<br>
contour->Update();<br>
<br>
vtkPolyData *smoothed_polys = contour->GetOutput();<br>
<br>
// calc cell normal<br>
vtkPolyDataNormals *triangleCellNormals= vtkPolyDataNormals::New();<br>
<br>
#if VTK_MAJOR_VERSION <= 5<br>
triangleCellNormals->SetInput(smoothed_polys);<br>
#else<br>
triangleCellNormals->SetInputData(smoothed_polys);<br>
#endif<br>
<br>
triangleCellNormals->ComputeCellNormalsOn();<br>
triangleCellNormals->ComputePointNormalsOff();<br>
triangleCellNormals->ConsistencyOn();<br>
triangleCellNormals->AutoOrientNormalsOn();<br>
triangleCellNormals->Update(); // creates vtkPolyData<br>
<br>
vtkPolyDataMapper* contourMapper = vtkPolyDataMapper::New();<br>
contourMapper->SetInput(triangleCellNormals->GetOutput());<br>
<br>
vtkActor* contourActor = vtkActor::New();<br>
contourActor->SetMapper(contourMapper);<br>
<br>
// Create a renderer, render window, and interactor<br>
vtkRenderer* renderer = vtkRenderer::New();<br>
vtkRenderWindow *renderWindow = vtkRenderWindow::New();<br>
vtkRenderWindowInteractor *renderWindowInteractor =<br>
vtkRenderWindowInteractor::New();<br>
<br>
// Add the actors to the scene<br>
renderWindow->AddRenderer(renderer);<br>
renderWindowInteractor->SetRenderWindow(renderWindow);<br>
renderer->AddActor(contourActor);<br>
<br>
// Render and interact<br>
renderWindow->Render();<br>
renderWindowInteractor->Start();<br>
<br>
Thanks,<br>
<br>
Naoki<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/RectilinearGrid-into-vtkContourFilter-tp5723107.html" target="_blank">http://vtk.1045678.n5.nabble.com/RectilinearGrid-into-vtkContourFilter-tp5723107.html</a><br>
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>
</blockquote></div><br></div>