- Home /
creating a shader that is compatible for smartphones
Hi there, I have created a shader that works great on windows but that does not function correctly for smartphones. The shader is ment as a poison effect shown in the image below:
When I create a build for my phone the correct poison color is being displayed but the screen waving effect seems to be completely missing.
Here is the shader code that creates the poison effect:
fixed4 frag (v2f i) : SV_Target
{
fixed4 col = tex2D(_MainTex, i.uv + float2(sin(i.vertex.y / 40 + _Time[1]) / 35 * _t, sin(i.vertex.x / 40 + _Time[1]) / 35 * _t));
float _RedOverTime = 1 - (_t / (1/(1-_RedFactor)));
float _GreenOverTime = 1 - (_t / (1/(1-_GreenFactor)));
float _BlueOverTime = 1 - (_t / (1/(1-_BlueFactor)));
col.r = col.r * _RedOverTime;
col.g = col.g * _GreenOverTime;
col.b = col.b * _BlueOverTime;
return col;
}
_t is a value between 0 and 1that determines the amount of screen waving and the amount of green that is being displayed in the game.
Any help would be really appreciated!
What I found out is that on phones with high resolution this effect is being displayed, but way too much, so what I need is to make the effect the same for all resolutions. I have no idea how to achieve this however... I hope someone reads this and is able to help me :)
Your answer
![](https://koobas.hobune.stream/wayback/20220612091125im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to verify if the player can use DX 11 shader ? 1 Answer
The Blacksmith: Wrinkle Maps asset not working in 5.4.1 1 Answer
Hang while loading assets, Shader.Parse ? 0 Answers
Crash with 'Standard MaskyMix Scatter (Specular, Surface)' shader 0 Answers
How to force the compilation of a shader in Unity? 5 Answers