Make a 3D Model Unlit

Hello, I am experimenting with Reality Capture and photogrammetry in general. I am trying to upload my meshes on my website. For that, I have been using Babylon.js for a couple of weeks.

Today, I tried to use Babylon tu make my mesh “unlit” via the babylon.js sandbox. Usually, what I do is I upload my mesh to the sandbox, I turn on the “unlit” option, and I export to babylon. From there, I just upload the .babylon as my mesh on my website. But my problem is that the sandbox seems to time out when my mesh is too big (30M triangles, approx 400Mo) so the scene is never downloaded.

My question is: is there a way to fix this? Or is there a way for me to make my mesh unlit using another method? I didn’t seem to find the right answer to my question on this forum sadly. I thought about turning on the unlit options directly from the code on the playground, but I don’t seem to find how to do that. I’d also like to bring down the “direct” options from 1 to 0.3 (this option can be found in the sandbox, in the inspector, in “levels”)

Thanks a lot !


It should not timeout, do you have a repro model we could use to see where it is crashing and if we could fix it ?

I can give you the model I am trying to export in Babylon!

Here is the video of me doing it : Babylon.js timeout? - YouTube

Here is the model :

cc @Evgeni_Popov if you have a couple spare cycles ?

The file is too big to be saved by Chrome because the strings generated are over 512Mb (I think it’s the limit in Chrome).

However, the limit is a bit bigger in Firefox and it does work with this browser: so you should use Firefox to export your modified scene. Note however that you should be patient, it can take 2 or 3 minutes to generate the file! You will know that the file has been generated when it appears in the “download” directory of your browser.

Hi! Thanks a lot for your answers, it’s really appreciated.

The thing is, I am using Firefox already. Is there any other browser you can think of that could do the job ?

Furthermore, when I press export to Babylon, my window freezes for like 30 sec like we can see in the video. For my smaller files, once the window unfreeze, the file is downloaded. But for this file, when the window unfreeze, nothing is downloaded. Should I wait even more?

Thanks a lot


Ah sorry, I thought you were exporting to a .glb file!

Exporting to a .babylon file does not work even in Firefox because the file is even bigger than when exporting to a .glb file…

Unfortunately, I can’t see a solution here, except by generating the file “on the fly” and pushing some small parts to the client one after the other. But that would mean a potential big rewrite of the exporters. Let’s see if some others can come up with a solution to this problem. cc @GeneralQuestions

Oh! I understand.

Is there a way to turn on the “unlit” parameters directly in the code? I don’t know too much about how this language works, but is there a way somehow to create an unlit material that I can apply to my mesh? Or something like that? Directly from the code itself? That would allow me to get rid of the middle man sandbox and would avoid this problem I hope?

Otherwise, I’ll wait to see if others know of something we don’t! Thanks a lot for your help and looking forward for GeneralQuestions sight on this!


Yes, on a PBR material (which are the types of material you get from a .glb file), just do material.unlit = true.

For eg:

The directIntensity property corresponds to the “Direct level” you are updating in your video.

Very cool! I’ll try this as soon as I can this weekend! Thanks for your insight, I’ll keep you updated!

I also tried it with the Opera Browser. It took way longer before it “timed out”. I think the string limit is way higher on Opera. From what I found, it could be pretty much twice as big as Firefox. But it still didn’t work for me sadly.
If that can help someone.

I tried to modify the playground you gave me to make it work with my model, but it doesn’t seem to work. I opened your playground, downloaded it and uploaded it to my website, and I get the babylon logo loading and nothing is happening.

This image is the result of downloading and uploading the playground you shared without modifying anything but downloading the BoomBox.gltf model.

The code I use seems to use “importmeshAsync” and doesn’t seem to assign material or scene whatsoever to the model.

I will keep trying other things. Maybe there is a browser with a string limit high enough?

Can you share a playground that reproduce the problem? Loading your file does work as it works in the sandbox, so loading it in the playground and modifying the unlit property should work too.


First, I tried this playground (the one you shared):

I uploaded it on my website, and it gave me the loading logo you can see in my previous answer !

Second, I tried with this playground :

It is exactly the same as yours, but with my file instead. Maybe I just can’t use a dropbox link to load my .glb even though it’s a direct download, I could understand that, but since even the basic playground you sent me doesn’t load on my website, I couldn’t try it out!

I also tried with this playground : (see answer below since it’s maximum two links per reply)

which is basically the code I use on my website (only the script section obviously) and it runs on my website, but not on the playground.

I am at lost here

About your dropbox based scene, your url is not correct:

1 Like

Oooh brilliant! So now it does work in the playground, but I still have the problem of it not working on my website with the infinite logo loading… Could it be my babylon.js version?

Thanks a lot!

Look at the console of the browser, in case there are some errors there: in your first PG, there is a “LoadFileError: Error status: 404 - Unable to load” error which indicates that the file could not be found.

I tried to look at the console, the error is :

It seems that when I press the download button from the PG and I extract it, no texture is downloaded leading to an error, am I right?

There we are, I downloaded the environement directly from babylon.js playground website and all seems to work now! So I can modify my unlit parameters directly from my code instead of using the sandbox, bypassing the max string limit I had from Firefox!!

I am really glad it works now!

Thanks a lot to all of you, you were very kind!

Have a wonderful day and year :slight_smile:

1 Like