Forum

Smaller file size with option to use different Blend4Web JS code

15 September 2015 23:07
It would be cool to have the option to toggle features that get included in the final .html export.

When I export a simple box, the .html file is 1,624k.

The .html file includes all of the features of Blend4Web, including physics etc.

It would be interesting to see what the smallest file size you can get with Blend4Web, to get just a rotatable box ( no physics, no animation support, no sounds support, no advanced shader code etc ).

You might have a panel with different options ( eg physics, advanced shaders ), and maybe a drop-down at the top with presets ( eg model viewer ( no animations ), model viewer ( animations ), physics based viewer etc ) which would then set the options based on the users choice.

These options would then choose a different .js file to include in the HTML file ( eg b4w.min.js, b4w_simple_model_viewer.min.js etc )
16 September 2015 13:03
Hi,

The .html file includes all of the features of Blend4Web, including physics etc.

For the record, Blend4Web currently has no physics support for exported self-contained HTML files, physics is available only if you load JSON files (with the web player, for example)

It would be interesting to see what the smallest file size you can get with Blend4Web, to get just a rotatable box ( no physics, no animation support, no sounds support, no advanced shader code etc ).

Removing parts of unused JS code is a good idea, especially with bloated code bases. It is actually already in place: upon
building applications (including the webplayer itself), the code is cleaned of all unused features.

I would also recommend to use a combination of JSON (+ binary) files and external textures/sounds which is much more efficient option than single base64-encoded HTMLs.
The Founder | Twitter | Facebook | Linkedin
16 September 2015 20:02
Hi Yuri,

The ability to have a smaller file size would be more if a client wanted a simple 3D logo to be integrated within a webpage or something similar.

If the 3D scene content itself was say about 100k, there seems to still be about one and a half megabytes of JS code ( which of course includes base-64 encoded images etc ).

> the code is cleaned of all unused features.

Maybe as an internal test, could you export a simple 3D cube, and see how small a .html file you can get?

I'd be very interested in hearing the results, and even a more detailed breakdown of what's included, and what gets excluded.

I had a look through the code, and there seems to be references to vehicles, armatures, nla animation, particles etc, even though I didn't use any of these in my export ( again, default Blender scene with box exported directly out, so box, light and a camera - Blend4Web .html file size = 1.6Mb ).

If you can come up with a very small, lightweight viewer direct from Blender, that could be a good target customer base for you, as well as targeting developers who will want run-time access to many of these features.
17 September 2015 07:52

The ability to have a smaller file size would be more if a client wanted a simple 3D logo to be integrated within a webpage or something similar.

If the 3D scene content itself was say about 100k, there seems to still be about one and a half megabytes of JS code ( which of course includes base-64 encoded images etc ).
Agreed!

> the code is cleaned of all unused features.

Maybe as an internal test, could you export a simple 3D cube, and see how small a .html file you can get?
Well, to be more precise, the code is cleaned of all API which are not imported by the application. This is performed during app compilation. Doing optimizations on per-feature basis at the moment of export would increase export time significantly, up to several seconds for a simple cube and much more for complicated scenes. Also, 1.6 Mb is not a big deal nowadays, so as far as the code base is small, we are not very concerned with implementing such optimizations.

Nonetheless, Blend4Web is open source software (there's also a commercial license which welcomes modifications) so if you are interested you could give your idea a try.


The Founder | Twitter | Facebook | Linkedin
17 September 2015 23:21
> Doing optimizations on per-feature basis at the moment of export would increase export time significantly, up to several
> seconds for a simple cube and much more for complicated scenes.

Of course, by default you would want the current fast export, but it would be good to allow artists to have the option of choosing a slower export if a smaller file size was required by their client.

> Also, 1.6 Mb is not a big deal nowadays, so as far as the code base is small, we are not very concerned with implementing
> such optimizations.

True, it's not too big, but if it was possible to export a WebGL scene with code 1/10 of that size, that would be something you could advertise to help sell Blend4Web. I was more mentioning it, just in case it was something on your to-do anyways.

Just out of interest, the Unity guys did a coding sprint with their WebGL exporter, and had mentioned that they got quite good size optimisations etc.

> Nonetheless, Blend4Web is open source software (there's also a commercial license which welcomes modifications) so if
> you are interested you could give your idea a try.

If I ever get the time, I'll give it a go :)

At the moment, I'm more experimenting with Blend4Web, to see how flexible it is to export content right out of Blender and into a web page. I'll def sign up for the commercial license if I see an opportunity to sell a Web 3D project to a client.
18 September 2015 12:31
Just out of interest, the Unity guys did a coding sprint with their WebGL exporter, and had mentioned that they got quite good size optimisations etc.
I don't think that 75mb for empty scene is good result anyway Even if it is reduced thrice (that's the info from the Unity blog, and there haven't been actual user tests as far as I know), there are still 25mb of data needed to be downloaded to see nothing.
19 September 2015 12:21
To be fair to the Unity guys, they managed to get the size of an internal build down to 1.2Mb

"We have been experimenting with this at our last HackWeek, where we had a project to see how far we can reduce the output size of our WebGL export. At the end of the week, we were able to build a simple Unity project to WebGL with a distribution size of 1.2 MB, by improving code stripping, improving compiler settings, and removing things we don’t need among other things. "

http://blogs.unity3d.com/2015/06/18/webgl-webassembly-and-feature-roadmap/


Having said that, Blend4Web seems to be the best WebGL cross platform system to date that I've seen ( including mobile support ), and with the workflow out-of-the-( Blender )-box and features like the new Logic Editor node system, for me it is a great solution for many (non game) web 3D projects.
21 September 2015 11:20
Thanks for the info, I wasn't aware of their recent development.
The Founder | Twitter | Facebook | Linkedin
 
Please register or log in to leave a reply.