Random mountains of unity3d randomly generated terrain

Source: Internet
Author: User

Use fractal noise to generate terrain, plus mountain shader, plus snow shader

Noise Generating Results


Noise generate the main reference to this article, will not repeat

Value3d:


PERLIN2D:


Fractal Noise:


Terrain Generation Results

Generate Terrain Grid method The main reference to this article, will not repeat

Noise frequency: 22, resolution: 256


Value3d:



perlin2d:



Fractal Noise:



Noise has many uses, such as topography, water bodies, fluids, textures of special objects, or making stickers non-repeatable, etc.


Mountain ShaderThe shader aspect is divided into two layers, the upper layer is the rock, the lower level is the plant, (can vary according to the map)

Using four kinds of maps, the upper two, the lower two, the noise map to adjust the two proportions, so as to avoid a monotonous, artificial signs obvious

The code mainly uses LERP


Note: When creating terrain, the UV proportions of the noise are adjusted (mountain density and detail)


Snow is mainly based on the direction of snow and normal direction of judgment, the two do dot product,

And then give the snow part to a specific snow texture, OK.

if (dot (N, _snowdir) > _snowinten) {c = _snowcolor; N = Normalize (I.normal) + normalize (Unpacknormal (tex2d (_snownormaltex, I.uv_snownormaltex)));}



Results

Add fog effect and Aa,bloom








All code is shared to GitHub


---------------by wolf96 http://blog.csdn.net/wolf96

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Random mountains of unity3d randomly generated terrain

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.