kui / 7dtd-map

Map renderer for 7 Day to Die
49 stars 8 forks source link

Efficient splat3/4 rendering #15

Open kui opened 5 years ago

kui commented 5 years ago

At A18 (or later A17?), splat3.png is completely transparent image. So we require to drop the alpha values of splat3.png on web browsers.

But the processing takes match time because the image is parsed with pure javascript.

We need to know about browser API (around File API? ImageBitmap? or Canvas?).

kui commented 5 years ago

Web browsers might drop rgb values of pixels which the alpha value is 0.

kui commented 4 years ago

Or WebAssembly SIMD in Beta Chrome 84?

kui commented 3 years ago

Splat convert is now fast enough by 026258dab05f61291b4a8cc5dc4c07edf5c4fd70. It takes vast time that slice creates new array instance.

kui commented 3 years ago

This issue should treat about pngjs.pack() into Blob. It takes about 14 secs in my env yet.

kui commented 3 years ago

Avoid to use pngjs.pack() in bcfcf17c103046944f667a914febcd11772d80b9.

kui commented 3 years ago

I will try wasm for PNG parsing.

kui commented 3 years ago

Rust png with wasm parses faster than pngjs.

Benchmark: https://github.com/kui/png-parse-benchmark

Result:

image

Note: It is slower than pngjs when devtool is opened.

But I'll not use this rust wasm. Code maintenance with wasm is harder than the current code. I think this benchmark result is not worth it.

kui commented 3 months ago

Same PC but the latest Chrome (126) image