Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove freezes which are called by image decoding [closed]

When i start moving in game, i see some freezes, that happened only once, after recording with dev tools, i saw that freezes are called by Image Decode(as i understand it's decoding textures for my geometries). So is there any way to "precode" images, and start game without that freezes?

recorder screen

like image 652
Wurger Wulf Avatar asked Jan 01 '26 21:01

Wurger Wulf


1 Answers

One solution to mitigate this problem is the usage of ImageBitmap. With this API, the image decode is going to happen in a separate thread without blocking the animation loop. In three.js you can use ImageBitmapLoader as a more performant substitute to ImageLoader. Have a look at the following example to see the loader in action:

https://threejs.org/examples/webgl_loader_imagebitmap.html

like image 129
Mugen87 Avatar answered Jan 06 '26 16:01

Mugen87



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!