Skip to main content


Showing posts from April, 2018

Curved Surface Shader [ Unity Implementation ]

Curved Surface Shader This is the shader that we will be having at the end of this tutorial.
 The curved surface shader is capable of achieving really varied visual effects from showing space-time curve due to gravity to a generic curved world shader that is seen in endless runners like Subway Surfers.
The concepts that you learn here can open you up to a new way of looking at shaders and if you didn't think they were the coolest thing ever already, hopefully let this be the turning point.😝.

Both the examples show above use the same exact material is just that different values have been passed to the shader.
Start by creating a new unlit shader in Unity and we will work our way from there.
First we define what the properties are:
_MainTex("Texture", 2D) = "white" {} _BendAmount("Bend Amount", Vector) = (1,1,1,1) _BendOrigin("Bend Origin", Vector) = (0,0,0,0) _BendFallOff("Bend Falloff", float) = 1.0 _BendFallOffStr("Falloff s…

C# Fundamentals - Pre-Processor Directives

C# Fundamentals - Pre-Processor Directives The pre-processor directives give instruction to the compiler to process some information before the actual compilation starts.
All pre-processor directives begin with #, and only white-space characters may appear before a pre-processor directive on any given line.
As pre-processor directives are not statements, they do not require a semi-colon (;) to the placed at the end of the line.
C# compiler does not have a separate pre-processor; however, the directives are processed as if there was one. In C# the pre-processor directives are used to help in conditional compilation.
Unlike C and C++ directives, they are not used to create macros. So as they are less flexible in what they can do in C++; they are mostly used for conditional compilation ( whether a set of lines of code would be compiled or not ). A pre-processor directive must be the only instruction on a line.
There are 6 main directives used in C#, they are: