We would like to hear your opinion about the game. Please take a moment and send us your thoughts here

Fixing assets

A while back, after the launch of Unity 5 I've been seduced to switch the project to the new shiny version of the game engine. I knew there will be problems, heck there are problems when installing a new minor version of unity all the time, with scripts written in javascript and not using #pragma strict, with namespace collision and so on.
But the worst are those who reveals themselves at play time. While red errors in console prevent you to launch the game, they have the solution and you can fix it, errors that show in player are far more challenging. First of all you need to understand what is happening and be able to describe it accurately. It is of no use to search for rendering problem in Unity while the shaders from assets were crafted with 4.x in mind and don't work anymore.
I had such a problem with trees from a package bought before, they shown a white border around the leafs.
Searching the Internet revealed a lot of people having the same issue, offering various solutions, none satisfactory. One guys says, disabling the Receive shadows on the mesh renderer fix the problem for him. Tried, didn't worked for me. Another one said it modified the camera background color to black, also didn't helped. I decided after a while, to wait untill the author of the assets update the packages to 5.x version and focused on another pressing issues.
White border tree Unity 5 Sara Donhildi AdventuresMany months later, the author only updated one assets from 3 i had bought from him and there was no ETA for the rest of them. So I decided to investigate the problem in depth and see if I can fix the problem without needing to write shaders myself. I have 2 problematic packages the Medieval Environment and Medieval Village. They have a lot of assets, so I changed only those I had use in main scene for now. It was easy for the buildings and small items (benches, barrels, tables, boxes etc.), just replaced the legacy shaders with standard shader and everything fall in place nicely. Piece of cake.
Not so easy though with the trees. All the trees were created with Unity Tree Creator and optimized for 4.x. Luckily I found an easy fix for them too. Just changing shader to the one recommended by Unity fixed all the problems:
Trees must use the Nature/Soft Occlusion Leaves and Nature/Soft Occlusion Bark shader. In order to use those shaders you also have to place the tree in a special folder that contains the name "Ambient-Occlusion".
So, to fix this:
  • Create a new folder called Ambient Occlusion.
  • Copy all the trees prefabs there.
  • Create 2 new materials for each tree, treeX_bark and treeX_leaf. Since the trees I copied comes with separate folders for textures in the same folders where the prefabs are, I decided to place the materials in the texture folders.
  • Set bark material to Nature/Soft Occlusion Bark shader and leaf material to Nature/Soft Occlusion Leaves shader. Add the diffuse texture in the Main Texture slot. Here you should play a bit with the values, because by default bark material was too dark for me. Here are my settings:
    • Soft Occlusion Bark Shader:
      • Alpha cutoff: 0.5, i kept default value for this
      • Base Light: 1, this is how darker the texture will look like, zero is complete dark, 1 looks fine for me.
      • Amb. Occlusion: 0.03, for some reason, the greater this value is, the darker the texture is. I would thought the more ambient occlusion will make the texture brighter, but hey...
    • Tree bark leaves shaders materials Sara Donhildi Adventures Soft Occlusion Leaves Shader:
      • Alpha cutoff: 0.5, i kept default value for this
      • Base Light: 0.122 or 0.37,
      • Amb. Occlusion: 0.25, the influence of ambient occlusion is lesser than on bark
      • Dir Occlusion: 1.33,
    Here is a link to complete description of those variables: http://wiki.unity3d.com/index.php?title=UnitreeShaders
  • Go to the tree prefab and change the materials to the newly created materials

Tree materials Sara Donhildi AdventuresIt is a tedious job to change 22 trees, but in the end everything was fixed and the trees in terrain worked correctly. The alternative was to replace them with speedtrees which look far better than unity trees on terrain and they don't show any difference when switching LODs or switching to sprites in distance. There are though 2 main issues with speedtree: they are more high poly than the old ones and they are far more expensive. At an average price of $39 (which is even higher if you live in EU, 43.2 Euros due to the fcking vat) it will mean to spend 1k Euro just for trees. While I strive for a better looking, I am not in the position to spend that much money for trees only. I found that mixing a few speedtrees with the old ones, will enrich the scene and provide a good amount of variety to make it a believable environment.
Powered by Unity

Available on:

Available on: Windows