Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
# shader-gallery | ||
A collection of shaders I've created for Unity3D | ||
|
||
## Wavy Ocean | ||
![wavy-ocean](img/wavy-ocean.png "wavy-ocean") |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' | ||
|
||
Shader "Custom/WavyOcean" | ||
{ | ||
Properties | ||
{ | ||
_MainTex ("Texture", 2D) = "white" {} | ||
} | ||
SubShader | ||
{ | ||
Tags { "RenderType" = "Opaque" } | ||
LOD 100 | ||
|
||
Pass | ||
{ | ||
CGPROGRAM | ||
#pragma vertex vert | ||
#pragma fragment frag | ||
|
||
#include "UnityCG.cginc" | ||
|
||
static const float mpi = 3.141592654; | ||
|
||
sampler2D _MainTex; | ||
float4 _MainTex_ST; | ||
|
||
struct vertOutput | ||
{ | ||
float2 uv : TEXCOORD0; | ||
float4 vertex : SV_POSITION; | ||
}; | ||
|
||
vertOutput vert (appdata_base input) | ||
{ | ||
vertOutput output; | ||
|
||
output.vertex = UnityObjectToClipPos(input.vertex); | ||
|
||
float2 dtexcoord = input.texcoord; | ||
dtexcoord.x = dtexcoord.x + sin(dtexcoord.y * 2 * mpi + _Time[0] * 2) * 0.1; | ||
|
||
output.uv = TRANSFORM_TEX(dtexcoord, _MainTex); | ||
|
||
return output; | ||
} | ||
|
||
fixed4 frag (vertOutput input) : SV_Target | ||
{ | ||
fixed4 col = tex2D(_MainTex, input.uv); | ||
return col; | ||
} | ||
ENDCG | ||
} | ||
} | ||
} |