Search the Community
Showing results for tags 'stl'.
-
When I downloaded the "SceneLoader.Append" demo code into my computer, then changed to my own .gltf file and run it on the chrome browser, but nothing was happened. I would be very grateful if someone could help me. By the way, I attached my test code below. <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Babylon.js sample code</title> <!-- Babylon.js --> <script src="https://code.jquery.com/pep/0.4.2/pep.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.6.2/dat.gui.min.js"></script> <script src="https://preview.babylonjs.com/ammo.js"></script> <script src="https://preview.babylonjs.com/cannon.js"></script> <script src="https://preview.babylonjs.com/Oimo.js"></script> <script src="https://preview.babylonjs.com/gltf_validator.js"></script> <script src="https://preview.babylonjs.com/earcut.min.js"></script> <script src="https://preview.babylonjs.com/babylon.js"></script> <script src="https://preview.babylonjs.com/inspector/babylon.inspector.bundle.js"></script> <script src="https://preview.babylonjs.com/materialsLibrary/babylonjs.materials.min.js"></script> <script src="https://preview.babylonjs.com/proceduralTexturesLibrary/babylonjs.proceduralTextures.min.js"></script> <script src="https://preview.babylonjs.com/postProcessesLibrary/babylonjs.postProcess.min.js"></script> <script src="https://preview.babylonjs.com/loaders/babylonjs.loaders.js"></script> <script src="https://preview.babylonjs.com/serializers/babylonjs.serializers.min.js"></script> <script src="https://preview.babylonjs.com/gui/babylon.gui.min.js"></script> <style> html, body { overflow: hidden; width: 100%; height: 100%; margin: 0; padding: 0; } #renderCanvas { width: 100%; height: 100%; touch-action: none; } </style> </head> <body> <canvas id="renderCanvas"></canvas> <script> var canvas = document.getElementById("renderCanvas"); var delayCreateScene = function () { // Create a scene. var scene = new BABYLON.Scene(engine); // Create a default skybox with an environment. var hdrTexture = BABYLON.CubeTexture.CreateFromPrefilteredData("textures/environment.dds", scene); var currentSkybox = scene.createDefaultSkybox(hdrTexture, true); // Append glTF model to scene. BABYLON.SceneLoader.Append("./", "test.gltf", scene, function (scene) { // Create a default arc rotate camera and light. scene.createDefaultCameraOrLight(true, true, true); // The default camera looks at the back of the asset. // Rotate the camera by 180 degrees to the front of the asset. scene.activeCamera.alpha += Math.PI; }); return scene; }; var engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true }); var scene = delayCreateScene(); engine.runRenderLoop(function () { if (scene) { scene.render(); } }); // Resize window.addEventListener("resize", function () { engine.resize(); }); </script> </body> </html>
-
I'm having an issue with collision. While messing around with terrain, I wanted to make a house, for said terrain. I made a little hexagonal house and exported a STL (I use sketchup web). It imported just fine, but I can't get any collision. My test site is here : (giv0.gitlab.io/Fpoy). I use gitlab because I love the Gitlab web ide and github has nothing like it. Thanks for any help, but if possible, I also need to size it down. I could probably do that on my own, but any efficient was is helpful. Ignore the terrain you spawn on, I was testing height maps and mixmaps and textures. Thanks in advance!
-
Back from the dead ^_^_^ MUAHAHAHA.... Anyways, I am loading an external STL, and everything seems to be going as planned. The file loads but nothing ever appears in the draw stack. It shows that there is a loaded mesh, that it contains polygonal data etc, but the draw calls remain at 0. Its been a while seine I have worked in BJS so I kinda don't even know where to start debugging this. This is the STL file https://s3-us-west-1.amazonaws.com/kirakira-dev/user-photos-main/577bfb3b6aa5717c0c06af6c/user-photos/1483735045390group_lmnop.stl and here is a screenshot of the debug layer: Any help on this would be greatly appreciated.
-
I'm not able to get an STL file to load due to an exception being thrown in Babylon.js. I'm using the chrome --allow-file-access-from-files and get the following error: BJS - [07:57:52]: Babylon.js engine (v2.5-alpha) launched babylon.js:formatted:3442GET file:///D:/Development/GCODE/GCODE/mark.stl.manifest?1471003072872 net::ERR_FILE_NOT_FOUNDt.checkManifestFile @ babylon.js:formatted:3442t @ babylon.js:formatted:3402t.Append @ babylon.js:formatted:19735t.Load @ babylon.js:formatted:19698(anonymous function) @ small.html:40 babylon.js:formatted:3437GET file:///D:/Development/GCODE/GCODE/mark.stl.manifest net::ERR_FILE_NOT_FOUND(anonymous function) @ babylon.js:formatted:3437 babylon.js:formatted:4396Uncaught Error: Error status: 0 - Unable to load mark.stle.onreadystatechange @ babylon.js:formatted:4396 The section of babylon.js code where I hit the exception is below (see the part about not having the a function: t.LoadFile = function(i, r, n, o, s, a) { i = t.CleanUrl(i); var h = function() { var e = new XMLHttpRequest , o = t.BaseUrl + i; e.open("GET", o, !0), s && (e.responseType = "arraybuffer"), e.onprogress = n, e.onreadystatechange = function() { if (4 === e.readyState) if (e.onreadystatechange = null , e.status >= 200 && e.status < 300 || navigator.isCocoonJS && 0 === e.status) r(s ? e.response : e.responseText); else { if (!a) throw new Error("Error status: " + e.status + " - Unable to load " + o); a() } } , Here's my simple html based on the <html> <head> <meta http-equiv="Content-Type" content="text/html" charset="utf-8"/> <title>STL Viewer</title> <script type="text/javascript" src="babylon.js"></script> <script type="text/javascript" src="babylon.stlFileLoader.js"></script>"> <style> html, body { overflow: hidden; width : 100%; height : 100%; margin : 0; padding : 0; } #renderCanvas { width : 100%; height : 100%; touch-action: none; } </style> </head> <body> <canvas id="renderCanvas"></canvas> <script> var canvas = document.getElementById('renderCanvas'); // load the 3D engine var engine = new BABYLON.Engine(canvas, true); BABYLON.SceneLoader.Load("", "mark.stl", engine, function (newScene) { newScene.activeCamera.attachControl(canvas, false); engine.runRenderLoop(function () { newScene.render(); }); }); </script> </body> </html>
-
Hey guys, i get this error message SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data if i run this code <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Babylon.js sample code</title> <!-- Babylon.js --> <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> //<script src="Babylon.js"></script> <script src="babylon.stlFileLoader.js"></script> //<script src="babylon.objFileLoader.js"></script> <style> html, body { overflow: hidden; width: 100%; height: 100%; margin: 0; padding: 0; } #renderCanvas { width: 100%; height: 100%; touch-action: none; } </style> </head> <body> <canvas id="renderCanvas"></canvas> <script> // Erstelle Canvas und Engine var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); var createScene = function () { // This creates a Babylon Scene object (not a shape/mesh) var scene = new BABYLON.Scene(engine); // This creates and positions an free camera var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 5, -10), scene); // This targets the camera to scene origin camera.setTarget(new BABYLON.Vector3.Zero()); // This attaches the camera to the canvas camera.attachControl(canvas, false); // This creates a light - aimed 0,1,0 - to the sky. var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), scene); // Dim the light a small amount light.intensity = .5; // Leave this function return scene; }; // Erstelle Scene var scene = createScene(); // Lade .STL ein BABYLON.SceneLoader.Load("/samples/", "ship.stl", engine, scene); /*BABYLON.SceneLoader.Load("", "ship.stl", engine, function (newScene) { newScene.activeCamera.attachControl(canvas, false); engine.runRenderLoop(function () { newScene.render(); }); });*/ // Zeichne engine.runRenderLoop(function () { scene.render(); }); // Resize window.addEventListener("resize", function () { engine.resize(); }); </script> </body> </html> in FireFox. I just want to load and show a stl or obj File.