Subdivide mesh as grid

I made a go at writing a script to subdivide an arbitrary landscape mesh into a grid in the playground below. Some problems I encountered:

  • stitching artifacts that show the borders of each grid piece
  • malformed geometry [Update: fixed]

Please note that the original model uses a normal map file that’s 300+ MB; it will take a few minutes to load.

1st attempt: https://playground.babylonjs.com/#HQBU7K#164
2nd (fixed geometry): https://playground.babylonjs.com/#HQBU7K#168
3rd better UV mapping: https://playground.babylonjs.com/#HQBU7K#172
(also less visible seams)

I was wondering if this has already been solved by one or some combination of the methods babylon js already provides. If not, any tips?

Update/Conclusion:
I think most people will be able to directly make use of this script -
https://playground.babylonjs.com/#HQBU7K#172

Would Grid Material | Babylon.js Documentation (babylonjs.com) work?

2 Likes

This looks extremely promising; gonna play around with that and see if I can cook up the result I’m going for. Thank you!

1 Like

So how would one go about generating height maps for each logical grid partition? I have a script that kind of works towards that end, but is very time intensive for detailed large maps.

Hmmm Grid Material is mostly for display, so you’d have to roll your own thing :thinking: @Evgeni_Popov any tips for that?

1 Like

I don’t know if it’s relevant but we have the dynamic terrain extension: Dynamic Terrain | Babylon.js Documentation ?

3 Likes

This also looks super promising. And pretty interesting too. I’ll be trying this one out too, thanks!

2 Likes