<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">I read from list that for vtkCompositeRenderManager, transparency can be handled by sorting the composition order, but I still can't find out how to sort the composition order? <br><br>I wrote following code to distribute data, render and composite. transparent part doesn't show up. <br><br>if vtkCompositeRenderManager can't handle transparency, is there a way to composite transparent rendered image from distributed nodes?<br><br>Thanks for help<br><br>Tracy<br><br>---------------------------------------------------------------------------------------------------------<br><br>#include "vtkCompositeRenderManager.h"<br>#include "vtkRenderWindow.h"<br>#include "vtkRenderWindowInteractor.h"<br>#include "vtkInteractorStyleTrackballCamera.h"<br>#include "vtkImageData.h"<br>#include "vtkSphereSource.h"<br>#include "vtkProperty.h"<br>#include
"vtkMPIController.h"<br>#include "vtkDataSetMapper.h"<br>#include "vtkActor.h"<br>#include "vtkRenderWindow.h"<br>#include "vtkRenderer.h"<br>#include "vtkCamera.h"<br>#include "vtkDistributedDataFilter.h"<br>//distribute data into process, composite rendered image.<br>void process(vtkMultiProcessController* controller, void* vtkNotUsed(arg))<br>{<br> int myId = controller->GetLocalProcessId();<br><br> vtkCompositeRenderManager* manager = vtkCompositeRenderManager::New();<br><br> vtkRenderer *ren = manager->MakeRenderer();<br> ren->SetBackground(1.0, 1.0, 1.0);<br><br> vtkRenderWindow* renWin = manager->MakeRenderWindow();<br> renWin->AddRenderer(ren);<br> renWin->SetSize(400, 300);<br> if(myId == 0)<br> renWin->SetPosition(400, 500);<br><br> manager->SetRenderWindow(renWin);<br>
manager->SetController(controller);<br><br> vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();<br> iren->SetRenderWindow(renWin);<br><br> vtkInteractorStyleTrackballCamera *style = vtkInteractorStyleTrackballCamera::New();<br> iren->SetInteractorStyle(style);<br><br> vtkSphereSource *sphere = vtkSphereSource::New();<br> vtkDistributedDataFilter *dist = vtkDistributedDataFilter::New();<br> dist->SetController(controller);<br> dist->SetInputConnection(sphere->GetOutputPort());<br> vtkDataSetMapper *sphereMapper = vtkDataSetMapper::New();<br> sphereMapper->SetInputConnection(dist->GetOutputPort());<br> vtkActor *sphereActor = vtkActor::New();<br> sphereActor->SetMapper(sphereMapper);<br><br> ren->AddActor(sphereActor);<br><br> if(myId == 0)<br>
{<br> sphereActor->GetProperty()->SetColor(1.0, 0.0, 1.0);<br> sphereActor->GetProperty()->SetOpacity(0.5);<br> }<br> else<br> sphereActor->GetProperty()->SetColor(0.0, 0.0, 1.0);<br> <br> if(myId==0)<br> {<br> renWin->Render();<br> ren->ResetCamera();<br> manager->StartInteractor();<br> manager->StopServices();<br> }<br> else<br> {<br> manager->StartServices();<br> }<br><br> sphere->Delete();<br> dist->Delete();<br> sphereMapper->Delete();<br> sphereActor->Delete();<br> iren->Delete();<br> style->Delete();<br> renWin->Delete();<br> manager->Delete();<br>}<br><br><br>int main( int argc, char* argv[] )<br>{<br>
<br> vtkMPIController* controller = vtkMPIController::New();<br> controller->Initialize(&argc, &argv);<br><br> if (controller->IsA("vtkThreadedController"))<br> {<br> controller->SetNumberOfProcesses(2);<br> } <br> <br> int numProcs = controller->GetNumberOfProcesses();<br> <br> if (numProcs != 2)<br> {<br> cerr << "This example requires two processes." << endl;<br> controller->Finalize();<br> controller->Delete();<br> return 1;<br> }<br><br> controller->SetSingleMethod(process, 0);<br> controller->SingleMethodExecute();<br> <br> controller->Finalize();<br> controller->Delete();<br> <br> return 0;<br>}<br><br></td></tr></table><br>