math3d-react icon indicating copy to clipboard operation
math3d-react copied to clipboard

Could we get the ability to 'record videos' here?

Open Zaq-Xander opened this issue 5 years ago • 2 comments

First of all, I just wanted to say what a fantastic application this is! I'm just a high-school student and I've only used this tool for two days, but it's phenomenal.

I have just now made a thing that causes (at least my) computer to lag a lot when I try to increment my "time" in the app. It's clearly taking a lot of time for my computer to figure out where everything should appear -- and that's fine, but I'd just like to pass by this idea for when things like this happen. (For reference, this is the link to what I've made: https://www.math3d.org/Ysonfvif) Perhaps there could be a button (maybe somewhere out-of-the-way like the bottom-right corner) that allows you to export a video file of what you've made. My idea for this is that you could select a variable (in my case, it'd be the in-application time "T"), give it a range to iterate through (in my thing, for instance, it's going from 0 to 2*pi, but 0 to 6.28 is fine), and then tell it to evaluate in intervals of however much (maybe evaluate it every 0.01 by default, so mine would figure out what should be displayed at T=0, then at T=0.01, then T=0.02, ..., T=6.26, T=6.27, T=6.28; perhaps you could also tell it to instead evaluate at some other custom spacing) and then it stores the resulting series of frames as a video file.

The video could just be taken from some user-specified camera location & angle, or maybe there could be functionality to allow the camera to move along with the specified variable (my "T"), too. Either way would be really cool.

I think this could help people like me when they create something too intense for their computer to process in real-time. Although a video loses the interactivity of using the app in real-time, it'd still be a good feature.

It's not urgent, of course, but I think it'd be a cool idea to implement in the future.

Again, thank you so much for this amazing tool :) I wish I could help more.

Zaq-Xander avatar Jul 29 '20 06:07 Zaq-Xander

@Zaq-Xander That's a realy cool visualization you made. Right now I mostly only have time for bug fixes and maintenance, but the video feature is a neat idea.

In the meantime...

Performance Tip: Decrease the number of samples

At least for your use case, I think you should be able to improve the visualization performance quite a bit by decreasing the number of samples. This is especially important for animated surfaces. By default surfaces use 64x64 grid which is 4096 samples. If you're animating a surface, the samples need to be recalculated with each animation frame.

You have several planes, which really only need a 2x2 sampling grid. A thousand times fewer samples. (Although, if you 8 grid lines, you need at least 8 samples on the a plane. Still, 8x8 is a lot better.)

Here's a version of your visualization where I decreased samples on a bunch of surfaces. (I also decreased samples on some of the lines, which does not hurt, but is probably not a performance factor). Mostly planes, but also some of the curves surfaces.

https://www.math3d.org/PbQbbE6d

Sample size is in the gear icon.

Two other comments:

  • In the example above, I changed the "z bias" on the normal plan so that it would more consistently appear on top of the surface. "z bias" is an offset toward the camera. ("z" in this context is the axis toward the camera, not the mathematical z axis)
  • You might want to change the axis scaling. By default the z-axis is half-scale, which distorts angles. Axis scaling is in the "Axes and Camera" tab.

ChristopherChudzicki avatar Jul 31 '20 12:07 ChristopherChudzicki

Thank you so much for responding! I really appreaciate that you took the time out of your day for this :)

Yes, thank you; that visualisation runs a lot smoother on my computer. I'll keep that all in mind in future.

Again, thanks for providing such a great tool; absolute legend.

Zaq-Xander avatar Aug 01 '20 04:08 Zaq-Xander