[Paraview] Disappearing volume rendering?

B.W.H. van Beest bwvb at xs4all.nl
Mon Oct 13 10:19:36 EDT 2014


Hi,

I'm struggling to get a proper 3D view of my model system (yes,
embarrassing!)
but must admit my defeat.
After stripping almost everything, keeping the minimum to exhibit the
issue,
I'm left with the following:

I have created a simple box source. To get a 3D representation, I
sub-classed
the code for this Source from vtkUnstructuredGridAlgorithm.

In the RequestData method, I define the 8 point of the unit cube. I
added the points to the
underlying unstructed grid, and I specified the cell topology.

This all seems to work: when instantiating this box Source, I *do* get the
expected cube in the representations (Surface, wireframe, Points).

However, when I select the "Volume" representation, *the image disappears*
What am I doing wrong?

As the code is not too long and very simple, I take the freedom to paste
it below.

Kind regards.
Bertwim

=========================================

 int sphBoxSourceC::RequestData( vtkInformation *vtkNotUsed(request),
                                vtkInformationVector
**vtkNotUsed(inputVector),
                                vtkInformationVector *outputVector)
{
   // Get the info object
   vtkInformation *outInfo = outputVector->GetInformationObject(0);
   vtkUnstructuredGrid *umesh = vtkUnstructuredGrid::SafeDownCast(
outInfo->Get( vtkDataObject::DATA_OBJECT() ) );
  
   // Pre-allocate some memory
   umesh->Allocate( 1024 );

   // Specify points.
   double r0[] = { 0.0, 0.0, 0.0 };
   double r1[] = { 1.0, 0.0, 0.0 };
   double r2[] = { 0.0, 1.0, 0.0 };
   double r3[] = { 1.0, 1.0, 0.0 };
   double r4[] = { 0.0, 0.0, 1.0 };
   double r5[] = { 1.0, 0.0, 1.0 };
   double r6[] = { 0.0, 1.0, 1.0 };
   double r7[] = { 1.0, 1.0, 1.0 };
  
   // Collect the points in a vtk data structures.
   {
      vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
      points->SetDataType( VTK_DOUBLE );

      points->InsertNextPoint( r0 );
      points->InsertNextPoint( r1 );
      points->InsertNextPoint( r2 );
      points->InsertNextPoint( r3 );
      points->InsertNextPoint( r4 );
      points->InsertNextPoint( r5 );
      points->InsertNextPoint( r6 );
      points->InsertNextPoint( r7 );

      // Transfer points to umesh.
      umesh->SetPoints( points );
   }

   // Cell Topology
   vtkIdType vtx[8] = { 0, 1, 3, 2, 4, 5, 7, 6 };
   umesh->InsertNextCell( VTK_HEXAHEDRON, 8, vtx );

   return 1;
}





More information about the ParaView mailing list