[vtkusers] Default view is half transparent

Ken Martin ken.martin at kitware.com
Wed Jan 31 08:45:03 EST 2018


If you are on OSX with Qt5 but using the old vtk QtWidget then there is a
known issue where the zbuffer doesn't work I believe. The new tk OPenGL
widget widget fixes the issue.  If you are not on OSX then it must be
something else but your code above looks fine.

On Wed, Jan 31, 2018 at 6:17 AM, Tanja Gerasimenko <staubchen03 at gmail.com>
wrote:

> Hello!
>
> I'm very new in vtk and I'm trying to visualize a triangular mesh
> describing a geometry (something like stl) with vtk and Qt. The result
> seems to be half transparent or something like that (see the picture). When
> I visualize it using Paraview it looks like as a solid. I've tried to auto
> orient normals and use ReverseSense but without success.
>
> Could you please tell me, what am I doing wrong?
>
> Thank you.
>
>
> The code is:
>
> vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
>
>     points->SetNumberOfPoints(surf_mesh.pt.size());
>     for (uint i=0; i<surf_mesh.pt.size(); ++i)
>     {
>         points->SetPoint(i, surf_mesh.pt[i].x, surf_mesh.pt[i].y,
> surf_mesh.pt[i].z);
>     };
>
>     vtkSmartPointer<vtkCellArray> polys = vtkSmartPointer<vtkCellArray>:
> :New();
>
>     for (uint i=0; i<surf_mesh.tr.size(); ++i)
>     {
>         polys->InsertNextCell(3);
>         polys->InsertCellPoint(surf_mesh.tr[i].p1);
>         polys->InsertCellPoint(surf_mesh.tr[i].p2);
>         polys->InsertCellPoint(surf_mesh.tr[i].p3);
>     };
>
>     vtkPolyData * polydata = vtkPolyData::New();
>     polydata->SetPoints(points);
>     polydata->SetPolys(polys);
>
>
>     vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<
> vtkPolyDataMapper>::New();
>     mapper->SetInputData(polydata);
>
>     vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
>     actor->SetMapper(mapper);
>     actor->GetProperty()->SetRepresentationToSurface();
>     actor->GetProperty()->SetFrontfaceCulling(0);
>     actor->GetProperty()->SetBackfaceCulling(0);
>
>
>     renderer->AddActor(actor);
>
>     renderer->ResetCamera();
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> https://vtk.org/mailman/listinfo/vtkusers
>
>


-- 
Ken Martin PhD
Distinguished Engineer
Kitware Inc.
28 Corporate Drive
Clifton Park NY 12065

This communication, including all attachments, contains confidential and
legally privileged information, and it is intended only for the use of the
addressee.  Access to this email by anyone else is unauthorized. If you are
not the intended recipient, any disclosure, copying, distribution or any
action taken in reliance on it is prohibited and may be unlawful. If you
received this communication in error please notify us immediately and
destroy the original message.  Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180131/19e599a1/attachment.html>


More information about the vtkusers mailing list