High fidelity animation in Hise - What are my options?
-
Probably another advanced and obscure question from me : )
I'm creating a scrolling histogram line graph from data generated in real time inside of a c++ external node (this will be extracted via a global cable I'm guessing, unless there is a more direct way).
What is the best option for me? I need high frame rate (at least 30) for smooth animation. I'm guessing that timers and paint routines might not be ideal (I've seen Christoph repeatedly recommend delaying timer loops, which as you would expect means we are stuck with a jittery frame rate, not to mention using a paint routine to draw the whole graph every iteration is not the most efficient way to draw this kind of graphic where history doesn't need to be redrawn, simply shifted in space).
Is c++ the best route? I've not done c++ graphics in Hise before (or anywhere). If it is indeed the best option I'll ask: has anyone here done this before?
-
@griffinboy try how far you get with the most simple approach and scale up the complexity only if you run into a dead end. Rendering a monochromatic histogram path with 30fps with Panels is not too much to ask, but make sure you use the C++ methods that create a path from a display buffer to avoid iterating over the data in HiseScript.
https://docs.hise.dev/scripting/scripting-api/displaybuffer/index.html#createpath
-
Thanks!
Is it possible (easy ) to create display buffers for external nodes?Else I can use a peak node or similar I guess to get to that step? Trying to be performant and have as few steps of 'translation' as possible with the data to get it into the path format.
-
@griffinboy Like this?
-
@griffinboy yes, use a peak node right after and then plot its data. Set it to an external buffer and use that with a floating tile.
-
You can also use a peak node as a member within your C++ class and pass on the external data to it, then forward all callbacks to it at the appropriate time.
-
Yeah exactly, scrolling history
-
This post is deleted! -
You can also use a peak node as a member within your C++ class and pass on the external data to it, then forward all callbacks to it at the appropriate time.
This might be my best option as I realised I simplified my explanation: The graph I am trying to draw is a bit more complex than simple history, I need to be able to redraw the whole graph with different data at certain points, so I guess it's not really a history graph
I'll try and do what you said here, although I've not done this before and I'm not entirely sure what you mean : )
-
@griffinboy I'm happy to help, hit me up over DM. It's super-easy to do what you'd like. Though my first suggestion, assuming that's what you want, is to adapt the tile @Christoph-Hart is using for HISE.
-
I'll message, thanks for the offer
-
@griffinboy Yes. First, pls take a look at my commercial spectral editor, Steinberg's SpectraLayers. If you want to do anything you see in that programme, obviously I can be pretty specific. If you'd like a license for it, let me know.
-
@clevername27 I've done similar stuff using a peak FFT external buffer, though I'm concerned about the efficiency of my code.
From the top of my head it was as simple as keeping an array of data updated by push/pop new/old external buffers. But then the paintRoutine behind has A LOT of data to draw! So it works, but the GPU probably hates me...
Would there be a more efficient way? And if you add a blur then...
Of course the data has first to be downsampled to whatever the resolution of the panel is, but still the paintRoutine can be sometime a painRoutine
-
@ustk said in High fidelity animation in Hise - What are my options?:
So it works, but the GPU probably hates me.
That's the thing, it's all being drawn on the CPU. That's the problem. I don't know if JUCE 8 finally solves this.
@ustk said in High fidelity animation in Hise - What are my options?:
And if you add a blur then.
Don't.... At least until Melatonin Blur gets implemented. If you have to, use drop shadow to fake blur on paths, but even that (except the text one, which uses Melatonin) is going to be somewhat hungry.
-
@aaronventure oh yes I always forget that the CPU is in charge… pity…
Yeah I simply dropped the stock blur for a long time, eager to see melatonin being implemented more deeply