[vtkusers] Drawing half a million "vtkParametricEllipsoid"s
David E DeMarle
dave.demarle at kitware.com
Wed May 22 09:23:59 EDT 2013
vtkGlyph3D will be more efficient. vtkGlyph3DMapper will be still more
efficient.
The concept you want is to define a single data set with points at the
locations where you want the elipsoids and the rotation matrices encoded
into a vector field on those locations, then apply either glypher to place
and orient a single ellipsoid instance onto that data set.
David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909
On Wed, May 22, 2013 at 8:56 AM, VoodooCode <MaxSchererMax at gmail.com> wrote:
> Hi,
>
> I want to draw half a million ellipsoids, all defined by their radii, a
> rotation matrix and a translation. Unfortunetly my code is way to slow to
> do
> this. It takes way to much GPU and graphic card memory. Drawing 16k
> ellipsoids is the maximum if I draw them in a loop using the provided
> sample
> code.
>
> I have read that there are people drawing about a million objects so I'm
> wondering why I'm that slow when drawing only half a million simple
> ellipsoids.
>
> In oder to give you some background information:
> I want to draw 500k Ellipsoids
> Rotation matrix(already combined, single matrices are not available) per
> ellipsoid
> Translation vector per ellipsoid.
> Set of radii per ellipsoid.
>
> This is my code sample. There is a loop using this code to draw all the
> ellipsoids, but for some reason it is terribly slow:
>
> //Start of sample
>
> vtkSmartPointer<vtkParametricEllipsoid> parametricVTKEllipsoid =
> vtkSmartPointer<vtkParametricEllipsoid>::New();
> vtkSmartPointer<vtkParametricFunctionSource>
> parametricFunctionSource =
> vtkSmartPointer<vtkParametricFunctionSource>::New();
> vtkSmartPointer<vtkMatrix4x4> transformationMatrix =
> vtkSmartPointer<vtkMatrix4x4>::New();
> vtkSmartPointer<vtkMatrixToLinearTransform>
> matrixToLinearTransform =
> vtkSmartPointer<vtkMatrixToLinearTransform>::New();
> vtkSmartPointer<vtkPolyDataMapper> mapper =
> vtkSmartPointer<vtkPolyDataMapper>::New();
> vtkSmartPointer<vtkLODActor> actor =
> vtkSmartPointer<vtkLODActor>::New();
>
> //Definition and transformation of the vtkEllipsoid
> parametricVTKEllipsoid->SetXRadius(radius[0]);
> parametricVTKEllipsoid->SetYRadius(radius[1]);
> parametricVTKEllipsoid->SetZRadius(radius[2]);
>
> parametricFunctionSource->SetParametricFunction(parametricVTKEllipsoid);
> parametricFunctionSource->Update();
>
> //Configuration of the rotation/translation
> configureMatrix(position, rotation, transformationMatrix);
> matrixToLinearTransform->SetInput(transformationMatrix);
> matrixToLinearTransform->Update();
>
> mapper->SetInput(parametricFunctionSource->GetOutput());
> actor->SetMapper(mapper);
> actor->SetUserTransform(matrixToLinearTransform);
>
> renderer_->AddActor(actor);
>
> //End of sample
>
> Regards,
> VoodooCode
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Drawing-half-a-million-vtkParametricEllipsoid-s-tp5720865.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130522/f9a8a124/attachment.htm>
More information about the vtkusers
mailing list