vtkfollower performance problem

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

vtkfollower performance problem

eclipse


Sorry for cross posting.

I uploaded same post StackOverflow, vtk user mailing lis, vtk git issues but nobody made an answer for this.

please forgive me.


I am trying to add vtkfollower to vtkrenderer for indicating the chosen point.

textured vtkfollower is represented correctly, but in the renderer, if I look closer (camera comes closer to polydata) it's getting really slow(frame drop) and the boundary of image turned into black. I did not set the edge line or something might be related.

then, if I move camera far from model its rendering performance is going back to normal.

here is the code.

why is this situation happening? Did I something in a wrong way?

`m_SourceFromQrc = vtkSmartPointer::New();

        m_SourceFromQrc->SetQImage(&m_qimageFromQrc);
        m_SourceFromQrc->Update();

        m_spVTKTexture = vtkSmartPointer<vtkTexture>::New();

        m_spVTKTexture->SetInputConnection(m_SourceFromQrc->GetOutputPort());
        m_spVTKTexture->Update();

        m_spVTKPlane = vtkSmartPointer<vtkPlaneSource>::New();

        m_spVTKPlane->SetNormal(0.0, 0.0, 1.0);


        m_spVTKTextureMappedPlane = vtkSmartPointer<vtkTextureMapToPlane>::New();

        m_spVTKTextureMappedPlane->SetInputConnection(m_spVTKPlane->GetOutputPort());

        m_planeDataMapper = vtkSmartPointer<vtkOpenGLPolyDataMapper>::New();

        m_planeDataMapper->SetInputConnection(m_spVTKTextureMappedPlane->GetOutputPort());


        double followerOriginPoint[3] = { 0.0 };
        followerOriginPoint[1] = -1 / 2.0;

        m_follower = vtkSmartPointer< vtkFollower>::New();
        m_follower->SetOrigin(followerOriginPoint); 

        m_follower->SetPosition(
            pos[0] - followerOriginPoint[0],
            pos[1] - followerOriginPoint[1],
            pos[2] - followerOriginPoint[2]);
        m_follower->SetScale(6);
        m_follower->SetMapper(m_planeDataMapper);
        m_follower->SetTexture(m_spVTKTexture);

        m_follower->SetCamera(getRenderer(m_rendererType)->GetActiveCamera());
        m_follower->VisibilityOn();
        m_follower->ForceOpaqueOff();
        getRenderer(m_rendererType)->AddActor(m_follower);`

If I change this code m_follower->SetTexture(m_spVTKTexture);

into m_follower->GetProperty()->SetTexture(m_spVTKTexture);,

Then, follower rendered properly without performance loss. but ForceOpaqueOff()does not work.

I am using VTK 7.0.

And the renderer is vtkrenderer.


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|

Re: vtkfollower performance problem

Ken Martin
ForceOpaqueOff is an odd call to make in that spot. If you want to force the actor to be opaque use ForceOpaqueOn() if you want to force it to be Transparent use ForceTransparentOn() Maybe you want to be using ForceTransparentOn() ?

On Tue, Dec 5, 2017 at 9:08 PM, eclipse <[hidden email]> wrote:


Sorry for cross posting.

I uploaded same post StackOverflow, vtk user mailing lis, vtk git issues but nobody made an answer for this.

please forgive me.


I am trying to add vtkfollower to vtkrenderer for indicating the chosen point.

textured vtkfollower is represented correctly, but in the renderer, if I look closer (camera comes closer to polydata) it's getting really slow(frame drop) and the boundary of image turned into black. I did not set the edge line or something might be related.

then, if I move camera far from model its rendering performance is going back to normal.

here is the code.

why is this situation happening? Did I something in a wrong way?

`m_SourceFromQrc = vtkSmartPointer::New();

        m_SourceFromQrc->SetQImage(&m_qimageFromQrc);
        m_SourceFromQrc->Update();

        m_spVTKTexture = vtkSmartPointer<vtkTexture>::New();

        m_spVTKTexture->SetInputConnection(m_SourceFromQrc->GetOutputPort());
        m_spVTKTexture->Update();

        m_spVTKPlane = vtkSmartPointer<vtkPlaneSource>::New();

        m_spVTKPlane->SetNormal(0.0, 0.0, 1.0);


        m_spVTKTextureMappedPlane = vtkSmartPointer<vtkTextureMapToPlane>::New();

        m_spVTKTextureMappedPlane->SetInputConnection(m_spVTKPlane->GetOutputPort());

        m_planeDataMapper = vtkSmartPointer<vtkOpenGLPolyDataMapper>::New();

        m_planeDataMapper->SetInputConnection(m_spVTKTextureMappedPlane->GetOutputPort());


        double followerOriginPoint[3] = { 0.0 };
        followerOriginPoint[1] = -1 / 2.0;

        m_follower = vtkSmartPointer< vtkFollower>::New();
        m_follower->SetOrigin(followerOriginPoint); 

        m_follower->SetPosition(
            pos[0] - followerOriginPoint[0],
            pos[1] - followerOriginPoint[1],
            pos[2] - followerOriginPoint[2]);
        m_follower->SetScale(6);
        m_follower->SetMapper(m_planeDataMapper);
        m_follower->SetTexture(m_spVTKTexture);

        m_follower->SetCamera(getRenderer(m_rendererType)->GetActiveCamera());
        m_follower->VisibilityOn();
        m_follower->ForceOpaqueOff();
        getRenderer(m_rendererType)->AddActor(m_follower);`

