- Home /
when I use shader grass is disappearing
When i'm use nightvision grass dissapear. What's wrong?
Shader "UnityFree/NightVision" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_Brightness ("Brightness Amount", Float ) = 5
_Bright ("Bright Areas", Float ) = 2.0
}
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert_img
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
uniform sampler2D _MainTex;
uniform float _Brightness;
uniform float _Bright;
//uniform float _SaturationAmount;
//uniform float _BrightnessAmount;
//uniform float _ContrastAmount;
half4 frag (v2f_img i) : COLOR {
half4 tex = tex2D( _MainTex, i.uv );
// greyscale the pixel color values
//half4 grey = dot( half3( 0.222, 0.707, 0.071 ), tex );
half4 grey = dot( half3( 0.080, 0.040, 0.059 ), tex );
if(_Bright == 1.0 ) {
// white out bright spots
if( grey.x > 0.4 )
grey *= _Brightness;
}
// boost the green channel
grey.y *= 1.8;
//grey.z *= 1.5;
//grey.x *= 1.5;
return grey;
}
ENDCG
}
}
}
PS: How to create vision-range?(darkness is directly proportional to the distance of the player)
Comment
I dont remember that I assigned any texture in _$$anonymous$$ainTex, where I can do this?
Your answer
Follow this Question
Related Questions
Blending/Fading Camera & Pixel Shader 1.1 0 Answers
How do I take a high quality screen shot from my scene view camera? 5 Answers
Screen go darker when it look at an Object? 1 Answer
CommandBuffer's CameraEvent ordering not in sync with shader rendering queue? 1 Answer
Fixed width, relative height, on different aspect ratio screen? 4 Answers