genvvk

Members
  • Content Count

    6
  • Joined

  • Last visited

Posts posted by genvvk


  1. Hi there, 

    I have one single OBJ file with several objects within. Each element has its unique name.

    Is it possible to load each object as a single mesh?

    Tried to do this:

    var parts = [];
    
    obj.onSuccess = function (task) {  
    
           for(var i = 0; i < task.loadedMeshes.length; i++){
    
                 parts.push(task.loadedMeshes[i]);
                 parts[parts - 1].material = uniqueMat;
    
                 ...
    
           }
    
    }

    But it seems that each next mesh / geometry has all previous ones like an avalanche. 

    Loading OBJ with 5 similar spheres as a test
    
    Geometry {delayLoadState: 0, _totalVertices: 266, _isDisposed: false, id: "c0d23769-a422-47c5-8060-fabd67a55b1a", _engine: Engine…}
    main.js:254 Geometry {delayLoadState: 0, _totalVertices: 532, _isDisposed: false, id: "e83a4890-a107-425d-969c-eea1f356e200", _engine: Engine…}
    main.js:254 Geometry {delayLoadState: 0, _totalVertices: 798, _isDisposed: false, id: "19b85286-2066-4ef7-9e95-bba19d906e71", _engine: Engine…}
    main.js:254 Geometry {delayLoadState: 0, _totalVertices: 1064, _isDisposed: false, id: "22bc102d-1acc-4fa8-9576-77a9915e666f", _engine: Engine…}
    main.js:254 Geometry {delayLoadState: 0, _totalVertices: 1330, _isDisposed: false, id: "3eb8eab7-1871-4fed-b484-c18fc881cb23", _engine: Engine…}
    main.js:234 0

     


  2. Hi there,

    Is there any kind of renderer.sortObjects() or renderer.depthTest() like other frameworks have?

    I have several transparent objects (alpha < 1.0) on the scene and sometimes renderer behaves glitchy (please see attachment). Theoretically, could write a function for sorting meshes by a distance to camera and set .alphaIndex, but it doesn't solve the problem with self-intersection like frame does c) & b).

    Babylon.JS 3.01, materials are PBRMaterial() with .disableDepthWrite = false and .alphaMode = 2.

    Any ideas? Thanks in advance!

    artefacts2 copy.jpg