Back to the Shapespark home page

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