Getting shader working on OpenGL ES 1.0 (Unity.3.5)

Hi,

I’m having some performance problems with my Unity Project which i didn’t have before. I’m using OpenGL ES 2.0 which i think the problem is. Is there anyway to make this shader working on OpenGL ES 1.0? Shader:

// Upgrade NOTE: replaced 'PositionFog()' with multiply of UNITY_MATRIX_MVP by position
// Upgrade NOTE: replaced 'V2F_POS_FOG' with 'float4 pos : SV_POSITION'

Shader "Hologram" {
    
    Properties {

        _Color ("Main Color", Color) = (1,1,1,1)

        _RimColor ("Rim Color", Color) = (1, 1, 1, 1)
        
        _RimPower ("Rim Power", Range(0.5,8.0)) = 3.0

        _MainTex ("Base (RGB)", 2D) = "white" {}

    }

    

    SubShader {

        

        Pass {

            

            CGPROGRAM

                

                #pragma vertex vert

                #pragma fragment frag

                #include "UnityCG.cginc"

                struct appdata {

                    float4 vertex : POSITION;

                    float3 normal : NORMAL;

                    float2 texcoord : TEXCOORD0;

                };

                

                struct v2f {

                    float4 pos : SV_POSITION;

                    float2 uv : TEXCOORD0;

                    float3 color : COLOR;

                };

                

                uniform float4 _MainTex_ST;

                uniform float4 _RimColor;
                
                uniform float _RimPower;

                

                v2f vert (appdata_base v) {

                    v2f o;

                    o.pos = mul (UNITY_MATRIX_MVP, v.vertex);

                    

                    float3 viewDir = normalize(ObjSpaceViewDir(v.vertex));

                    float dotProduct = 1 - dot(v.normal, viewDir) * _RimPower;

                    float rimWidth = 0.7;

                    o.color = smoothstep(1 - rimWidth, 1.0, dotProduct);

                    

                    o.color *= _RimColor;

                    

                    o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);

                    

                    return o;

                }

                

                uniform sampler2D _MainTex;

                uniform float4 _Color;

                

                float4 frag(v2f i) : COLOR {

                    float4 texcol = tex2D(_MainTex, i.uv);

                    texcol *= _Color;

                    texcol.rgb += i.color;

                    return texcol;

                }
            ENDCG
        }
    }
}

No. It doesn’t use shaders.

Why do you care?

To be clear, GLES 1 still determines how to render things based on Unity shader files. However, it only supports fixed function shaders, not Cg or GLSL programs like the shader you have posted.

It would be possible to write a roughly equivalent fixed function shader using SphereMap texture coordinates, like in this thread. You would need to use a texture to define your rim ramp, but it should work just fine.