- Home /
Intensive Shaders + Dynamic Batching
So, I'm developing a game for mobile platforms, and I'm trying to come up with a cost-effective way to make the game cool cartoony without slaughtering mobile performance. I'm currently using two custom shaders to achieve this.
-unlit tinted alpha with alpha testing
-unlit tinted
These work fantastic but they don't allow blob shadows to work. So I imported the toon shaders for the heck of it, applied it to my game, and it supposedly ran as fast as before. All of my objects so far derive from a common atlas texture and are optimized for dynamic batching. However, I tested this out on my PC and not an actual mobile device. That being said, I think the objects are still being batch drawn.
I only plan on developing for iPhone3GS and later, so the device itself won't be a problem. But I know toon shading is an intensive shader compared to the ones listed above. Should I only worry about shader intensity only if I'm not using shared materials between objects? All of the objects in my game use one material, vehicles use another, NPCs will all share two materials, and level geometry another.
Answer by ScroodgeM · Aug 09, 2012 at 08:51 PM
if it is possible in your case, assign to shaders unique queue value, this will help unity engine to batch them. of course, queue changing should be done with knowledge what does it affects.
also, if it's possible, combine meshes to force them do draw in one draw call. for example, after placing static objects on scene, force them to combine geometry.
for all other objects, try to place object so that on sorting objects by distance groups that should be batched will be place in sequence.
one crazy idea: can you use your 'unlit tinted alpha with alpha testing' with some improvements to avoid unneeded calculations with alpha instead of 'unlit tinted'?
Could you clarify? The alpha needs to be in there so that materials with an alpha channel get drawn correctly, and the tinting is used in case I want to set the theme of the level. It's my current idea to replace lightmaps and scene lighting, change the tint of the materials.
i mean where you use 'unlit tinted' just use 'unlit tinted alpha with alpha testing', but to avoid calculations of alpha in that materials make some improvements to shader that will let disable it. as i understood in 'unlit tinted' you don't use alpha?
Ah yes. How would I go about doing that? It'd be easier just to manually reassign them :3
this crazy idea needs to be tested on target platform. can be inefficient in many cases. and don't forget to disable alpha-calcs in shader for non-transparent materials.
ok, truth be told, I have no idea how to do any of this lol. could you point me in the direction so I could try to figure this out?
Your answer
Follow this Question
Related Questions
How can I optimize this code? 2 Answers
Shader performance question. 0 Answers
Shader.WarmupAllShaders ? What it does? 0 Answers
Transparency issue on iOS 1 Answer
Color white does nothing consider mobile... really? 1 Answer