Hi All,
Generally, PNG files are larger in size compared to JPG files. As a result, JPG files can be downloaded faster. Apart from the file size and download speed benefits, are there memory usage advantages when creating textures with JPG files instead of PNG files, particularly in cases where an alpha channel is not required?
Thank you,
David
Nope they are both decoded into full RGBA data
JPG is lossy.
WEBP format will give you the smallest asset size.
You may check it here - https://glb.babylonpress.org/
What about audio, mp3 or wav?
There are many other options for web audio - Web audio codec guide - Web media technologies | MDN
Just for your information : (and for the love of the technology behind, I worked a lot with Fourier in the past )
-
JPG is based on DCT (Discrete Cosine Transform) which is a variant of Fourier Transform. It basically means that it’s good for describing smooth variations along blocks of pixels.
-
At the opposite, PNG behind lossless, any smooth variation means that all the different colors along the variation needs to be written individually (PNG is using a custom color palette, which is as big as there are many colors in the image)
It means that in term of size :
- Complex image : PNG will be larger
- Simple image : PNG will be MUCH MUCH LIGHTER
The WORST scenario for the JPEG is a “violent” color change (like a vertical color limit). Without going deep into fourier transform explanation, it’s due to the fact that instant change (from color 1 to color 2) is seen as all frequencies at the same time (in the frequencial domain). It needs the full description of all frequencies of the JPEG range just to be described. While in PNG, it just writes “Ok, now we go from color 1 to color 2”.
For example, taking this picture in 4K :
Let’s do a “posterisation” on the texture (reducing number of colors)
Ok so we have the SAME image (4K), except the second one has fewer colors)
Let’s have a look at size :
Non only in the poster version the PNG is much lighter, but the JPG actually had its size multiplied by 4, just by reducing the number of colors !
Conclusion : in many case PNG is still ligher
If you go for a pixel art game : AVOID JPG
++
Tricotou
What is it you didn’t do? Did you ever create banknotes?
In case, you can PM me
That’s why we still need designers and specialists. Most people have no faen clue of how to work with a colorpalette and that limitation to the number of colors has a huge effect on the size of the export. Same goes with color profiling. Most apps let you just choose a format and a level of compression. Even junior, intermediate and sometimes senior designers have no idea of how this works (and the huge impact it can have). I believe it’s one of my favorite topic in this domain… since it’s just that ez to show your skills and always makes for great impression
On the other hand, who really wants to go through all the learning and understanding of this nowadays? Like how many years working at fournier did it take you to just get a full understanding of it?
Ahah
I like your answers, and the risk of going totally off topic is high
When you are passionate in whatever domain, I think it’s no effort to deep dive in it. When I was 8 in the 90’s, my dad who was (still is !) some kind of a genius in computer stuffs, and analog electronics, built me a camera to drive my RC car in FPV in the apartment (Paris). The camera was sending images in analog on the official french TV channels, but on some channels nobody could actually use. At the time when you was watching TV, there were no cable, no ADSL, no internet, nothing. We had 6 channels in France. And starting from 7, it was all white noise. I had to go up, 8, 9, 10, …, 42, 43, 44, 45, and eventually arriving at 46 and BOOM ! I have the living room seen from the RC car . Fun fact is, if any neighbor would have switched on his TV on channel 46 (which is totally unlikely), he would have a free visit of the apartment
So to say, “I fell into it when I was a kid”… Later on I went from RC cars to planes and multirotors (today known as “drones” but at the time the term was not even used, and non of DJI stuffs would exist) and from 15 y.o. I started designing my own antennas for FPV. Getting interested into radio frequencies stuffs, I obviously heard and read a lot about Fourier, but it was hard to understand. At the time, my Youtube channel was dad with a paper and a pen .
I fully understood it during my studies in Maths & Physics, when I got interested into computer graphics. I had coded in FreeBasic a “game” (call me nerd, but I had fun like if it was an actual game) where you would draw a shape in 2D with the mouse, and then it would compute its Fourier Transform to be drawn by series of cosines. It was basically exactly this video :
Ahah, sorry for the huge text block
I would sum it all up in one sentence : Best way to learn anything is to get passionnate in it and have fun with it.
And now, I’m thinking about recoding this shit in a Playground with BJS… Thank you !
OOps! I’m sorry. I didn’t mean to put additional pressure on you
First I need to fix the PG snippets, otherwise, @roland is really going to get crazy
Nothing else would please me more If you need any help tracking the bug down, just ping me.