<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif; "><div><div><div>I am assuming that you have already got your volume rendering working in serial.</div><div><br></div><div>At first glance, I can see that the IceT parallel render manager is in the wrong compositing mode. By default, the manager uses a z buffer comparison as its composite operation. That works great for opaque surfaces, but does not work at all for transparent objects (as is the case for volume rendering). In fact, I believe most of the volume rendering algorithms write nothing in the z buffer, so IceT will assume that nothing is rendered and throw away all your rendered pixels.</div><div><br></div><div>You need to tell the parallel render manager to do alpha blending. Because alpha blending is order dependent, you also have to tell the parallel render manager the spatial decomposition of your data. You do that by creating a vtkPKdTree to the parallel render manager (if I remember right).</div><div><br></div><div>-Ken</div><div>
<font size="2"><font face="Consolas,Courier New,Courier"><span style="font-size:10pt"><br>
**** Kenneth Moreland<br>
*** Sandia National Laboratories<br>
*********** <br>
*** *** *** email: <font color="#0000FF"><u><a href="kmorel@sandia.gov">kmorel@sandia.gov</a><br>
</u></font>** *** ** phone: (505) 844-8919<br>
*** web: <font color="#0000FF"><u><a href="http://www.cs.unm.edu/~kmorel">http://www.cs.unm.edu/~kmorel</a></u></font><br>
</span></font></font>
</div></div></div><div><br></div><span id="OLK_SRC_BODY_SECTION"><div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt"><span style="font-weight:bold">From: </span> ºú½¡ <<a href="mailto:hujian198681@gmail.com">hujian198681@gmail.com</a>><br><span style="font-weight:bold">Date: </span> Sat, 19 Feb 2011 01:47:33 -0700<br><span style="font-weight:bold">To: </span> "<a href="mailto:paraview@paraview.org">paraview@paraview.org</a>" <<a href="mailto:paraview@paraview.org">paraview@paraview.org</a>><br><span style="font-weight:bold">Subject: </span> [Paraview] is there any wrong?<br></div><div><br></div><p>dear all: <br> I want to parallel volume rendering in my computer, but I can not make it parallel, here is my code. Is there any wrong? <br>#include "vtkCompositeRenderManager.h" <br>#include "vtkRenderWindow.h" <br>
#include "vtkRenderWindowInteractor.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 <vtkHAVSVolumeMapper.h> <br>#include <vtkDataSetTriangleFilter.h> <br>#include <vtkPiecewiseFunction.h> <br>#include <vtkColorTransferFunction.h> <br>
#include <vtkVolumeProperty.h> <br>#include <vtkVolume.h> <br>#include <vtkPolyDataMapper.h> <br>#include <vtkStdString.h> <br>#include <vtkXMLUnstructuredGridReader.h> <br>#include <vtkStructuredGridOutlineFilter.h> <br>
#include <vtkStreamLine.h> <br>#include <vtkProperty.h> <br>#include "vtkPointData.h" <br>#include <vtkPointSource.h> <br>#include <vtkTubeFilter.h> <br>#include "vtkPolyDataMapper.h" <br>
#include "vtkRenderWindow.h" <br>#include "vtkRenderWindowInteractor.h" <br>#include "vtkIceTRenderManager.h" <br>#include "vtkMPIController.h" <br>#include "vtkDataSetMapper.h" <br>
#include "vtkContourFilter.h" <br>#include "vtkActor.h" <br>#include "vtkRenderWindow.h" <br>#include "vtkRenderer.h" <br>#include "vtkActor.h" <br>#include "vtkPolyDataMapper.h" <br>
#include "vtkSmartPointer.h" <br>#include "vtkDistributedDataFilter.h" <br>#include "vtkDataSetAttributes.h" <br>#include "vtkProjectedTetrahedraMapper.h" <br>#include "vtkUnstructuredGrid.h" <br>
#include "vtkUnstructuredGridVolumeRayCastMapper.h" <br>#include "vtkIceTRenderer.h" <br>#include "vtkParallelRenderManager.h" <br>#include "vtkOrderedCompositeDistributor.h" <br>#include "vtkPKdTree.h" <br>
#include "vtkFixedPointVolumeRayCastMapper.h" <br>#include <iostream> <br>using namespace std; <br>struct args_struct <br>{ <br> int argc; <br> char** argv; <br>}; <br><br>void process(vtkMultiProcessController* controller, void* arg) <br>
{ <br> int myId = controller->GetLocalProcessId(); <br> args_struct * args = reinterpret_cast<args_struct *>(arg); <br><br> vtkIceTRenderManager *manager = vtkIceTRenderManager::New(); <br> //vtkCompositeRenderManager *manager = vtkCompositeRenderManager::New(); <br>
//vtkRenderer *ren = manager->MakeRenderer(); <br> vtkIceTRenderer *ren =vtkIceTRenderer::New(); <br> vtkRenderWindow* renWin = manager->MakeRenderWindow(); <br> renWin->AddRenderer(ren); <br>
renWin->SetSize(400, 300); <br><br><br><br> if(myId == 0) <br> renWin->SetPosition(400, 500); <br><br> manager->SetRenderWindow(renWin); <br> manager->SetController(controller); <br><br> vtkRenderWindowInteractor* iren = <br> vtkRenderWindowInteractor::New(); <br> iren->SetRenderWindow(renWin); <br><br> std::string dataRoot = "E:\\vtkdata-5.4.2\\VTKData"; <br><br> std::string filename = dataRoot + "/Data/hj_vector_xyz2.vtu"; <br><br> vtkXMLUnstructuredGridReader *reader = vtkXMLUnstructuredGridReader::New(); <br> reader->SetFileName(filename.c_str()); <br><br>/////////////////////////////////////////////////////////////////////////////////////Ìå»æÖÆ <br><br><br> vtkDistributedDataFilter * piece = vtkDistributedDataFilter::New(); <br> piece->SetInputConnection(reader->GetOutputPort()); <br>
piece->SetController(controller); <br><br><br> vtkDataSetTriangleFilter *trifilter = vtkDataSetTriangleFilter::New(); <br> trifilter->SetInputConnection(piece->GetOutputPort()); <br><br><br>
vtkPiecewiseFunction *opacityTransferFunction = vtkPiecewiseFunction::New(); <br> opacityTransferFunction->AddPoint(-3.0, 0.02); <br> opacityTransferFunction->AddPoint(0.0, 0.04); <br> opacityTransferFunction->AddPoint(2.0, 0.06); <br><br><br> vtkColorTransferFunction *colorTransferFunction = vtkColorTransferFunction::New(); <br> colorTransferFunction->AddRGBPoint(-3, 1, 1.0, 0.0); <br> colorTransferFunction->AddRGBPoint(-1, 1, 1, 0); <br>
colorTransferFunction->AddRGBPoint(0, 1, 1, 0); <br> colorTransferFunction->AddRGBPoint(1.0, 1, 0.0, 0.0); <br> colorTransferFunction->AddRGBPoint(1.5, 1, 1.0, 0); <br><br> vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New(); <br>
volumeProperty->SetColor(colorTransferFunction); <br> volumeProperty->SetScalarOpacity(opacityTransferFunction); <br><br><br> vtkHAVSVolumeMapper *volumeMapper = vtkHAVSVolumeMapper::New(); <br>
volumeMapper->SetInputConnection(trifilter->GetOutputPort()); <br> volumeMapper->SetGPUDataStructures(true); <br> volumeMapper->SetKBufferSizeTo2(); <br><br><br> vtkVolume *volume = vtkVolume::New(); <br>
volume->SetMapper(volumeMapper); <br> volume->SetProperty(volumeProperty); <br><br> ren->AddActor(volume); <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><br> iren->Delete(); <br> renWin->Delete(); <br> manager->Delete(); <br>} <br><br>int main( int argc, char* argv[] ) <br>{ <br><br> vtkMPIController* controller = vtkMPIController::New(); <br>
controller->Initialize(&argc, &argv); <br> vtkMultiProcessController::SetGlobalController(controller); <br><br> args_struct args; <br> args.argc = argc; <br> args.argv = argv; <br><br><br> controller->SetSingleMethod(process,&args); <br> controller->SingleMethodExecute(); <br><br> controller->Finalize(); <br> controller->Delete(); <br><br> return 0; <br>
} <br><br></p></span></body></html>