Error: Cannot load cubemap because 6 files were not defined

Hi @bghgary ,
I understood the problem. On my test smartphone, the internet/wifi was switched off. Sorry, my mistake.
I would like to try another solution:

const envTexture = CubeTexture.CreateFromPrefilteredData("app:///textures/environment.env", scene);

Tnank you for your support

1 Like

Did it give you an error?

If

const envTexture = CubeTexture.CreateFromPrefilteredData("app:///textures/environment.env", scene);

Error: ERROR BJS - [10:16:37]: Not a babylon environment map

if

const envTexture = CubeTexture.CreateFromPrefilteredData("/textures/environment.env", scene);

Error:

 WARN  Possible Unhandled Promise Rejection (id: 0):
Error: Exception in HostFunction: Error parsing URL scheme: Tried to implicitly convert null Java String to C++ String
[native code]
open@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.artspacesvr&modulesOnly=false&runModule=true:188933:28

The error happens because the file is missing or something else?

Iā€™m assuming this error happens when wifi is turned off right?

@DarraghBurke Can you look into these when you get a chance?

1 Like

No, I have wifi

Ok, now Iā€™m confused. I thought you said it was working now, but because you turned off wifi, it was not working. I was wondering what the error message (or if an error was reported at all) was when wifi was turned off.

If you call CubeTexture.CreateFromPrefilteredData("/textures/environment.env", scene);, I would expect an error message. You canā€™t open URLs without a scheme (the short string before the path, like http:// or app://) in Babylon Native. This works on the web, it just uses the current domain, but that doesnā€™t make sense in a Native context.

In this case the Android URL parsing library failed to parse the URL, generating this error.

Youā€™ll want to use a URL like app:///textures/environment.env. or else http://playground.babylonjs.com/textures/environment.env

1 Like

Hi @DarraghBurke @bghgary

Hi,
I have wifi and works but only:

scene.createDefaultEnvironment({ createSkybox: false, createGround: false });

I am trying to load environment locally now:

const envTexture = CubeTexture.CreateFromPrefilteredData("app:///textures/environment.env", scene)

Then I get a error:

ERROR  BJS - [08:49:52]: Not a babylon environment map

@DarraghBurke Can you investigate?

1 Like

Sure, taking a look now.

1 Like

Other question,
I want to insert HemisphericLight in this model to regulate it later.
It works earlier.
Now it doesnā€™t work. I canā€™t see the light?
Idea?

Iā€™m not seeing that error message, but cubemaps donā€™t seem to be rendering for me on Android. Iā€™ll keep investigating and keep you posted.

Scratch my previous answer, I was able to get it rendering using the following:

const envTexture = BABYLON.CubeTexture.CreateFromPrefilteredData("app:///textures/environment.env", scene);
scene.createDefaultSkybox(envTexture, true, 10000);

Can you share the directory structure of your project? Iā€™m going to bring in @ryantrem on this one since he knows more about loading local assets in React Native.

As far as hemispheric light, this works fine for me:

const light = new BABYLON.HemisphericLight("hemi", BABYLON.Vector3.Left(), scene);

What does your code look like?

1 Like

When using Babylon React Native, you have two options for loading local resources:

  1. Embed resources in the app the same way you would if you werenā€™t using React Native, and load them with app:///. Embedding files is different on each platform.
  2. Base 64 encode the file into a json blob and reference it from some js/ts file in your project. This is not efficient, but easy to do. More details here: How to import a local .glb file in BabylonReactNative? - #9 by ryantrem

We hope to make loading files easier in Babylon React Native, but React Native itself creates some hurdles for this that we havenā€™t resolved yet.

1 Like

Hi,
this is my code:

      const envTexture = CubeTexture.CreateFromPrefilteredData("app:///textures/environment.env", scene);
      scene.createDefaultSkybox(envTexture, true, 10000);
      envTexture.name = "envTex";
      envTexture.gammaSpace = false;
      scene.environmentTexture = envTexture;

This my error message for this code:

ERROR  BJS - [19:45:00]: Not a babylon environment map

On the light theme: everything ok

Hi,
here is a quote:

glTF vs. GLB
GLB is a version of glTF. GLB is binary, while glTF is based on JSON (JavaScript Object Notation). With glTF, some data is stored in external files, like textures (which will be an image like JPEG or PNG), shaders (GLSL), or geometry and animation data (BIN). GLB files store this data internally, so no support files are 

Why should a glTF/json be better than GLB/binary?

Or just use glTF modl?

Can you update your repo from earlier with this? We are unable to repro this problem.

1 Like

Hi @igorroman777 checking in, were you able to update your repo so @bghgary can help you further?