Jump to content


  • Content Count

  • Joined

  • Last visited

About sable

  • Rank
    Advanced Member

Profile Information

  • Location
    New Zealand

Recent Profile Visitors

1974 profile views
  1. Was mainly just copied from a project I've been working on which faced similar performance issues with picking sphere particles from a sps, with corrections for the pivot point changing. I''ll try and take a look at sorting out the jumping in the next few days, but post back if you get it sorted before then.
  2. The reason it was quite slow is that spheres have a lot of faces, and the pick function has to iterate over each one to find the picked point. The fastPick version doesn't behave in the same way as the original, as it generally is just stopping at the ground/wall intersection, so is not putting the mouse sphere on the SPS. You can implement your own picking for the sps, and do ray sphere tests, https://www.babylonjs-playground.com/debug.html#8PY6X5#18, which is much, much, faster. If the particles aren't spheres, then you could do the above using spheres as bounding spheres, and
  3. Using facet normals: https://www.babylonjs-playground.com/#95PXRY#32 https://doc.babylonjs.com/how_to/how_to_use_facetdata Though I think @Wingnut is right in that a decal may fit your needs better, especially for footsteps.
  4. Something like this: https://www.babylonjs-playground.com/#95PXRY#29 Would need to be changed slightly if you wanted facet normal instead.
  5. https://webglstats.com/webgl/parameter/MAX_TEXTURE_SIZE Which would concur with Sebavan's 4k recommendation (and 2k if you really need to support old mobile devices).
  6. Cool, done. https://github.com/BabylonJS/Babylon.js/pull/5500 Thanks @Gijs for that pg, made it easy to test.
  7. I removed the offsetX check as I was finding it jarring for the camera to pan a little sometimes while rotating if the x offset happened to be zero (while the y offset was not). Where's the screenCoordinatesToWorldCoordinates function from? It sounds like the start of firing a ray from the camera and then using it to pick a point. ´╗┐Regarding picking a pivot point, if you're just dealing with a flat 2d plane, then doing an intersection test against that (BABYLON.Plane) will be a bit cheaper than doing one against a mesh (especially if you're wanting to test on mouse move when dragging
  8. https://www.babylonjs-playground.com/#NU4F6Y#91 Was just a minor error, assigning the dragPoint.y the pickpoint.y instead of z on line 47. I added a //change comment to each line I modified from the original pg. Made this pg from scratch while checking, but prob not too much use to you.
  9. I was looking at the pg in the above post, and noticed that the near plane is positioned incorrectly. It seems that passing in a source plane to meshBuilder's createPlane function translates the plane in the wrong direction, and also rotates it so that it is facing the wrong way. For a plane with normal (0,0,1), and a point on the plane (0,0,10), meshBuilder will position the plane at (0,0,-10) and face it looking along the -ve Z axis. Example pg, with what I believe are fixes here.
  10. I implemented google map style controls in a pg linked above, and also provided a link to where this (something similar anyway) was used in production (which will give you a better idea as to whether this is the sort control style you're wanting to do). I modified the ArcRotate camera though, not the Free Camera.
  11. If all you're wanting is the additional angle that the camera will rotate due to inertia after the pointerup event, you can calculate it in radians as: const additionalAngle = camera.inertialAlphaOffset / (1 - camera.inertia); which follows from the implementation posted by Sebavan above. http://playground.babylonjs.com/#PCMNE0#1
  12. If you're meaning it won't build (i.e. you're using typescript) you can cast to any to get around that (the only downside being if the variable name or behaviour changes in a future version of babylonjs).
  13. https://github.com/BabylonJS/Babylon.js/blob/4b63e18d3dbd31d400fff1cba68de2981f8ba2ee/src/Materials/Textures/babylon.baseTexture.ts#L16 https://github.com/BabylonJS/Babylon.js/blob/4b63e18d3dbd31d400fff1cba68de2981f8ba2ee/src/babylon.scene.ts#L6001 Setting has alpha seems to mark all materials in the scene as dirty. So in this case it's calling markAllMaterialsAsDirty a thousand times, each time with a larger materials array to loop over. You could get a compromise of behaviour by just setting the private _hasAlpha and then calling markAllMaterialsAsDirty after the loop. htt
  14. https://www.babylonjs-playground.com/#DD2IDJ The above pg implements controls that are similar to most mapping solutions (panning keeps mouse in same position, as does zooming), and is basically a stripped down version of the control system I used here (though there the camera was also heavily modified so as to allow both rotation around the globe and about the surface target. The 2d mode available through the tools menu could have been done using the control scene from the pg and the standard camera however. Touch controls are also implemented there but not in the above pg). There may be
  15. Yeah my use case is loading a model (.babylon format), and then applying a customMaterial to it (so I can modify the shaders). I was trying to just attach the texture from the original material to this new material and just update the sampling mode when I ran across the issue (after discovering that setting the sampling mode in the .babylon file was also didn't work). My workaround was to just extract the url and make a new texture, which I'll continue to do for now, as even waiting for the texture to load doesn't seem to always work. Thanks for looking into this.
  • Create New...