Seba

Members
  • Content Count

    12
  • Joined

  • Last visited

Everything posted by Seba

  1. Hello there, I trying to reduce the draw calls in my project and in my in investigation I noticed that a sprite manager is taking 2 draw calls even if we have no sprite in its sprite list. So just adding this line will cost you 2 draw calls : var spriteManager = new BABYLON.SpriteManager("spm", "fakeurl", 1, 10, scene); Is it a bug or there is a reason for this behavior ? If no reason is possible to fix it in the next Babylon version ? Cheers.
  2. Hello I get some black parts on custom shapes created with BABYLON.MeshBuilder.ExtrudeShape Here is my code (this.points is an array of Vector2): if (!this._shapeInScene) { let points: Array<BABYLON.Vector3>; let path: Array<BABYLON.Vector3>; let color: BABYLON.Color4; // points = new Array<BABYLON.Vector3>(); for (let p of this.points) { points.push(new BABYLON.Vector3(p.x, p.y, this.plan.planCenter.y)); } points.push(points[0]); path = new Array<BABYLON.Vector3>(); path.push(new BABYLON.Vector3(0, 0, 0)); path.push(new BABYLON.Vector3(0, this.height, 0)); this._shapeInScene = BABYLON.MeshBuilder.ExtrudeShape( this.name, { shape: points, path: path, sideOrientation: BABYLON.Mesh.DOUBLESIDE, updatable: true, cap: BABYLON.Mesh.CAP_END } ); color = new BABYLON.Color4(this.color.r / 255, this.color.g / 255, this.color.b / 255, 1); this.colors = new Array<number>(); var positions = this._shapeInScene.getVerticesData(BABYLON.VertexBuffer.PositionKind); this.positions = []; for(var p = 0; p < positions.length; p++) { this.positions.push(positions[p]); } for(var p = 0; p < positions.length / 3; p++) { this.colors.push(color.r, color.g, color.b, color.a); } this._shapeInScene.hasVertexAlpha = true; this._shapeInScene.setVerticesData(BABYLON.VertexBuffer.ColorKind, this.colors); } And here a screenshot of my issue : And my question is what could be the reason of this issue? Maybe my points in my Vector2 Array are not sorted properly? Here an exemple on a babylon playground: https://www.babylonjs-playground.com/#HG7TAS
  3. Ok got it! Thanks a lot for this clear explanation.
  4. And for more informations if I do same on the others axis. So if I rotate 91 degrees or whatever on axis Y and Z. I do get back the good results from quaternion.toEulerAngles()
  5. Hey JohnK thank for your answer. Yes I did read this article but I still don't understand why when you rotate above 90 degrees on axe X all axis are changed. I did a mistake in code when converting radian to degrees which fix problem 1. So for my second problem if I apply a rotation of 91 degrees like below : mesh.rotationQuaternion = BABYLON.Quaternion.RotationYawPitchRoll( 0, (91 * Math.PI) / 180, // 91 degrees convert to rad 0 ); var euler = quaternion.toEulerAngles(); I get thi following results: euler.x = 89 degrees, but should be 91 euler.y = 180 degrees, but should be 0 euler.z = 180 degrees, but should be 0 Here an updated version of my playground: https://playground.babylonjs.com/#7QNRN2#2 press key 'a' gonna rotate 91 degrees on axe X and show the results in the console
  6. Hello Babylon community, I have troubles to understand how to switch from quaternion to euler angles and vice versa. First problem: When I apply a rotation to a cube on axe X which should be a 90 degrees (when the face facing us get on the top) I get a value above 130 degrees from my convertion (quaternion to euler). Second problem: When I go over 140 degree on axe X, axes Y and Z are changed! However I'm just playing with X axe. Am I missing something? Here a playground: https://playground.babylonjs.com/#7QNRN2#1 Press the key 'a' to rotate on the axe X and watch the console to see the euler angles convert from radian to degrees. Keys mapping: keys 'a' and 'd' for rotation on X keys 'w' and 's' for rotation on Y keys 'q' and 'e' for rotation on Z
  7. Hello Jerome. Thanks for your reply. Ok I was really hoping to keep my sprites system, but I'll try either your solution or Deltakosh one.
  8. Hi Deltakosh, Thanks for your reply. Do you mean something like using a mesh instead of a sprite like a plane, then set my texture to this plane and set plane.billboardMode to BILLBOARDMODE_ALL? I have a lot of sprites. My project is a Map in 3D of a building let's say a shopping center and each shop is represented by a mesh in 3D and floating above a sprite which is the shop's logo. I'm affraid that using meshes instead of sprites will drop down the rendering.
  9. Ok I found how to fix it by using renderingGroupId parameter from the meshes and the sprite manager. set 0 to meshes and 1 to sprite manager. But it's not perfect, if we set the camera position under the plane (grass) we have the sprite drawn before the plane.
  10. Hello guys, I have troubles with showing shapes that have an opacity < 1 and which are behind a sprite that also has an opacity < 1. I attach a screenshot and here the playground As you can see the shapes behind the sprite disappear I tried differents options with material's shape such as : forceDepthWrite needDepthPrePass separateCullingPass zOffset But nothing works, and on the Sprite side we don't have a lot of parameters to play with. I wonder if it's not due to a kind of optimization of babylon to not drop down the render.