Jump to content

Skybox texture loading RED CHECKERS


webGLmmk
 Share

Recommended Posts

Can't exactly use the playground for this I dont think. I'm getting the dreaded red checkers and I really can't see what I"m doing wrong. Although in the documentation, the pictures show that its supposed to be  "jpg"...the paragraph specifies .png

jpgorpng.png

so....jpg or png?  That's just my excuse for having trouble with this. I tried both locally anyway. Its probably path related.

this is the directory where my images are. https://github.com/3dwebgs/miscWebGLpages/tree/gh-pages/textures/skybox

This is the file itself: https://github.com/3dwebgs/miscWebGLpages/blob/gh-pages/starfield.html


			// Skybox
			var skybox = BABYLON.Mesh.CreateBox("skyBox", 500.0, scene);
			var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", scene);
			skyboxMaterial.backFaceCulling = false;
			skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("textures/skybox", scene);
			skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
			skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
			skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
			skyboxMaterial.disableLighting = true;
			skybox.material = skyboxMaterial;

 

 

loaded page: http://3dwebgs.github.io/miscWebGLpages/starfield.html

 

and yeah you DO seem to have to refresh the page to get it to load. I saw that in a previous thread somewhere....if only a star field looked like a checkerboard.

 

Link to comment
Share on other sites

Hi @webGLmmk 

the skybox texture needs path + name of the skyboxes, babylon only adds "_py.jpg" etc, to your path to allow several different skyboxes to be stored and easily switched between by changing the last name :) 

so atm, babylon is looking at "textures/skybox_py.jpg"

all you gotta do is change 

skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("textures/skybox", scene);

into

skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("textures/skybox/skybox", scene);

to get the last folder included and it should work :) 

Link to comment
Share on other sites

50 minutes ago, aWeirdo said:

Hi @webGLmmk 

the skybox texture needs path + name of the skyboxes, babylon only adds "_py.jpg" etc, to your path to allow several different skyboxes to be stored and easily switched between by changing the last name :) 

so atm, babylon is looking at "textures/skybox_py.jpg"

all you gotta do is change 


skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("textures/skybox", scene);

into


skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("textures/skybox/skybox", scene);

to get the last folder included and it should work :) 

bingo, this community is the best.

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