[vtkusers] Points Color's Opacity

harshanand harsha.nyshadham at gmail.com
Mon Mar 11 16:38:08 EDT 2013


Hi Guys,

Two Questions:

1)
I created three points in the same position and 3 vertex for them. For each
point I assigned color's Red,Green,Blue respectively and set alpha as
0.5(half opacity).

I expected to see a white point since opacity of all 3 points is half,and
also since Red,Green,Blue should merge into white. However I get blue but a
little less brighter than blue with half opacity. But shouldn't it be white?
( or at least closer to white may be a bit dim)

My project involves rendering many points over same position, so I liked to
view the effect of point colors merge when their opacity is half (like a
bright effect ).

2)
How do I add different brightness to each point like (diffuse and
specular)?( points from polydata)

Thanks <http://vtk.1045678.n5.nabble.com/file/n5719252/pointcolor.png> 
Harsha

Code Snippet:

 vtkSmartPointer<vtkPoints> points =
    vtkSmartPointer<vtkPoints>::New();
  points->InsertNextPoint (0.0, 0.0, 0.0);
  points->InsertNextPoint (1.0, 0.0, 0.0);
  points->InsertNextPoint (0.0, 1.0, 0.0);
  points->InsertNextPoint (1.0, 1.0, 0.0);
  points->InsertNextPoint (1.0, 1.0, 0.0);
  points->InsertNextPoint (1.0, 1.0, 0.0);
 
  vtkSmartPointer<vtkPolyData> pointsPolydata =
    vtkSmartPointer<vtkPolyData>::New();
 
  pointsPolydata->SetPoints(points);
 
  vtkSmartPointer<vtkVertexGlyphFilter> vertexFilter =
    vtkSmartPointer<vtkVertexGlyphFilter>::New();
#if VTK_MAJOR_VERSION <= 5
  vertexFilter->SetInputConnection(pointsPolydata->GetProducerPort());
#else
  vertexFilter->SetInputData(pointsPolydata);
#endif
  vertexFilter->Update();
 
  vtkSmartPointer<vtkPolyData> polydata =
    vtkSmartPointer<vtkPolyData>::New();
  polydata->ShallowCopy(vertexFilter->GetOutput());
 
  // Setup colors
  unsigned char red[4] = {255, 0, 0,130};
  unsigned char green[4] = {0, 255, 0,130};
  unsigned char blue[4] = {0, 0, 255,130};
 
  vtkSmartPointer<vtkUnsignedCharArray> colors =
    vtkSmartPointer<vtkUnsignedCharArray>::New();
  colors->SetNumberOfComponents(4);
  colors->SetName ("Colors");
  colors->InsertNextTupleValue(red);
  colors->InsertNextTupleValue(green);
  colors->InsertNextTupleValue(blue);
  colors->InsertNextTupleValue(red);
  colors->InsertNextTupleValue(green);
  colors->InsertNextTupleValue(blue);
 
  polydata->GetPointData()->SetScalars(colors);



--
View this message in context: http://vtk.1045678.n5.nabble.com/Points-Color-s-Opacity-tp5719252.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list