[vtkusers] Volume Rendering with vtkUnstructuredGridRayCastMapper

Dominik Szczerba domi at vision.ee.ethz.ch
Wed Dec 28 15:23:51 EST 2005


smells like platform specific problems. get a linux test box.
--domi

Randall Hand wrote:
> I pull it from cvs (cvs co -r VTK-5-0).
> 
> As for using the version with Paraview, i'ld love to.. But unfortunately due
> to a wierd quirk with Cmake/Paraview/Irix we are unable to compile Paraview
> on Irix due to problems with command lines being too long.  Also, no binary
> version of paraview is offered for Irix anymore via paraview.org .  So I
> have to run Paraview on Windows, but this VTK work is being done on Irix.
> 
> On 12/28/05, Dominik Szczerba <domi at vision.ee.ethz.ch> wrote:
> 
>>where did you get 5.0 from? I dont see it on vtk.org
>>then why not try vtk that comes along with paraview?
>>--domi
>>
>>Randall Hand wrote:
>>
>>>I don't think these classes exist in the 4.4.  Plus alot of stuff has
>>>changed between 4.4 & 5.0 (This isn't CVS head, it's the 5.0 Branch
>>
>>that's
>>
>>>supposed to be pretty stable), that makes it pretty difficult for me to
>>>backport.
>>>
>>>On 12/28/05, Dominik Szczerba <domi at vision.ee.ethz.ch> wrote:
>>>
>>>
>>>>Did you try with the "official" 4.4? I often have problems with the CVS
>>>>version.
>>>>--domi
>>>>
>>>>Randall Hand wrote:
>>>>
>>>>
>>>>>I'm attempting to render an unstructured dataset that contains 1 vector
>>>>>field and 7 scalar fields.  I want to map Color & Opacity to one of the
>>>>
>>>>1
>>>>
>>>>
>>>>>scalar fields (both to the same one) and volume render it.  I can do
>>>>
>>>>this in
>>>>
>>>>
>>>>>Paraview easily (screenie attached), but my VTK code returns a blank
>>>>
>>>>black
>>>>
>>>>
>>>>>window everytime.  Am I missing something here?
>>>>>
>>>>>I'm doing it all offscreen on an SGI Irix box (Onyx340) with the VTK
>>>>>5.0Branch installed & MangledMesa.  The code I'm using is below:
>>>>>
>>>>>==============================
>>>>>#include <vtkColorTransferFunction.h >
>>>>>#include <vtkDataSetReader.h>
>>>>>#include <vtkPiecewiseFunction.h>
>>>>>#include <vtkUnstructuredGridVolumeRayCastMapper.h>
>>>>>#include <vtkUnstructuredGrid.h>
>>>>>#include < vtkDataSet.h>
>>>>>#include <vtkRenderWindow.h>
>>>>>#include <vtkRenderer.h>
>>>>>#include <vtkRenderLargeImage.h>
>>>>>#include <vtkPNGWriter.h>
>>>>>#include <vtkVolumeProperty.h>
>>>>>#include <vtkDataSetTriangleFilter.h >
>>>>>#include <vtkImagingFactory.h>
>>>>>#include <vtkGraphicsFactory.h>
>>>>>void main(void) {
>>>>>   vtkGraphicsFactory *factGraphics = vtkGraphicsFactory::New();
>>>>>   factGraphics->SetUseMesaClasses(1);
>>>>>   factGraphics->SetOffScreenOnlyMode(1);
>>>>>   factGraphics->Delete();
>>>>>   vtkImagingFactory *factImage = vtkImagingFactory::New();
>>>>>   factImage->SetUseMesaClasses(1);
>>>>>   factImage->Delete();
>>>>>   vtkDataSetReader *reader = vtkDataSetReader::New();
>>>>>   reader->SetFileName("../VTK/step_127.vtk");
>>>>>   reader->ReadAllScalarsOn();
>>>>>
>>>>>   vtkDataSetTriangleFilter *tri = vtkDataSetTriangleFilter::New();
>>>>>   tri->SetInput(reader->GetOutput());
>>>>>
>>>>>
>>>>>   vtkColorTransferFunction *color = vtkColorTransferFunction::New();
>>>>>
>>>>>   color->AddRGBPoint(250, 0, 0, 1);
>>>>>   color->AddRGBPoint(450, 1, 0, 0);
>>>>>   color->AddRGBPoint(2600, 1, 1, 0);
>>>>>   color->AddRGBPoint(5000, 1, 1, 1);
>>>>>
>>>>>   vtkPiecewiseFunction *opacity = vtkPiecewiseFunction::New();
>>>>>   opacity->AddPoint(250, 0.1);
>>>>>   opacity->AddPoint(450, 0.1);
>>>>>   opacity->AddPoint(2600, 0.25);
>>>>>   opacity->AddPoint(5000, 1.0);
>>>>>
>>>>>   vtkVolumeProperty *volProp = vtkVolumeProperty::New();
>>>>>   volProp->SetColor(color);
>>>>>   volProp->SetScalarOpacity(opacity);
>>>>>   volProp->SetInterpolationTypeToLinear();
>>>>>
>>>>>   vtkUnstructuredGridVolumeRayCastMapper *mapper =
>>>>>           vtkUnstructuredGridVolumeRayCastMapper::New();
>>>>>   mapper->SetScalarModeToUsePointFieldData();
>>>>>   mapper->SelectScalarArray("Temperature");
>>>>>   mapper->SetInput(tri->GetOutput());
>>>>>
>>>>>   vtkVolume *volume = vtkVolume::New();
>>>>>   volume->SetMapper(mapper);
>>>>>   volume->SetProperty(volProp);
>>>>>   volume->Update();
>>>>>   vtkRenderWindow *renWin = vtkRenderWindow::New();
>>>>>   vtkRenderer *ren1 = vtkRenderer::New();
>>>>>   renWin->OffScreenRenderingOn();
>>>>>   renWin->AddRenderer(ren1);
>>>>>
>>>>>   ren1->AddVolume(volume);
>>>>>   ren1->ResetCamera();
>>>>>   renWin->SetSize(1024, 1024);
>>>>>   renWin->Modified();
>>>>>
>>>>>   vtkRenderLargeImage *w2if = vtkRenderLargeImage::New();
>>>>>   w2if->SetInput(ren1);
>>>>>   w2if->SetMagnification(1);
>>>>>
>>>>>   vtkPNGWriter *png  = vtkPNGWriter::New();
>>>>>   png->SetInput(w2if->GetOutput());
>>>>>   png->SetFileName("output.png");
>>>>>   png->Write();
>>>>>}
>>>>>===============
>>>>>
>>>>>
>>>>>--
>>>>>Randall Hand
>>>>>Visualization Scientist,
>>>>>ERDC-MSRC Vicksburg, MS
>>>>>Homepage: http://www.yeraze.com
>>>>>
>>>>>
>>>>>
>>
>>>>>------------------------------------------------------------------------
>>>>>
>>>>>
>>
>>>>>------------------------------------------------------------------------
>>>>>
>>>>>_______________________________________________
>>>>>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
>>>>
>>>>--
>>>>Dominik Szczerba, Dr.
>>>>Computer Vision Lab CH-8092 Zurich
>>>>http://www.vision.ee.ethz.ch/~domi
>>>>
>>>
>>>
>>>
>>>
>>>--
>>>Randall Hand
>>>Visualization Scientist,
>>>ERDC-MSRC Vicksburg, MS
>>>Homepage: http://www.yeraze.com
>>>
>>
>>--
>>Dominik Szczerba, Dr.
>>Computer Vision Lab CH-8092 Zurich
>>http://www.vision.ee.ethz.ch/~domi
>>
> 
> 
> 
> 
> --
> Randall Hand
> Visualization Scientist,
> ERDC-MSRC Vicksburg, MS
> Homepage: http://www.yeraze.com
> 

-- 
Dominik Szczerba, Dr.
Computer Vision Lab CH-8092 Zurich
http://www.vision.ee.ethz.ch/~domi



More information about the vtkusers mailing list