noname0310 / babylon-mmd

babylon.js mmd loader and runtime
https://noname0310.github.io/babylon-mmd/
MIT License
123 stars 5 forks source link

Integrating BPMX Model Files into Private PNG Chunks to Display Previews #19

Open SavAct opened 5 months ago

SavAct commented 5 months ago

I appreciate that you are converting the model files directly into your own format (BPMX). Since you've gone this far, how about storing this file format in a private PNG chunk? This means the file would be hidden within a PNG image.

There are companies that handle it this way in order to display a preview image without compatibility issues across all web browsers and operating systems without the need to install any software/plugins. This could be done with a few lines of code; see: https://github.com/SavAct/pnghide

noname0310 commented 5 months ago

Cool idea, I've seen something like that at Koikatsu.

But what exactly are the compatibility issues and is this a feature you really need?

I'm concerned about the increase in bundle size due to the addition of these features

SavAct commented 5 months ago

There are benefits to being able to immediately recognize which model is depicted in a preview image:

  1. When someone shares a PNG file online, and I can directly see what the content will be, I am more likely to download it compared to an unfamiliar file format.

  2. Typically, modern operating systems already display a preview of PNG files. If you have many models stored in a folder on your computer, it would be more convenient to see a preview of each model directly in order to differentiate them without needing to load each of them into a program.

Therefore, in my opinion, this file format within a png would likely achieve higher user acceptance and spread more quickly in forums and similar venues. However, the increased bundle size is indeed a significant point of criticism: I have used "pngjs," which should already include the "crc32" library. Currently, pngjs has a transpiled size of 4.23 KB.

SavAct commented 5 months ago

But what exactly are the compatibility issues and is this a feature you really need?

Sorry, "compatibility issues" was an inaccurate ai translation.

noname0310 commented 5 months ago

4KB is huge. The bpmx format is a format I made for fast load, so if there's a big overhead here, there's no reason to use it