You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			40 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Plaintext
		
	
		
		
			
		
	
	
			40 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Plaintext
		
	
| 
											2 years ago
										 | Shader "FluidDynamics/MatRenderer2"  | ||
|  | {     | ||
|  |     Properties | ||
|  |     { | ||
|  |         _MainTex ("MainTexture", 2D) = "white" {} | ||
|  |     } | ||
|  |     SubShader  | ||
|  |     { | ||
|  |         Blend SrcAlpha OneMinusSrcAlpha  | ||
|  |         ZWrite Off | ||
|  |         Tags {"Queue" = "Transparent" } | ||
|  |         ZTest LEqual | ||
|  |         CGPROGRAM | ||
|  |         #include "UnityCG.cginc" | ||
|  |         #pragma surface surf Lambert addshadow fullforwardshadows | ||
|  |         #pragma target 4.5 | ||
|  |         float2 _Size; | ||
|  |         #ifdef SHADER_API_D3D11 | ||
|  |             StructuredBuffer<float> _Particles; | ||
|  |             StructuredBuffer<float4> _ColourRamp; | ||
|  |         #endif | ||
|  |          | ||
|  |         struct Input | ||
|  |         { | ||
|  |             float2 uv; | ||
|  |         }; | ||
|  | 
 | ||
|  |         void surf (Input IN, inout SurfaceOutput o) { | ||
|  |             #ifdef SHADER_API_D3D11 | ||
|  |                 int x = (int)(IN.uv.x*_Size.x); | ||
|  |                 int y = (int)(IN.uv.y*_Size.y); | ||
|  |                 float4 col = _ColourRamp[clamp(_Particles[y*_Size.x + x], 0.0, 255.0)]; | ||
|  |                 o.Albedo = col.rgb; | ||
|  |                 o.Alpha = col.a; | ||
|  |             #endif | ||
|  |         } | ||
|  |         ENDCG | ||
|  |     } | ||
|  |     Fallback "Diffuse" | ||
|  | } |