alanz2223 Posted March 11, 2016 Share Posted March 11, 2016 Is there a way to specify to the mesh to create troughs (valleys) instead of peaks? I would like to simulate the lunar surface. BABYLON.Mesh.CreatePlaneFromHeightMap(); Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 11, 2016 Share Posted March 11, 2016 I guess you can rotate it on X axis to revert it? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 11, 2016 Share Posted March 11, 2016 And I did not test but you can try to use negative value for heights: https://github.com/BabylonJS/Babylon.js/blob/master/src/Mesh/babylon.mesh.ts#L1743 Quote Link to comment Share on other sites More sharing options...
alanz2223 Posted March 11, 2016 Author Share Posted March 11, 2016 Well if you go that route then you can only have troughs or peaks, ideally you want both to simulate a real landscape. Do you know what color the algorithm bases altitude on? like pure white = minimum height, pure black = maximum height. Because what might work would be setting an offset so that your common ground is actually higher which coulb be a grey color, and then valleys are pure white and mountains are black. But this also seems hackish and I could run into bottlenecks when using a noise algorithm to create height maps. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 11, 2016 Share Posted March 11, 2016 That's the power of open source, you can read the code Here is the formula used : https://github.com/BabylonJS/Babylon.js/blob/master/src/Mesh/babylon.mesh.vertexData.ts#L1330 Based on this I guess that negative values should work Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted March 12, 2016 Share Posted March 12, 2016 Black is Down white is Up. if you want a lunar surface just adjust your height map... you dont have to invert anything on the displacement calculations, just the colors of your heightmap image. Have you checked out solutions like WorldMachine for generating heightmaps? A lunar one would be fast and easy and you could even generate wear and flow maps. 50% grey is flat and you can decide when you call the heightmap model if it goes down and up from the 0 point or just up (I might be making this second part up but I think its right). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.