[vtkusers] Mesh Opacity
Biddiscombe, John A.
biddisco at cscs.ch
Wed May 22 03:18:54 EDT 2013
For correct transparent blending, add a vtkDepthSortPolyDataFilter (or whatever it's called). Just before the mapper, it needs the camera to be set so that it can get the correct distance order of each polygon.
JB
From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf Of max perlman
Sent: 22 May 2013 08:20
To: vtkusers at vtk.org
Subject: [vtkusers] Mesh Opacity
Dear VTKers,
I want to show a mesh(that i read from an obj file using vtkobjreader) and when i reduce opacity, not to see the triangles from which it is made.
How can i achieve this?
Part of the code:
reader = vtkOBJReader.New();
reader.SetFileName(filePath);
reader.Update();
vtkPolyDataNormals boneNormals = new vtkPolyDataNormals();
boneNormals.SetInputConnection(reader.GetOutputPort());
boneNormals.SetFeatureAngle(60.0);
vtkPolyDataMapper mapper1 = vtkPolyDataMapper.New();
mapper1.SetInputConnection(boneNormals.GetOutputPort());
actor1 = vtkActor.New();
actor1.SetMapper(mapper1);
renderWindow = renderWindowControl1.RenderWindow;
vtkRenderer renderer = renderWindow.GetRenderers().GetFirstRenderer();
// set background color
renderer.SetBackground(0.5, 0.5, 0.5);
renderer.AddActor(actor1);
renderer.ResetCamera();
renderWindow.Render();
private void button8_Click(object sender, EventArgs e)
{
if (j > 0)
{
j -= 0.1;
actor1.GetProperty().SetOpacity(j);
renderWindow.Render();
}
}
Thank you,
Max
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130522/4da45b73/attachment.htm>
More information about the vtkusers
mailing list