zhg115

Members
  • Content Count

    6
  • Joined

  • Last visited

Posts posted by zhg115


  1. var p = BABYLON.Vector3.Project(vector, 
                BABYLON.Matrix.Identity(), 
                scene.getTransformMatrix(), 
                camera.viewport.toGlobal(engine));

    it's return P { x: NaN , y: NaN}

    camera.viewport.toGlobal(engine) is null 

    e {x: NaN, y: NaN, width: NaN, height: NaN}

    i find google and the result page is return the NaN too.

    http://www.babylonjs-playground.com/#UWSIL#1

     

    I use it this function last month, and it worked. 

    but now didn't work. 

    I don't konw why?

    help...

     


  2. thank you for you answer.

    this image is I using 3dMax import and export to make fbx file. then using  FbxExporter  to convert babylon file. 

    and it run ok.

    In blender,  In weight paint mode, select the Weight Tools panel in the toolbar, and run Limit Total, This removes vertex groups with lowest weights.

    I think 3dMax have something this logic too,

    so  the next Version  FbxExporter is possible to add the logic?

    screenshot_-8-2_15-56.png


  3. hi, I have a problem. when i import obj mesh and auto load texture from obj file,  I can't load the texture. this problem occurs some obj file.

     the first image is  using Babylonjs, second is using Threejs.

    sources:
            BABYLON.SceneLoader.ImportMesh("", "/model/load/", "turbosonic.obj", scene, function (meshes) {  
             });

    help..

    screenshot_-7-26_10-06.png

    turbosonic.png


  4. hi.  I want to check the camera can see the point.  and I caculate the worldviewProject like which is the Vertex shader has.

    the code: 

    // worldViewProjectionMatrix = world * view * projection

    // worldViewProjectionMatrix * vector

    var viewport = camera.viewport.toGlobal(engine);
        
        var cw = viewport.width;
        var ch = viewport.height;
        var cx = viewport.x;
        var cy = viewport.y;
        var viewportMatrix = BABYLON.Vector3._viewportMatrixCache ? BABYLON.Vector3._viewportMatrixCache : (BABYLON.Vector3._viewportMatrixCache = new BABYLON.Matrix());
        BABYLON.Matrix.FromValuesToRef(cw / 2.0, 0, 0, 0, 0, -ch / 2.0, 0, 0, 0, 0, 1, 0, cx + cw / 2.0, ch / 2.0 + cy, 0, 1, viewportMatrix);
        var matrix = BABYLON.Vector3._matrixCache ? BABYLON.Vector3._matrixCache : (BABYLON.Vector3._matrixCache = new BABYLON.Matrix());

       BABYLON.Matrix.Identity().multiplyToRef( viewportMatrix , matrix);
         matrix.multiplyToRef(camera.getProjectionMatrix(), matrix);
         
         
         var p2 = BABYLON.Vector3.TransformCoordinates(vector, matrix)

    //BABYLON.Vector3.Project(vector, world, transform, viewport) 

    var p = BABYLON.Vector3.Project(vector, 
                BABYLON.Matrix.Identity(), 
               scene.getTransformMatrix(),   //scene.getTransformMatrix(), 
                camera.viewport.toGlobal(engine));

    console.log(p);

    console.log(p2);

    // p and p2 xy not like

    help.