[vtkusers] Drawing half a million "vtkParametricEllipsoid"s

VoodooCode MaxSchererMax at gmail.com
Wed May 22 08:56:34 EDT 2013


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.



More information about the vtkusers mailing list