Unity - Texture repeat without tiling

A texture repeat without tiling shader:


Demo: https://www.suntabu.com/demos/E4/

Shader "Unlit/TextureRepeat"
{
	Properties
	{
		    _MainTex ("Texture", 2D) = "white" {}
        _BlendRatio("_BlendRatio",Range(0,1))=0.5

	}
	SubShader
	{
		Tags { "RenderType"="Opaque" }
		LOD 100

		Pass
		{
			CGPROGRAM
			#pragma vertex vert
			#pragma fragment frag
			// make fog work
			#pragma multi_compile_fog
			
			#include "UnityCG.cginc"

			struct appdata
			{
				float4 vertex : POSITION;
				float2 uv : TEXCOORD0;
			};

			struct v2f
			{
				float2 uv : TEXCOORD0;
				UNITY_FOG_COORDS(1)
				float4 vertex : SV_POSITION;
			};

			sampler2D _MainTex;
			float4 _MainTex_ST;
			float _BlendRatio;
			
			v2f vert (appdata v)
			{
				v2f o;
				o.vertex = UnityObjectToClipPos(v.vertex);
				o.uv = TRANSFORM_TEX(v.uv, _MainTex);
				UNITY_TRANSFER_FOG(o,o.vertex);
				return o;
			}
			
			float random (float2 uv)
			{
				return frac(sin(dot(uv,float2(12.9898,78.233)))*43758.5453123);
			}

Read more

Unity warlock incinerate

Simulate warlock's spell - Incinerate in world of warcraft:

Construct the mesh and update it each frame

Initialize vertices of mesh
var vertices = new Vector3[(SEGMENTS_COUNT + 1) * 2];

for (var i = 0; i < vertices.Length; i++) {
	vertices [i] = transform.position;
}

Read more

Convert GLSL shader to Unity Vertex Fragment shader

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

Read more