Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

_MainTex_ST Redefinition error

$
0
0
I need some help I'm trying to put together a particle shader using the surface shader mixed with the soft particle shader and It says the "Redefinition of _MainTex_ST at line 126 (d3d11)" but the code is only 117 lines long. could I have some help with this. I doubt I'm even doing this correctly and need help doing this correctly. thank you. Shader "Particles/SurfaceParticle(Soft)" { Properties { _TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5) _MainTex ("Particle Texture", 2D) = "white" {} _InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0 } Category { //Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" } Blend SrcAlpha OneMinusSrcAlpha AlphaTest Greater .01 ColorMask RGB Cull Off Lighting On ZWrite Off Fog { Color (0,0,0,0) } BindChannels { Bind "Color", color Bind "Vertex", vertex Bind "TexCoord", texcoord } SubShader { Tags { "Queue"="Transparent" "RenderType"="Transparent" } CGPROGRAM //#pragma surface surf SimpleLambert #pragma surface surf Lambert alpha half4 LightingSimpleLambert (SurfaceOutput s, half3 lightDir, half atten) { half NdotL = dot (s.Normal, lightDir); half4 c; c.rgb = s.Albedo * _LightColor0.rgb * (NdotL * atten); c.a = s.Alpha; return c; } struct Input { float2 uv_MainTex; }; sampler2D _MainTex; fixed4 _TintColor; void surf (Input IN, inout SurfaceOutput o) { o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb; o.Alpha = tex2D (_MainTex, IN.uv_MainTex).a; } struct appdata_t { float4 vertex : POSITION; fixed4 color : COLOR; float2 texcoord : TEXCOORD0; }; struct v2f { float4 vertex : POSITION; fixed4 color : COLOR; float2 texcoord : TEXCOORD0; #ifdef SOFTPARTICLES_ON float4 projPos : TEXCOORD1; #endif }; float4 _MainTex_ST; v2f vert (appdata_t v) { v2f o; o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); #ifdef SOFTPARTICLES_ON o.projPos = ComputeScreenPos (o.vertex); COMPUTE_EYEDEPTH(o.projPos.z); #endif o.color = v.color; o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex); return o; } sampler2D _CameraDepthTexture; float _InvFade; fixed4 frag (v2f i) : COLOR { #ifdef SOFTPARTICLES_ON float sceneZ = LinearEyeDepth (UNITY_SAMPLE_DEPTH(tex2Dproj(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos)))); float partZ = i.projPos.z; float fade = saturate (_InvFade * (sceneZ-partZ)); i.color.a *= fade; #endif return 2.0f * i.color * _TintColor * tex2D(_MainTex, i.texcoord); } ENDCG } // ---- Fragment program cards // ---- Dual texture cards SubShader { Pass { SetTexture [_MainTex] { constantColor [_TintColor] combine constant * primary } SetTexture [_MainTex] { combine texture * previous DOUBLE } } } // ---- Single texture cards (does not do color tint) SubShader { Pass { SetTexture [_MainTex] { combine texture * primary } } } } }

Viewing all articles
Browse latest Browse all 2891

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>