Jump to content

changing Skybox dynamically


javalang
 Share

Recommended Posts

Hoping for help, I'm trying to change the skybox dynamically with following code:
 

changeSkybox = function(imageurls) {
    var ctex=BABYLON.CubeTexture.CreateFromImages(imageurls,scene, true);
    if(scene.getMeshByName("hdrSkyBox")) {
        scene.getMeshByName("hdrSkyBox").dispose();
    }
    scene.createDefaultSkybox(ctex, true, 100, 0.15);
}

The skybox is changing only once,  independently if the imageurls are from file or from datasource.

If I use BABYLON.CubeTexture.CreateFromPrefilteredData ( which I cannot use in my scenario) it works as expected.

so, where is the bug?  Debugging shows everything fine, no errors, caching problem?

 

 

 

 

 

Link to comment
Share on other sites

  • 3 months later...

Use case goes as following..

We are looking to give End User generated Image to be Visible as "environment" (in normal webgl terminology) just like skybox behaves. 

We know End User may not generate 6 cube images. or they may. we are fine if they take only one image and we may show it as environment texture. 

but due to mobile first and flaky network and also due to User generated Image may involve privacy issue.

we may not able to push images back to server and round trip it back.

we are fine even using getUserMedia API of webRTC specs and capture image byte stream.

but thing which is not clear to me is how we pass raw image bytestream to environment type texture (not to 3d object).

 

Link to comment
Share on other sites

I am sorry, I do not understand the question.

The getUserMedia  is not for using local files but to access the local device camera and won t help in your case. if your user s want to use their local assets they need to rely on file input or drag and drop/copy paste

 

Link to comment
Share on other sites

Ok sorry to make you confuse..

Let me help rephrase use case.

we wanted local images/User generate image from client device to use as environment. so first i thought to use localfilesystem API.

But after your reply i search and found that localfilesystem API is not accepted or got traction as web standard yet.

so I fall back to using WebRTC route with getusermedia API and I thought let user click the photo from WebRTC and lets reuse same image stream from WebRTC to inject as material.

Looks like from your reply its tricky to achieve in babylon . let me explore few more high level library . I will keep posted if i found some work around.

Incase you come across any workaround please let us know..

Thanks

  

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...