Skip to content

Instantly share code, notes, and snippets.

@aras-p
Last active September 30, 2016 08:29
Show Gist options
  • Save aras-p/6702557 to your computer and use it in GitHub Desktop.
Save aras-p/6702557 to your computer and use it in GitHub Desktop.
"Unity on mobile wtfs"

Too long to reply on twitter, so.

300 vertex limit[900 = uv+norm+pos), 6 passes for dynamic shadows, terrain shader is inefficient, etc... Win RT+Unity sounds FUN!

I haven't watched the video, but have looked at the slides. So, point by point:

300 vertex limit

That is for dynamic batching, i.e. meshes larger than that aren't transformed on the CPU each frame to try to save the draw calls. This isn't a WinRT limiation; it simply doesn't make sense to spend CPU time transforming larger meshes, in order to save some CPU time to save a draw call.

6 passes for dynamic shadows

Don't know where you got that. I guess that would happen if you'd enable 4-cascade directional light shadows, and the object was large enough to hit all 4 cascades? Then 4 draw calls to render shadow caster into each shadow cascade, one draw call to collect cascades into screenspace shadow mask, and one regular draw call to render the object, applying the shadows.

However. Using 4-cascade shadow maps on current mobile hardware is way overkill. Don't do that! Also, don't make each and every object cast shadows on current mobile hardware; the most practical way right now is to only make "a couple of moving characters" cast shadows.

Terrain shader is inefficient

I wouldn't put it that way; maybe more like "trees usually have lots of overdraw, and you want to avoid overdraw on slow GPUs". And also, "terrain mixes many texture layers, and you want to avoid that on slow GPUs". That is, mobile hardware is way, way slower than what you have on desktop, and Unity magically can't make it faster.

When workign with terrain, that would mean getting all the detail levels down. Start billboard trees at lower distance. Start "base map" (instead of mixing textures) at lower distance. Decrease grass/detail density & distance. Decrease terrain geometry LOD & increase allowed pixel error.

These are things you just have to live with, when the hardare is 10-50 times slower than in your desktop rig.

Tegra can't do shadows

Correct, Tegra 2/3 can't do shadows. It just can't. Neither on WinRT nor on Android. Problem officer? :)

Fog doesn't work on WinRT

Yes our built-in fog doesn't work on DX11 feature levels 9.x. That is correct. And it has something to do with the way we do fog (runtime shader patching to insert fog calculations); and that way is pretty much impossible to pull of on DX11 9.x feature levels. So yeah, you'd have to do workarounds, i.e. to insert the fog calculations in your own fog shaders. I don't like that either, but not much I can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment