Search the Community
Showing results for tags 'creategroundfromheightmap'.
-
What are some options for creating terrain from heightmaps via NullEngine? I'm trying to create a serverside terrain for collision checks in a multiplayer game. The main issue is that Mesh.CreateGroundFromHeightMap involves loading an image and going through pixel data via canvas, none of which exists in node. Some ideas: Expose canvas + image api on the server: https://github.com/Automattic/node-canvas can provide Image and Canvas to NullEngine, though I've written a server side image processor recently that uses this tech and while it does work it isn't entirely straight forward because quite a few extra things need installed before it all works. I'm not sure how many babylon nullengine features use canvas/image, if its just this one then I doubt this route is worth it. Just loading the image in node: a small patch function that detects if we're in node and loads an image and gets its pixels using regular node fs. I'm not 100% sure how to do this but it sounds possible. This would kinda fork the logic inside of Mesh.CreateGroundFromHeightMap unless it was exposed in a new way. Go straight to the heightmap data and skip the images: https://doc.babylonjs.com/api/classes/babylon.vertexdata#creategroundfromheightmap - this does assume pixel data (UInt8 array of RGB? RGBA?) but has no dependency on canvas as far as I can tell. I don't understand the colorFilter (0.3, 0.59, 0.11) though, so someone would have to explain it to me. In my case I actually generated my heightmaps in node to begin with, and then saved them as images purely as a visual tool to see how the maps would look. I happen to be using these debug images and loading them into babylon because it works automagically! I could certain just skip all this and save them in some other format, like a 1D array of UInt8s (though in this scenario it would be ideal to skip RGBA and just have raw height data). I could probably add this to babylon by following the existing example if this is a feature people want. Once again I'm a total 3D noob, so if there is a much more trivial solution please let me know :D. I'm also willing to contribute, but I just don't want to make the wrong contribution.
- 3 replies
-
- creategroundfromheightmap
- terrain
-
(and 2 more)
Tagged with:
-
Hi there, I'd like to procedurally generate a height map in run time and don't want to save it to the image, as it costs in additional overhead. I'm looking for a way to use 2d array instead of image url (the array dimension may serve as a number of subdivisions). Obviously I don't want to rewrite the CreateGroundFromHeightMap function, because this function is works fine and there is no need at all to reinvent a wheel. What I'd expect for, is that CreateGroundFromHeightMap will consist of two functions - the basic one, which receives the two dimensional array, and the wrapper function which converts the image to the 2d array. I'm wondering how can I do it without changing the code of the framework (maybe I'm missing something), and why its's not done this way so far? P.s. If you will look at the implementation of CreateGroundFromHeightMap, you will notice that this is what actually happening there - first of all get the data from the image, and then build the height map. It's just not organized well (or, again, maybe I'm missing something).
- 14 replies
-
- height mapprocedural
- CreateGroundFromHeightMap
-
(and 1 more)
Tagged with:
-
Hi guys! I have a mesh (ground) that is created with this function: ground = BABYLON.Mesh.CreateGroundFromHeightMap("ground", captureFilePath, 200, 200, 250, 0, 10, scene, false); At some point, I know that the file (captureFilePath) has changed (same file, but data has changed), and so, I want to update the mesh. I tried to do like this: ground.dispose(); ground = BABYLON.Mesh.CreateGroundFromHeightMap("ground", captureFilePath, 200, 200, 250, 0, 10, scene, false); But nothing changed. I feel like my first image is cached somewhere, because if I change the file (not only the data, but also the name), eveything goes well. My project is an offline project and the file is located on my local drive. Any idea? Thanks! Fred
-
Hi, I have a huge problem with oimo and ground created with CreateGroundFromHeightMap. Please look at this: http://www.babylonjs-playground.com/#W3NZA Maybe I am doing something terribly wrong? Marius
- 3 replies
-
- oimo
- CreateGroundFromHeightMap
-
(and 2 more)
Tagged with:
-
Hello! (I've spent a few minutes looking up my issue, but I did not really found anything regarding this, so please feel free to lock & close it if it is already discussed somewhere else) So I've been generating some meshes from height maps with the CreateGroundFromHeightMap method on the Mesh object/class. As the mesh size increases I should increase the "subdivisions" parameter value, to get some smooth mesh, but after setting some 180-200 as value, I'm getting some weird issues, like the meshes from one end get connected back to the new ones at the start of the new columns, resulting big ass triangles through the valley. See this image: http://snag.gy/5GB1I.jpg Is this a known issue, or am I doing something wrong? Thanks, Alex
- 5 replies
-
- CreateGroundFromHeightMap
- Mesh
-
(and 1 more)
Tagged with: