Android and shadows

I am currently investigating my options for having shadows on Android, and I realize they are few and not very satisfactory. What I found out so far:

  1. Using built-in DirectionalLightShadowRenderer:
    Possible but crashes in the Android emulator (still works on an actual mobile device), and brings the FPS rate to a crawling halt - for a very simple scene with <200 objects (and each having a very moderate amount of vertices), I got 15-20 FPS on a Nokia 7.2. Optics are fine, though (obviously), with geometrically correct shadows:

  2. Simulate shadows by adding a plane with a prerendered shadow texture to each model:

    Looks ok at first glance, but overlapping shadows produce darker spots (could be worked around by prerendering into a separate frame buffer), shadows only work on flat surfaces (thus no shadow under the bridge), and object shadows are not correctly distorted when falling onto other objects / vertical surfaces / etc. Also, it’s quite complicated to avoid shadows hanging over ledges (I trim the shadow quad and adjust UV coordinates). On the up side, frame rate is virtually unaffected.

  3. Projecting a simple shadow texture onto the scene (below objects which cast the shadow obviously). Haven’t done this, as I am going for a crisper voxel look where blurry shadows won’t work well.

Do you know any other options? Ideally, I would like to have something I could simply drop in without much additional coding, and performance should be affected as little as possible. In my particular case, I could live with some constraints as my scenes are mostly flat and most objects do not rotate or move around that much.

As far as I know, many 3D games on mobile platforms use baking to speed up rendering, which is very fast and can be stabilized at 60 frames. However, the SDK does not provide baking options, so you need to use blender or 3dsmax to bake lightmap, and then set the lightmap texture of unshader or phonglighting.

What about this one from SimFX?

I almost suggested it but I think the fuzzy shadows are not the style he wants.

Thanks for the pointer! I will look into it. pspeed is right, though, this might not fit the look I am after, but will definitely check it out.

1 Like