Hey guys so I am new to Shader codes and I have been following this tutorial on Underwater shader using perlin noise. The problem is that the image processing shader is giving me this error:
'Vincintech/UwaterImageEffect': failed to open source file: 'noiseSimplex.cginc' at line 24 (on d3d11)
here is my code:
Shader "Vincintech/UwaterImageEffect"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_NoiseScale("Noise Scale",float) = 1
_NoiseFreqeuncy("Noise Frequency",float) = 1
_NoiseSpeed("Noise Speed",float) = 1
_PixelOffset("Pixel Offset", float) = 0.005
}
SubShader
{
// No culling or depth
Cull Off ZWrite Off ZTest Always
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "noiseSimplex.cginc"
#define M_PI 3.1415926535897932384626433832795
uniform float _NoiseScale,_NoiseFrequency, _NoiseSpeed;
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float4 scrPos : TEXTCOORD1;
};
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.scrPOS = ComputeScreenPos(o.vertex);
o.uv = v.uv;
return o;
}
sampler2D _MainTex;
fixed4 frag(v2f i) : COLOR
{
float3 spos = float3(i.scrPos.x,i.scrPos.y,0 * __NoiseFrequency);
spos.z += _Time.x * _NoiseSpeed;
float noise = _NoiseScale * ((snoise(spos) + 1) / 2);
float4 noiseToDirection = float4(cos(noise*M_PI*2), sin(noise*M_PI*2),0,0);
fixed4 col = fixed4(noise,noise,noise,1);
fixed4 col = tex2Dproj(_MainTex, i, scrPos + normalize(noiseToDirection*_PixelOffset));
// just invert the colors
// col.rgb = col.rgb;
return col;
}
ENDCG
}
}
}
↧