Jump to content

Cannot render textures


Recommended Posts

I am brand new to babylon.js, and am not able to render textures on simple objects.  Most of the script below was taken directly from GitHub to see if it was a syntax mistake, and even when I launch this HTML file into Chrome, a simple sphere won't render - simply a blank canvas.  I can assign all other material attributes except textures.  If anyone can identify what the issue might be, I would really appreciate it.  I've tried placing textures in different folders, and now at the root folder.  Thank you.


   <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
   <title>Babylon - Basic scene</title>
      html, body {
         overflow: hidden;
         width: 100%;
         height: 100%;
         margin: 0;
         padding: 0;
      #renderCanvas {
         width: 100%;
         height: 100%;
         touch-action: none;
   <script src="babylon.js"></script>
   <script src="hand.js"></script>
   <script src="cannon.js"></script>  <!-- optional physics engine -->
   <canvas id="renderCanvas"></canvas>
   <script type="text/javascript">
    var CreateBumpScene = function (engine) {
    var scene = new BABYLON.Scene(engine);
    var camera = new BABYLON.ArcRotateCamera("Camera", 0, 0, 10, BABYLON.Vector3.Zero(), scene);
    var light = new BABYLON.PointLight("Omni", new BABYLON.Vector3(20, 100, 2), scene);
    var sphere = BABYLON.Mesh.CreateSphere("Sphere", 16, 3, scene);
    var material = new BABYLON.StandardMaterial("kosh", scene);
    material.bumpTexture = new BABYLON.Texture("/refMap.jpg", scene);
    material.diffuseColor = new BABYLON.Color3(1, 0, 0);
    sphere.material = material;
    camera.setPosition(new BABYLON.Vector3(-5, 5, 0));
    scene.registerBeforeRender(function() {
        sphere.rotation.y += 0.02;
    return scene;
      var scene = createScene();
      engine.runRenderLoop(function () {
      window.addEventListener("resize", function () {
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.

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.


  • Recently Browsing   0 members

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