Skip to content

Commit

Permalink
Add wavy-ocean
Browse files Browse the repository at this point in the history
  • Loading branch information
aodendaal committed Nov 10, 2017
1 parent 146245f commit 803d154
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
@@ -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")
Binary file added img/wavy-ocean.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions wavy-ocean.shader
@@ -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
}
}
}

0 comments on commit 803d154

Please sign in to comment.