
snupas
Members-
Content count
10 -
Joined
-
Last visited
About snupas
-
Rank
Member
-
Cloning mesh removes the original mesh, can't hide the copy
snupas replied to snupas's topic in Questions & Answers
Ahh firefox properly outputs the error: Error: WebGL warning: Exceeded 16 live WebGL contexts for this principal, losing the least recently used one. How am I exceeding 16 live webgl contexts with a single copy? EDIT: Nevermind, that doesn't relate to this error, I don't get this error in Chrome or Edge. -
Cloning mesh removes the original mesh, can't hide the copy
snupas posted a topic in Questions & Answers
I'm trying to test out morphtargets, so I load up a scene and try to create a copy of the original mesh to then scale it and morph between the two, but for some reason the original mesh isn't being rendered anymore, plus the copy isn't hidden with setEnabled(). If I remove all of the copy code, the original mesh starts being rendered fine again. var scene; var mesh; var meshCopy; if (BABYLON.Engine.isSupported()) { var canvas = document.getElementById("renderCanvas"); var engine = new BABYLON.Engine(canvas, true); BABYLON.SceneLoader.Load("assets/2/", "untitled.babylon", engine, function (newScene) { newScene.executeWhenReady(function () { // Attach camera to canvas inputs newScene.activeCamera.attachControl(canvas); scene = newScene; mesh = scene.meshes[0]; mesh.convertToFlatShadedMesh(); meshCopy = mesh.clone("1"); meshCopy.x -=10; // meshCopy.parent = mesh; meshCopy.setEnabled(false); meshCopy.position.y =+ 1; meshCopy.scaling = new BABYLON.Vector3(1.1, 1.5, 1.0); meshCopy.bakeCurrentTransformIntoVertices(); var manager = new BABYLON.MorphTargetManager(); mesh.morphTargetManager = manager; //var target = BABYLON.MorphTarget.FromMesh(meshCopy, "instance1", 0.25); engine.runRenderLoop(function() { newScene.render(); }); }); }, function (progress) { }); } -
-
I am trying to make an online character creator, in the style of sims. I was wondering where to start in terms of adjusting the fat or a skinniness of a rigged 3D model, what variables are involved, what are the prerequisites? If there is something that exists there that I could build off of, that would be great. Thanks.
-
Solution was to show the bootstrap modal on page load with 0 opacity and z-index of -2 and allow everything to load up while being invisible on the web page and not obstructing anything. Then when I need to prepare to show it, I hide the modal, set back opacity to 1 and z-index to bootstrap modal default of 1050. $('#myModal').modal('toggle'); $("#myModal").css({ opacity: 0, 'z-index': -2, }); $('#myModal').modal('toggle'); $("#myModal").css({ opacity: 1, 'z-index': 1050, }); Not really a babylon.js library related bug, but someone that's using babylon.js in an iframe situation could end up in the same situation.
-
Thanks for the input, But apparently the bug is more so related to the canvas element being inside of a hidden iframe. So the parent element of the iframe that has the babylon js document is hidden initially, so certain canvas functions you can't perform in Firefox on such an element. In my case it's a bootstrap modal, so I can't use the opacity:0 workaround instead of having it hidden... In case anyone else stumbles upon this: https://bugzilla.mozilla.org/show_bug.cgi?id=941146
-
Cordova is still the equivalent of running a chromium tab, if not slightly slower. The only performance boost you'd get is that you wouldn't have to serve the scene files from a server necessarily.
- 4 replies
-
- performance
- android
-
(and 1 more)
Tagged with:
-
Was just trying to draw some axis for transformations based on some already working code on the forums/playground and I keept getting errors in Firefox that points to the i.prototype.drawText function in the babylon js library. Here's the error: Here's the source: var showAxis = function (size) { var makeTextPlane = function (text, color, size) { var dynamicTexture = new BABYLON.DynamicTexture("DynamicTexture", 50, scene, true); dynamicTexture.hasAlpha = true; dynamicTexture.drawText(text, 5, 40, "bold 36px Arial", color, "transparent", true); var plane = new BABYLON.Mesh.CreatePlane("TextPlane", size, scene, true); plane.material = new BABYLON.StandardMaterial("TextPlaneMaterial", scene); plane.material.backFaceCulling = false; plane.material.specularColor = new BABYLON.Color3(0, 0, 0); plane.material.diffuseTexture = dynamicTexture; return plane; }; var axisX = BABYLON.Mesh.CreateLines("axisX", [ new BABYLON.Vector3.Zero(), new BABYLON.Vector3(size, 0, 0), new BABYLON.Vector3(size * 0.95, 0.05 * size, 0), new BABYLON.Vector3(size, 0, 0), new BABYLON.Vector3(size * 0.95, -0.05 * size, 0) ], scene); axisX.color = new BABYLON.Color3(0, 0, 1); axisX.position.z += 20; axisX.position.y -= 4; axisX.position.x -= 40; var xChar = makeTextPlane("X", "red", size / 10); xChar.position = new BABYLON.Vector3(0.9 * size, -0.05 * size, 0); var axisY = BABYLON.Mesh.CreateLines("axisY", [ new BABYLON.Vector3.Zero(), new BABYLON.Vector3(0, size, 0), new BABYLON.Vector3(-0.05 * size, size * 0.95, 0), new BABYLON.Vector3(0, size, 0), new BABYLON.Vector3(0.05 * size, size * 0.95, 0) ], scene); axisY.position.z = 34 axisY.position.y = -20; axisY.position.x += offset; axisY.color = new BABYLON.Color3(0, 0, 1); var yChar = makeTextPlane("Y", "green", size / 10); yChar.position = new BABYLON.Vector3(0, 0.9 * size, -0.05 * size); }; I tried both preview and stable versions of babylon.js, both with the majority of components included.
-
Cheers mate, just what i needed :).
-
-
Hello, Does Babylon JS have some built in functionality for transform controls(the likes you would see in your average 3D manipulation software), or any examples that I could start building off of? Three js example of this. Thanks.
-
-
Quick question, I'm trying to export a unity scene and utilize with babylon js. https://github.com/BabylonJS/Babylon.js/tree/master/Exporters/Unity 5 Using the deprecated exporter seems straight forward and actually works, is there a reason to use the other one and is it ready for prime time? Thanks