• Stars
    star
    185
  • Rank 208,271 (Top 5 %)
  • Language
    C#
  • Created about 4 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A small GPU-based component designed to aid in cleaning and refining satellite/DEM based terrains directly inside Unity.

Terrain Prettifier

alt text alt text

What is this?

Terrain Prettifier is a small component designed to clean and improve satellite/DEM based terrains directly inside of Unity. I started working on it because I was frustrated with how cumbersome the process of working with multiple terrain tiles in external programs was, where often I just wanted to add some higher resolution detail to an already existing height map. It can also be used to upscale and add detail to low-resolution terrain height maps.

It is entirely GPU based and so runs at interactive framerates. Additionally, it uses a ray-marched preview renderer which allows you to instantly see the results of your settings and only applies the modifications to the actual terrain height map once you are happy with the results.

Height map filtering

Denoiser

alt text Applies a bilateral blur filter to the heightmap before further processing. Useful for filtering noisy input data without destroying important features.

Ridge Maker

alt text Sharpens ridges. Useful if your DEM data is overly smooth. Also useful for upscaling low-resolution data.

Erosion

alt text Adds hydraulic erosion-like features to slopes. It should be noted this is not an actual hydraulic simulation, but rather uses a gradient-aligned noise algorithm which looks like erosion. Very useful for adding detail to slopes, and in particular for upscaling low-resolution data.

Satellite map filtering

Shadow Removal

alt text Identifies shadows based on pixel luminosity and replaces them with adjacent features.

Cavity Filter

alt text Burns cavity (concave/convex) features into the color map. Should be used with care since it easily makes the resulting color map look like crap.

Usage

Drop the Assets/TerrainPrettifier directory into your Assets folder to install. To apply to a terrain, add the TerrainPrettifier component.
Once you are happy with the results, press "Apply to Terrain" and "Save Processed Texture" respectively.
The resolution of the output is based on that of the input. As such, if you wish to upscale a low-resolution terrain, you first need to increase the height map resolution on the terrain itself to your desired target resolution.
The preview renderer is only active while the terrain is selected. To turn it off, simply uncheck it in the component.
It is an editor-only script and can not be used at runtime. The component does nothing if included in a build.

Limitations

Does not take neighbouring terrain tiles into account. This is a planned feature but I can't promise it will be added anytime soon.

Acknowledgements & further reading

Bilateral filter by mrharicot: https://www.shadertoy.com/view/4dfGDH
Erosion noise by Clay John: https://www.shadertoy.com/view/MtGcWh
Gavoronoise by S.Guillitte: https://www.shadertoy.com/view/llsGWl
Ray-marching terrain by Inigo Quilez: https://www.iquilezles.org/www/articles/terrainmarching/terrainmarching.htm

Can I use this code for X/what license applies to the code?

Check the sources above for what license applies to the individual parts of the project. Besides this, consider any of my code in the repository as public domain.

More Repositories

1

BNAO

A tiny, GPU-based Bent Normal and Ambient Occlusion baker for Unity.
C#
529
star
2

MinimalAtmosphere

A minimal atmospheric scattering implementation for Unity
C#
459
star
3

BakerBoy

A single-component, GPU-based universal ambient occlusion and bent normal baker for Unity. The successor to my BNAO respository
HLSL
302
star
4

MeshDecal

A simple mesh decal component for Unity
C#
210
star
5

CloudNoiseGen

A static utility class for Unity which handles generating and loading periodic, cloud-like (perlin-worley) 3D noise textures on the GPU.
C#
127
star
6

VolumetricTracer

A simple way to render soft, volumetric bullet tracers in Unity. Only needs a unit cube and a material to render and supports instancing.
ShaderLab
117
star
7

CapsuleOcclusion

Unity package implementing clustered capsule/character occlusion
C#
92
star
8

VertexColorBaker

A tiny vertex color baker for Unity that runs on the GPU, implemented as an AssetPostprocessor
C#
86
star
9

SDFGI

A Monte Carlo path tracer implemented on the GPU in Unity, using Signed Distance Fields.
C#
77
star
10

Celery

Mask
24
star
11

SphericalHarmonicsDev

ShaderLab
10
star
12

SphericalHarmonics

HLSL
9
star
13

TNM084_Lab3

A procedural lava ball in Unity
C#
5
star
14

BasicPlayerMovement

A super simple Unity demo featuring two ways of doing basic player and camera movement.
C#
5
star
15

AtomicSurfer

A super-rad surfing/shark shooter simulator.
C#
4
star
16

TextureProcessor

Static utility class for processing texture on the GPU.
C#
4
star
17

InfinitePain

A RougLike FPS created during a game jam
C#
4
star
18

LiTHeLan_Final

C#
3
star
19

LudumDare38

C#
2
star
20

iMat

Java
1
star
21

MoS

C#
1
star