- Home /
Is this surface shader too heavy for mobile?
I am having problems with thermal throttling on my Samsung S8+ (It is tt for sure cause when i cool the device i don't have fps drop). I am using Beautify PP and default anti-aliasing. Rendering of the scene takes between 70-80 draw-calls where :
- 1 Clear
- ~50 Scene objects
- 12 UI
- 15 Post-Processing
- 1 AA
I am using bellow shader on every object except on shadow plane where i use unlit-transparent and glass transparent surface shader(I have 1 shadowplane with texture and 2 planes for glass). No shadows in the scene and only 1 directional light. I baked shadows and put it on a plane as a texture.
Scene has 27k triangles in total (38k verts), using 3 instances of the mentioned shader 1 for the floor, 1 for the bottom part of the box and 1 for the top part. Scene is rendered in 1080p resolution. Instancing is enabled and all materials use 2048 textures. I hope someone can help :)
Shader "Custom/Mobile/DoubleSurface Bump" {
Properties {
_CombTex ("SurfaceMask(R) Occlusion(G) Map", 2D) = "white" {}
_BumpMap ("Normal Map", 2D) = "bump" {}
_AlbedoColor1 ("Color 1", Color) = (1, 1, 1, 1)
_Metallic1 ("Metallic", Range(0,1)) = 0.0
_Glossiness1 ("Smoothness", Range(0,1)) = 0.5
_AlbedoColor2 ("Color 2", Color) = (1, 1, 1, 1)
_Metallic2 ("Metallic", Range(0,1)) = 0.0
_Glossiness2 ("Smoothness", Range(0,1)) = 0.5
_OcclusionStrength ("Occlusion Strength", Range(0, 1)) = 1
_OcclusionMultiplier ("Occlusion Multiplier", Range(0, 1)) = 1
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Standard noshadow noforwardadd noambient interpolateview
#pragma target 3.0
sampler2D _CombTex;
sampler2D _BumpMap;
struct Input {
float2 uv_CombTex;
float2 uv_BumpMap;
};
fixed4 _AlbedoColor1;
half _Metallic1;
half _Glossiness1;
fixed4 _AlbedoColor2;
half _Metallic2;
half _Glossiness2;
half _OcclusionStrength;
half _OcclusionMultiplier;
void surf (Input IN, inout SurfaceOutputStandard o) {
// Evaluating maps
fixed4 comb = tex2D (_CombTex, IN.uv_CombTex);
fixed3 normals = UnpackNormal(tex2D (_BumpMap, IN.uv_BumpMap));
// Occlusion calculation
half occlusion = pow (comb.g, _OcclusionStrength) * _OcclusionMultiplier;
half difference = 1 - comb.r;
o.Albedo = _AlbedoColor1 * comb.r + _AlbedoColor2 * difference;
o.Metallic = _Metallic1 * comb.r + _Metallic2 * difference;
o.Smoothness = _Glossiness1 * comb.r + _Glossiness2 * difference;
o.Normal = normals;
o.Occlusion = occlusion;
o.Alpha = comb.a;
}
ENDCG
}
FallBack "Diffuse"
}
I made it this way cause all my objects r made from like 2 types of material, lets say matte black and gold so i use 1 texture for that, better than using 1 for albedo and other for metallness, occlusion etc.
Your answer
![](https://koobas.hobune.stream/wayback/20220612164357im_/https://answers.unity.com/themes/thub/images/avi.jpg)