If I change this code m_follower->SetTexture(m_spVTKTexture);

into m_follower->GetProperty()->SetTexture(m_spVTKTexture);,

Then, follower rendered properly without performance loss. but ForceOpaqueOff()does not work.

I am using VTK 7.0.

And the renderer is vtkrenderer.


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers





--
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.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|

Re: vtkfollower performance problem

eclipse
First of all, Thanks for Reply.

I want to make vtkfollower come to front regardless of any other polydata. 

Whether or not I move camera position, vtkollower should be rendered.

  camera  -  vtkfolllower - actor of other polydatas.






2017-12-08 23:50 GMT+09:00 Ken Martin <[hidden email]>:
ForceOpaqueOff is an odd call to make in that spot. If you want to force the actor to be opaque use ForceOpaqueOn() if you want to force it to be Transparent use ForceTransparentOn() Maybe you want to be using ForceTransparentOn() ?

On Tue, Dec 5, 2017 at 9:08 PM, eclipse <[hidden email]> wrote:


Sorry for cross posting.

I uploaded same post StackOverflow, vtk user mailing lis, vtk git issues but nobody made an answer for this.

please forgive me.


I am trying to add vtkfollower to vtkrenderer for indicating the chosen point.

textured vtkfollower is represented correctly, but in the renderer, if I look closer (camera comes closer to polydata) it's getting really slow(frame drop) and the boundary of image turned into black. I did not set the edge line or something might be related.

then, if I move camera far from model its rendering performance is going back to normal.

here is the code.

why is this situation happening? Did I something in a wrong way?

`m_SourceFromQrc = vtkSmartPointer::New();

        m_SourceFromQrc->SetQImage(&m_qimageFromQrc);
        m_SourceFromQrc->Update();

        m_spVTKTexture = vtkSmartPointer<vtkTexture>::New();

        m_spVTKTexture->SetInputConnection(m_SourceFromQrc->GetOutputPort());
        m_spVTKTexture->Update();

        m_spVTKPlane = vtkSmartPointer<vtkPlaneSource>::New();

        m_spVTKPlane->SetNormal(0.0, 0.0, 1.0);


        m_spVTKTextureMappedPlane = vtkSmartPointer<vtkTextureMapToPlane>::New();

        m_spVTKTextureMappedPlane->SetInputConnection(m_spVTKPlane->GetOutputPort());

        m_planeDataMapper = vtkSmartPointer<vtkOpenGLPolyDataMapper>::New();

        m_planeDataMapper->SetInputConnection(m_spVTKTextureMappedPlane->GetOutputPort());


        double followerOriginPoint[3] = { 0.0 };
        followerOriginPoint[1] = -1 / 2.0;

        m_follower = vtkSmartPointer< vtkFollower>::New();
        m_follower->SetOrigin(followerOriginPoint); 

        m_follower->SetPosition(
            pos[0] - followerOriginPoint[0],
            pos[1] - followerOriginPoint[1],
            pos[2] - followerOriginPoint[2]);
        m_follower->SetScale(6);
        m_follower->SetMapper(m_planeDataMapper);
        m_follower->SetTexture(m_spVTKTexture);

        m_follower->SetCamera(getRenderer(m_rendererType)->GetActiveCamera());
        m_follower->VisibilityOn();
        m_follower->ForceOpaqueOff();
        getRenderer(m_rendererType)->AddActor(m_follower);`

If I change this code m_follower->SetTexture(m_spVTKTexture);

into m_follower->GetProperty()->SetTexture(m_spVTKTexture);,

Then, follower rendered properly without performance loss. but ForceOpaqueOff()does not work.

I am using VTK 7.0.

And the renderer is vtkrenderer.


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers





--
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.


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers