Gavan1
November 3, 2025, 5:10am
1
I have a very basic Scene and importing just.
import { Scene, PerspectiveCamera, WebGLRenderer, BoxGeometry, MeshBasicMaterial, Mesh } from ‘three’;
gziped of that component was 117.77 kB.
upgrading from 0.180.0 to 0.181.0 that went up by 8kb , to 125.03 kB compressed!
That’s a substantial change. I obviously can’t decrease the size if I want to go with v 0.181.0 .
I would assume it’s WebGLRenderer , or Scene that got the code bump.
Apart from doing a diff comparison on three src, any one use tooling that can be used to assess where the size is coming from?
@Mugen87
Not quite the answer that you look for, but you can see individual PRs that made r181 and their size contribution. For example this pull request:
says:
Gavan1
November 3, 2025, 8:03am
3
Thanks for sharing that Pavel, I did come across that but it didn’t reflect a 8KB size increase.
which is quite considerable. Keep in mind from v0.180.0 to 0.181.0 I am importing the same packages.
I’m sticking with v0.180 until I can asses where the 8KB is coming from.
on a side note this might be a perfect use case to use AI tooling ;).
There are many PRs for a single release, some increase size, others - decrease. If you check the other PRs you might find where these 8KB come from. Most likely they are accumulated from many changes, not just one. I found a PR that adds 1.5KB to a compressed minimal scene. A few others like it and you will start asking why the increase is only 8KB.
Anyway, if you find how to identify the origin of the increase, post it here. Maybe somebody else would find it useful.
1 Like
Mugen87
November 3, 2025, 10:34am
5
It is not unusual that the size of the library varies. If we enhance the engine, it means we add new lines of code or entire new modules which eventually increases the overall size of the build files. Depending on what parts of the engine you are using, some of these additions can be removed via tree-shaking. Others not which is true for all changes regarding the renderer.
The most noticeable for this topic in WebGLRenderer is below which improved the quality of image-based lighting.
dev ← dfglut
opened 01:10PM - 14 Oct 25 UTC
Related issue: #26796
Was looking into #26796 and while at it I ended up tryi… ng a DFG LUT approach...
Now the metals has less diffuse:
| Before | After | Diff |
| --- | --- | --- |
| <img width="928" height="401" alt="Screenshot 2025-10-14 at 11 02 18 PM" src="https://github.com/user-attachments/assets/6af7701a-dfb9-45f1-a007-e9d561fe60d4" /> | <img width="928" height="401" alt="Screenshot 2025-10-14 at 11 25 59 PM" src="https://github.com/user-attachments/assets/9626391f-61cc-4f54-bd4e-460ff2fcbbec" /> | <img width="928" height="401" alt="image" src="https://github.com/user-attachments/assets/56126420-4a66-4e19-b530-4de33e56211d" /> |
The rough materials (top right) look more like rubber now:
| Before | After | Diff |
| --- | --- | --- |
| <img width="927" height="904" alt="Screenshot 2025-10-14 at 11 30 19 PM" src="https://github.com/user-attachments/assets/d16db5b8-e784-43d9-8d19-ce66436417f8" /> | <img width="927" height="904" alt="Screenshot 2025-10-14 at 11 30 25 PM" src="https://github.com/user-attachments/assets/15b11b34-e9bd-483d-8ee3-74c947cd168c" /> | <img width="927" height="904" alt="image" src="https://github.com/user-attachments/assets/ce3e5992-9ac3-41f5-a058-a7fb568e5469" /> |
| <img width="927" height="904" alt="Screenshot 2025-10-14 at 11 34 53 PM" src="https://github.com/user-attachments/assets/c7fd78e5-be18-4f90-b3b8-f3051220642f" /> | <img width="927" height="904" alt="Screenshot 2025-10-14 at 11 34 48 PM" src="https://github.com/user-attachments/assets/40151b00-f9a6-4bf7-93d6-01139c479c91" /> | <img width="927" height="904" alt="image" src="https://github.com/user-attachments/assets/8edd8d5b-b8cf-47a5-a6be-284bc521f444" /> |
| <img width="927" height="904" alt="Screenshot 2025-10-15 at 12 29 40 AM" src="https://github.com/user-attachments/assets/23357482-5d39-40b3-80d7-d1b65ba77a87" /> | <img width="927" height="904" alt="Screenshot 2025-10-15 at 12 29 45 AM" src="https://github.com/user-attachments/assets/ad6ef2d4-fef9-4c2e-b9de-c21d88660bde" /> | <img width="927" height="904" alt="image" src="https://github.com/user-attachments/assets/02db92f2-bad7-47a8-b148-f1ed6de08402" /> |
The helmet tube in the bottom left now has more detail:
| Before | After | Diff |
| --- | --- | --- |
| <img width="1215" height="1135" alt="Screenshot 2025-10-16 at 2 44 07 PM" src="https://github.com/user-attachments/assets/8941d525-3e49-48aa-bf5a-215b8228d65e" /> | <img width="1215" height="1135" alt="Screenshot 2025-10-16 at 2 44 00 PM" src="https://github.com/user-attachments/assets/e12785df-cff0-4d92-bd1a-05d134f3aef4" /> | <img width="1215" height="1135" alt="image" src="https://github.com/user-attachments/assets/7cc29d2a-1144-472d-9188-d7a8cafecb9d" /> |
This one is the most surprising one...The analytical approach "ate" the normals:
| Before | After | Diff |
| --- | --- | --- |
| <img width="1215" height="1135" alt="Screenshot 2025-10-16 at 2 51 40 PM" src="https://github.com/user-attachments/assets/4ca77cf7-d410-42fc-b68f-dd26214dc246" /> | <img width="1215" height="1135" alt="Screenshot 2025-10-16 at 2 51 46 PM" src="https://github.com/user-attachments/assets/31f37c0d-f033-4041-b566-37505ac38784" /> | <img width="1215" height="1135" alt="image" src="https://github.com/user-attachments/assets/5207feb3-7af5-4fe0-9e84-005cec6e7f3e" /> |
On this one the metal also has less diffuse and the rough material has more fresnel.
| Before | After | Diff |
| --- | --- | --- |
| <img width="1009" height="1135" alt="Screenshot 2025-10-16 at 3 31 07 PM" src="https://github.com/user-attachments/assets/6c0b1c73-f156-49ce-a20e-0b5204350315" /> | <img width="1009" height="1135" alt="Screenshot 2025-10-16 at 3 31 11 PM" src="https://github.com/user-attachments/assets/a6eb8e51-0d11-4e6d-82e3-89d4d9339f06" /> | <img width="1009" height="1135" alt="image" src="https://github.com/user-attachments/assets/b48e720d-8d49-4be2-a2d2-ce67d321ea76" /> |
For comparing:
https://raw.githack.com/mrdoob/three.js/r180/examples/index.html
https://raw.githack.com/mrdoob/three.js/29dbaedbed63acba23fd50f58bdf33498c7eaa1b/examples/index.html
It requires a precomputed lookup table in form of a texture which adds alone 17KB (unzipped) to the renderer.
To me, 8KB isn’t much since it’s barely noticeable during a download. Besides, in WebGPURenderer the materials are less coupled with the renderer. So unlike in WebGLRenderer, the LUT should not be included in the build if you are not using PBR materials.
2 Likes