landscape_generator - ryzom/ryzomcore GitHub Wiki


title: NeL Landscape Generator description: published: true date: 2023-03-01T05:22:02.861Z tags: editor: markdown dateCreated: 2022-03-15T01:51:27.742Z

User Input

The user may provide a heightmap, either generated or hand drawn.

Alternatively, the user may provide a mesh, which will be used to generate a heightmap from the top and bottom views. This is useful for generating caves and canopies with reliable dimensions.

Adjustment of gamma and offset to fine-tune the result of hand drawn heightmaps.

Final Output

A top surface, and optionally a bottom surface, with consistent density, and only quad surfaces.

The surfaces shall be automatically refined with bezier splines.

The artist may still need to merge multiple surfaces for more complex terrain designs, this should be straightforward.

The tool does not need to depend on NeL or 3ds Max. It can just output an obj for the non-patch mesh, and a maxscript procedure to build the patch mesh in 3ds Max.

Goal is for the artist to only need to focus on the refinement and decoration.

Steps

Tool will allow artist to preview each step individually.

Generate blocky mesh

Generate a mesh with blocks of all the same sizes that entirely covers the heightmap. The mesh will be the most coarse subdivision level of NeL zones.

Lower blocks to terrain

Lower all block top surfaces to fit the terrain.

blocky_map.png

Mark walls

Mark all walls, and top and bottom edges, that are less than 50% the needed height to require a full block raise. These are the walls that will be removed.

select_wall.png

Remove walls

Use the edge flipping technique to eliminate all smooth walls. Alternate between clockwise and counter-clockwise on odd and even layers. Eliminate all vertices that remain with only 2 edges after every flip. This technique removes walls while keeping all surfaces quad.

flip_edge.png

flip_edges.png

smooth_wall.png

Smoothen loops

Smoothen loops to avoid sharp zigzag patterns.

Fit to heightmap

Fit controls of walls and floors closer to the heightmap. Especially make sure the sharp edges are nearest to the sharp edges in the heightmap.

Might need multiple rounds of smoothing and fitting steps?

Add bezier controllers

Smoothen loops. Control sharpness of edges based on the heightmap.

Notes

The tool can pre-flag overlapping walls for stitching at the first step. Give the top precedence. Might be possible to auto-stitch to some extent!

Generate material splat map using the height map. For sand just randomly scatter sand, let it drip down, stop at any existing sand, don't drip sand where there already is sand. Repeat until largely full. Track from which step each sand grain is. Use that to create a gradient. Let the user choose the range for the gradient, and dither the splat map for the sand.

Generate another splat map for steep walls, these definitely don't have sand, so this overrides the sand map. This may be bark on a Fyros map, whereas the non-sand base may be coarse wood rubble.

Another splat map for very steep walls, based on the actual mesh.

Optionally, Generate a splat map for the most appropriate displacement tiles, based on the texturing of the heightmap, and the other splat maps. May also generate a splat map for textures based on the heightmap texturing.

Auto-paint from a corner in a scanline motion diagonally, using the existing painting algorithm. Then auto-paint everything in a pseudorandom order, to evenly spread out the bias of the transition pieces. For any unpaintable tiles, randomly pick any of the neighbouring materials until it works. If still nothing, pick any other material.

To make this sellable, we can make an alternate SubD output mode, that generates displacement textures based on the heightmap or reference mesh.

Smoothing might be possible to do in all directions by just tagging all the short faces for all three directions, instead of doing the mesh modification straight away...

⚠️ **GitHub.com Fallback** ⚠️