Search the Community
Showing results for tags 'incremental loading'.
-
Hello everyone, I'm pretty new in babylonjs, also in webdev. I tried to import my model with incremental.babylon file to optimize the performance, cause I have quite large model... I'm working with importMesh function, but when I run in my dev environment on localhost, get console error with 404 server responde (file not found) on every single geometrydata file =( although it runs with append function, but the control and every other part of the software aren't working, just show the model exactly the same position as I converted in the sandbox (from glb to babylonjs file). I use webpacker, but I dont have any problem if I run the program with the simple glb or babylon file extension (except that its pretty slow and lagging). Do you have any idea, why the geometrydata files not be found (its in the folder of the incrementel.babylon file as the quite short document of the topic propose) ? Many thanks for any idea, Im suffering with this for days now...
-
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; }
-
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
-
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: https://playground.babylonjs.com/#NAC4IT 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
-
As a part of evaluating Babylon.js, I’m trying to create a simple prototype of a first person game. It would consist of a square region/map (i.e. a square mesh with a basic texture) that is divided into 4 sub-regions (or, tiles) of equal size. Think of it as Tile1 to Tile4. Each tile consist in it one 3D cube (a cube mesh with a basic texture). The player (the camera object) moves from one tile to the next, and that tile & cube to where the player moves to, then become visible to the player. Attached an image depicting this. On this, I had a question and would appreciate if anyone could answer. How does one implement “automatic streaming & loading of assets” in Bablylon.js? In this prototype, the game would start out by player being, say, on Tile1 and Cube1 being visible. Other tiles & cubes aren’t yet visible. As the player moves and nears the boundary of Tile1, the other tile (say, Tile2) becomes visible - in a sort of fade-in effect. As the player crosses into Tile2, the Tile2 region and Cube2 becomes visible (Tile1 & Cube1 slowly fade out). Additionally, the non-visible assets (Tile2, 3 & 4 and Cube2, 3 & 4) are not yet present in the client/browser's memory (or disk). They would be "streamed" from the server to the browser only when the Player nears them. e.g. in the above case, as the Player nears the boundary of Tile1, only then the meshes/textures for Tile2 and Cube2 would be streamed from the sever to the browser. Essentially, how does one achieve streaming & loading of a sub-regions of a map and objects that are in viewing distance of a Player? As the user traverses, other sub-region and objects start getting streamed in and loaded automatically, and become visible to the Player – in a seamless way? One strategy I could think of was getting the Player's coordinates with reference to the coordinates of the Tile2 & Cube2, and computing the distance between them. When the distance becomes less than a specific threshold, send an event to the server to stream Tile2 & Cube2 assets. But am not sure if this could be done, or if this is the best way to implement it. Any pointers/tutorial/references would be helpful. The “incremental loading” section of the documentation wasn’t explicit as to how this could be implemented. http://doc.babylonjs.com/tutorials/Using_the_Incremental_Loading_System Wasn’t able to find an answer in any of the forum posts as well. TIA.
-
Hi, I was just wondering how, in theory, you could incrementally load part of a scene that is changed in game and saved out? i.e. Load map, build things, save map. I've read the docs and seen that there is a way to do incremental loading, but that is using a piece of software that I won't have on the server. Can I save out the blocks of the scene into a certain json format? Thanks for your help
- 16 replies
-
- incremental loading
- Load
-
(and 1 more)
Tagged with: