4
$\begingroup$

I'm attempting to view and rotate a Graphics3D object with a very large set of geometric primitives ($\approx 10^6$ objects such as spheres or lines), and everything is functioning very slowly. Are there any tricks for speeding up object display / manipulations or to spread the burden of redrawing the image over multiple cores?

Also, how can I specify that the object should initially appear larger in the Mathematica workbook? More specifically, I mean that I would like to specify that the output for some Graphics3D[...] command should initially be displayed at a specified size in the workbook?

$\endgroup$
5
$\begingroup$

For image size look at this question. For the rest... Well I think @SjoerdC.deVries thoughts are spot on. I also can add that probably a powerful video card will make a difference. With 10^5 spheres my GPU load goes sky-high. Yet in terms of memory and computational time to simply create the graphics initially you need to use GraphicsComplex because it is treated as single graphics primitive. This may also help you with some further manipulations. For example if you are adding spheres with a Dynamic slider - GraphicsComplex will work much faster. Here is some simple numbers:

Compute 10^5 points:

p = RandomReal[1, {10^5, 3}];

Build 10^5 spheres using GraphicsComplex and compute time and size

obj = GraphicsComplex[p, Sphere[Range[10^5], .01]];
t0 = AbsoluteTime[];
gr = Graphics3D[obj]
AbsoluteTime[] - t0
gr // ByteCount

enter image description here

Build 10^5 spheres, each separately and compute time and size

obj = Sphere[#, .01] & /@ p;
t0 = AbsoluteTime[];
gr = Graphics3D[obj]
AbsoluteTime[] - t0
gr // ByteCount

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.