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

Custom Outline Shader acting weird on iOS builds.

$
0
0
Hello! We are using a custom outline shader in our project. It works great in the editor, on android, and on older iOS devices, but it seems on iOS 11 devices, the outline on the shader appears to disappear. It clearly still has the same shader on, but almost appears as if the values are getting adjusted in the builds or something strange. - Does anyone know anything about why this would happen? I'll shader the shader code below. I did not write it. Any help is greatly appreciated! - Shader "Custom/OutlineShader" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _Outline("Outline Thickness", Range(0.0, 0.3)) = 0.002 _OutlineColor("Outline Color", Color) = (0,0,0,1) } CGINCLUDE #include "UnityCG.cginc" sampler2D _MainTex; half4 _MainTex_ST; half _Outline; half4 _OutlineColor; struct appdata { half4 vertex : POSITION; half4 uv : TEXCOORD0; half3 normal : NORMAL; fixed4 color : COLOR; }; struct v2f { half4 pos : POSITION; half2 uv : TEXCOORD0; fixed4 color : COLOR; }; ENDCG SubShader { Tags { "RenderType"="Opaque" "Queue" = "Transparent" } Pass{ Name "OUTLINE" Cull Front CGPROGRAM #pragma vertex vert #pragma fragment frag v2f vert(appdata v) { v2f o; o.pos = UnityObjectToClipPos(v.vertex); half3 norm = mul((half3x3)UNITY_MATRIX_IT_MV, v.normal); half2 offset = TransformViewToProjection(norm.xy); o.pos.xy += offset * o.pos.z * _Outline; o.color = _OutlineColor; return o; } fixed4 frag(v2f i) : COLOR { fixed4 o; o = i.color; return o; } ENDCG } Pass { Name "TEXTURE" Cull Back ZWrite On ZTest LEqual CGPROGRAM #pragma vertex vert #pragma fragment frag v2f vert(appdata v) { v2f o; o.pos = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); o.color = v.color; return o; } fixed4 frag(v2f i) : COLOR { fixed4 o; o = tex2D(_MainTex, i.uv.xy); return o; } ENDCG } } }

Viewing all articles
Browse latest Browse all 4709

Trending Articles



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