Search the Community
Showing results for tags 'textures render'.
-
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. <html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Babylon - Basic scene</title> <style> html, body { overflow: hidden; width: 100%; height: 100%; margin: 0; padding: 0; } #renderCanvas { width: 100%; height: 100%; touch-action: none; } </style> <script src="babylon.js"></script> <script src="hand.js"></script> <script src="cannon.js"></script> <!-- optional physics engine --></head> <body> <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 () { scene.render(); }); window.addEventListener("resize", function () { engine.resize(); }); </script> </body></html>