Convergence

Members
  • Content Count

    124
  • Joined

  • Last visited

  • Days Won

    3

Reputation Activity

  1. Like
    Convergence got a reaction from The Leftover in Creating a city building simulator   
    Thanks to the awesome Babylon framework, I'm creating a city building and simulation game; I thought I'd share the progress so I can ask some questions in case I get stuck.
    Here's a sample town (read-only at the moment because the UI is far from complete): 
    http://misc.blicky.net/c2/?id=1 (desktop only)
    Some screenshots..



    Current issues:
    Shadows are way too 1990's, even though the targetTexture is 4096 in size. It would be nice if the shadowGenerator's matrix would adopt to only include faces that are in the camera frustum. That way shadows would look good from afar and close-up. Solved Road intersections are a pita. The current solution, using CSGs on the road segments (extruded shapes) and some math to create a plane is barely acceptable and rather slow/error-prone.  Performance. While 'idle' FPS is not bad, when adding more structures, the browser will lag because it is using MergeMeshes() to merge the new structures to the existing meshes. I'm currently transitioning to SPS meshes, because they build a lot faster, however are also more restrictive. So my question is: why is MergeMeshes() slower than SPS.buildMesh() and can it be made to match the latters' speed?
  2. Like
    Convergence got a reaction from Mingsen in Creating a city building simulator   
    Thanks to the awesome Babylon framework, I'm creating a city building and simulation game; I thought I'd share the progress so I can ask some questions in case I get stuck.
    Here's a sample town (read-only at the moment because the UI is far from complete): 
    http://misc.blicky.net/c2/?id=1 (desktop only)
    Some screenshots..



    Current issues:
    Shadows are way too 1990's, even though the targetTexture is 4096 in size. It would be nice if the shadowGenerator's matrix would adopt to only include faces that are in the camera frustum. That way shadows would look good from afar and close-up. Solved Road intersections are a pita. The current solution, using CSGs on the road segments (extruded shapes) and some math to create a plane is barely acceptable and rather slow/error-prone.  Performance. While 'idle' FPS is not bad, when adding more structures, the browser will lag because it is using MergeMeshes() to merge the new structures to the existing meshes. I'm currently transitioning to SPS meshes, because they build a lot faster, however are also more restrictive. So my question is: why is MergeMeshes() slower than SPS.buildMesh() and can it be made to match the latters' speed?
  3. Like
    Convergence got a reaction from JackFalcon in Convert vector from world to local space   
    Likely a very simple question for the veterans
    Is it possible to convert a Vector3 given in world space coords to the local space of a mesh?
    Example: http://www.babylonjs-playground.com/#XMFZ0Z#3
  4. Like
    Convergence got a reaction from JackFalcon in Convert vector from world to local space   
    Oh, I might have found the answer myself in the babylon code 
    var invertParentWorldMatrix = parent.getWorldMatrix().clone(); invertParentWorldMatrix.invert(); var worldPosition = new BABYLON.Vector3(x, y, z); position = BABYLON.Vector3.TransformCoordinates(worldPosition, invertParentWorldMatrix);  
  5. Like
    Convergence got a reaction from Boz in Combining babylon.js and openstreetmaps.org data to create 3D maps from user data   
    I worked before on a city simulator before but unfortunately my motivation fizzled out and I never really continued with it, because there were some issues such as intersections for which I never got a good solution.
    After a while I stumbled accross Mapzen, which mainly uses openstreetmaps data and decided, why not combine it with babylon. I'm not the first one to try it , but still doing it for fun  It uses SPS, but the SPS.buildMesh() function is kinda slow which causes the initial load to be rather slow.
    Here's my rendition (still alpha/beta) of 3D openstreetmaps with babylon.js with some examples (only tested in chrome desktop and android):
    newark liberty airport
    french alphs
    naarden vesting
    hong kong (elevation data is not very accurate for asia unfortunately)
    Need good gfx card:
    lower manhattan 
    manila
    The search currently uses openstreetmaps search which is kind of wonky. If you want to search a city, it's better to search a landmark within that city.
    Current issues:
    Is there any way to speed up the initial buildMesh() call for SPS? I remember reading something about offloading SPS tasks to the worker?
    I can't get the minimap thing to work.. how to copy a mesh to another scene?
  6. Like
    Convergence got a reaction from Kemal UÇAR in Combining babylon.js and openstreetmaps.org data to create 3D maps from user data   
    I worked before on a city simulator before but unfortunately my motivation fizzled out and I never really continued with it, because there were some issues such as intersections for which I never got a good solution.
    After a while I stumbled accross Mapzen, which mainly uses openstreetmaps data and decided, why not combine it with babylon. I'm not the first one to try it , but still doing it for fun  It uses SPS, but the SPS.buildMesh() function is kinda slow which causes the initial load to be rather slow.
    Here's my rendition (still alpha/beta) of 3D openstreetmaps with babylon.js with some examples (only tested in chrome desktop and android):
    newark liberty airport
    french alphs
    naarden vesting
    hong kong (elevation data is not very accurate for asia unfortunately)
    Need good gfx card:
    lower manhattan 
    manila
    The search currently uses openstreetmaps search which is kind of wonky. If you want to search a city, it's better to search a landmark within that city.
    Current issues:
    Is there any way to speed up the initial buildMesh() call for SPS? I remember reading something about offloading SPS tasks to the worker?
    I can't get the minimap thing to work.. how to copy a mesh to another scene?
  7. Like
    Convergence got a reaction from iiceman in Combining babylon.js and openstreetmaps.org data to create 3D maps from user data   
    I worked before on a city simulator before but unfortunately my motivation fizzled out and I never really continued with it, because there were some issues such as intersections for which I never got a good solution.
    After a while I stumbled accross Mapzen, which mainly uses openstreetmaps data and decided, why not combine it with babylon. I'm not the first one to try it , but still doing it for fun  It uses SPS, but the SPS.buildMesh() function is kinda slow which causes the initial load to be rather slow.
    Here's my rendition (still alpha/beta) of 3D openstreetmaps with babylon.js with some examples (only tested in chrome desktop and android):
    newark liberty airport
    french alphs
    naarden vesting
    hong kong (elevation data is not very accurate for asia unfortunately)
    Need good gfx card:
    lower manhattan 
    manila
    The search currently uses openstreetmaps search which is kind of wonky. If you want to search a city, it's better to search a landmark within that city.
    Current issues:
    Is there any way to speed up the initial buildMesh() call for SPS? I remember reading something about offloading SPS tasks to the worker?
    I can't get the minimap thing to work.. how to copy a mesh to another scene?
  8. Like
    Convergence reacted to jerome in Three.js or Babylon.js for room design   
    Moreover there are serious and objective reasons to prefer BabylonJS over ThreeJS :
    - the name "BabylonJS" is longer than the name "ThreeJS"
    - Deltakosh's hairdressing is more fashionable than Mr Dood's one
    - BabylonJS has an animated logo
     
  9. Like
    Convergence got a reaction from NasimiAsl in Combining babylon.js and openstreetmaps.org data to create 3D maps from user data   
    I worked before on a city simulator before but unfortunately my motivation fizzled out and I never really continued with it, because there were some issues such as intersections for which I never got a good solution.
    After a while I stumbled accross Mapzen, which mainly uses openstreetmaps data and decided, why not combine it with babylon. I'm not the first one to try it , but still doing it for fun  It uses SPS, but the SPS.buildMesh() function is kinda slow which causes the initial load to be rather slow.
    Here's my rendition (still alpha/beta) of 3D openstreetmaps with babylon.js with some examples (only tested in chrome desktop and android):
    newark liberty airport
    french alphs
    naarden vesting
    hong kong (elevation data is not very accurate for asia unfortunately)
    Need good gfx card:
    lower manhattan 
    manila
    The search currently uses openstreetmaps search which is kind of wonky. If you want to search a city, it's better to search a landmark within that city.
    Current issues:
    Is there any way to speed up the initial buildMesh() call for SPS? I remember reading something about offloading SPS tasks to the worker?
    I can't get the minimap thing to work.. how to copy a mesh to another scene?
  10. Thanks
    Convergence got a reaction from V!nc3r in Combining babylon.js and openstreetmaps.org data to create 3D maps from user data   
    I worked before on a city simulator before but unfortunately my motivation fizzled out and I never really continued with it, because there were some issues such as intersections for which I never got a good solution.
    After a while I stumbled accross Mapzen, which mainly uses openstreetmaps data and decided, why not combine it with babylon. I'm not the first one to try it , but still doing it for fun  It uses SPS, but the SPS.buildMesh() function is kinda slow which causes the initial load to be rather slow.
    Here's my rendition (still alpha/beta) of 3D openstreetmaps with babylon.js with some examples (only tested in chrome desktop and android):
    newark liberty airport
    french alphs
    naarden vesting
    hong kong (elevation data is not very accurate for asia unfortunately)
    Need good gfx card:
    lower manhattan 
    manila
    The search currently uses openstreetmaps search which is kind of wonky. If you want to search a city, it's better to search a landmark within that city.
    Current issues:
    Is there any way to speed up the initial buildMesh() call for SPS? I remember reading something about offloading SPS tasks to the worker?
    I can't get the minimap thing to work.. how to copy a mesh to another scene?
  11. Like
    Convergence reacted to jerome in SPS experiments   
    Hi,
    People usually love the Solid Particle System (aka SPS). Some of them sometimes ask for new features like the ability to extend it once created (coming soon) or for some extra speed by the ability to disable some computations.
    I made some study about how things could get faster. The short answer is : go to a lower lever in the implementation (replace the arrays of objects by typed arrays of floats, for instance), then use if possible other processes (GPU or workers).
    Well, here are the current status of my prototypes, so you can compare on your computer and browser the differences.
    The SPS of reference is really big, filled with 40K (yes, 40, 000 !) boxes and tetrahedrons. It's far more than we usually ask to a SPS with animated solid particles in the PG examples you could find in the forum posts. So your browser may suffer a bit ...
    Reference legacy SPS : http://jerome.bousquie.fr/BJS/test/spsReference.html
    Then comes the lighter typed array based version : http://jerome.bousquie.fr/BJS/test/spsBuffer.html 
    As you can notice, it's a bit faster. Not only because of the usage of buffers/typed arrays, but also because it has less features than the legacy SPS for now.
    Let's go on...
    [EDIT] (from here, your need to have a browser with sharedArrayBuffer enabled)
    Here comes his new friend, the worker based SPS : http://jerome.bousquie.fr/BJS/test/spsProtoWorker.html
    This one is really faster. In this version, the particle logic (what the user want them to do) is still in the main thread and the worker only computes the transformations (the final vertex coordinates from the particle rotations, positions, scaling values, etc).
    At last, here's the second worker version : http://jerome.bousquie.fr/BJS/test/spsProtoWorker2.html
    It looks faster ... at least on my browsers.
    In this last version, the particle logic is deported in the worker. The main thread only carries for updating the mesh from the vertex buffers.
    In both worker versions, the worker computations are decoupled from the render loop. This means that the worker computes, then answers the main thread it has finished and this one just orders it to compute again, whatever the render loop is currently doing at this moment. The render loop just reads the data currently updated by the worker in a shared buffer (shared between the worker and the main thread)
    Next study step to come (not soon) : the GPU based SPS
     
    Please wait for a while until the frame counter stabilizes to the current average value if you run the tests.
     
     
     
     
  12. Like
    Convergence got a reaction from satguru in Combining babylon.js and openstreetmaps.org data to create 3D maps from user data   
    I worked before on a city simulator before but unfortunately my motivation fizzled out and I never really continued with it, because there were some issues such as intersections for which I never got a good solution.
    After a while I stumbled accross Mapzen, which mainly uses openstreetmaps data and decided, why not combine it with babylon. I'm not the first one to try it , but still doing it for fun  It uses SPS, but the SPS.buildMesh() function is kinda slow which causes the initial load to be rather slow.
    Here's my rendition (still alpha/beta) of 3D openstreetmaps with babylon.js with some examples (only tested in chrome desktop and android):
    newark liberty airport
    french alphs
    naarden vesting
    hong kong (elevation data is not very accurate for asia unfortunately)
    Need good gfx card:
    lower manhattan 
    manila
    The search currently uses openstreetmaps search which is kind of wonky. If you want to search a city, it's better to search a landmark within that city.
    Current issues:
    Is there any way to speed up the initial buildMesh() call for SPS? I remember reading something about offloading SPS tasks to the worker?
    I can't get the minimap thing to work.. how to copy a mesh to another scene?
  13. Like
    Convergence reacted to jerome in Combining babylon.js and openstreetmaps.org data to create 3D maps from user data   
    @Convergence just for my own curiosity, and like you soldi particles don't look to move/evolve once created, did you try to build an immutable SPS to check if this could speed up the scene ?
  14. Like
    Convergence reacted to Deltakosh in Combining babylon.js and openstreetmaps.org data to create 3D maps from user data   
    This is extremely impressive!!!
    Do you want to be featured on babylonjs.com ?
  15. Like
    Convergence reacted to jerome in Combining babylon.js and openstreetmaps.org data to create 3D maps from user data   
    and BTW, I just downloaded some of your demos : huge work and really impressive !! 
  16. Like
    Convergence reacted to jerome in Combining babylon.js and openstreetmaps.org data to create 3D maps from user data   
    The worker experiments I did with the SPS were for the particle animation parts : setParticles()
    I'll have a check about where or what could be optimized in the building process.
    [EDIT] SPS experiment link : 
     
  17. Like
    Convergence got a reaction from adam in Combining babylon.js and openstreetmaps.org data to create 3D maps from user data   
    I worked before on a city simulator before but unfortunately my motivation fizzled out and I never really continued with it, because there were some issues such as intersections for which I never got a good solution.
    After a while I stumbled accross Mapzen, which mainly uses openstreetmaps data and decided, why not combine it with babylon. I'm not the first one to try it , but still doing it for fun  It uses SPS, but the SPS.buildMesh() function is kinda slow which causes the initial load to be rather slow.
    Here's my rendition (still alpha/beta) of 3D openstreetmaps with babylon.js with some examples (only tested in chrome desktop and android):
    newark liberty airport
    french alphs
    naarden vesting
    hong kong (elevation data is not very accurate for asia unfortunately)
    Need good gfx card:
    lower manhattan 
    manila
    The search currently uses openstreetmaps search which is kind of wonky. If you want to search a city, it's better to search a landmark within that city.
    Current issues:
    Is there any way to speed up the initial buildMesh() call for SPS? I remember reading something about offloading SPS tasks to the worker?
    I can't get the minimap thing to work.. how to copy a mesh to another scene?
  18. Like
    Convergence got a reaction from jerome in Combining babylon.js and openstreetmaps.org data to create 3D maps from user data   
    I worked before on a city simulator before but unfortunately my motivation fizzled out and I never really continued with it, because there were some issues such as intersections for which I never got a good solution.
    After a while I stumbled accross Mapzen, which mainly uses openstreetmaps data and decided, why not combine it with babylon. I'm not the first one to try it , but still doing it for fun  It uses SPS, but the SPS.buildMesh() function is kinda slow which causes the initial load to be rather slow.
    Here's my rendition (still alpha/beta) of 3D openstreetmaps with babylon.js with some examples (only tested in chrome desktop and android):
    newark liberty airport
    french alphs
    naarden vesting
    hong kong (elevation data is not very accurate for asia unfortunately)
    Need good gfx card:
    lower manhattan 
    manila
    The search currently uses openstreetmaps search which is kind of wonky. If you want to search a city, it's better to search a landmark within that city.
    Current issues:
    Is there any way to speed up the initial buildMesh() call for SPS? I remember reading something about offloading SPS tasks to the worker?
    I can't get the minimap thing to work.. how to copy a mesh to another scene?
  19. Like
    Convergence reacted to Wingnut in lookAt() when either the source mesh and/or target position are parented   
    Hi C, good to see you again.  umm... I think what you have shown in the playground... is ALMOST intended and ALMOST normal.
    The Mesh:  When the lookAt() mesh is parented, the rotation for that mesh... is "bound" to the parent's rotation.  If lookAt() tried to rotate that mesh, it would be ignoring the rotation handed-down from its parent.  Instead, the handed-down parent rotation... WINS.    Rotation, position, and scaling... are "the big 3 hand-me-downs" from a parent mesh.  Note:  When the parent is a light or camera, the "big 3" rule doesn't apply.  For example, cameras and lights have no .scaling to hand-down.
    The Target:  When the target is parented, use .getAbsolutePosition() instead of .position... as the first parameter of the lookAt() call.  See line 41...
    https://www.babylonjs-playground.com/#FZEH1H#1
    The 'ALMOST':  I think that when a lookAt() is done with full parameters, and when the last parameter is NOT BABYLON.Space.LOCAL, then the lookAt() function should automatically convert/change the first parameter. It should automatically modify the pos value... from being box1.position... to being box1.getAbsolutePosition().
    Example:  line 37 - box1.lookAt(box2.position, 0, 0, 0, BABYLON.Space.WORLD);
    If I'm reading the typescript source correctly, line 1316 should use .getAbsolutePosition() IF the last parameter is NOT BABYLON.Space.LOCAL.  Not sure, though.
    When I activate line 37 (and de-activate line 41), the lookAt() should work fine, because I am using WORLD as the last parameter, and NOT LOCAL.
    But activating line 37 and de-activating 41... fails.  This MIGHT indicate that the automatic convertor to .getAbsolutePosition() in the framework code... is failing.
    Perhaps some TS experts might want to verify this.  I'm certainly no expert in these matters. 
    For now, just use .getAbsolutePosition() for looking-at parented targets, such as line 41 does.  Meantime, perhaps you or some other coding Gods... will 'look at' line 1316 and tell us if they think it is doing its job.     Hope this helps.
    Other forum helpers... PLEASE correct any wrong things I have said.  Thanks!  I'm always scared of saying wrong things. 
  20. Like
    Convergence reacted to JohnK in Building from Floorplans   
    There is a tutorial for PolygonMeshBuilder but not in conjunction with the angled corners. Studying the construction of the angled section it it made from three angled walls. Each wall is made up of a base, two sides, a top and an interior and exterior rectangle, with holes for windows and doors. PolygonMeshBuilder is only used for the interior and exterior rectangles and the holes for windows. Notice that each window is wholly inside one of these angles walls, there is no provision for making a single window that goes across all three angled walls.
    To make a curved wall you would need to replace the three angles walls with many angled walls at the correct positions and angles, which can be done but you could not have doors and windows in it.
    To provide for curved ( or angled section, eg bays) then I would need to add code for a curved wall that could cope with doors and windows. Perhaps I might look at that some time next week.
    To show curved walls (without doors or windows) http://www.babylonjs-playground.com/#4GBWI5#5  is possible but not straightforward to achieve.
  21. Like
    Convergence got a reaction from Pryme8 in .getHeightAtCoordinates() not returning height correctly when paired with .convertToFlatShadedMesh()   
    Maybe you can duplicate the grondMesh before flatshading() it, and perform the getHeightAtCoordinates() on the smoothshaded mesh, while its hidden?
  22. Like
    Convergence reacted to Wingnut in Detect Intersection of Submesh   
    It takes special skills, I tell ya.   Type an unbearably-long reply, assuming that the user is a 4 year old (ridiculous over-explaining of the subject, nowhere near on-topic, packed with failed attempts at comedy). 
    Eventually, the user commits suicide out of tedium, and that is usually a workable solution.  heh.
  23. Like
    Convergence reacted to JohnK in The start of a house with ExtrudePolygon   
    Nothing special, just as the title says an example of building with ExtrudePolygon http://www.babylonjs-playground.com/#RNCYVM
  24. Like
    Convergence got a reaction from Dirtyburger in Triangle geometry, curves   
    you can try 
     
    var c = BABYLON.Vector3.Center(a, b).add(new BABYLON.Vector3(0, BABYLON.Vector3.Distance(a, b) / 5, 0)); change axis in the add portion as deeded.
  25. Like
    Convergence reacted to jerome in Dynamic Terrain   
    Tadammm : https://github.com/BabylonJS/Extensions/blob/master/DynamicTerrain/documentation/dynamicTerrainDocumentation.md#map-creation-from-a-height-map
    Example : http://www.babylonjs-playground.com/#FJNR5#125 
    + some easing method about UV Map called, weirdly,  createUVMap() : https://github.com/BabylonJS/Extensions/blob/master/DynamicTerrain/documentation/dynamicTerrainDocumentation.md#uv-map
     
    @Convergence at last, CreateMapFromHeightMap()