Hi there, I’m building a mesh/terrain generator and well I have a few questions
Source project: PlayCanvas 3D HTML5 Game Engine
I’m not sure how to smooth out terrains between two different meshes/planes, how can this be achieved? Is there any function or example this beeing done? Thanks
Another question: Would it be possible (after mesh generation) to generate different zones by mesh height and apply different textures to meshes, like sand grass etc
Yes, it’s definitely possible though it requires a lot of manual work.
You will need to visit the terrain edges in your positions array and flatten/average them so both terrains match. At the same moment you will need to calculate the normals to take into account the triangles of the other terrain, to avoid getting lighting artifacts.
This thread is quite useful on that subject: Tiled terrain and normals - #6 by Leonidas
For generating different zone heights that’s possible. You could calculate the terrain UV coordinates to match a specific texture, I don’t have an example in mind for that.
Another way is to use a height based shader to do the same thing and mix between the various textures used. Here is a Three.js example that you can study for learning:
Thanks for your informative reply, lots of work ahead, would it be any easier to smooth out single planes corners instead? Will look for examples
This is what I’m aiming for (looks) PlayCanvas 3D HTML5 Game Engine
Saldy it is outdated
When you say smooth out single planes corners, what do you mean exactly?
Smooth out the normals for lighting? Or reduce the height on the corners so it looks more like an island at the center?
More like an island look, I’m totally lost with mesh stuff, a good start would be to select corners of the mesh
The idea is to flatten all corners, thus colliding planes would look seamless (I hope) as I am not planing to generate hills
Just an idea: What if heightmap (with transition to black corners) could be applied during generation? Probably not as the engine would still have to proccess whole map
I’m done with terrain generation, (back to heightmaps) what’s left is coloring, I’ve found some usefull link over here Around custom shaders
Could this work? What are the steps to reproduce shader on PlayCanvas, the glsl has to be rewritten?