Azure is down so *.babylonjs.com is too

Given the fact that I’m a rookie, guessed that downloading the framework version from your github page (Release 8.33.4 · BabylonJS/Babylon.js) would be independent of your CDN. I know it was very naive from me, but just playing around with BABYLON. So, how can I make my files of the framework version independent from your CDN. Do I have to change the base URLs to “my.wonderfull.server” and transpile again the TS BABYLON forked files to javascript? Excuse me if asking a stupid question. Just a noobe! By the way, is there a way to modify the base URL to avoid transpiling thing? Not familiar with TS. I know it’s contrary to the tree-shaking structure, and also sounds lazy, is there a way, for guys like me, that just want to use the javascript bundle compact standalone version of BABYLON?

The main source of confusion is the lack of a definitive list of Babylon CDN resources needed to create a self-contained, local setup. A secondary challenge is understanding how to correctly integrate the necessary links into the code.

A potential solution would be a single script - such as an ExternalResourceLocalizer - that handles all external dependencies. By importing this script and its associated resources, developers could achieve a fully local Babylon configuration.

2 Likes

I like that idea a lot. Initially we tried to document it in this page:
Documentation/content/setup/frameworkPackages/CDN.md at 128eb8d0b6e4441795bb5d28892aa737cf15145e ¡ BabylonJS/Documentation

Do you see missing things there?

Live: Babylon.js docs

2 Likes

Tryied @alexchuber 8th comment suggestion, with just the resources needed for my webpage, and the inclusion of the suggested code by @alexchuber in line 2 of my script file (“BABYLON.Tools.ScriptBaseUrl = ‘./your_babylon_base_directory’ “) and it worked for me. At first, after line inclusion, browser throw glslang not found error, but it was because did’t had the resource in the folder, after copied browser throw the twgsl error, but once copied local no errors. Suggest to try the @alexchuber solution at least for basic and elementary webpages and/or webapps, in case you need to rely on your local copy of BABYLON.

3 Likes

I am not sure that this list is complete, I don’t see even scene.createDefaultEnvironment() :slight_smile:

do you mind updating that doc? Let’s make sure we have everything lol

I don’t mind but probably there are some other external assets which may be missed?

Do Havok or Recast work when CDN is down? I haven’t check personally, but maybe somebody knows the answer :slight_smile:

Also, this line also needs correction since it is related only to some resources, not all resources (no environment files).

Yes I do agree. Let’s already do some of the changes. Let’s see for havoc (@Cedric ) or recast(@roland)

We may not get all of it in one shot but we will improve over time:)

Recast is loaded from https://unpkg.com/@recast-navigation.

You can also inject your own Recast instance:

export async function InitRecast(options?: { version?: string; instance?: RecastInjection });

export type RecastInjection = typeof import("@recast-navigation/core") & typeof import("@recast-navigation/generators");

Is there a way to choose .bin file URL for AreaLight?

https://github.com/BabylonJS/Babylon.js/blob/5695bd3bd826fc07e85058dad1da73dd43e8e874/packages/dev/core/src/Lights/LTC/ltcTextureTool.ts#L27

cc @srzerbetto

1 Like

I don’t want to be a pain in the asgard of nobody, but there are 33 references to “.babylonjs.com”, in the babylos.js file, including following list (cdn, core, assets, preview, snipet, controllers, and playground). So, the line ‘BABYLON.Tools.ScriptBaseUrl = “./babylon”;’ that I used in my code to load everything from “my.wonderfull.server” will still working if using assets, the babylon loading logo, or other features?

1 https://cdn.babylonjs.com
2 https://assets.babylonjs.com/core
3,4 preview.babylonjs.com, cdn.babylonjs.com (same code line)
5 https://cdn.babylonjs.com/babylon.ktx2Decoder.js
6 https://snippet.babylonjs.com
7 https://cdn.babylonjs.com/Assets/vrButton.png
8 https://assets.babylonjs.com/core/environments/backgroundGround.png
9 https://assets.babylonjs.com/core/environments/backgroundSkybox.dds
10 https://assets.babylonjs.com/core/environments/environmentSpecular.env
11 “https://doc.babylonjs.com/features/featuresDeepDive/importers/loadingFileTypes” (Just text)
12 https://controllers.babylonjs.com/generic/
13 Same as 12
14 https://assets.babylonjs.com/core/nme/currentScreenPostProcess.png
15 https://cdn.babylonjs.com/Assets/vrButton.png
16 https://assets.babylonjs.com/core/HandMeshes/
17 https://assets.babylonjs.com/core/HandMeshes/handsShader.json
18 https://assets.babylonjs.com/core/areaLights/areaLightsLTC.bin
19 https://cdn.babylonjs.com/Assets/babylonLogo.png
20 https://cdn.babylonjs.com/Assets/loadingIcon.png
21 //playground.babylonjs.com/textures/player.png
22 https://assets.babylonjs.com/textures/blue_noise/blue_noise_rgb.png
23 https://assets.babylonjs.com/core/nme/currentScreenPostProcess.png
24 https://assets.babylonjs.com/particles
25 https://assets.babylonjs.com/core/textures/flare.png
26 https://assets.babylonjs.com/textures/flare.png
27 https://assets.babylonjs.com/textures/blue_noise/blue_noise_rgb.png
28 https://controllers.babylonjs.com/generic/
29 https://controllers.babylonjs.com/microsoft/
30 https://controllers.babylonjs.com/oculus/
31 https://controllers.babylonjs.com/oculusQuest/
32 https://controllers.babylonjs.com/generic/
33 https://controllers.babylonjs.com/vive/

Ir really depends on what you use. If you are doing XR we may need to load the hand meshes if you do not provide yours, etc…

The best way would be to run your experience and look at the network monitor to see the requests to *.babylonjs.com

A hodge-podge of thoughts here about how these URLs fit into our “global” configuration options:

  • CDN and Asset URLs
    If a URL has cdn.babylonjs.com or assets.babylonjs.com, it should go through GetAssetUrl() or GetBabylonScriptURL(). These swap the base for AssetBaseUrl or ScriptBaseUrl.
    Note that there could totally be some missing cases, since many of these URL configuration changes are fairly recent. It sounds like AreaLights is one. (EDIT: Just kidding. It’s configurable via AssetBaseUrl. Don’t know if it can be configured individually, though.) Possibly recast too, but since that’s part of an add-on, I’m not sure if it needs to fall under ScriptBaseUrl.
  • About AssetBaseUrl
    My earlier suggestion to just use ScriptBaseUrl was misleading :slightly_smiling_face:. As you and @labris pointed out, this doesn’t affect asset URLs in core, such as the default environment. To affect these, use AssetBaseUrl instead. The asset server contents live in the Assets repo. If you want to serve both the CDN and asset server together, you can set both base URLs at the same time using CDNBaseUrl.
    The docs have been updated to reflect this… though I just realized I forgot to include instructions on how to grab the asset server contents…
  • Snippet URLs
    I’m not aware of a way to configure snippet.babylonjs.com. I’m also not sure there’s a need, so this might be a non-issue?
  • Controller URLs
    I believe there’s some level of configuration for the controllers.babylonjs.com URLs, but probably not through ScriptBaseUrl or AssetBaseUrl. If anyone knows more, please chime in!

And thank YOU for taking the time to dive into this. There’s still more work to do here, so please don’t hesitate to share what you find. All the feedback in this thread has already been incredibly helpful :slight_smile:

4 Likes