• Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by Numa

  1. oh right, that makes sense! that's it, beautiful thank you
  2. reflectivity yes: var baseMaterial = new BABYLON.PBRMaterial("baseMaterial", scene); baseMaterial.reflectionTexture = hdrTexture; baseMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.CUBIC_MODE; baseMaterial.directIntensity = 1.8; baseMaterial.specularIntensity = 1; baseMaterial.environmentIntensity = 0.2; baseMaterial.cameraExposure = 1.4; baseMaterial.cameraContrast = 0.95; baseMaterial.microSurface = 0.27; baseMaterial.reflectivityColor = new BABYLON.Color3(0.2, 0.2, 0.2); baseMaterial.emissiveColor = new BABYLON.Color3(0.1, 0.1, 0.1); baseMaterial.useRadianceOverAlpha = false; I'll use visibility instead of alpha then
  3. Thanks, I'll try to reproduce it in a playground. It might have to do with animations (I don't set alpha to 0, I animate it). For now my workaround is to call material.disableLighting = true.
  4. Hi there, I'm fading out meshes by setting material.alpha = 0; However they still appear in the scene. I checked and their alpha is definitely set to 0. Bug? Feature? Thanks
  5. Thanks everyone, it's fixed now clientX/clientY did the trick. All I needed to detect was that the mouse was out so I could fire a mouse up event, no need for any babylon/mesh info. @Wingnut Interesting test scene here's the working code: var OnPointerMove = function (e) { if (!pointerIsDown) return; if (e.clientX > engine.getRenderWidth() || e.clientY > engine.getRenderHeight() || e.clientX < 0 || e.clientY < 0) { // Create pointerUp event var pointerUpEvent = document.createEvent("MouseEvents"); pointerUpEvent.initMouseEvent("pointerup"); canvas.dispatchEvent(pointerUpEvent); } } Also when I said "messages" I meant actual messages, that you can use to communicate between an iframe and its parent (but as I said I couldn't use that, as my iframes might end up on random domains and I can't authorize them manually one by one^^). Here's how they work: document.getElementById('myIframe').contentWindow.postMessage('myMessage', '*'); you then authorize on your iframe's page by checking the origin: window.addEventListener('message', function(event) { // Check origin of the data if (~event.origin.indexOf(''){ // The data sent with postMessage is stored in if ( === 'myMessage'){ doSomething() } } else { // The data hasn't been sent from a trusted source, don't use it. return; } });
  6. Hi there, it looks like the "pointerout" event is not fired while the mouse is clicked, is that expected? How would I go about detecting when the mouse is dragged (and released) outside the canvas? My canvas is in an iframe which is in an outside domain, so I can't send messages back and forth. Any ideas?
  7. Numa


    Thanks everyone
  8. Numa


    sent I'll have a look at blending animations^^
  9. Numa


    Thanks, glad you like it That would be awesome yes! If you want me to send you a well-worded short description let me know. It's a lot better now The engine has improved a lot, and we're getting better at it too. Part of our problems came from us having to learn a completely new library and its conventions/documentation. The 2D labels were a massive challenge until @Nockawa released canvas2D. One area that we think could be improved and would make a big difference for us is the animation/tweening. In unity we use, having a similar tweening class in babylon would be amazing. Three.js has Besides that it's been great!
  10. Numa


    Hi there, I thought I'd share what we've been working on. JigSpace is a platform for creating and sharing 3D, step by step instruction for anything. Kind of a 3D powerpoint! To create these instructions we have a very simple web editor based on Unity, and for viewing them we use Babylon. It works on computers and phones but also in VR and AR (we have dedicated apps for android/ios/oculus/hololens) Here's a link to our library: We decided to use Babylon for speed and portability and it has been fantastic. It's a young engine so of course we ran into hurdles along the way but always received great help from the community. Let me know what you think!
  11. This looks great @NasimiAsl, let me know when I can start using this
  12. thanks, I had a look and from what I can tell it only affect this function, which to be honest looks like minified code var isInArrayUV = (arr: Array<{ normals: Array<number>; idx: Array<number>; uv: Array<number> }>, obj: Array<number>) => { if (!arr[obj[0]]) arr[obj[0]] = { normals: [], idx: [], uv: [] }; var idx = arr[obj[0]].normals.indexOf(obj[1]); if (idx != 1 && (obj[2] == arr[obj[0]].uv[idx])) { return arr[obj[0]].idx[idx]; } return -1; }; Do we know who wrote the obj loader? I'd love to understand what this does
  13. Yes it looks like the change only takes effect if you reapply the vertex data (I can see it on another model where it affects the lighting) I'm wondering how this even runs in the playground, there is a typo line 31, "inices" instead of "indices". If you fix the typo, it doesn't smooth I got excited for a moment
  14. yes but I edited the other post and started this new one, as the problem is not at all what I thought it was it has nothing to do with me moving verts. It's just that the "optimization" flag in the obj loader causes the normals to not recalculate correctly.
  15. Hi there, If you load an obj with the flag OPTIMIZE_WITH_UV=true then recompute the normals, you lose the smoothing. playground: (switch line 14 from true to false hehe) Right now I have to pick between broken texture (flag set to false) or broken normals (flag set to true) any ideas? Thanks
  16. I just realized the problem is not at all what I thought it was, I will make a new post. Sorry about that, feel free to delete!
  17. Yes I think I do. I move submeshes around in my application based on external data and it's all contingent on each submesh having its origin at the center of its bounding box. However when I load a model, all submeshes have their origin at the center of the model (0, 0, 0) so I move the verts so that the center of the bounding box is 0,0,0, then I translate the mesh back to where it was. I use object.bakeTransformIntoVertices(); Is there a better way to achieve that? I'm not sure why I would lose the smoothing after recalculating, I move the whole thing at once, verts have the same relative positions.
  18. Hi there, After loading my mesh I apply a translation/rotation to the verts so I need to recompute the normals if I want the lighting to be accurate. However it causes the normals to not be smoothed, am I doing it wrong? BABYLON.Mesh.prototype.recomputeNormals = function () { var normals = []; var positions = this.getVerticesData(BABYLON.VertexBuffer.PositionKind); normals = this.getVerticesData(BABYLON.VertexBuffer.NormalKind); BABYLON.VertexData.ComputeNormals(positions, this.getIndices(), normals); this.setVerticesData(BABYLON.VertexBuffer.NormalKind, normals); } before recomputing the normals: After: thanks!
  19. Hi there, I'm embedding my canvas in an iframe. everything works fine on desktop and android, but for some reason I can't rotate around on iOS (it scrolls the page instead). It responds fine to taps however. I'm using pep.js, it's included before babylon.js, and I also threw in BABYLON.Camera.ForceAttachControlToAlwaysPreventDefault = true; any ideas? Thanks!
  20. Thanks davrous, I'll give it a try. @NasimiAsl awesome, Keep us posted!
  21. For anyone coming across this post, it looks like this has been fixed in the latest version of the gltf loader, you can now set BABYLON.GLTFFileLoader.IncrementalLoading = false;
  22. Hi there, I noticed that the OBJ Importer doesn't have a loadAsync function. Currently it freezes the page while parsing the file. Is there currently a way to load an obj file asynchronously? are webworkers the only way? Thanks