adam Posted August 11, 2016 Share Posted August 11, 2016 Does anyone know how to create vertical sides on a ground mesh? Here is a PG to work with: http://www.babylonjs-playground.com/#WJPB9#2 I'd like the mesh to extend downward on all 4 sides to fill the bottom of the box. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 11, 2016 Share Posted August 11, 2016 I can think of a few ways to do this, but I have a couple questions first. Does it need to be a single mesh? If so does the bottom need to stitch itself together as it goes to simplify the geometry? or do you just need something to cap it. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 11, 2016 Share Posted August 11, 2016 Cooool playground! Wow! Ok, let me roll an idea past ya. START with your ground mesh on the bottom of the box. Now raise the Y-height of every point EXCEPT those around the outer edge of the mesh. Now add about 13... to the height of every noise-affected point. Your box is 40 high, the land surface sits about 1/3 up, so 40/3 = 13.xx. Ya know how displacementMaps tend to raise everything in the middle of a mesh, but leave the outer edges of the mesh... at their original height? Same with your thing. Keep your outer edges on the bottom of the box, and then raise all your not-along-edge noise-points normally, +13. That might work. You might even want to USE a displaceMap instead of a ground. Also, if you get all your not-raised edge vertices to be directly under the noise-affected edge vertices... your side walls will be perfectly vertical. If not, the sides of the mesh will have a steep taper. Does this make any sense? In other words, you will be adding one row of vertices on each side of the current ground, and placing each point of those... at the bottom of the box. Also, if you want nice texture on those sides, good luck. In my method, the texture will be smears and streaks, I believe. UV adjusting should be able to fix that, somewhat, I guess. I think that would work... but you know me, Adam. More dreamer than coder. If BJS had a ground.setVertexHeight( {row: x, column: y, amount: z}) helper-function, I might have tried to draw the sides myself. adam 1 Quote Link to comment Share on other sites More sharing options...
adam Posted August 11, 2016 Author Share Posted August 11, 2016 Thanks Wingnut. I got a good start on it: http://www.babylonjs-playground.com/#WJPB9#3 http://www.babylonjs-playground.com/#WJPB9#4 http://www.babylonjs-playground.com/#WJPB9#5 Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 11, 2016 Share Posted August 11, 2016 Man, that's fast! And NICE!!! Cool. Mind if I steal all your code and techniques from this playground? Too late, saved all. Quote Link to comment Share on other sites More sharing options...
adam Posted August 11, 2016 Author Share Posted August 11, 2016 1 minute ago, Wingnut said: Mind if I steal all your code and techniques from this playground? No problem. I took most of it from Jerome. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 11, 2016 Share Posted August 11, 2016 The look of the texture on the sides... that turned out pretty good, too, eh? I thought it would be a lot trashier-looking than it is. Quote Link to comment Share on other sites More sharing options...
adam Posted August 11, 2016 Author Share Posted August 11, 2016 40 minutes ago, Pryme8 said: Does it need to be a single mesh? That's what I was hoping for. Quote Link to comment Share on other sites More sharing options...
adam Posted August 11, 2016 Author Share Posted August 11, 2016 I created a createSidesOnGroundMesh function. http://www.babylonjs-playground.com/#WJPB9#6 gryff 1 Quote Link to comment Share on other sites More sharing options...
gryff Posted August 12, 2016 Share Posted August 12, 2016 @adam : nothing like answering your own questions And just to make sure the dark corners were not a problem with the code, I put in a Hemi light instead of the Directional light With Hemi And as they say, "No problem" cheers, gryff adam 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted August 12, 2016 Share Posted August 12, 2016 this code does exactly what you want : https://github.com/jbousquie/ArtilleryDuel/commit/19637fd99c7d7f55fcd83d4e0449449bd967c755 adam and NasimiAsl 2 Quote Link to comment Share on other sites More sharing options...
adam Posted August 12, 2016 Author Share Posted August 12, 2016 Thanks Jerome. I used that code to create another function called createSidesForGroundMesh: http://www.babylonjs-playground.com/#WJPB9#8 I'm not sure why the texture isn't appearing here: http://www.babylonjs-playground.com/#WJPB9#9 jerome 1 Quote Link to comment Share on other sites More sharing options...
adam Posted September 3, 2016 Author Share Posted September 3, 2016 I modified Jerome's code to create sides that take a texture: http://www.babylonjs-playground.com/#WJPB9#14 The way I was creating the sides toward the beginning of this thread messes up the getHeight function of the groundMesh. Wingnut and NasimiAsl 2 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.