• Content Count

  • Joined

  • Last visited

1 Follower

About yokewang

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I think RTT method is the best way. The original 3d file is in max format, can I use 3D MAX to implement it? I am newbie in 3D MAX, any guid or documents will be appreciated. I found a video on youtube. Thanks V!nc3r.
  2. I have an obj mesh with some textures, several of them are repeated(uvs are not within [0,1]). I'd like to merge all those textures into one texture and transform the uvs. As I know so far, some algorithms 1)uv transforming when texture merge. 2)split triangles into small triangles to keep each uv within [0,1]. 3)RTT method may help to solve this problem. Are there any tools can implement it?
  3. yokewang

    camera example on mobile device

    Thank @Sebavan and @JCPalmer so much for your help. Add pep.min.js everything works.
  4. Hello, I am looking for camera examples that can run on mobile and use touch events to implement rotation, zoom operations. Any help will be appreciated.
  5. yokewang

    BabylonJS render slower thanThreeJS?

    Freezing active meshes skip the step of checking 8000 mesh frustum clipping and state. if (mesh.alwaysSelectAsActiveMesh || mesh.isVisible && mesh.visibility > 0 && ((mesh.layerMask & this.activeCamera.layerMask) !== 0) && mesh.isInFrustum(this._frustumPlanes)) { this._activeMeshes.push(mesh); this.activeCamera._activeMeshes.push(mesh); mesh._activate(this._renderId); if (meshLOD !== mesh) { meshLOD._activate(this._renderId); } this._activeMesh(mesh, meshLOD); } this._activeMesh(mesh, meshLOD) costs time. And I got a little performance boost after below code replacement(BUT IT IS NOT A WISE SOLUTION). // this._totalVertices.addCount(mesh.getTotalVertices(), false); this._totalVertices.addCount(mesh._geometry._totalVertices, false); // if (mesh.alwaysSelectAsActiveMesh || mesh.isVisible && mesh.visibility > 0 && ((mesh.layerMask & this.activeCamera.layerMask) !== 0) && mesh.isInFrustum(this._frustumPlanes)) { if (mesh.alwaysSelectAsActiveMesh || mesh.isVisible && mesh.visibility > 0 && ((mesh.layerMask & this.activeCamera.layerMask) !== 0) && mesh._boundingInfo.boundingSphere.isInFrustum(this._frustumPlanes)) {
  6. yokewang

    BabylonJS render slower thanThreeJS?

    The new version for 3JS: https://jsfiddle.net/pofq4827/16/ (disabled matrix auto updating and opaque objects sorting before rendering), its frame rate increased furtherly. The javascript computation time before indeed rendering(gl command) is within 2ms comparing to 10ms in BabylonJS. After inspecting the code for ThreeJS and BabylonJS, _evaluateActiveMeshes method costs too much for 8000 meshes.
  7. yokewang

    BabylonJS render slower thanThreeJS?

    The frame rate improved by some optimizations from https://doc.babylonjs.com/how_to/optimizing_your_scene. https://jsfiddle.net/6ng7usmj/57/ optimized version. But still slower than ThreeJS version. https://jsfiddle.net/6ng7usmj original version. BTW: We should not compare an ONE DRAWCALL instance version with a 8000 DRAWCALL version. And ThreeJS supports instanced draw too. It's seems BabylonJs spends more time than ThreeJS to evaluate active meshes. I will try octree to see if it will help. Any help would be greatly appreciated.
  8. I have written a simple demo to render 8000 cubes in BabylonJS. But found out it's quite slower than in ThreeJS. Demo in BabylonJs: https://jsfiddle.net/6ng7usmj/ Demo in ThreeJS: https://jsfiddle.net/pofq4827/ It does not make sense, because BabylonJS supports more performance related features like vao. Any help would be greatly appreciated.
  9. yokewang

    babylonjs and nodejs on server side

    I made it by writing a new class named HeadlessEngine, which accepts the headless-gl as param and inits some necessary resources.
  10. yokewang

    babylonjs and nodejs on server side

    @Deltakosh. Can you give me some hints to new an Engine with headless-gl? Many thanks.
  11. Hi, Is it possible to run babylonjs and nodejs on server side(without a window) to draw RenderTargetTexture? I notice there is NullEngine for server side scenario and headless-gl in npm for OpenGL binding. Thanks.
  12. yokewang

    create ground mesh from a plane

    Thanks for @Amarth2Estel's and @JohnK's help. It works. A new version with axes(verify the correctness): https://playground.babylonjs.com/#72YAXV#2
  13. Hi, I want to create a ground mesh from a plane. let plane = new Plane(-0.4, -0.2, -0.6, 0.1); //normal and offset let planeMesh = Mesh.CreateGround("planeMesh", 100, 100, 2, scene); //to make the planeMesh to fit the plane, transformation should be added to the mesh planeMesh.rotation = ... planeMesh.positon = ... someone can help me out? Thanks.
  14. I found some clues from the source code. If scaling.isNonUniform, it will iterate every mesh in the scene to _markAllSubMeshesAsDirty(I don't know why) when call computeWorldMatrix. Below is the stack detail. sphereMesh.computeWorldMatrix(); --> if (this.scaling.isNonUniform) { this._updateNonUniformScalingState(true); } --> AbstractMesh.prototype._updateNonUniformScalingState = function (value) { if (!_super.prototype._updateNonUniformScalingState.call(this, value)) { return false; } this._markSubMeshesAsMiscDirty(); return true; }; --> AbstractMesh.prototype._markSubMeshesAsMiscDirty = function () { if (!this.subMeshes) { return; } for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) { var subMesh = _a[_i]; var material = subMesh.getMaterial(); if (material) { material.markAsDirty(BABYLON.Material.MiscDirtyFlag); } } }; --> Material.prototype.markAsDirty = function (flag) { if (flag & Material.TextureDirtyFlag) { this._markAllSubMeshesAsTexturesDirty(); } if (flag & Material.LightDirtyFlag) { this._markAllSubMeshesAsLightsDirty(); } if (flag & Material.FresnelDirtyFlag) { this._markAllSubMeshesAsFresnelDirty(); } if (flag & Material.AttributesDirtyFlag) { this._markAllSubMeshesAsAttributesDirty(); } if (flag & Material.MiscDirtyFlag) { this._markAllSubMeshesAsMiscDirty(); } this.getScene().resetCachedMaterial(); }; --> Material.prototype._markAllSubMeshesAsMiscDirty = function () { this._markAllSubMeshesAsDirty(function (defines) { return defines.markAsMiscDirty(); }); }; --> Material.prototype._markAllSubMeshesAsDirty = function (func) { for (var _i = 0, _a = this.getScene().meshes; _i < _a.length; _i++) { var mesh = _a[_i]; if (!mesh.subMeshes) { continue; } for (var _b = 0, _c = mesh.subMeshes; _b < _c.length; _b++) { var subMesh = _c[_b]; if (subMesh.getMaterial() !== this) { continue; } if (!subMesh._materialDefines) { continue; } func(subMesh._materialDefines); } } }; The last function _markAllSubMeshesAsDirty will iterate every mesh in the scene, so the performance will decrease dramatically. It's very confusing that changing scaling is related to the material and will iterate each mesh in the scene. BTW: My babylonjs version is 3.1.1
  15. I have tested the performance for different number meshes. number no-scaling scaling 1000 31ms 61ms 3375 80ms 587ms 8000 291ms 3276ms 15625 470ms 20615ms The time of no-scaling is almost linear to the number of meshes. But with scaling, the time is exponential increasing. It's confused.