[vtkusers] Help (rendering large no. of spheres)
David.Pont at ForestResearch.co.nz
David.Pont at ForestResearch.co.nz
Wed Oct 30 15:31:23 EST 2002
Dharmendra
> Can someone go thru the code and suggest me where Iam wrong (if at all).
You should try vtkLODActor instead of vtkActor, and you can control the
switch to lower LOD with
vtkRenderWindowInteractor->SetDesiredUpdateRate( DisplayFramesPerSecond
);
I see in your code that you use a value of 9 for SetThetaResolution
SetPhiResolution. This is quite high if you have large numbers of points
(81? triangles per sphere, * lots of points). Try lower values, OK you lose
sphere quality but interaction is your problem. Spheres are useful glyphs
(look the same from any angle) but they are costly in triangles. Try
vtkCubeSource, I'll bet that cranks up the speed.
But wait.... Interesting what a bit of reading can uncover, I just found a
class I never knew existed: vtkLODProp3D, this looks as though you can set
up mappers that have used spheres of differing resolution (for example),
say 9, 6, 3; and have the renderer switch between them to try and get your
desired update rate. You could also add a mapper directly from the point
data to get points as a lowest level of detail. The earlier suggestion of
using vtkMaskPoints, then to glyphs, could be used too...
This sounds promising... I suppose the only danger is consuming all your
memory with these multiple representations of the data, given it is
'large'.
Dave Pont
|--------+--------------------------------->
| | Dharmendra |
| | <dharmendra at strandgenom|
| | ics.com> |
| | Sent by: |
| | vtkusers-admin at public.k|
| | itware.com |
| | |
| | |
| | 30/10/2002 18:29 |
| | |
|--------+--------------------------------->
>------------------------------------------------------------------------------------------------------------|
| |
| To: vtkusers at public.kitware.com |
| cc: |
| Subject: [vtkusers] Help (rendering large no. of spheres) |
>------------------------------------------------------------------------------------------------------------|
Hello All,
Well iam sending a peice of code that I have wriiten for rendering.
I think this is where it is getting slowed down.
Can someone go thru the code and suggest me where Iam wrong (if at all).
Directly in C++ is slow .I have created a dll and used it in python it is
dead slow.
coord_dump has basically sphere positions .
sphereSource = vtkSphereSource::New();
sphereSource->SetThetaResolution(9);
sphereSource->SetPhiResolution(9);
sphereSource->SetRadius(2);
ifstream file("F:\\docking\\dock\\dock\\reader\\coord_dump");
cout << file.is_open() <<endl;
char str[10];
float coord[3];
float radius;
file >>str>>radius >> coord[0] >> coord[1] >> coord[2] ;
int i = 0;
while( !file.eof() ){
file >>str>>radius >> coord[0] >> coord[1] >> coord[2]
;
atomPoints->InsertNextPoint(coord);
i++;
}
// Create a data set for the atoms.
atomsPolyData = vtkPolyData::New();
atomsPolyData->SetPoints(atomPoints);
atomPoints->Delete();
// Create atoms, using a vtkGlyph3D object
vtkGlyph3D *atoms = vtkGlyph3D::New();
atoms->SetInput(atomsPolyData);
atoms->SetSource(sphereSource->GetOutput());
atoms->SetScaleFactor(0.7);
atoms->SetScaleModeToScaleByScalar();
// Create the mapper and actor and finish up the visualization pipeline
vtkPolyDataMapper *atomsMapper = vtkPolyDataMapper::New();
atomsMapper->SetInput(atoms->GetOutput());
vtkActor *atomsActor = vtkActor::New();
atomsActor->SetMapper(atomsMapper);
ren->AddActor(atomsActor);
ren->SetBackground(155,133,122);
// interact with data
renWin->Render();
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: <
http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list