Showing posts from November, 2017

How to create scrollable dynamic text in Unity 5.x

In this tutorial, i will show you how to make scrolling content in unity and how to set content for scrollable textarea.


Output Structs for Unity Shaders Used in Unity 5.x

The way shaders allow you to communicate the rendering properties of your material to their lighting model is via a surface output. It is basically a wrapper around all the parameters that the current lighting model needs. It should not surprise you that different lighting models have different surface output structs. The following table shows the three main output structs used in Unity 5 and how they can be used:

The SurfaceOutput struct has the following properties:
fixed3 Albedo;:  This is the diffuse color of the materialfixed3 Normal;:  This is the tangent space normal, if writtenfixed3 Emission;: This is the color of the light emitted by the material (this property is    declared as half3 in the Standard Shaders)fixed Alpha;: This is the transparency of the materialhalf  Specular;: This is the specular power from 0 to 1fixed Gloss;: This is the specular intensity  The SurfaceOutputStandard struct has the following properties:
fixed3 Albedo;: This is the base color of the material(…

Unity 5.x - Surface Shader Property Types


Clean Unity’s Project Wizard in Unity 5.x on Windows 10

There are two ways to delete a project in the Unity’s project wizard. The first one is simply deleting, renaming or moving the directory directly from its location. The project wizard is smart enough and this is the recommended option.

The second one requires administrator privileges and deleting the registry entries associated with the projects we want to get rid of from the wizard’s list without deleting, moving or renaming the directories.
1 - Go to Windows registry (run regedit.exe).

2 - In the Windows registry, go to
HKEY_CURRENT_USER/Software/Unity Technologies/Unity Editor 5.x/

4- Find the entries which names begin with “RecentlyUsedProjectPaths-“. They’re numbered. If you click on the entry you can see your project path.

5- Select and delete the entries you want to get rid of.

Reference: This post is updated version of the solution from 

Physically Based Rendering and lighting models in Unity3D

Why is it colder at the poles and hotter on the equator? This question, which seems completely unrelated to shaders, is actually fundamental to understand how lighting models work. As explained in the previous part of this tutorial, surface shaders use a mathematical model to predict how light will reflect on triangles. Generally speaking, Unity supports two types of shading techniques, one for matte and one for specular materials. The former ones are perfect for opaque surfaces, while the latter ones simulate objects which reflections. The Maths behind these lighting models can get quite complicated, but understanding how they work is essential if you want to create your own, custom lighting effect. Up to Unity4.x, the default diffuse lighting model was based on the Lambertian reflectance.

Diffuse surfaces: the Lambertian model Going back to the initial question, the reason why the poles are colder, is because they receive less sunlight compared to the equator. This happ…

Shaders Part 5

Implementation of Specular, Diffuse Distance, Normal Extrusion shaders.
Dowload from 

Shaders Part 4

Implementation of Lambert, Half Lambert, Toon Wrap shaders.
Dowload from 

Shaders Part 3

Implementation of Reflection, Vertex Color, Fog shaders.
Dowload from 

Shaders Part 2


Shaders Part 1

Implementation of Diffuse, Texture and Normal shaders.
Dowload from 

Custom data computed per-vertex - Unity Shader Bug fix

On Unity's web site (, Custom data computed per-vertex Shader has a bug, when I try the shader I get correct result in Scene view but not int Game view.

The fix is normalizing the normals.Just add normalize.

void vert (inout appdata_full v, out Input o) {
            o.customColor = normalize(abs(v.normal));


Then correct result is: