Jump to content

Load skybox in exported scene


Adem
 Share

Recommended Posts

Hello:), i tried to create a skybox in my exported scene .babylon, but i couldn't see the skybox, it was just the imported scene

 

here's the code:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Using babylon.js - How to load a scene</title>
          <script src="http://www.babylonjs.com/hand.minified-1.2.js"></script>
        <script src="http://www.babylonjs.com/cannon.js"></script>
        <script src="http://www.babylonjs.com/oimo.js"></script>
        <script src="http://www.babylonjs.com/babylon.js"></script>
    <style>
        html, body {
            width: 100%;
            height: 100%;
            padding: 0;
            margin: 0;
            overflow: hidden;
        }

        #renderCanvas {
            width: 100%;
            height: 100%;
        }
    </style>
</head>
<body>
    <canvas id="renderCanvas"></canvas>
 </body>
</html>
This page is pretty simple because all you need is just a canvas and a reference to babylon.js.

Then you will have to use BABYLON.SceneLoader object to load your scene. To do so, just add this script block right after the canvas:

<script>
    if (BABYLON.Engine.isSupported()) {
        var canvas = document.getElementById("renderCanvas");
        var engine = new BABYLON.Engine(canvas, true);

        BABYLON.SceneLoader.Load("Retail/", "Retail.babylon", engine, function (newScene) {
            // Wait for textures and shaders to be ready
            newScene.executeWhenReady(function () {
var box = new BABYLON.Mesh.CreateBox("box",6100, newScene);
                // Attach camera to canvas inputs
                newScene.activeCamera.attachControl(canvas);

                // Once the scene is loaded, just register a render loop to render it
                engine.runRenderLoop(function() {
                    newScene.render();
                });
            });
        }, function (progress) {
            // To do: give progress feedback to user
        });
    }
</script>
 </body>
</html>

Link to comment
Share on other sites

@Adem : in reply to your PM, add the skybox in code like this:

// create a skybox
					
var skybox = BABYLON.Mesh.CreateBox("skyBox", 500.0, newScene);

var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", newScene);
skyboxMaterial.backFaceCulling = false;
skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("skybox/skybox", newScene);
skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
skyboxMaterial.diffuseColor = new BABYLON.Color3(0.0, 0.0, 0.0);
skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0);

skybox.material = skyboxMaterial;

The distance away for this skybox, in the first line above, is 500 units - you can set your own value for this. Make sure you set the camera as well :

camera.maxZ= 500;

If the MaxZ value is less than the size of the skybox you can get odd behaviour.

More info here.

cheers,gryff :)

Link to comment
Share on other sites

Depends.  If you are kind... you hug the users, no matter how they communicate.  Perhaps teach PM-sender that on-forum help requests are better, because they help everyone.

I never scold a user... unless they are intentionally being annoying.  I have had NO PM's for help... that were intentionally being annoying, or seeking to cause anger.  Zero.

Maybe we can request a forum software change.  Perhaps add some text where we can remind PM writers... that asking for help with BJS scenes... is best done on-forum, and why.

Nowhere do we publicly announce that PM for "personal help"... is unwanted/discouraged, and "tact" is different across various international borders.

If you want to start a "policy" where PM for personal help is "wrong", then we need to tell that to users... prominently... where all can see it, and learn of this new unvoted-upon policy. 

"policy" and "police" are related... and "police disease" is a terrible addiction that easily happens to people with no feeling-of-empowerment in their lives.  This forum should avoid "police addictions" at all costs, in my opinion.  We all have better things to do... than patrol the forum for policy breakers who need spankings.  I am guilty of this "attempted steering" of users... myself... and I really don't like that part of me.  I prefer to build bobsleds and spray particles. :) 

If I feel I must try to steer someone or some policy, I try to do it with love, just like this attempt.  Perhaps I am doing "forum kindness policing" with this post, eh?  *nod*  Don't worry, I have no gun or stick.... just a mouth for convincing.  Others seem to be attempting to convince... that PM for help.... should be labeled as "wrong".  I don't agree.

Link to comment
Share on other sites

I'm not saying it's bad, but that help from PM does not help. If a user has the same problem, he does not find the answers in the PM. What I find regrettable is that some members send multiple PM with the same message hoping for a quick response from the first one that responds. That's what I do not think is correct. 

I regularly help by PM, but I prefer that PM for particular messages, issues that do not have their place on public. 

With the PM one is like to obliged to answer and if one can not help, what to say ? If you want to say hello to me, ask me how my family or other, PM is done for this, not to ask Help in private by sending the same message to multiple users. I see things like that.

That said, I have lot helped by PM, but sometimes it annoys me when the message is anti personal or brief: hello I need to do this, it does not work, thank you to help me. (to shorten it).

Link to comment
Share on other sites

Yep, well said.  "obliged"... perfect word.

It's about "manners" and "tact".

Can we find a way to remind users of policy preferences?

Perhaps some text below "Compose New"...

   The BabylonJS forum admin asks that you publicly post (on-forum) ALL project questions, and avoid sending personal messages requesting project help.  Thanks!

I suppose this would require a modification to the forum software, or an add-on extension to it.  hmm.

compose.jpg

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...