[vtkusers] [other] Rendering 2D image and points

James Dippner jdippner at informetric.com
Thu Aug 28 18:37:10 EDT 2008


Try using PolyDataMapper::ScalarVisibilityOff()

Pascale Beliveau wrote:
> Hi James,
>  
>    Unfortunately, if I set the visibility to false, the points are not 
> rendered at all. I made the test rendering only the points with 
> visibility set to false and true and this will not help for the 
> transparancy.
>  
> To set the opacity, I used vtkImageBlend for the image. I also set the 
> alpha factor for the points using the lookuptable but it did not help. 
> I can still only render or the image, or the points and not both at 
> the same time.
>  
>  If you have other suggestions, I would appreciate it! I still have 
> the problem,
>  
> Pascale
>  
>  
>  
> On 8/28/08, *James Dippner* <jdippner at informetric.com 
> <mailto:jdippner at informetric.com>> wrote:
>
>     You might try setting the cell visibility on the points actor to
>     false, you may also try setting the opacity for the same actor.
>
>
>
>     Pascale Beliveau wrote:
>
>         Hi vtkusers,
>             I want to try a simple task: show an image (jpg) and see
>         points over it. I have done the following code but the image
>         is shown darker than it should. When rendered alone, the image
>         has the correct intensities. Here is what I did:
>          - create polydata from points and cells
>         - create PolyDataMapper, Actor and Renderer for polydata
>         - create ImageMapper, Actor2D and Renderer for image
>         (vtkImageData)
>         - create RenderWindow and add both renderer for polydata and
>         for image
>          Is there something I'm missing, or do I add both images
>         incorectly to the RenderWindow? I'm a bit puzzled by this
>         effect and did not find anything helpfull on the mailing list.
>          Thanks in advance for your help,
>         Pascale
>           The following is the code I created:
>          // create set of points that will deform image
>         vtkPoints * Points = vtkPoints::New();
>         Points->SetNumberOfPoints(2);
>         Points->SetPoint(0,1,1,1);
>         Points->SetPoint(1,10,10,10);
>         vtkCellArray * Cells = vtkCellArray::New();
>         Cells->InsertNextCell(2);
>         Cells->InsertCellPoint(0);
>         Cells->InsertCellPoint(1);
>
>         vtkPolyData * PolyData = vtkPolyData::New();
>         PolyData->SetPoints(Points);
>         PolyData->SetVerts(Cells);
>
>         // create image viewer
>         vtkImageMapper * MapImage = vtkImageMapper::New();
>         MapImage->SetInput(Image);
>         vtkActor2D * ImActor = vtkActor2D::New();
>         ImActor->SetMapper(MapImage);
>         vtkRenderer * ImRenderer = vtkRenderer::New();
>         ImRenderer->AddActor2D(ImActor);
>
>         vtkRenderWindowInteractor * Interactor =
>         vtkRenderWindowInteractor::New();
>
>         // create viewer for points
>         vtkPolyDataMapper * Mapper = vtkPolyDataMapper::New();
>         Mapper->SetInput(PolyData);
>         vtkActor * Actor = vtkActor::New();
>         Actor->SetMapper(Mapper);
>         vtkRenderer * Renderer = vtkRenderer::New();
>         Renderer->AddViewProp(Actor);
>           // add both to main render window
>         vtkRenderWindow * RenderWindow = vtkRenderWindow::New();
>         RenderWindow->SetSize(400,600);
>         RenderWindow->SetInteractor(Interactor);
>         RenderWindow->AddRenderer(Renderer);
>         RenderWindow->AddRenderer(ImRenderer);
>         RenderWindow->Render();
>         Interactor->Start();
>         ------------------------------------------------------------------------
>
>         _______________________________________________
>         This is the private VTK discussion list.
>         Please keep messages on-topic. Check the FAQ at:
>         http://www.vtk.org/Wiki/VTK_FAQ
>         Follow this link to subscribe/unsubscribe:
>         http://www.vtk.org/mailman/listinfo/vtkusers
>          
>
>
>     -- 
>
>

-- 



More information about the vtkusers mailing list