Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
- // Shader created with Shader Forge v1.38
- // 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.38;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,cgin:,lico:0,lgpr:1,limd:0,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:False,hqlp:False,rprd:False,enco:False,rmgx:True,imps: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,atcv:False,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,atwp: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,fsmp:False;n:type:ShaderForge.SFN_Final,id:9361,x:35942,y:31973,varname:node_9361,prsc:2|normal-3007-OUT,custl-6326-OUT,alpha-6819-OUT,refract-5113-OUT,disp-1849-OUT,tess-5431-OUT;n:type:ShaderForge.SFN_DepthBlend,id:9071,x:33493,y:32938,varname:node_9071,prsc:2;n:type:ShaderForge.SFN_ViewVector,id:8669,x:32990,y:32678,varname:node_8669,prsc:2;n:type:ShaderForge.SFN_Dot,id:2252,x:33227,y:32710,varname:node_2252,prsc:2,dt:0|A-8669-OUT,B-1231-OUT;n:type:ShaderForge.SFN_Vector3,id:1231,x:32971,y:32868,varname:node_1231,prsc:2,v1:0,v2:1,v3:0;n:type:ShaderForge.SFN_Multiply,id:9704,x:34002,y:32647,varname:node_9704,prsc:2|A-2252-OUT,B-9071-OUT,C-2510-OUT;n:type:ShaderForge.SFN_Add,id:8294,x:34002,y:32784,varname:node_8294,prsc:2|A-9704-OUT,B-9071-OUT;n:type:ShaderForge.SFN_Slider,id:2510,x:32931,y:33068,ptovrint:False,ptlb:UpViewForce,ptin:_UpViewForce,varname:node_2510,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0,max:3;n:type:ShaderForge.SFN_Color,id:912,x:34367,y:31851,ptovrint:False,ptlb:Water Color,ptin:_WaterColor,varname:node_912,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0.3474265,c2:0.7000254,c3:0.75,c4:1;n:type:ShaderForge.SFN_LightVector,id:2922,x:33284,y:31829,varname:node_2922,prsc:2;n:type:ShaderForge.SFN_NormalVector,id:9763,x:33295,y:31978,prsc:2,pt:True;n:type:ShaderForge.SFN_Dot,id:7794,x:33621,y:31977,varname:node_7794,prsc:2,dt:3|A-2922-OUT,B-9763-OUT;n:type:ShaderForge.SFN_Tex2d,id:7722,x:34353,y:31503,varname:node_7722,prsc:2,ntxv:3,isnm:True|UVIN-2268-UVOUT,TEX-8656-TEX;n:type:ShaderForge.SFN_Add,id:653,x:34607,y:31983,varname:node_653,prsc:2|A-912-RGB,B-5295-OUT;n:type:ShaderForge.SFN_Append,id:2892,x:34234,y:32298,varname:node_2892,prsc:2|A-7722-R,B-7722-G;n:type:ShaderForge.SFN_Multiply,id:5113,x:34528,y:32629,varname:node_5113,prsc:2|A-2892-OUT,B-6819-OUT,C-7167-OUT;n:type:ShaderForge.SFN_Slider,id:7167,x:34077,y:32464,ptovrint:False,ptlb:Refraction,ptin:_Refraction,varname:node_7167,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0,max:1;n:type:ShaderForge.SFN_Multiply,id:6819,x:34528,y:32802,varname:node_6819,prsc:2|A-8294-OUT,B-4920-OUT;n:type:ShaderForge.SFN_Slider,id:4920,x:33863,y:33076,ptovrint:False,ptlb:Depth Force,ptin:_DepthForce,varname:node_4920,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0,max:1;n:type:ShaderForge.SFN_Power,id:1017,x:33809,y:32130,varname:node_1017,prsc:2|VAL-7794-OUT,EXP-5590-OUT;n:type:ShaderForge.SFN_Slider,id:6496,x:33112,y:32146,ptovrint:False,ptlb:Specular Definition,ptin:_SpecularDefinition,varname:node_6496,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0,max:1;n:type:ShaderForge.SFN_Exp,id:1354,x:33489,y:32092,varname:node_1354,prsc:2,et:0|IN-6496-OUT;n:type:ShaderForge.SFN_Multiply,id:5590,x:33489,y:32252,varname:node_5590,prsc:2|A-1354-OUT,B-6099-OUT;n:type:ShaderForge.SFN_Vector1,id:6099,x:33175,y:32248,varname:node_6099,prsc:2,v1:4;n:type:ShaderForge.SFN_Panner,id:2268,x:33922,y:31480,varname:node_2268,prsc:2,spu:1,spv:1|UVIN-49-OUT,DIST-1761-OUT;n:type:ShaderForge.SFN_Time,id:5400,x:33377,y:31683,varname:node_5400,prsc:2;n:type:ShaderForge.SFN_Slider,id:4468,x:32969,y:31703,ptovrint:False,ptlb:Waves Speed,ptin:_WavesSpeed,varname:node_4468,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0.5,max:1;n:type:ShaderForge.SFN_Multiply,id:1761,x:33665,y:31570,varname:node_1761,prsc:2|A-4468-OUT,B-5400-T;n:type:ShaderForge.SFN_Tex2dAsset,id:8656,x:33920,y:31246,ptovrint:False,ptlb:WaterNormal,ptin:_WaterNormal,varname:node_8656,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,ntxv:3,isnm:True;n:type:ShaderForge.SFN_Slider,id:6053,x:33413,y:32472,ptovrint:False,ptlb:Specular Power,ptin:_SpecularPower,varname:node_6053,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:1,cur:1,max:10;n:type:ShaderForge.SFN_Multiply,id:2063,x:34055,y:32099,varname:node_2063,prsc:2|A-1017-OUT,B-6053-OUT;n:type:ShaderForge.SFN_Tex2d,id:4564,x:34454,y:31691,varname:node_4564,prsc:2,ntxv:0,isnm:False|UVIN-4203-OUT,TEX-8656-TEX;n:type:ShaderForge.SFN_Panner,id:4590,x:33886,y:31667,varname:node_4590,prsc:2,spu:0.33,spv:0.256|UVIN-49-OUT,DIST-1761-OUT;n:type:ShaderForge.SFN_NormalBlend,id:3007,x:34873,y:31816,varname:node_3007,prsc:2|BSE-7722-RGB,DTL-4564-RGB;n:type:ShaderForge.SFN_LightAttenuation,id:9331,x:34488,y:32251,varname:node_9331,prsc:2;n:type:ShaderForge.SFN_Multiply,id:6326,x:34766,y:32109,varname:node_6326,prsc:2|A-653-OUT,B-9331-OUT;n:type:ShaderForge.SFN_Vector1,id:9413,x:33886,y:31826,varname:node_9413,prsc:2,v1:0.5;n:type:ShaderForge.SFN_Multiply,id:4203,x:34182,y:31683,varname:node_4203,prsc:2|A-4590-UVOUT,B-9413-OUT;n:type:ShaderForge.SFN_FragmentPosition,id:9662,x:32928,y:31340,varname:node_9662,prsc:2;n:type:ShaderForge.SFN_Append,id:49,x:33175,y:31348,varname:node_49,prsc:2|A-9662-X,B-9662-Z;n:type:ShaderForge.SFN_Posterize,id:5295,x:34296,y:32099,varname:node_5295,prsc:2|IN-2063-OUT,STPS-2560-OUT;n:type:ShaderForge.SFN_Vector1,id:2560,x:34036,y:32239,varname:node_2560,prsc:2,v1:2;n:type:ShaderForge.SFN_Slider,id:5431,x:35799,y:32695,ptovrint:False,ptlb:Tesellation,ptin:_Tesellation,varname:node_5431,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:1,cur:1,max:20;n:type:ShaderForge.SFN_Tex2d,id:6117,x:34994,y:32349,varname:node_6117,prsc:2,ntxv:0,isnm:False|UVIN-2268-UVOUT,TEX-3643-TEX;n:type:ShaderForge.SFN_Append,id:1849,x:35643,y:32398,varname:node_1849,prsc:2|A-4616-OUT,B-6872-OUT,C-4616-OUT;n:type:ShaderForge.SFN_Vector1,id:4616,x:35643,y:32346,varname:node_4616,prsc:2,v1:0;n:type:ShaderForge.SFN_Tex2dAsset,id:3643,x:34659,y:32426,ptovrint:False,ptlb:Wave Foam,ptin:_WaveFoam,varname:node_3643,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,ntxv:0,isnm:False;n:type:ShaderForge.SFN_Tex2d,id:7873,x:32344,y:33904,ptovrint:False,ptlb:Normal_copy,ptin:_Normal_copy,varname:_Normal_copy,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:dc9196df32ffdc04da99f757b6873f1a,ntxv:3,isnm:True|UVIN-4287-UVOUT;n:type:ShaderForge.SFN_TexCoord,id:4287,x:31858,y:33813,varname:node_4287,prsc:2,uv:0,uaff:False;n:type:ShaderForge.SFN_Slider,id:1971,x:35025,y:32725,ptovrint:False,ptlb:Waves Strength,ptin:_WavesStrength,varname:node_1971,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0.1,max:1;n:type:ShaderForge.SFN_Add,id:4709,x:35423,y:32482,varname:node_4709,prsc:2|A-6117-R,B-5374-R;n:type:ShaderForge.SFN_Multiply,id:6872,x:35423,y:32604,varname:node_6872,prsc:2|A-4709-OUT,B-1971-OUT;n:type:ShaderForge.SFN_Tex2d,id:5374,x:34994,y:32506,varname:node_5374,prsc:2,ntxv:0,isnm:False|UVIN-4590-UVOUT,TEX-3643-TEX;proporder:2510-912-7167-4920-6496-4468-8656-6053-5431-3643-1971;pass:END;sub:END;*/
- Shader "IdealGf/Water Shader" {
- Properties {
- _UpViewForce ("UpViewForce", Range(0, 3)) = 0
- _WaterColor ("Water Color", Color) = (0.3474265,0.7000254,0.75,1)
- _Refraction ("Refraction", Range(0, 1)) = 0
- _DepthForce ("Depth Force", Range(0, 1)) = 0
- _SpecularDefinition ("Specular Definition", Range(0, 1)) = 0
- _WavesSpeed ("Waves Speed", Range(0, 1)) = 0.5
- _WaterNormal ("WaterNormal", 2D) = "bump" {}
- _SpecularPower ("Specular Power", Range(1, 10)) = 1
- _Tesellation ("Tesellation", Range(1, 20)) = 1
- _WaveFoam ("Wave Foam", 2D) = "white" {}
- _WavesStrength ("Waves Strength", Range(0, 1)) = 0.1
- [HideInInspector]_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
- }
- SubShader {
- Tags {
- "IgnoreProjector"="True"
- "Queue"="Transparent"
- "RenderType"="Transparent"
- }
- GrabPass{ }
- Pass {
- Name "FORWARD"
- Tags {
- "LightMode"="ForwardBase"
- }
- Blend SrcAlpha OneMinusSrcAlpha
- ZWrite Off
- CGPROGRAM
- #pragma hull hull
- #pragma domain domain
- #pragma vertex tessvert
- #pragma fragment frag
- #define UNITY_PASS_FORWARDBASE
- #include "UnityCG.cginc"
- #include "Lighting.cginc"
- #include "Tessellation.cginc"
- #pragma multi_compile_fwdbase
- #pragma multi_compile_fog
- #pragma only_renderers d3d9 d3d11 glcore gles
- #pragma target 5.0
- uniform sampler2D _GrabTexture;
- uniform sampler2D _CameraDepthTexture;
- uniform float _UpViewForce;
- uniform float4 _WaterColor;
- uniform float _Refraction;
- uniform float _DepthForce;
- uniform float _SpecularDefinition;
- uniform float _WavesSpeed;
- uniform sampler2D _WaterNormal; uniform float4 _WaterNormal_ST;
- uniform float _SpecularPower;
- uniform float _Tesellation;
- uniform sampler2D _WaveFoam; uniform float4 _WaveFoam_ST;
- uniform float _WavesStrength;
- struct VertexInput {
- float4 vertex : POSITION;
- float3 normal : NORMAL;
- float4 tangent : TANGENT;
- };
- struct VertexOutput {
- float4 pos : SV_POSITION;
- float4 posWorld : TEXCOORD0;
- float3 normalDir : TEXCOORD1;
- float3 tangentDir : TEXCOORD2;
- float3 bitangentDir : TEXCOORD3;
- float4 projPos : TEXCOORD4;
- UNITY_FOG_COORDS(5)
- };
- VertexOutput vert (VertexInput v) {
- VertexOutput o = (VertexOutput)0;
- 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);
- o.posWorld = mul(unity_ObjectToWorld, v.vertex);
- o.pos = UnityObjectToClipPos( v.vertex );
- UNITY_TRANSFER_FOG(o,o.pos);
- o.projPos = ComputeScreenPos (o.pos);
- COMPUTE_EYEDEPTH(o.projPos.z);
- return o;
- }
- #ifdef UNITY_CAN_COMPILE_TESSELLATION
- struct TessVertex {
- float4 vertex : INTERNALTESSPOS;
- float3 normal : NORMAL;
- float4 tangent : TANGENT;
- };
- struct OutputPatchConstant {
- float edge[3] : SV_TessFactor;
- float inside : SV_InsideTessFactor;
- float3 vTangent[4] : TANGENT;
- float2 vUV[4] : TEXCOORD;
- float3 vTanUCorner[4] : TANUCORNER;
- float3 vTanVCorner[4] : TANVCORNER;
- float4 vCWts : TANWEIGHTS;
- };
- TessVertex tessvert (VertexInput v) {
- TessVertex o;
- o.vertex = v.vertex;
- o.normal = v.normal;
- o.tangent = v.tangent;
- return o;
- }
- void displacement (inout VertexInput v){
- float node_4616 = 0.0;
- float4 node_5400 = _Time;
- float node_1761 = (_WavesSpeed*node_5400.g);
- float2 node_49 = float2(mul(unity_ObjectToWorld, v.vertex).r,mul(unity_ObjectToWorld, v.vertex).b);
- float2 node_2268 = (node_49+node_1761*float2(1,1));
- float4 node_6117 = tex2Dlod(_WaveFoam,float4(TRANSFORM_TEX(node_2268, _WaveFoam),0.0,0));
- float2 node_4590 = (node_49+node_1761*float2(0.33,0.256));
- float4 node_5374 = tex2Dlod(_WaveFoam,float4(TRANSFORM_TEX(node_4590, _WaveFoam),0.0,0));
- v.vertex.xyz += float3(node_4616,((node_6117.r+node_5374.r)*_WavesStrength),node_4616);
- }
- float Tessellation(TessVertex v){
- return _Tesellation;
- }
- float4 Tessellation(TessVertex v, TessVertex v1, TessVertex v2){
- float tv = Tessellation(v);
- float tv1 = Tessellation(v1);
- float tv2 = Tessellation(v2);
- return float4( tv1+tv2, tv2+tv, tv+tv1, tv+tv1+tv2 ) / float4(2,2,2,3);
- }
- OutputPatchConstant hullconst (InputPatch<TessVertex,3> v) {
- OutputPatchConstant o = (OutputPatchConstant)0;
- float4 ts = Tessellation( v[0], v[1], v[2] );
- o.edge[0] = ts.x;
- o.edge[1] = ts.y;
- o.edge[2] = ts.z;
- o.inside = ts.w;
- return o;
- }
- [domain("tri")]
- [partitioning("fractional_odd")]
- [outputtopology("triangle_cw")]
- [patchconstantfunc("hullconst")]
- [outputcontrolpoints(3)]
- TessVertex hull (InputPatch<TessVertex,3> v, uint id : SV_OutputControlPointID) {
- return v[id];
- }
- [domain("tri")]
- VertexOutput domain (OutputPatchConstant tessFactors, const OutputPatch<TessVertex,3> vi, float3 bary : SV_DomainLocation) {
- VertexInput v = (VertexInput)0;
- v.vertex = vi[0].vertex*bary.x + vi[1].vertex*bary.y + vi[2].vertex*bary.z;
- v.normal = vi[0].normal*bary.x + vi[1].normal*bary.y + vi[2].normal*bary.z;
- v.tangent = vi[0].tangent*bary.x + vi[1].tangent*bary.y + vi[2].tangent*bary.z;
- displacement(v);
- VertexOutput o = vert(v);
- return o;
- }
- #endif
- 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);
- float4 node_5400 = _Time;
- float node_1761 = (_WavesSpeed*node_5400.g);
- float2 node_49 = float2(i.posWorld.r,i.posWorld.b);
- float2 node_2268 = (node_49+node_1761*float2(1,1));
- float3 node_7722 = UnpackNormal(tex2D(_WaterNormal,TRANSFORM_TEX(node_2268, _WaterNormal)));
- float2 node_4590 = (node_49+node_1761*float2(0.33,0.256));
- float2 node_4203 = (node_4590*0.5);
- float3 node_4564 = UnpackNormal(tex2D(_WaterNormal,TRANSFORM_TEX(node_4203, _WaterNormal)));
- float3 node_3007_nrm_base = node_7722.rgb + float3(0,0,1);
- float3 node_3007_nrm_detail = node_4564.rgb * float3(-1,-1,1);
- float3 node_3007_nrm_combined = node_3007_nrm_base*dot(node_3007_nrm_base, node_3007_nrm_detail)/node_3007_nrm_base.z - node_3007_nrm_detail;
- float3 node_3007 = node_3007_nrm_combined;
- float3 normalLocal = node_3007;
- float3 normalDirection = normalize(mul( normalLocal, tangentTransform )); // Perturbed normals
- float sceneZ = max(0,LinearEyeDepth (UNITY_SAMPLE_DEPTH(tex2Dproj(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos)))) - _ProjectionParams.g);
- float partZ = max(0,i.projPos.z - _ProjectionParams.g);
- float node_9071 = saturate((sceneZ-partZ));
- float node_6819 = (((dot(viewDirection,float3(0,1,0))*node_9071*_UpViewForce)+node_9071)*_DepthForce);
- float2 sceneUVs = (i.projPos.xy / i.projPos.w) + (float2(node_7722.r,node_7722.g)*node_6819*_Refraction);
- float4 sceneColor = tex2D(_GrabTexture, sceneUVs);
- float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz);
- ////// Lighting:
- float attenuation = 1;
- float node_2560 = 2.0;
- float3 finalColor = ((_WaterColor.rgb+floor((pow(abs(dot(lightDirection,normalDirection)),(exp(_SpecularDefinition)*4.0))*_SpecularPower) * node_2560) / (node_2560 - 1))*attenuation);
- fixed4 finalRGBA = fixed4(lerp(sceneColor.rgb, finalColor,node_6819),1);
- UNITY_APPLY_FOG(i.fogCoord, finalRGBA);
- return finalRGBA;
- }
- ENDCG
- }
- Pass {
- Name "ShadowCaster"
- Tags {
- "LightMode"="ShadowCaster"
- }
- Offset 1, 1
- Cull Back
- CGPROGRAM
- #pragma hull hull
- #pragma domain domain
- #pragma vertex tessvert
- #pragma fragment frag
- #define UNITY_PASS_SHADOWCASTER
- #include "UnityCG.cginc"
- #include "Lighting.cginc"
- #include "Tessellation.cginc"
- #pragma fragmentoption ARB_precision_hint_fastest
- #pragma multi_compile_shadowcaster
- #pragma multi_compile_fog
- #pragma only_renderers d3d9 d3d11 glcore gles
- #pragma target 5.0
- uniform float _WavesSpeed;
- uniform float _Tesellation;
- uniform sampler2D _WaveFoam; uniform float4 _WaveFoam_ST;
- uniform float _WavesStrength;
- struct VertexInput {
- float4 vertex : POSITION;
- float3 normal : NORMAL;
- float4 tangent : TANGENT;
- };
- struct VertexOutput {
- V2F_SHADOW_CASTER;
- float4 posWorld : TEXCOORD1;
- };
- VertexOutput vert (VertexInput v) {
- VertexOutput o = (VertexOutput)0;
- o.posWorld = mul(unity_ObjectToWorld, v.vertex);
- o.pos = UnityObjectToClipPos( v.vertex );
- TRANSFER_SHADOW_CASTER(o)
- return o;
- }
- #ifdef UNITY_CAN_COMPILE_TESSELLATION
- struct TessVertex {
- float4 vertex : INTERNALTESSPOS;
- float3 normal : NORMAL;
- float4 tangent : TANGENT;
- };
- struct OutputPatchConstant {
- float edge[3] : SV_TessFactor;
- float inside : SV_InsideTessFactor;
- float3 vTangent[4] : TANGENT;
- float2 vUV[4] : TEXCOORD;
- float3 vTanUCorner[4] : TANUCORNER;
- float3 vTanVCorner[4] : TANVCORNER;
- float4 vCWts : TANWEIGHTS;
- };
- TessVertex tessvert (VertexInput v) {
- TessVertex o;
- o.vertex = v.vertex;
- o.normal = v.normal;
- o.tangent = v.tangent;
- return o;
- }
- void displacement (inout VertexInput v){
- float node_4616 = 0.0;
- float4 node_5400 = _Time;
- float node_1761 = (_WavesSpeed*node_5400.g);
- float2 node_49 = float2(mul(unity_ObjectToWorld, v.vertex).r,mul(unity_ObjectToWorld, v.vertex).b);
- float2 node_2268 = (node_49+node_1761*float2(1,1));
- float4 node_6117 = tex2Dlod(_WaveFoam,float4(TRANSFORM_TEX(node_2268, _WaveFoam),0.0,0));
- float2 node_4590 = (node_49+node_1761*float2(0.33,0.256));
- float4 node_5374 = tex2Dlod(_WaveFoam,float4(TRANSFORM_TEX(node_4590, _WaveFoam),0.0,0));
- v.vertex.xyz += float3(node_4616,((node_6117.r+node_5374.r)*_WavesStrength),node_4616);
- }
- float Tessellation(TessVertex v){
- return _Tesellation;
- }
- float4 Tessellation(TessVertex v, TessVertex v1, TessVertex v2){
- float tv = Tessellation(v);
- float tv1 = Tessellation(v1);
- float tv2 = Tessellation(v2);
- return float4( tv1+tv2, tv2+tv, tv+tv1, tv+tv1+tv2 ) / float4(2,2,2,3);
- }
- OutputPatchConstant hullconst (InputPatch<TessVertex,3> v) {
- OutputPatchConstant o = (OutputPatchConstant)0;
- float4 ts = Tessellation( v[0], v[1], v[2] );
- o.edge[0] = ts.x;
- o.edge[1] = ts.y;
- o.edge[2] = ts.z;
- o.inside = ts.w;
- return o;
- }
- [domain("tri")]
- [partitioning("fractional_odd")]
- [outputtopology("triangle_cw")]
- [patchconstantfunc("hullconst")]
- [outputcontrolpoints(3)]
- TessVertex hull (InputPatch<TessVertex,3> v, uint id : SV_OutputControlPointID) {
- return v[id];
- }
- [domain("tri")]
- VertexOutput domain (OutputPatchConstant tessFactors, const OutputPatch<TessVertex,3> vi, float3 bary : SV_DomainLocation) {
- VertexInput v = (VertexInput)0;
- v.vertex = vi[0].vertex*bary.x + vi[1].vertex*bary.y + vi[2].vertex*bary.z;
- v.normal = vi[0].normal*bary.x + vi[1].normal*bary.y + vi[2].normal*bary.z;
- v.tangent = vi[0].tangent*bary.x + vi[1].tangent*bary.y + vi[2].tangent*bary.z;
- displacement(v);
- VertexOutput o = vert(v);
- return o;
- }
- #endif
- float4 frag(VertexOutput i) : COLOR {
- SHADOW_CASTER_FRAGMENT(i)
- }
- ENDCG
- }
- }
- FallBack "Diffuse"
- CustomEditor "ShaderForgeMaterialInspector"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement