Is it possible to save the lightmap as JPG?

The file size of the lightmap is too large. My client complains that the loading time is too long.
Is it possible to save the lightmap as JPG?
JPG is only 1/5 size of PNG, which will greatly reduce the loading time of the scene.

If you need to use the transparent channel of PNG, is it possible to save a new black and white jpg to describe the information of the transparent channel?

Some time ago we have experimented with different lightmap formats, but at that time we didn’t manage to get anything that didn’t have considerable quality problems. We would like to return to these experiments at some point, because lightmaps are currently the largest resources to load.

I’m afraid with JPGs we may get considerable compression related artifacts. It isn’t unfortunately possible to test easily by yourself, because both lightmap baking engine and JavaScript loaders assume lightmap is a 4 channel PNG image with high dynamic range data. Lightmap uses RGBM encoding to achieve HDR, where alpha channel is used to store multiplier that allows pixel to have larger than 1.0 light intensity. With JPG HDR will not be possible, unless there is an additional texture that store a multiplier.

I think we can make such experiment on our end and prepare a scene with JPG lightmap to see if such mode makes sense (quality loss is acceptable).

2 Likes

@jan @Hill_Lam I have been using tinypng conversion online recently to reduce the size of my pngs. It works ok for most purposes and maintains transparency, would that be a manual option to replace the lightmaps with a smaller sized png file?

It is worth testing. I suspect this compressor may make assumptions that the image contains data to be viewed directly by humans, so the technique may not work well for a raw data that is stored in lightmaps. Anyway, this should be easy to test, PNG lightmaps are stored in img/large/std, and could be directly replaced there.

1 Like

Hello,

It would be really great if such progress is made and the lightmap size has been reduced because of JPG format. I would request SS team to please consider this as a priority in the upcoming developments of Shapespark.

Thank you.

Thanks for the suggestion.

JPG format has three 8-bit channels (R, G, B) which is not sufficient to encode HDR lightmaps that Shapespark bakes.

We have been experimenting with reducing the lightmap size, but we have been focusing on using GPU-compressed texture formats. Such formats, unlike JPG, could reduce not only the download size, but also the run-time memory consumption. We haven’t yet reached a satisfying solution that provides significant size reduction without sacrificing too much quality.