Windy Terrain

A method of generating 3D terrain with lots of cool, small details.

Discuss noise, fractals, procedural generation, distance fields, and whatever else would be cool to generate!
Post Reply
User avatar
Lin
Site Admin
Posts: 22
Joined: Tue Jul 04, 2017 6:02 am
Location: Phoenix, Arizona
Role: Researcher
Contact:

Windy Terrain

#1

Post by Lin » Tue Sep 12, 2017 7:06 am

Summary: Generates what I call "windy" terrain, where it uses noise to offset the sampling point for the actual noise. It's a rather costly calculation, but the results are worth it. This function is what was used in the site's logo!

Code: Select all

public static float Windy(float x, float y, float z)
{
	float g_scale = 0.00002f;
	float ym = 2.0f;
	const float wind_scale = 0.000001f;
	const float wind_percent = 5.8f;
	float height = 50000;

	float wind_x = SimplexNoise.Noise(x * wind_scale + 1.186f, y * wind_scale + 1.186f, z * wind_scale + 1.186f, 4, 0.5f) * wind_percent;
	float wind_y = SimplexNoise.Noise(x * wind_scale + 0.842f, y * wind_scale + 0.842f, z * wind_scale + 0.842f, 4, 0.5f) * wind_percent;
	float wind_z = SimplexNoise.Noise(x * wind_scale + 0.357f, y * wind_scale + 0.357f, z * wind_scale + 0.357f, 4, 0.5f) * wind_percent;

	float n = SimplexNoise.Noise(x * g_scale + wind_x, y * g_scale + wind_y, z * g_scale + wind_z, 8, 0.5f);
	n = (float)Math.Pow(n, 2.0f) * height;

	return y * ym - n - 0.01f;
}
Note: You need simplex noise sampling. You can of course, also mess with the wind offset parameters, which are used if you're using interpolated random noise texture instead of simplex noise, and number of octaves.

Image
Image

Tags:

User avatar
Papa G
Posts: 1
Joined: Wed Jul 05, 2017 1:57 pm
Role: Programmer

Re: Windy Terrain

#2

Post by Papa G » Tue Sep 12, 2017 1:53 pm

How can one speed up noise calculations ? Would it involve OpenCL, SIMD, rendering noise to a texture ? Thanks :). Looks great btw xD

User avatar
Lin
Site Admin
Posts: 22
Joined: Tue Jul 04, 2017 6:02 am
Location: Phoenix, Arizona
Role: Researcher
Contact:

Re: Windy Terrain

#3

Post by Lin » Tue Sep 12, 2017 3:17 pm

Well there are multiple ways to generate noise. With all the independent floating point math, it's just begging to be thrown on the gpu. There's another way to generate noise there, which is to generate a random texture on the cpu, upload it to the gpu, and take advantage of the linear interpolated sampling, combined with multiple octaves. The results are really nice. How you get that from the gpu to the cpu is up to you.

Auburn
Posts: 1
Joined: Tue Jan 02, 2018 8:41 pm
Role: Programmer

Re: Windy Terrain

#4

Post by Auburn » Tue Jan 02, 2018 8:42 pm

I think it is known as domain warping: http://www.iquilezles.org/www/articles/warp/warp.htm

User avatar
Lin
Site Admin
Posts: 22
Joined: Tue Jul 04, 2017 6:02 am
Location: Phoenix, Arizona
Role: Researcher
Contact:

Re: Windy Terrain

#5

Post by Lin » Wed Jan 03, 2018 12:42 am

You're right, and actually I only very recently noticed that the infamous GPU Gems 3 article for complex terrain generation does just this.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest