Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

iOS shader: 'Vector' syntax error (on gles)

$
0
0
Hello, everyone! I've wrote a shader that uses a Vector paramter passed from outside by script. It works perfectly in Editor, but when I'm trying to build it for iOS I get that error: Shader error in 'Custom/UI/UI - glow around point': 'Vector' : syntax error syntax error at line 58 (on gles). Suprisingly, I can't google any info on this - why is this occuring and how to fix it? Would appreciate if anyone could help! line 58 reads the following: uniform Vector _PointPosition; Here's the full shader code: Shader "Custom/UI/UI - Glow around point" { Properties { [PerRendererData]_MainTex("Main texture", 2D) = "white" {} _Color("Main color", Color) = (0,0,0,0) _GlowColor("Glow color", Color) = (0,0,0,0) _GlowDistance("Glow power (distance)", float) = 5 _GlowSpeed("Glow Speed", float) = 2 _GlowRadius("Glow attenuation (radius)", float) = 50 [Space(30)] _StencilComp("Stencil Comparison", Float) = 8 _Stencil("Stencil ID", Float) = 0 _StencilOp("Stencil Operation", Float) = 0 _StencilWriteMask("Stencil Write Mask", Float) = 255 _StencilReadMask("Stencil Read Mask", Float) = 255 _ColorMask("Color Mask", Float) = 15 } SubShader { Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" "PreviewType" = "Plane" } Stencil { Ref[_Stencil] Comp[_StencilComp] Pass[_StencilOp] ReadMask[_StencilReadMask] WriteMask[_StencilWriteMask] } ColorMask[_ColorMask] Cull Off ZWrite Off ZTest[unity_GUIZTestMode] Blend SrcAlpha One Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" uniform sampler2D _MainTex; // Use in a script that knows the position on fake light emitting point Shader.SetGlobalVector("_PointPosition", fakeLightObject.transform.position); uniform Vector _PointPosition; uniform float4 _MainTex_ST; uniform float4 _MainTex_TexelSize; uniform float4 _Color; uniform float4 _GlowColor; uniform float _GlowDistance; uniform float _GlowRadius; uniform float _GlowSpeed; uniform fixed _isGoalHornOn; struct appdata { float4 vertex : POSITION; float2 texcoord : TEXCOORD0; float4 color : COLOR; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; float4 color : COLOR; }; v2f vert(appdata v) { v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.color = v.color; o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); return o; } fixed4 frag(v2f i) : SV_Target { fixed4 color = _Color * tex2D(_MainTex, i.uv*_MainTex_ST)*i.color; float dist = distance(_PointPosition, i.vertex) / _GlowDistance; fixed glowIntensity = (sin(_Time.y*_GlowSpeed) + 1)*0.5; color.rgb += lerp(0, smoothstep(_GlowRadius, 0, dist) * (_GlowColor*glowIntensity) / (dist), _isGoalHornOn); return color; } ENDCG } } Fallback "Mobile/VertexLit" }

Viewing all articles
Browse latest Browse all 4709

Trending Articles



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