Landscape, without smoothing

Hi, I’m afraid because of the way landscape data is stored and rendered, there’s no way to implement smoothing groups. Smoothing groups are typically rendered by duplicating vertices with the same position but a different normal for each triangle. To save memory, Landscape stores only the height and normal at each shared vertex and everything else is computed by the shaders, so there’s nowhere to store which normal we want to use for each of the 6 triangles attached to a single vertex.

I think the best solution for your mobile game would be to use a static mesh.

edited* nvm

I’m working on converting landscapes to faceted meshes to bring PolyWorld to the Unreal Engine:

Here is a work-in-progress shot of a mesh that’s been generated from a landscape via blueprint:

580f877ef73f205cc6f2834bf00a362869706f19.jpeg

Now I just need to sample the landscape textures and blend masks, store that in vertex colors, and we’d be in business.

Care to share exactly how this was achieved?? ^^

*Sorry to necro, but there’s helpful info in here and it’s a top Google result…

World Position > DDX and DDY > Cross > Transform (Tangent to World) > Normal input
Then uncheck Tangent Normals in the material

In ye olden days of 3D graphics, flat polygons were shaded from a single point in the center. This was really cheap because the light only had to be calculated once per-poly from a single point. The limitations with this were horrific: shadows could not shade properly because you can’t shade by pixel, only by poly, and the end result would always look jagged. N64 devs preferred Gourard shading at the vertex to get a smoother result. Nowadays normals are computed per-pixel allowing smooth, round surfaces like cylinders and spheres to be rendered properly. Unfortunately, this means every surface must be considered smooth. If you want a sharp, hard edge, the mesh needs to be split along the hard edge, resulting in two vertices at the split.

To make this simple, you can’t actually improve performance with flat polygonal rendering because UE4 calculates normals per-pixel. The DDX/DDY cross method doesn’t work on mobile ES2 because they’re not supported features. You /can/ make every model flat-shaded, but you’d just be increasing your vertex count exponentially, which would seriously tank your performance. I think it might be possible to change the base shader files to shade normals per-poly instead of per-vertex, but I don’t know how well it would work or how exactly to implement this.

This is not how my approach was achieved. I literally reconstructed the Unreal Landscape as a set of static meshes according to the landscape settings. But when constructing the triangle indices array, there are no shared elements/shared vertices. Every element in the array is unique which results in faceted normals.

The performance does not tank with these extra vertices as I do this in other engines. It’s just simple geometry.

So I tried this. It works but when I move close to a shaped or raised terrain.The shape shifts. Is it LOD issue or something else?

Output: https://imgur/MSmsNrq

Material:

LOD settings for my Terrain:

lod.PNG

For anyone seeing this, you should connect the following to the normal pin of the material, and then turn off tangent space normal in the material settings.

Note that I did not use absolute world position. The reason for this is due to floating point inaccuracies which can cause visual artifacts, mostly when looking at terrain from very close.

For example, if you are using this normal to create an auto-material (assign grass/dirt/stone to different inclinations) you will have visual artifacts in certain inclinations, as follows:

However, if I use “Camera Relative World Location”, the issue is solved, as such: