Urho3D Wiki
Register
Advertisement

(Simplex) Noise[]

In USP the materials of the terrain and level geometry are realtime generated on the graphic card using Simplex Noise (that's an improved version of the more well known Perlin Noise made by the same guy). It's based on this: https://github.com/ashima/webgl-noise
See https://github.com/gawag/Urho-Sample-Platformer/tree/master/Build/bin/Data/Shaders/GLSL for the noise function (in snoise.glsl) and the shaders where it's used.

With this noise it's possible to automatically generate materials similar to the Blender generic cloud textures but without having to bake it to (2D) textures and having to use UV mapping with ugly cuts or ugly texture stretching. (This can also be fixed with Tri-Planar Texturing.)

Such generated materials are practically 3D textures with an infinite resolution. You can't do as much as with Blender or image editing programs, but it may be enough for such an unrealistic/CGI style as used in USP.

The biggest problem though is the high cost. These realtime materials are really draining FPS especially with multiple lights close by.

Here are some examples of the possibilities:

Most screenshots don't show the normal map calculation which got added later (it's included in all USP shaders).

Simple Math[]

You can also use (more) simple calculations based on the world position to create realtime materials on the GPU (this is much cheaper as the noise stuff above):

Here I filled the noise_height function in https://github.com/gawag/Urho-Sample-Platformer/blob/master/Build/bin/Data/Shaders/GLSL/level_1_terrain.glsl with this:

float noise_height(vec3 p)  // p is the world position
{
float f=sin(p.x*2)+sin(p.y*2)+sin(p.z*2);
f/=3; // to get the values between -1 and 1
f=0.5+f*2.0; // do some fancy stuff
f=clamp(f,0,1);
f-=0.5;
f=abs(f*2);
f*=f;

return f;
}

Which resulted in the ground looking like:

USP simple math shader
USP simple math shader2

You can see that such simple calculations result in quite repetitive and abstract textures. Though it can still be useful.

More examples (older ones):

Advertisement