Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Mobile Shadows - Anyone got them to work?

Discussion in 'iOS and tvOS' started by quitebuttery, Dec 26, 2012.

  1. quitebuttery

    quitebuttery

    Joined:
    Mar 12, 2011
    Posts:
    327
    Does anyone have an example project with working iOS mobile shadows? I can't get them to work in my project at all--in the Editor or on the device. I'm wondering if you need to use specific shaders for it to work? (I'm using custom shaders on most objects). I seem to have the quality, lighting, and gameobject settings (send/receive shadows) correct.
     
  2. GMM

    GMM

    Joined:
    Sep 24, 2012
    Posts:
    301
    Are you using dynamic shadows? Dynamic shadows for mobile requires Unity Pro and even then they are very taxing, If not look into using a combination of baked and blob shadows that gives you good performance and decent graphics.
     
  3. quitebuttery

    quitebuttery

    Joined:
    Mar 12, 2011
    Posts:
    327
    Yep, I have Unity Pro. Blob shadows look terrible (their performance isn't that great either!), and my game is pretty basic so I think it's a good candidate for mobile shadows. I'd actually like to test it out to see what the perf is like. I figure maybe in more complicated games I'd only enable them on the iPhone 4S or above etc.
     
  4. GMM

    GMM

    Joined:
    Sep 24, 2012
    Posts:
    301
    Try seeing if it will work with some of unity's included shaders, I had no trouble in making dynamic shadows work on a project I did a few weeks back for mobile.
     
  5. Horror

    Horror

    Joined:
    Jul 18, 2011
    Posts:
    207
    I have them working on an iPhone 4 using normal mapped surfaces. Make sure you:

    - Use a directional light (shadows won't cast from any other light type on mobile).
    - Set your directional light to either "Important" or "Auto".
    - Check the mesh renderers you want to receive shadows with "Receive Shadows".
    - Check the mesh renderers you want to cast shadows with "Cast Shadows".
    - Take a look at Edit > Project Settings > Quality (I'm using Hard Shadows, Low Resolution, Stable Fit, No Cascades, Shadow Distance = 12)
     
  6. Be-Rad

    Be-Rad

    Joined:
    Feb 5, 2009
    Posts:
    34
    I found shadows did NOT work when OpenGL ES 1.x was selected.
    Make sure OpenGL ES 2.0 is highlighted in the player settings.

    Turning shadows on I went from ~30 fps to 12-15 on my iPad 1 and iPod touch 4, with low res shadows.
     
  7. snedgel

    snedgel

    Joined:
    Jan 11, 2013
    Posts:
    8
    hi ,
    here is my problem . i work on unity for an AR project . i mad a box with a extrude in it and i put an animation of rotation on the box ... the problem is that when i export an .apk for my android , i don't have any self shadow projected on my box in AR .... and i have dynamic shadow in unity . i don't understand why it doens't export on my android ...

    i'm using unity pro , and my player settign are :

    minimum API level : android 2.0.1 exlair ( api level 6 )
    device filter : ARMv7 only
    instal location : prfer external
    graphic level : openGL ES 2.0

    Can u help me plz ? Thanks
     
  8. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
  9. snedgel

    snedgel

    Joined:
    Jan 11, 2013
    Posts:
    8
    i have an sony ericson android , version : 2.3.4
     
  10. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    You should be more specific about device model, because it highly depends on what GPU it has. From Unity Manual (http://docs.unity3d.com/Documentation/Manual/Shadows.html) : "GL_OES_depth_texture support. Most notably, Tegra-based Android devices do not have it, so shadows are not supported there.". Also you need Pro version of Android license.