• Content Count

  • Joined

  • Last visited

About matdav

  • Rank
  • Birthday 05/03/1969

Profile Information

  • Gender
  • Location
    Foggia, IT
  • Interests
    Software Development

Contact Methods

  • Skype

Recent Profile Visitors

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

  1. Hi all, in my project I'm using incremental loading in order to split large scene files in small pieces. In the incremental files creation I'm trying to use Draco encoding to reduce the file size and speed up the loading process (certainly then should be implemented decoding when reading the file). I'm using the following code but the resulting encoded data is larger than the original data. I ask you first of all if the reasoning I'm doing makes sense and then if someone can explain to me where I'm wrong. Thanks a lot, Matteo createDelayLoadingFileData: function (meshOrGeometry, isMesh) { var result = { positions: meshOrGeometry.positions, indices: meshOrGeometry.indices, normals: meshOrGeometry.normals, }; if (meshOrGeometry.uvs) { result.uvs = meshOrGeometry.uvs; } if (meshOrGeometry.uvs2) { result.uvs2 = meshOrGeometry.uvs2; } if (meshOrGeometry.colors) { result.colors = meshOrGeometry.colors; } if (meshOrGeometry.matricesIndices) { result.matricesIndices = meshOrGeometry.matricesIndices; } if (meshOrGeometry.matricesWeights) { result.matricesWeights = meshOrGeometry.matricesWeights; } if (isMesh && meshOrGeometry.subMeshes) { result.subMeshes = meshOrGeometry.subMeshes; } // --------------------------------------------------------------------- // Test draco encoding // --------------------------------------------------------------------- const mesh = { indices: new Uint32Array(result.indices), positions: new Float32Array(result.positions), normals: new Float32Array(result.normals), uvs: new Float32Array(result.uvs) }; const encoderModule = DracoEncoderModule(); const encoder = new encoderModule.Encoder(); const meshBuilder = new encoderModule.MeshBuilder(); const dracoMesh = new encoderModule.Mesh(); const numFaces = mesh.indices.length / 3; const numPoints = mesh.positions.length; meshBuilder.AddFacesToMesh(dracoMesh, numFaces, mesh.indices); meshBuilder.AddFloatAttributeToMesh(dracoMesh, encoderModule.POSITION, numPoints, 3, mesh.positions); if (result.hasOwnProperty('normals')) { meshBuilder.AddFloatAttributeToMesh( dracoMesh, encoderModule.NORMAL, numPoints, 3, mesh.normals); } if (result.hasOwnProperty('colors')) { meshBuilder.AddFloatAttributeToMesh( dracoMesh, encoderModule.COLOR, numPoints, 3, mesh.colors); } if (result.hasOwnProperty('uvs')) { meshBuilder.AddFloatAttributeToMesh( dracoMesh, encoderModule.TEX_COORD, numPoints, 3, mesh.uvs); } var method = "edgebreaker"; // test method if (method === "edgebreaker") { encoder.SetEncodingMethod(encoderModule.MESH_EDGEBREAKER_ENCODING); } else if (method === "sequential") { encoder.SetEncodingMethod(encoderModule.MESH_SEQUENTIAL_ENCODING); } const encodedData = new encoderModule.DracoInt8Array(); // Use default encoding setting. const encodedLen = encoder.EncodeMeshToDracoBuffer(dracoMesh, encodedData); // Copy encoded data to buffer. const outputArray = []; for (let i = 0; i < encodedLen; ++i) { outputArray.push(encodedData.GetValue(i)); } encoderModule.destroy(dracoMesh); encoderModule.destroy(encodedData); encoderModule.destroy(encoder); encoderModule.destroy(meshBuilder); result.dracoData = outputArray; result.dracoDataLen = outputArray.length; // --------------------------------------------------------------------- return result; }
  2. Hi @Amarth2Estel, I'll try to follow your solution. Thanks a lot, Matteo
  3. Hi everybody, I'm looking for a way to get a ground in my scene with the same exact color of the background (scene.clearColor), that reflects the meshes above it and that displays shadows casted by a light on receiving objects. I tried to use EnvironmentHelper to get this result but I always have a halo on the ground, see the following playground: Is there a way to avoid that halo so that the color of the ground is the same as the background? I don't want the user see the ground at all, I only want shadows and mirroring. I tried also to use the BackgroundMaterial directly but without success (see playground) I tried then to create the ground and the materials by hand but as in the following playground, but I have a problem to show shadows and reflections at the same time. Also, to get the same color of the background I set gammaSpace to true on the MirrorTexture but I get a reflection too dark (and no shadows). I saw that exists ShadowOnly material that shows only shadows. Is there a similar material with mirroring too? Any suggestions are welcome, thanks, Matteo
  4. Hi guys, I have this problem with the latest version of the library. I added an observable to scene.onPrePointerObservable to get notifications on pointer down and up on the scene and accordingly set a variable _isPointerDown to true or false, in the same way is done in FramingBehavior to detect the user is moving the scene. When I make a single click on the scene I correctly receive the two notifications for the pointer down and pointer up events. The problem occurs when I do dragging (moving the camera). I receive the notifications for pointer down and pointer move, even in the moment of button release (pointer up is missing). So the variable _isPointerDown remains true even when the pointer is not down anymore. The problem started with the latest version (3.3.0-alpha.0) Take a look at the following playground and at the console. Thanks, Matteo
  5. Hi, i'm using incremental scene loading and I have a problem trying to force full loading using the flag SceneLoader.ForceFullSceneLoadingForIncremental = true. I think the problem could be in the mesh Parse method. At line 2463 of babylon.mesh.ts file I see: // Geometry mesh.isUnIndexed = !!parsedMesh.isUnIndexed; mesh.hasVertexAlpha = parsedMesh.hasVertexAlpha; if (parsedMesh.delayLoadingFile) { mesh.delayLoadState = Engine.DELAYLOADSTATE_NOTLOADED; ... ... mesh._delayLoadingFunction = Geometry._ImportGeometry; if (SceneLoader.ForceFullSceneLoadingForIncremental) { mesh._checkDelayState(); } } else { Geometry._ImportGeometry(parsedMesh, mesh); // no call to mesh._checkDelayState here } In my case mesh do not have delayLoadingFile but geometry have it. In the else brach at line 2520 the mesh._checkDelayState() is not called and so data are not loaded. Thanks, Matteo
  6. Hi guys, I'm trying the incremental loading functionality in order to see if it could be useful for complex scene cases. I used the MakeIncremental tool to create the incremental files. When I try to load the .incremental.babylon scene file I always get an error when in import vertices data step. I created a playground for this problem: I thinks could also be useful to get some images of ma debug steps (in attachment). As you can see the problem seems to be in the call to updateExtend. The function is called without any input and the call to data = this.getVerticesData(BABYLON.VertexBuffer.PositionKind); returns null. The lib version is the 3.2.0-beta.4. Thanks, Matteo
  7. @bghgary Thank you for investigating this problem! You're right about the blob url, I created the topic mainly for the UV problem. @Deltakosh Thanks for quick fix!
  8. Hi guys! I'm relatively new to both Babylon JS and 3D world and I'm trying to understand how things work in order to use Babylon JS in my current project. So please forgive me if I'll say nonsense. What I would like to do is import assets in my scene from external files, for example from a glTF or obj file, manipulate objects and then save the final 3D scene in .babylon format in order to read it back later. I'm getting problems when I import objects from glTF files and in particular for the textures. First of all, when I import the glTF file, for each texture a new blob in memory is created and the temporary object url (created with URL.createObjectURL()) is set to the texture url, losing the original file name. Secondly and more problematic, the UV mappings does not seem to work anymore when reading the serialized babylon json file. To explain better I created a playground sample. The sample loads objects from two files: the original avocado.gltf file (shown on the left in the scene) and the serialized baylon file (on the right). To get the babylon js file I just serialized the scene with the object obtained from the glTF file and I replaced in the resulting json the blob object urls with the file names of the textures, saved to the same path as the babylon file. As you can see, in the object on the right the texture coordinates are not mapped well anymore to the mesh vertices. However, if you look at the console, you can see that the uv data seem to be there and are the same in both cases. So what could be the problem? Am I doing something wrong? I hope I've explained myself well, Thanks, Matteo
  9. Hi everybody, it seems there is a problem in FresnelParameters parsing and in particular with left and right colors. See console: Thanks