Hi all,
I’ve been researched for quite a while and could not find an easy way to achieve what I want:
Generate a curved landscape on a small portion of planet surface, with all other landscape auto tools still available (e.g. collision, foliage, materials, lighting).
- I do not need the whole planet procedural generated mesh (I know many people are working on this), so I suppose it’s not necessary to start from scratch for this function; Most of my use case would be covered by current native Landscape Module so I’d like to leverage that.
- The curvature on the landscape is important to me because higher latitude would have shorter distance (which is important for the game play), due to the nature of Mercator projection of earth heightmaps.
- I cannot “bake” this curvature into the original heightmaps to tricky the system since the area is too large (longitude range > 40 degree, latitude range > 30 degree) to make the peak point into uint16 range.
What I have tried so far:
- I surely tried the WorldPositionOffset in material but we all know it’s just vertex shift in GPU while no effect on collision or other functions from the native tools. For example, the foliage does not work for me. I noticed there is an option to bBakeMaterialPositionOffsetIntoCollision, but I could never make it work correctly, and I don’t know if it can really applicable to my huge area with large both XY and Z offset.
- I definitely implemented some procedural terrain generation algorithms (e.g. CDLOD) in some open source light weight game engines (e.g. Urho3D). It worked perfect for the terrain mesh generation and LOD transition etc. But I had not reached the point to work with terrain materials, foliage, collision and all other stuff. I don’t think those parts are easy work. So I would really prefer to use Unreal native module as much as possible.
- I also tried to modify the source code and compile my own version. However, I could not get it work since the code base is pretty complicated with many different things unrelated to my logic. I could not find the place where the heightmap finally converted to mesh and render in the real world. I also find the source code is not well organized in many different ways so it’s very error-prone if I do not have a full & deep understanding on every single bit of the Landscape module. for example, I saw lots of hard-coded things like
(HeightZ - 32768.0f) * LANDSCAPE_ZSCALE
everywhere. It’s in LandscapeEditorTool, LandscapeCollision, LandscapeComponent, LandscapeSceneProxy, LandscapeRender and many other different places. They are not changing the vertex directly but used for other derivatives calculation (e.g. normals). I feel it’s really easy to miss some and write bugs everywhere.
However, I do feel modify the source code might be the only way I could achieve this.
I feel a little bit frustrated given my current experience on Unreal engine. It looks really easy to start at the first place with all well-made native functionality, but when you reach the point that you want to modify things, it’s always really hard. I’ve worked on some other engines and I did not have similar feelings. Not sure if it’s just me or not. But I still want to try to use Unreal as much as possible given those native implemented features and arts (which is super hard to do in another open source engine).
Anyway, any thoughts or idea on the easiest way I could do the curved landscape?
Thanks!