Académique Documents
Professionnel Documents
Culture Documents
Horizon[ON] Manual
p.s.: Please take some time and rate Horizon[ON] on the Unity Assetstore. We did our best
to make our product stand out but your support is what makes it successful!
Features:
Main
extend your terrain towards the horizon at a minimum cost
smooth blending
works for terrains of any size
extremely adjustable & artist friendly workflow
very low on draw calls
mobile friendly
works with Unity 4.6 free version
ready for Unity 5
Shaders/Materials
multi_compile shaders - use only the features you really need
clever material management
tidy custom material inspector
PBR, but still adjustable to your needs
works with OpenGL, DX9, DX11,
works in Linear and Gamma Space
IBL Ambient Lighting & Specularity
ambient override and tint to easily match your scenery
4 Layers for different terrain types on one horizon
detail textures and normal maps
emissive channels for distant city lights, volcanoes or else...
water & ice (oceans, rivers, lakes...)
height based fog
vertical cliffs
displacement
tesselation(DX11 only)
dynamic snow
Blendobjects
easily add hills and cliffs to the horizon with a minimum of polygons
add tesselated parts to the horizon for great detail
all perfectly blended with the horizon object
Useable as a terrain solution(!)
(Note: its not meant to be a replacement for powerful terrain solutions like RTP)
suitable very well for top-down games, flight simulators & strategy games.
even in first person it can look great(depending on your needs of course)
Important Note!!!
Please import Horizon[ON] into an empty project and make yourself familiar with it before importing it into
an existing project. Horizon[ON] uses shader keywords to enable and disable features. In unity 4.6 exists a
limitation of 64 shader keywords and if you have already a lot of shaders in your project, it can be that upon
import of Horizon[ON] you exceed this limit. If that is the case you will get an error, saying :
Maximum number (64) of shader keywords exceeded, ...
If that happens to you, dont panic, Horizon[ON] uses these keywords only to enable certain features, if you
know already which features you are going to use you can easily define them in the shadercode,
from:
#pragma multi_compile _EXAMPLE_KEYWORD_OFF _EXAMPLE_KEYWORD_ON
to
#define _EXAMPLE_KEYWORD_ON
On the pages 19 and 20 of this manual you find a detailed explanation of why and how to deal with shader
keywords. Please read this section thoroughly before you import Horizon[ON] into an existing project!!!
Horizon[ON] Features
Use these checkboxes to enable or disable certain features. This will compile a shader variant that has only
the selected features.
Layercount - Set how many layers you want to use.
Diffuse Lighting Mode - Ambient, Cubemap, UnitySH(Unity5 only), SkyshopSH(Skyshop only).
Enable Specularity - Check if you want to use direct specularity.
Enable Reflections - Check if you want to use cubemap reflections.
Enable Normalmapping - Check if you want to use normalmaps.
Enable Emissiveness - Check if you want to use emissiveness.
Enable Detail Textures - Check if you want to use detail textures.
Enable Water - Check if you want to use water.
Enable Fog - Check if you want to use layered fog.
Enable Snow - Check if you want to use dynamic snow.
Of course, the more features you enable the slower Horizon[ON] will be. This is mainly of concern for
mobiles, as on desktop even with everything enabled Horizon[ON] should perform very good. Also on
mobile you might run into compatibility issues if you just enable everything. It depends on the devices and its
unfortunately impossible to guarantee that everything works on every device out there.
Depending on which features you select, there might be some options invisible in the categories
below and also in the material inspectors.
Transition Settings
If there is a child element of the type Transition these
options are availible for you to adjust.
Scale Inner - this is the transition length from the terrain to the horizon. The longer the transition is, the
smoother it will appear but it will also make you lose more of your useable terrain area, so its best to find a
good compromise.
Scale Outer - here you can adjust how far the object should extend outwards. Basically, bigger is better,
scale it as far as your Camera farclip plane allows.
Scale Height - this is the transition height from the horizon to the sky. If you want the horizonline to be
smooth, use a high value, if you want your horizon line to be sharp, use a small value.
Scale Inner only affects the Transition Terrain element. Scale Outer and Scale Height only affect the
Transition Sky element.
Note that you have to scale the Horizon[ON] Transition elements first in the transform(!).
E.g. If your terrain is 5000m big you also need to put that value into the transforms scale.
(Uniformly - X: 5000, Y: 5000, Z: 5000)
Main settings
Mask (RGBA) - Assign your custom mask here. This mask works basically like a splatmap but can
be painted in an image editing program. It does not need to be normalized, so layers are lerped on top
of each other. Layer 1 is placed everywhere, layer 2 is placed where the red channel is white, layer 3 is
placed where the green channel is white, layer 4 is placed where the blue channel is white and water
will be placed where the alpha channel is white.
Global Tint - Tints the whole Horizon[ON] object. This can help to get a perfect blend with your
terrain.
Emission Color - If you use the alpha channel of a layer as an emission mask it will take the
according pixels of the layer colormap as emission color, this color can be tinted (multiplicative) using
this color picker. The alpha channel acts as a multiplier(useful to get HDR for bloom).
Ambient Override (A) Amount- You can make Horizon[ON] to use a different ambient light color
than the one set in the render settings. The alpha channel controls how strong the override is.
Ambient vs. IBL - If you use a diffuse IBL cubemap(feature tab) you can blend between ambient light
and IBL. This is useful in various cases, e.g. to animate a change in lighting conditions.
Normal intensity - If you use normalmapping (features tab) you can use this to control
the overall strength of the layer normal maps.
Normalmap - Should fit your colormap but a normal map created from a grayscale perlin noise can
do the trick as well in many cases. A normalmap generated in WorldMachine or Terrain Composer
that matches your colormap is ideal.
Tiling - Controls how often the colormap and normalmap will be tiled.
Tint / Saturation - Tints this layer. Middle grey is neutral, so you can darken or birghen your layer
here. The alpha value of the color picker controls the saturation of this layer.
Spec / Gloss - Used to adjust the specularity(RGB in the color picker) and glossiness(A in the color
picker). Tip: switch the color picker to HSV, a Value of 6 and a Value of 17 in the Alpha gives good
results in most cases.
Detail Intensity - If you have detail textures enabled in the features tab you can use this slider to
adjust how strong the detail textures will be applied to this layer.
Detail Settings
Water Settings
Fog Settings
Snow Settings
Displacement Settings
Cliff Settings
10
IBL Settings
Horizon[ON] Tools
11
Transitions - there are 2 elements in this category, Transition Terrain and Transition Sky.
BlendMeshes Displaced - this category contains elements that use displacement and can be
placed on a flat horizon.
BlendMeshes NonDisplaced - this category contains elements that dont use displacement and
can be placed on a flat horizon.
Multi Level Arrangements - this category contains elements that are used to compose a horizon in
as special way.
Some elements need to be scaled uniformly and some others can be scaled freely. Displaced elements use
the scale of the Y-axis do define their vertical bounds. I will explain more about scaling in the description of the
elements.
12
13
Transition Elements
There are 2 elements in this category:
Transition Terrain
Transition Sky
14
You should take care that your camera far clip plane
is big enough so it wont clip the transiton.
In many cases this object is also the basis to place
elements from the BlendMeshes categories on top.
If you are using multi level arrangements, this
object should be the outmost object(and therefor
should have the largest scale - dont forget to scale it
uniformly).
These are called exampes because you can easily model more of them in a 3D program. You dont even need
to take care about UVs. These objects can be placed anywhere on the horizon if it is flat. You can also scale
them in any way you like. These objects are great to add vertical detail to your horizon if you are strongly
constrained by performance(Mobile) and cannot use displacement.
Cliffs and Hills are very similar, the difference is that cliff objects use 2 planar mapping in world space for
vertical surfaces. The great thing about these objects is that they can have mesh colliders attached to them,
which opens a lot of possibilities. Because they are textured in worldspace they can be intersected nicely, the
textures would always be continous in such cases. Those objects would be fantastic candidates for creative
misusing. Cliffs for example could be used as dungeon walls or obstacles on a minigolf course.
About modeling your own BlendMeshes:
It is very easy and any shape is possible, the only thing you should take care of, is that their pivot is in the
middle and on the bottom. Idealy you model also a flattening transition on the bottom side, to get flawless
blending with the underlying surface.
15
16
Since all the levels have the same amount of triangles but are scaled always twice as big there is a logarythmic
falloff of detail, which means the triangles stay roughly at the same size on the screen. Much detail in the
foreground less detail in the background.
17
18
// Layer 4 Settings
// Snow Settings
_BlendColormap3
_SnowAmount
_TintSaturationBlend3
_SnowColor
_BlendGloss3
_SnowSpecGloss
_BlendEmission3
_SnowHeight
_BlendNormalmap3
_SnowHeightTransition
_SpecGlossBlend3
_SnowSlopeDamp
_BlendDetailIntensity3
_SnowOutputColorBrightness2Coverage
// Detail Settings
// Displacement Settings
_DetailColormap
_Parallax
_DetailColormapIntensity
_ReduceByVertexAlpha
_DetailNormalmap
_ReduceByUVBorder
_DetailNormalmapIntensity
_ReduceByUVBorderLength
// Water Settings
_ParallaxMap
_WaterColorAColorBlend
_EdgeLength
_WaterSpecGloss
// Cliff Settings
_WaterNormalmap
_CliffColormap
_WaterBlend
_CliffGloss
_WaterWaves
_CliffEmission
_WaterWaveSpeed
_SpecGlossCliff
// Fog Settings
_CliffNormalmap
_OverlayFogAmount
_CliffDetailmap
_OverlayFogColorAfromAmbient
_CliffDetailColorIntensity
_OverlayFogAmountFromReflCubemap
_CliffDetailNormalmap
_OverlayFogStartDistance
_CliffDetailNormalIntensity
_OverlayFogDistanceTransition
_OverlayFogStartHeight
_OverlayFogHeightTransition
_OverlayFogDistance2Height
_OverlayFogEmissivePunchThru
// IBL Settings
_DiffuseIBLCubemap
_DiffIBLMulti
unity_SpecCube0
_IBLSpecRoughMIP
_IBLMIPDim_Rough
_IBLSpecGlossMIP
_IBLMIPDim_Gloss
Horizon[ON] Transition.shader
Horizon[ON] Flat.shader
Horizon[ON] Object.shader
Horizon[ON] Cliff.shader
Horizon[ON] Displacement.shader
Horizon[ON] Tesselation(DX11).shader
The place to change the multi compile options is in all shaders the same, look for line 185:
As you can see i have put a copy of the original code there and commented it out as a backup. You dont have
to fear to screw something up and you dont need to backup the shader files.
19
20
After:
to
Useful Links
Programs & Tools that might help you to create textures for Horizon[ON]:
WorldComposer: Its a very cool tool for unity, which allows you to grab satelite images from the web very
easily. The satelite images are of very high quality and it even has tools to remove shadows or clouds from the
images.
https://www.assetstore.unity3d.com/en/#!/content/13238
TerrainComposer: It is very powerful and versatile, you can create unity terrains with the data you get from
WorldComposer. You can modify it and even generate fitting normal maps.
https://www.assetstore.unity3d.com/en/#!/content/7065
Worldmachine: Very powerful terrain generator, you can create very realistic terrains with it and output all
maps that you need for Horizon[ON].
http://www.world-machine.com
Crazybump: Can be useful to generate normal and heightmaps from images.
http://www.crazybump.com/
Video Tutorials that might help you:
Making textures tileable: This thechnique can be used to make your layer textures and you your mask
tileable.
http://youtu.be/4SiYt92RINo
Creating Splatmaps: You can use this or similar techniques to create a mask for Horizon[ON].
http://youtu.be/U-c9FnsXT_s
21
FAQs
Will be added consequently when questions arise.
22
Getting Started
We will start with an empty scene, preferably in a new project(this way we can make sure everything works, if you use an
existing project there might be incompatibility issues and the getting started tutorial is not the right place to adress these).
First we need to do a few little preparations. Lets go to the Project Settings/Player
In the Player Settings we will switch the color space to linear, the Horizon[ON] shaders are generally physically based
shaders. They use Schlicks Approximation for fresnel reflectance and are energy conservative. So, while it is not
necessary to work in linear color space it is recommended if you go for a realistic look. For now we just choose linear.
Now that this is done lets select the main camera and set the far clip plane to a relatively high value of 59000. This is of
course also depending on your scenes but in general horizon will look most convincing with a high view distance. For the
sake of this tutorial we will use this value.
Next we will go to the Render Settings and enable fog, also we set the fog mode to EXP2 and the density to 0,00005.
Now we should choose an appropriate fog color. You can switch the color picker to HSV by clicking on the little Icon above
the values.We pick a hue of 214, a saturation of 10 and a value of 249.
Now we need to add a sky to the scene, In the Folder Horizon[ON]/_Example Scene(import optional)/Skydome you can
find a prefab called Skydome. Drop it into the hierarchy and make sure its position is 0 ,0 ,0.
We need a terrain too, so lets add the one from the Folder Horizon[ON]/_Example Scene(import optional)/Terrain. Just
drop the prefab into the hierarchy.
Select the newly added terrain and set its position to ( 0 , -1 ,0 ). This is only for now as we want to see the transition
from terrain to Horizon[ON] without any z-fighting. In the manual i will explain more on how to solve z-fighting between
Horizon[ON] and terrains.
Now the only missing thing is a directional light to be our sun. We add the Sun prefab from the Skydome folder. If you drop
it into the hierarchy you should be good to go and a good sun orientation, brightness and color is already set.
Now we are done with the preparations, your scene should now look like this, maybe adjust your scene camera to get a
similar viewing angle.
Now we add the Horizon[ON] Master to the scene. Right click on empty space in the hierarchy window and select
Horizon[ON]/Horizon[ON] Master.
It should be selected now and you can see this is just an empty container at the moment. Horizon Master will help you to
manage all the Horizon[ON] Elements. Some of these elements we are going through in this guide. Some of them youll
have to try yourself. There are 4 categories of elements: Transitions, Blendmeshes Displaced, Blendmeshes NonDispaced
and Multi Level Arrangements(which contain sub elements).
So, we can add the first element. We need a transition from terrain to Horizon[ON]. Right click the Horizon[ON] Master
object in the hierarchy(this way the newly created element will automatically be a child of Horizon[ON] Master).
Select: Horizon[ON] / Horizon[ON] Elements / Transitions / Transition Terrain.
Whenever you add a new element it will automatically be selected. You can also see that the transition object has a
disabled script called Horizon Compensate ZFightingattached. We ignore that for now, i explain it in the Manual. Now
the material of the transition is not yet synced. Once you reselect the Horizon[ON] Master it will take care of its children.
Do that now. Reselect the Horizon Master. As you can see there are now a few more options available. That is because
Horizon[ON] Master will check its children for the used materials and expose its parameters depending on which features
you enable. This will help you to keep multiple materials/shaders in sync and give you the ability to adjust parameters on
multiple shaders at once.
So now that we have placed the first element, lets carry on with the next. Right click on our Horizon[ON] object and...
Select: Horizon[ON] / Horizon[ON] Elements / Transitions / Transition Sky.
Ok, now our world is not square anymore, that is already a big improvement but it is still not much bigger then our terrain.
We will take care of that in the next step. Reselect the parent.
In the Inspector click on the little triangle next to Transition Settings | Show to unfold this section. Here are 3 values to
adjust, Scale Inner, Scale Outer and Scale Height, play a bit with them to see what they do. As you can see Scale Outer
is a float field and has no slider but you can click and drag on the label to adjust its values. This can be done on all float
fields that have no slider. When you are familiar with what these values do, adjust it like in the screen above.
Often the wireframe of the selection is a bit distracting when adjusting material parameters. There is a solution for that
problem in the tools section of the Horizon[ON] Master script. Unfold the tools and tick the checkbox next to Hide
Selection Wireframe. Keep in mind though that this setting will be remembered by the children.
Looks already quite nice. The colors and are roughly matching but we can fine tune that.
...bring down the value a little bit. Now the brightness is perfectly matching but the horizon is a bit pale compared with the
terrain. Lets unfold the Layer 1 Settings.
Layers also have their own tint color and they also have a saturation value, which is set by the alpha channel in the color
picker.
Great match but in close up we see a difference in high resolution detail. But first lets take care of the sandy corner.
Lets just extrapolate what you have learned and skip layers 2 and 3, we will switch directly to a layercount of 4.
10
Now that we increased the layercount there are a few more options available in the Main Settings section. We see that
there is a mask used to define where which layer is drawn. We need to find a sandy area which we can move towards our
terrain. Of course it should match the sandy corner of the terrain. Click and drag the OffsetX and OffsetY labels until
you have it matching roughly like in the above image.
Great, though the sand is a little bit too dark. Open the Layer 4 Settings section and change the value in the
Tint / Saturation color picker. A little bit brighter should give us a better blend. We will also set the tiling to a value of 15.
Awesome, but what is this? Well, this is how i painted the mask, i wanted to have the sand as a beach area, surrounding
water and in the depths of the water should be a little bit greenish detail, lets see if that works out.
11
12
Hmm, yes i think that is good. Actually this corner on the lake looks like it could fit our sandy part of the terrain. Let us go
back to the Main Settings Section.
It fits but the terrain is a bit to big, or our mask is too small... We will put our mask scale to around 18000 meters. We also
need to adjust the offset but you know already how that works. I like the water but in reality water is not just painted on, it
should reflect the sun.
So, lets go back to the Horizon[ON] Features Section and check Enable Specularity. Awesome but i have another
complaint. The water is way too smooth, its like a perfect mirror... Seems like we need to enable normalmaps.
13
How to enable and disable features you know already, i guess i dont need to tell you... Probably you have done it already
before you turned the page. Hey, wow, now not only the water looks better also the rest looks more interesting. There is
still something fishy about the water though... (Pun intended).
I know what is missing on the water. Water should not only reflect the sun, it should also reflect the sky...
We need to enable reflections.
Like i mentioned already 2 pages earlier, the terrain has more high frequency detail compared with Horizon[ON]. Sure, we
could just crank up the resolution of the layer textures but i think there is a better way. Since we are already in the features
section lets check if detail textures do the trick.
Looking top down we are already there but the horizon line is not far enough away.
Do you remember where to change it? Yes right, Scale Outer in the Transition Settings should be increased. Actually
we should put it as far away as we can but of course it should not exceed the skydome radius or if a skybox is used it
should not exceed the far clip plane of our camera. You can switch the view to orthographic and top down to check but
you could also just trust me and go with a value of 50.
14
15
Nice, in case it is not active on your side you can enable Effects in the top bar of the scene view. This will not only let
us see if the fog is matching but also our water will be animated. One thing is a major letdown though our horizon is
completely flat. Seen from above this is no problem at all but a flat viewing angle breaks the illusion.
We can try something, youll like this i guess. Lets right click our Horizon[ON] object in the hierarchy(we need another
child element) and go to: Horizon[ON] / Horizon[ON] Elements / Blendmeshes NonDisplaced and choose Hill Example.
A camoufaged UFO has landed on our terrain. Actually it is a blend mesh, reselect the Horizon[ON] Master to make sure
the material is synced. Also it should disable the distracting wireframe.
16
Great, now back on our Hill Blendmesh you can move it around, this is where the fun begins! Just place it anywhere you
like. You can move it freely but you should make sure that the Y position is always on the same level as the underlying
surface. Also you should make sure that your transform is set to Pivot and not Center.
You can also scale it however you like. Make it long and flat or round and pointy, its up to you. You can either duplicate it or
get more hills from the create menu. Place some more hills if you like or just continue with the next step.
There is also another example of blendmesh, the cliff blendmesh. I named them example to emphasize that you can
create your own blendmeshes. It is very easy to do so, you dont even need to care about UVs.
Just like with the Hill Example, you can move and scale the cliff freely. Experiment a bit with it.
Let us try out the fog feature. Enable the fog feature and lets dig a little deeper.
Open the Fog Settings section and well take a look at the options, The most obvious thing there is the Fog Amount.
17
18
What the Color does is also pretty clear but the alpha value maybe not, if you increase it the fog color will be taken more
and more from the ambient light color. As these 2 are usually close together (if not just the same color), it might be easier
if you want to care only about one value. Cubemap Add is also very interesting, it adds color from the reflection cubemap
to the fog color, this is nice to get more directional dependency of the fog and can help to match the fog with the skybox.
Take a moment and experiment with the other values, if you hover the mouse over a label there will be a tooltip explaining
the functionality. You can take the values in the image above as a guideline if you want to do so.
Try also to set the Diffuse Lighting Mode to Cubemap in the features section. You should be familiar with IBL already.
If not, look it up. It is basically what the famous Skyshop does, Cubemaps generated with Skyshop are compatible.
Ok, now we can take a look at another type of blendmesh. The displaced category... Those are my favorite ones.
In case you have plastered your horizon already with hills and cliffs you might want to make some room
for the next experiments.
Again, right click on the Horizon[ON] Master object in the hierarchy and take a look in:
Horizon[ON] / Horizon[ON] Elements / Blendmeshes Displaced.
Feel free to place them as you like, these can only be scaled on X and Z the Y axis is driven by a 4 channel heightmap
where each channel relates to one layer.
Dont forget to sync the material by selecting the parent after placing the first one(This is only necessary once for each
shared material).
Lets have some fun with the Displacement Settings. Play with the height and the other settings. Dont forget that for
everything are tooltips available. So if you need an explanation for a certain feature, it is right there under your
mouse cursor.
19
20
Try all the blendmeshes from the displaced category. They are great fun to play with, i like how they automatically conform
to Horizon[ON] and flatten on the water. Especially how the rivers cut through the mountains is nice.
Time to look at the most impressive displacement feature of Horizon[ON], but we need more room... Delete all children of
the Horizon[ON] Master, only leave the Horizon[ON]_Transition_Terrain in there.
Let us also put all the other objects into a new gameobject. I called it _Scene but it is not of importance how it is called.
It will just help us to keep the scene more organized.
21
Now that we have made room, we can right click our Horizon[ON] Master object and look into the Multi Level
Arrangement category, lets select Displacement Level Start.
As you can see, this object encloses our terrain completely and flattens towards the center. It consists of 12 children, 2
planes on each side and another plane in each corner. These planes have UVs set up in a special way, so the shader knows
where to flatten the displacement. Select the parent so the material gets synced in case it is not already.
We will now add another element from this category. Select Multi Level Regular. This is now the first time we need to
change the scale of the object to make it fit. By the other elements, e.g. the Transition Terrain, was fitting our terrain right
away. This is because by standard the elements are scaled to the default size of 1000 meters. If our terrain was of another
size, for example 2000 by 2000, we would need to put that values in the transform.
22
Lets fit the scale of our new element. We need to make it twice as big as our previous level. So put the X and Z Scale to
2000. As you can see it fits the Displacement Level Start perfectly.
Lets carry on and repeat the process. We create another Displacement Level Regular....
... and set the scale twice as big as the previous level, so now we need to set the X and Z Scale to 4000. We need another
Displacement Level Regular, you can either duplicate the previous one or use the create menu. Double up the scale
once again. You can create as many levels enclosing the previous levels as you like but for now 3 of the Displacement
Level Regular will be enough.
23
Since these are not flattened towards the outside edge we need now to place a Displacement Level End element.
It need to be twice as big as the previous level as well, so lets now put the scale on X and Z to 16000.
You may need to disable fog for a moment to be able to see something in a more zoomed out state. You can see that the
outside edge is again perfectly flat.
24
We are already pretty far in the outskirts of our horizon and we dont need to put much detail there so we can continue flat.
We will pick another element from the same category: Flat Level Regular.
Now it is time to place our sky transition. Lets go to the Transitions category and pick Transition Sky.
25
As you are probably expecting we need to scale it up. This time we put the scale on X, Y and Z to 64000. Here the Y
axis is important as the mesh is not flat and we want the scale to be uniform. We can see that the mesh is now clearly
intersecting with our skydome, so lets fix that.
We need to go to the Transition Settings on our Horizon[ON] Master object and put Scale Outer to 0. We do that
because unlike with the previous setup we already have a big horizon and dont need to scale it up additionally. The
upward bend on the transition should now end right before our skydome.
We dont want to see this upward bend though, its only there to give a nice fade towards the sky. So we can re-enable fog
now.
26
Actually we are done now, you can go back into the Displacement Settings and play with the Height (m) value. While
you have selected the Horizon[ON] Master object you can also try to move it around on the X and Z axis. You will notice
that the textures will stay in place regardless. You may want that or not so there is a way to change that.
Go to the Main Settings and check Use local Space. Move the Horizon[ON] Master object again and see the difference.
In case you want to do world shifting, this setting might be useful.
The picture above shows a with and without montage, amazing how tiny our terrain appears to be...
Ok, we are finished, you notice i didnt touch on to many details. This guide is really only to get you started.
Take a look at the main manual for explanations of all sliders and knobs and explore a bit on your own.
Have fun using Horizon[ON],
Peter