Browse Source

added wave prefab + animation + script

master
Joshua Reason 7 years ago
parent
commit
35cfdb8373
14 changed files with 462 additions and 0 deletions
  1. BIN
      IronToad_UnityProject/Assets/Animations/WaveRing.controller
  2. +8
    -0
      IronToad_UnityProject/Assets/Animations/WaveRing.controller.meta
  3. BIN
      IronToad_UnityProject/Assets/Animations/WaveRingPlay.anim
  4. +8
    -0
      IronToad_UnityProject/Assets/Animations/WaveRingPlay.anim.meta
  5. +11
    -0
      IronToad_UnityProject/Assets/Scripts/PlayerController.cs
  6. +9
    -0
      IronToad_UnityProject/Assets/Sound.meta
  7. +8
    -0
      IronToad_UnityProject/Assets/Sound.meta~33da7c3282ca6f5c80ab157e88e7a3f2b299d2eb.meta~5def2651a9a68039ca23aa6ed804786939978fb1.meta
  8. BIN
      IronToad_UnityProject/Assets/water/WaterWave.mat
  9. +8
    -0
      IronToad_UnityProject/Assets/water/WaterWave.mat.meta
  10. BIN
      IronToad_UnityProject/Assets/water/WaveRing.prefab
  11. +8
    -0
      IronToad_UnityProject/Assets/water/WaveRing.prefab.meta
  12. +393
    -0
      IronToad_UnityProject/Assets/water/WaveShader_TimeScale.shader
  13. +9
    -0
      IronToad_UnityProject/Assets/water/WaveShader_TimeScale.shader.meta
  14. BIN
      IronToad_UnityProject/ProjectSettings/TagManager.asset

BIN
IronToad_UnityProject/Assets/Animations/WaveRing.controller View File


+ 8
- 0
IronToad_UnityProject/Assets/Animations/WaveRing.controller.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 27cceb296e458354180349e5dbb7f5a5
timeCreated: 1485018104
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

BIN
IronToad_UnityProject/Assets/Animations/WaveRingPlay.anim View File


+ 8
- 0
IronToad_UnityProject/Assets/Animations/WaveRingPlay.anim.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7d18c45db6dba324da55110c321130d4
timeCreated: 1485018104
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 11
- 0
IronToad_UnityProject/Assets/Scripts/PlayerController.cs View File

