As The last ship sailed towards the distant horizon I sat there watching on a rock My mind slowly drifting away Forming into my... Dreamtale
Convert GLSL shader to Unity Vertex Fragment shader
2017-11-29 / 1 min read

Sometimes we get some really wonderful effect rendered by other type of shader like glsl.

So before rewriting glsl shader to unity vertex/fragment shader, we must know the convert rules:

vec2            -> float2
vec3            -> float3
vec4            -> float4

texture2D       -> tex2D
textureCube     -> texCUBE
mat2            -> float2x2
fract           -> frac

iGlobalTime     -> _Time.y
<!-- more -->

iResolution     -> _ScreenParams
mix             -> lerp
mod             -> fmod
atan(x,y)       -> atan2(y,x)   // Note order of x,y
*=              -> mul()