tengbao / vanta

Animated 3D backgrounds for your website
http://vantajs.com/
MIT License
5.54k stars 1.02k forks source link

High CPU usage of topology effect #23

Open Jeckerson opened 5 years ago

Jeckerson commented 5 years ago

I think topology effect need some performance optimization as it use ~25-30% of my CPU, mean while another effects using between 5-10%.

Topology image

Birds image

tengbao commented 5 years ago

Yup, I think I'll need to rewrite it. Thanks for the heads up.

interactivist commented 5 years ago

The same problem occurs using the FOG effect. Is there a way to reduce the frames per seconds for example?

TKasperczyk commented 5 years ago

The same problem occurs using the FOG effect. Is there a way to reduce the frames per seconds for example?

There is. You'd have to modify the setup function and add: p.frameRate(10) but it will slow down the whole animation.

interactivist commented 5 years ago

You mean the script in "three.r92.min.js" or my individual init script? Where can i add this option?

TKasperczyk commented 5 years ago

You mean the script in "three.r92.min.js" or my individual init script? Where can i add this option?

In dist/vanta.topology.min.js or src/vanta.topology.js. The first file is minified. In the second case, the setup function begins at line 42. The variable p refers to the p5.js context, so the only thing you have to do is to add p.frameRate(10); at the beginning of this function. Note that in the minified version, it gets a bit confusing, because p is translated to e and e becomes p for some reason.

funktionslust commented 3 years ago

Yup, I think I'll need to rewrite it. Thanks for the heads up.

@tengbao Do you need support here? Would be great to have this fixed. Are there any plans to address this issue in near future?