Question by
davidmurdoch · May 19, 2017 at 10:38 PM ·
shadershadersshader programming
Mobile Shader that swaps in an image
I'm using a shader similar to the following. It works on desktop but not on Android (2013 Moto X and some others tested).
Shader "Infinity Code/Online Maps/Tileset"
{
Properties
{
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_GrassTexture("Grass Texture", 2D) = "green" {}
}
SubShader
{
Tags {"Queue"="Transparent-100" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 200
CGPROGRAM
#pragma surface surf Lambert alpha
sampler2D _MainTex;
sampler2D _GrassTexture;
struct Input
{
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o)
{
o.Albedo = tex2D(_GrassTexture, IN.uv_MainTex);
o.Alpha = 1;
}
ENDCG
}
Fallback "Transparent/VertexLit"
}
_GrassTexture is set to an image file that should be used instead of what's in the IN. An desktop this works great. On Android it renders just grey.
Is this sort of thing just not going to be possible on Android or am I doing something wrong?
Comment
Your answer
Follow this Question
Related Questions
Getting Color Generated from Shader to Script to Shader 0 Answers
Converted ShaderToy shader showing up black 1 Answer
why outline is drawed only on front side of skinned mesh render 1 Answer
Very basic shader problem 0 Answers
Render oject A when behind object B, but not if behind object B and object C 1 Answer