@ -8,6 +8,8 @@ public class PlayerController : MonoBehaviour {
public float radius;
public float time;
public GameObject waveRing;
// Update is called once per frame
void Update () {
@ -21,6 +23,15 @@ public class PlayerController : MonoBehaviour {
Debug.DrawRay(ray.origin, ray.direction * 100, Color.green);
if (Physics.Raycast(ray, out hit, Mathf.Infinity,rayMask)) {
Vector3 pos = hit.point;
pos.y += 1;
Quaternion rot = Quaternion.Euler(-90, 0, 0);
if (waveRing != null)
Destroy(Instantiate(waveRing, pos, rot),4);
WaterController waterScript = hit.collider.gameObject.GetComponent<WaterController>();
Debug.DrawLine(Camera.main.transform.position, hit.point, Color.red,1);

+ 9
- 0
IronToad_UnityProject/Assets/Sound.meta View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 73fb9ee280b0c75439600b4d5c3a6a7d
folderAsset: yes
timeCreated: 1484996421
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 8
- 0
IronToad_UnityProject/Assets/Sound.meta~33da7c3282ca6f5c80ab157e88e7a3f2b299d2eb.meta~5def2651a9a68039ca23aa6ed804786939978fb1.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8fe9694a87e3fd545b420671f19f0beb
timeCreated: 1485009964
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

BIN
IronToad_UnityProject/Assets/water/WaterWave.mat View File


+ 8
- 0
IronToad_UnityProject/Assets/water/WaterWave.mat.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c9c90b6f5271b464880e476763a4d017
timeCreated: 1485017769
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

BIN
IronToad_UnityProject/Assets/water/WaveRing.prefab View File


+ 8
- 0
IronToad_UnityProject/Assets/water/WaveRing.prefab.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f4f33b77e9eb86943bfb31f715612630
timeCreated: 1485018084
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

+ 393
- 0
IronToad_UnityProject/Assets/water/WaveShader_TimeScale.shader View File

@ -0,0 +1,393 @@
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
// Shader created with Shader Forge v1.30
// Shader Forge (c) Neat Corporation / Joachim Holmer - http://www.acegikmo.com/shaderforge/
// Note: Manually altering this data may prevent you from opening it in Shader Forge
/*SF_DATA;ver:1.30;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,lico:1,lgpr:1,limd:1,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:True,hqlp:False,rprd:False,enco:False,rmgx:True,rpth:0,vtps:0,hqsc:True,nrmq:1,nrsp:0,vomd:0,spxs:False,tesm:0,olmd:1,culm:0,bsrc:3,bdst:7,dpts:2,wrdp:False,dith:0,rfrpo:True,rfrpn:Refraction,coma:15,ufog:True,aust:True,igpj:True,qofs:0,qpre:3,rntp:2,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:0.5,fgcg:0.5,fgcb:0.5,fgca:1,fgde:0.01,fgrn:0,fgrf:300,stcl:False,stva:128,stmr:255,stmw:255,stcp:6,stps:0,stfa:0,stfz:0,ofsf:0,ofsu:0,f2p0:False,fnsp:False,fnfb:False;n:type:ShaderForge.SFN_Final,id:1,x:33430,y:32397,varname:node_1,prsc:2|diff-7524-OUT,alpha-677-OUT,voffset-4711-OUT;n:type:ShaderForge.SFN_Distance,id:9544,x:31798,y:32501,varname:node_9544,prsc:2|A-1960-UVOUT,B-7815-OUT;n:type:ShaderForge.SFN_TexCoord,id:1960,x:31563,y:32410,varname:node_1960,prsc:2,uv:0;n:type:ShaderForge.SFN_Vector2,id:7815,x:31563,y:32587,varname:node_7815,prsc:2,v1:0.5,v2:0.5;n:type:ShaderForge.SFN_Add,id:7248,x:32013,y:32501,varname:node_7248,prsc:2|A-9544-OUT,B-8808-OUT;n:type:ShaderForge.SFN_Sin,id:5748,x:32366,y:32520,varname:node_5748,prsc:2|IN-6766-OUT;n:type:ShaderForge.SFN_RemapRange,id:8808,x:31776,y:32721,varname:node_8808,prsc:2,frmn:0,frmx:2,tomn:0,tomx:1|IN-9742-OUT;n:type:ShaderForge.SFN_Multiply,id:6766,x:32198,y:32520,varname:node_6766,prsc:2|A-7248-OUT,B-1783-OUT;n:type:ShaderForge.SFN_Slider,id:1783,x:31895,y:32812,ptovrint:False,ptlb:Ring_Amount,ptin:_Ring_Amount,varname:node_1783,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:1,cur:19.17478,max:200;n:type:ShaderForge.SFN_Time,id:8294,x:31085,y:32629,varname:node_8294,prsc:2;n:type:ShaderForge.SFN_OneMinus,id:6695,x:31563,y:32739,varname:node_6695,prsc:2|IN-5972-OUT;n:type:ShaderForge.SFN_NormalVector,id:5768,x:32771,y:33002,prsc:2,pt:False;n:type:ShaderForge.SFN_Multiply,id:4711,x:33050,y:32857,varname:node_4711,prsc:2|A-118-OUT,B-5768-OUT;n:type:ShaderForge.SFN_Color,id:5556,x:32639,y:32012,ptovrint:False,ptlb:FoamColor,ptin:_FoamColor,varname:node_5556,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:1,c2:1,c3:1,c4:1;n:type:ShaderForge.SFN_Multiply,id:118,x:32652,y:32879,varname:node_118,prsc:2|A-5748-OUT,B-3985-OUT;n:type:ShaderForge.SFN_Slider,id:3985,x:32250,y:33044,ptovrint:False,ptlb:WaveHeight,ptin:_WaveHeight,varname:node_3985,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:1,cur:5.549279,max:10;n:type:ShaderForge.SFN_Slider,id:9742,x:30915,y:32824,ptovrint:False,ptlb:Speed,ptin:_Speed,varname:node_9742,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:-1,cur:-1,max:1.5;n:type:ShaderForge.SFN_Clamp01,id:1198,x:32804,y:32376,varname:node_1198,prsc:2|IN-5748-OUT;n:type:ShaderForge.SFN_Multiply,id:677,x:33117,y:32477,varname:node_677,prsc:2|A-1198-OUT,B-2892-OUT,C-6357-OUT;n:type:ShaderForge.SFN_OneMinus,id:9994,x:32013,y:32251,varname:node_9994,prsc:2|IN-9544-OUT;n:type:ShaderForge.SFN_Round,id:2892,x:32210,y:32251,varname:node_2892,prsc:2|IN-9994-OUT;n:type:ShaderForge.SFN_Multiply,id:7524,x:33117,y:32314,varname:node_7524,prsc:2|A-5556-RGB,B-1198-OUT;n:type:ShaderForge.SFN_Multiply,id:5972,x:31340,y:32739,varname:node_5972,prsc:2|A-8294-T,B-9742-OUT;n:type:ShaderForge.SFN_Slider,id:6357,x:32597,y:32713,ptovrint:False,ptlb:Fade,ptin:_Fade,varname:node_6357,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:1,max:1;proporder:1783-5556-3985-9742-6357;pass:END;sub:END;*/
Shader "LightHouse/WaterShader" {
Properties {
_Ring_Amount ("Ring_Amount", Range(1, 200)) = 19.17478
_FoamColor ("FoamColor", Color) = (1,1,1,1)
_WaveHeight ("WaveHeight", Range(1, 10)) = 5.549279
_Speed ("Speed", Range(-1, 1.5)) = -1
_Fade ("Fade", Range(0, 1)) = 1
[HideInInspector]_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
}
SubShader {
Tags {
"IgnoreProjector"="True"
"Queue"="Transparent"
"RenderType"="Transparent"
}
Pass {
Name "FORWARD"
Tags {
"LightMode"="ForwardBase"
}
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#define UNITY_PASS_FORWARDBASE
#define SHOULD_SAMPLE_SH ( defined (LIGHTMAP_OFF) && defined(DYNAMICLIGHTMAP_OFF) )
#include "UnityCG.cginc"
#include "Lighting.cginc"
#include "UnityPBSLighting.cginc"
#include "UnityStandardBRDF.cginc"
#pragma multi_compile_fwdbase
#pragma multi_compile LIGHTMAP_OFF LIGHTMAP_ON
#pragma multi_compile DIRLIGHTMAP_OFF DIRLIGHTMAP_COMBINED DIRLIGHTMAP_SEPARATE
#pragma multi_compile DYNAMICLIGHTMAP_OFF DYNAMICLIGHTMAP_ON
#pragma multi_compile_fog
#pragma exclude_renderers xbox360 ps3
#pragma target 3.0
uniform float _Ring_Amount;
uniform float4 _FoamColor;
uniform float _WaveHeight;
uniform float _Speed;
uniform float _Fade;
struct VertexInput {
float4 vertex : POSITION;
float3 normal : NORMAL;
float4 tangent : TANGENT;
float2 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
float2 texcoord2 : TEXCOORD2;
};
struct VertexOutput {
float4 pos : SV_POSITION;
float2 uv0 : TEXCOORD0;
float2 uv1 : TEXCOORD1;
float2 uv2 : TEXCOORD2;
float4 posWorld : TEXCOORD3;
float3 normalDir : TEXCOORD4;
float3 tangentDir : TEXCOORD5;
float3 bitangentDir : TEXCOORD6;
UNITY_FOG_COORDS(7)
#if defined(LIGHTMAP_ON) || defined(UNITY_SHOULD_SAMPLE_SH)
float4 ambientOrLightmapUV : TEXCOORD8;
#endif
};
VertexOutput vert (VertexInput v) {
VertexOutput o = (VertexOutput)0;
o.uv0 = v.texcoord0;
o.uv1 = v.texcoord1;
o.uv2 = v.texcoord2;
#ifdef LIGHTMAP_ON
o.ambientOrLightmapUV.xy = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw;
o.ambientOrLightmapUV.zw = 0;
#elif UNITY_SHOULD_SAMPLE_SH
#endif
#ifdef DYNAMICLIGHTMAP_ON
o.ambientOrLightmapUV.zw = v.texcoord2.xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;
#endif
o.normalDir = UnityObjectToWorldNormal(v.normal);
o.tangentDir = normalize( mul( unity_ObjectToWorld, float4( v.tangent.xyz, 0.0 ) ).xyz );
o.bitangentDir = normalize(cross(o.normalDir, o.tangentDir) * v.tangent.w);
float node_9544 = distance(o.uv0,float2(0.5,0.5));
float node_5748 = sin(((node_9544+(_Speed*0.5+0.0))*_Ring_Amount));
v.vertex.xyz += ((node_5748*_WaveHeight)*v.normal);
o.posWorld = mul(unity_ObjectToWorld, v.vertex);
float3 lightColor = _LightColor0.rgb;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex );
UNITY_TRANSFER_FOG(o,o.pos);
return o;
}
float4 frag(VertexOutput i) : COLOR {
i.normalDir = normalize(i.normalDir);
float3x3 tangentTransform = float3x3( i.tangentDir, i.bitangentDir, i.normalDir);
float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
float3 normalDirection = i.normalDir;
float3 viewReflectDirection = reflect( -viewDirection, normalDirection );
float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz);
float3 lightColor = _LightColor0.rgb;
////// Lighting:
float attenuation = 1;
float3 attenColor = attenuation * _LightColor0.xyz;
/////// GI Data:
UnityLight light;
#ifdef LIGHTMAP_OFF
light.color = lightColor;
light.dir = lightDirection;
light.ndotl = LambertTerm (normalDirection, light.dir);
#else
light.color = half3(0.f, 0.f, 0.f);
light.ndotl = 0.0f;
light.dir = half3(0.f, 0.f, 0.f);
#endif
UnityGIInput d;
d.light = light;
d.worldPos = i.posWorld.xyz;
d.worldViewDir = viewDirection;
d.atten = attenuation;
#if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
d.ambient = 0;
d.lightmapUV = i.ambientOrLightmapUV;
#else
d.ambient = i.ambientOrLightmapUV;
#endif
Unity_GlossyEnvironmentData ugls_en_data;
ugls_en_data.roughness = 1.0 - 0;
ugls_en_data.reflUVW = viewReflectDirection;
UnityGI gi = UnityGlobalIllumination(d, 1, normalDirection, ugls_en_data );
lightDirection = gi.light.dir;
lightColor = gi.light.color;
/////// Diffuse:
float NdotL = max(0.0,dot( normalDirection, lightDirection ));
float3 directDiffuse = max( 0.0, NdotL) * attenColor;
float3 indirectDiffuse = float3(0,0,0);
indirectDiffuse += gi.indirect.diffuse;
float node_9544 = distance(i.uv0,float2(0.5,0.5));
float node_5748 = sin(((node_9544+(_Speed*0.5+0.0))*_Ring_Amount));
float node_1198 = saturate(node_5748);
float3 diffuseColor = (_FoamColor.rgb*node_1198);
float3 diffuse = (directDiffuse + indirectDiffuse) * diffuseColor;
/// Final Color:
float3 finalColor = diffuse;
fixed4 finalRGBA = fixed4(finalColor,(node_1198*round((1.0 - node_9544))*_Fade));
UNITY_APPLY_FOG(i.fogCoord, finalRGBA);
return finalRGBA;
}
ENDCG
}
Pass {
Name "FORWARD_DELTA"
Tags {
"LightMode"="ForwardAdd"
}
Blend One One
ZWrite Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#define UNITY_PASS_FORWARDADD
#define SHOULD_SAMPLE_SH ( defined (LIGHTMAP_OFF) && defined(DYNAMICLIGHTMAP_OFF) )
#include "UnityCG.cginc"
#include "AutoLight.cginc"
#include "Lighting.cginc"
#include "UnityPBSLighting.cginc"
#include "UnityStandardBRDF.cginc"
#pragma multi_compile_fwdadd
#pragma multi_compile LIGHTMAP_OFF LIGHTMAP_ON
#pragma multi_compile DIRLIGHTMAP_OFF DIRLIGHTMAP_COMBINED DIRLIGHTMAP_SEPARATE
#pragma multi_compile DYNAMICLIGHTMAP_OFF DYNAMICLIGHTMAP_ON
#pragma multi_compile_fog
#pragma exclude_renderers xbox360 ps3
#pragma target 3.0
uniform float _Ring_Amount;
uniform float4 _FoamColor;
uniform float _WaveHeight;
uniform float _Speed;
uniform float _Fade;
struct VertexInput {
float4 vertex : POSITION;
float3 normal : NORMAL;
float4 tangent : TANGENT;
float2 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
float2 texcoord2 : TEXCOORD2;
};
struct VertexOutput {
float4 pos : SV_POSITION;
float2 uv0 : TEXCOORD0;
float2 uv1 : TEXCOORD1;
float2 uv2 : TEXCOORD2;
float4 posWorld : TEXCOORD3;
float3 normalDir : TEXCOORD4;
float3 tangentDir : TEXCOORD5;
float3 bitangentDir : TEXCOORD6;
LIGHTING_COORDS(7,8)
UNITY_FOG_COORDS(9)
};
VertexOutput vert (VertexInput v) {
VertexOutput o = (VertexOutput)0;
o.uv0 = v.texcoord0;
o.uv1 = v.texcoord1;
o.uv2 = v.texcoord2;
o.normalDir = UnityObjectToWorldNormal(v.normal);
o.tangentDir = normalize( mul( unity_ObjectToWorld, float4( v.tangent.xyz, 0.0 ) ).xyz );
o.bitangentDir = normalize(cross(o.normalDir, o.tangentDir) * v.tangent.w);
float node_9544 = distance(o.uv0,float2(0.5,0.5));
float node_5748 = sin(((node_9544+(_Speed*0.5+0.0))*_Ring_Amount));
v.vertex.xyz += ((node_5748*_WaveHeight)*v.normal);
o.posWorld = mul(unity_ObjectToWorld, v.vertex);
float3 lightColor = _LightColor0.rgb;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex );
UNITY_TRANSFER_FOG(o,o.pos);
TRANSFER_VERTEX_TO_FRAGMENT(o)
return o;
}
float4 frag(VertexOutput i) : COLOR {
i.normalDir = normalize(i.normalDir);
float3x3 tangentTransform = float3x3( i.tangentDir, i.bitangentDir, i.normalDir);
float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
float3 normalDirection = i.normalDir;
float3 lightDirection = normalize(lerp(_WorldSpaceLightPos0.xyz, _WorldSpaceLightPos0.xyz - i.posWorld.xyz,_WorldSpaceLightPos0.w));
float3 lightColor = _LightColor0.rgb;
////// Lighting:
float attenuation = LIGHT_ATTENUATION(i);
float3 attenColor = attenuation * _LightColor0.xyz;
/////// Diffuse:
float NdotL = max(0.0,dot( normalDirection, lightDirection ));
float3 directDiffuse = max( 0.0, NdotL) * attenColor;
float node_9544 = distance(i.uv0,float2(0.5,0.5));
float node_5748 = sin(((node_9544+(_Speed*0.5+0.0))*_Ring_Amount));
float node_1198 = saturate(node_5748);
float3 diffuseColor = (_FoamColor.rgb*node_1198);
float3 diffuse = directDiffuse * diffuseColor;
/// Final Color:
float3 finalColor = diffuse;
fixed4 finalRGBA = fixed4(finalColor * (node_1198*round((1.0 - node_9544))*_Fade),0);
UNITY_APPLY_FOG(i.fogCoord, finalRGBA);
return finalRGBA;
}
ENDCG
}
Pass {
Name "ShadowCaster"
Tags {
"LightMode"="ShadowCaster"
}
Offset 1, 1
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#define UNITY_PASS_SHADOWCASTER
#define SHOULD_SAMPLE_SH ( defined (LIGHTMAP_OFF) && defined(DYNAMICLIGHTMAP_OFF) )
#include "UnityCG.cginc"
#include "Lighting.cginc"
#include "UnityPBSLighting.cginc"
#include "UnityStandardBRDF.cginc"
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_shadowcaster
#pragma multi_compile LIGHTMAP_OFF LIGHTMAP_ON
#pragma multi_compile DIRLIGHTMAP_OFF DIRLIGHTMAP_COMBINED DIRLIGHTMAP_SEPARATE
#pragma multi_compile DYNAMICLIGHTMAP_OFF DYNAMICLIGHTMAP_ON
#pragma multi_compile_fog
#pragma exclude_renderers xbox360 ps3
#pragma target 3.0
uniform float _Ring_Amount;
uniform float _WaveHeight;
uniform float _Speed;
struct VertexInput {
float4 vertex : POSITION;
float3 normal : NORMAL;
float2 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
float2 texcoord2 : TEXCOORD2;
};
struct VertexOutput {
V2F_SHADOW_CASTER;
float2 uv0 : TEXCOORD1;
float2 uv1 : TEXCOORD2;
float2 uv2 : TEXCOORD3;
float4 posWorld : TEXCOORD4;
float3 normalDir : TEXCOORD5;
};
VertexOutput vert (VertexInput v) {
VertexOutput o = (VertexOutput)0;
o.uv0 = v.texcoord0;
o.uv1 = v.texcoord1;
o.uv2 = v.texcoord2;
o.normalDir = UnityObjectToWorldNormal(v.normal);
float node_9544 = distance(o.uv0,float2(0.5,0.5));
float node_5748 = sin(((node_9544+(_Speed*0.5+0.0))*_Ring_Amount));
v.vertex.xyz += ((node_5748*_WaveHeight)*v.normal);
o.posWorld = mul(unity_ObjectToWorld, v.vertex);
o.pos = mul(UNITY_MATRIX_MVP, v.vertex );
TRANSFER_SHADOW_CASTER(o)
return o;
}
float4 frag(VertexOutput i) : COLOR {
i.normalDir = normalize(i.normalDir);
float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
float3 normalDirection = i.normalDir;
SHADOW_CASTER_FRAGMENT(i)
}
ENDCG
}
Pass {
Name "Meta"
Tags {
"LightMode"="Meta"
}
Cull Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#define UNITY_PASS_META 1
#define SHOULD_SAMPLE_SH ( defined (LIGHTMAP_OFF) && defined(DYNAMICLIGHTMAP_OFF) )
#include "UnityCG.cginc"
#include "Lighting.cginc"
#include "UnityPBSLighting.cginc"
#include "UnityStandardBRDF.cginc"
#include "UnityMetaPass.cginc"
#pragma fragmentoption ARB_precision_hint_fastest
#pragma multi_compile_shadowcaster
#pragma multi_compile LIGHTMAP_OFF LIGHTMAP_ON
#pragma multi_compile DIRLIGHTMAP_OFF DIRLIGHTMAP_COMBINED DIRLIGHTMAP_SEPARATE
#pragma multi_compile DYNAMICLIGHTMAP_OFF DYNAMICLIGHTMAP_ON
#pragma multi_compile_fog
#pragma exclude_renderers xbox360 ps3
#pragma target 3.0
uniform float _Ring_Amount;
uniform float4 _FoamColor;
uniform float _WaveHeight;
uniform float _Speed;
struct VertexInput {
float4 vertex : POSITION;
float3 normal : NORMAL;
float2 texcoord0 : TEXCOORD0;
float2 texcoord1 : TEXCOORD1;
float2 texcoord2 : TEXCOORD2;
};
struct VertexOutput {
float4 pos : SV_POSITION;
float2 uv0 : TEXCOORD0;
float2 uv1 : TEXCOORD1;
float2 uv2 : TEXCOORD2;
float4 posWorld : TEXCOORD3;
float3 normalDir : TEXCOORD4;
};
VertexOutput vert (VertexInput v) {
VertexOutput o = (VertexOutput)0;
o.uv0 = v.texcoord0;
o.uv1 = v.texcoord1;
o.uv2 = v.texcoord2;
o.normalDir = UnityObjectToWorldNormal(v.normal);
float node_9544 = distance(o.uv0,float2(0.5,0.5));
float node_5748 = sin(((node_9544+(_Speed*0.5+0.0))*_Ring_Amount));
v.vertex.xyz += ((node_5748*_WaveHeight)*v.normal);
o.posWorld = mul(unity_ObjectToWorld, v.vertex);
o.pos = UnityMetaVertexPosition(v.vertex, v.texcoord1.xy, v.texcoord2.xy, unity_LightmapST, unity_DynamicLightmapST );
return o;
}
float4 frag(VertexOutput i) : SV_Target {
i.normalDir = normalize(i.normalDir);
float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
float3 normalDirection = i.normalDir;
UnityMetaInput o;
UNITY_INITIALIZE_OUTPUT( UnityMetaInput, o );
o.Emission = 0;
float node_9544 = distance(i.uv0,float2(0.5,0.5));
float node_5748 = sin(((node_9544+(_Speed*0.5+0.0))*_Ring_Amount));
float node_1198 = saturate(node_5748);
float3 diffColor = (_FoamColor.rgb*node_1198);
o.Albedo = diffColor;
return UnityMetaFragment( o );
}
ENDCG
}
}
FallBack "Diffuse"
CustomEditor "ShaderForgeMaterialInspector"
}

+ 9
- 0
IronToad_UnityProject/Assets/water/WaveShader_TimeScale.shader.meta View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 49d9869e237ffb64e8fba6d0250b9a46
timeCreated: 1485017769
licenseType: Free
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:

BIN
IronToad_UnityProject/ProjectSettings/TagManager.asset View File


Loading…
Cancel
Save