4
$\begingroup$

I'm trying to graph a few dynamic and animated graphs but am running into some issues. Whenever they are moving, the graphs loose almost all clarity: enter image description here

On checking the task bar, it seems like the graphs are being rendered almost entirely using the cpu and not at all with the gpu. Is there any setting/function that will allow me to use the gpu to enhance the quality of animations, or are there any other ways to keep the image clear as it animates?

The code for the above graphic is given below:

Animate[Plot3D[Sin[Pi*x/n]*Cos[Pi*y/n], {x, -2, 2}, {y, -2, 2}], {n, 
  1, 4}]
$\endgroup$
6
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – Michael E2
    Commented Feb 5, 2021 at 20:43
  • $\begingroup$ I'm not sure there's enough information here to answer your question. What code did you use to generate the graphics you are manipulating? See also RenderingOptions. $\endgroup$
    – Michael E2
    Commented Feb 5, 2021 at 20:46
  • $\begingroup$ Sorry @MichaelE2, I've added in the code. $\endgroup$
    – Flumpo
    Commented Feb 5, 2021 at 20:53
  • 1
    $\begingroup$ Each time n is updated, the cpu has to recalculate what graphics to send to the gpu. I think there's no way around that model. But the clarity is due to an option that is set while Animate is running. Try adding , PerformanceGoal -> "Quality" before the enclosing ] of Plot3D. $\endgroup$
    – Michael E2
    Commented Feb 5, 2021 at 20:58
  • $\begingroup$ Thank you, it's looking a lot better now, although there does seem to be a bit of slowdown. Are there any alternatives to Animate that might work better? $\endgroup$
    – Flumpo
    Commented Feb 5, 2021 at 21:08

1 Answer 1

4
$\begingroup$

PerformanceGoal is an easy option but if you want more control you can use ControlActive which Jon McLoone from Wolfram explains it on YouTube around 13:00.

In summery you can use ControlActive[2,5] to specify two value, first (2) will be used in animations or when you're interacting with graphic, like rotating and etc, second value (5) will be used when there is no interacion therefore the graphic can be rendered in higher quality.

Use ControlActive with properties that change quality of your graphic like MaxRecursion, PlotPoints or ... to really fine-tune your result.

And when you're working with Animate, if it looks little buggy, use RefreshRate to decrease the animation FPS and as a result lower computation and smoother result.

Another options is if you want to send the result as video to someone, capture with low AnimationRate then increase the speed of captured video before sending.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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