Search Unity

Unity Free v4.2 Realtime Shadows

Discussion in 'Editor & General Support' started by Amateur, Jul 29, 2013.

  1. Amateur

    Amateur

    Joined:
    Jan 12, 2013
    Posts:
    12
    Hello All,

    Just curious if this is a newbie problem, very likely I'm doing something wrong.

    I wanted to test out the real-time shadows with Unity Free (I've been playing with Unity since v3.2), and I've never had Pro before, other than making blob shadows in Unity Free, so I've never been able to experiment with the built-in realtime Shadows.

    However, when I give my scene one directional light, and add a cube and a plane (real quick prototyping here), and ensure the directional light is set to hard shadows, and my two objects are set to cast and receive shadows, nothing is happening. I am able to bake a shadow using lightmapping, but I don't see any real time shadows. I've also tried adding just a cube (non-static and static) to see if I can get the shadows to work, but nothing happens. Not sure if there is something I'm missing, like a special shader or something.

    Note, I recently upgraded from Unity 4.X to Unity 4.2 and I'm having to use the current fix to get Unity to run in Windows 8 64bit (adding the -force-d3d11 when Unity starts) to avoid crashing. Not sure if that has anything to do with it.

    Just curious if anyone else has tried. And thanks again Unity for enabling these features for free users, while I do intend to upgrade to Pro someday (when I actually make something), being able to test out these features as a free user has been beneficial. I've already been playing around with the Navmesh features as well.

    Thanks!
     
  2. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    Try increasing the "Shadow Distance" under Quality settings while your game is running to see if the shadows appear.
     
    Last edited: Jul 29, 2013
  3. chrisall76

    chrisall76

    Joined:
    May 19, 2012
    Posts:
    667
    try a shadow strength of 1 and a bias of 0.05
     
  4. DeXoN

    DeXoN

    Joined:
    Feb 10, 2013
    Posts:
    30
    Go to Edit -> Project Settings -> Quality. Select lower default values until you have a checkmark on your platform. Make sure shadows are enabled. If you've made changes to default settings, you can always select reset in the upper right hand corner.
     
  5. Amateur

    Amateur

    Joined:
    Jan 12, 2013
    Posts:
    12
    Hey Guys,

    Thanks for the suggestions, tried all those, but still nothing. All the elements appear to be there, and I've tried adjusting the quality settings, to include shadow distance. Still no shadows. Is it possible there is something happening with a previous install?

    Light is being cast on the objects from the directional light, but no shadows are appearing underneath or around the objects onto the plane beneath
     
  6. DeXoN

    DeXoN

    Joined:
    Feb 10, 2013
    Posts:
    30
    Did you make sure each object and the ground can cast and receive shadows? Check mesh renderer.

    Nevermind, I see you already checked these.
     
    Last edited: Jul 29, 2013
  7. Cleroth

    Cleroth

    Joined:
    Jul 11, 2012
    Posts:
    25
    Edit -> Project Settings -> Player -> Other Settings -> Rendering Path = Deferred Lighting
     
  8. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    …is pro only ;)

    I had the same problem myself at first, then I fiddled with all sort of options, until I got to the directional light itself. Set it to hard shadows, and they should appear.
     
  9. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    ...and deferred rendering is not necessary for directional shadows anyway (or even spotlight/point light shadows, as long as you fiddle with the shaders a bit).

    --Eric
     
  10. Amateur

    Amateur

    Joined:
    Jan 12, 2013
    Posts:
    12
    Hey All, thanks for the continued suggestions. You're right, deferred lighting is a pro feature, gave me a nice little warning on that :)

    Still no luck, must be something up with my settings and/or Windows 8. Tried everything else I can think of.

    Anyone else having similar issues? Seems like a lot of folks are having issues just getting Unity 4.2 to work with Windows 8, so far it continues to work for me with the -force-d3d11 option. Unless there is some sort of registry setting or hidden files preventing the shadows from working, I'm at a loss.

    Thanks again!!
     
  11. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    I guess it's something for UT to take a look at then. Might be a GPU driver-related issue. I have them working on HD4000 graphics, so it doesn't need much to work.
     
  12. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,552
    Try this perhaps - its a basic scene with a cast shadow.
     

    Attached Files:

  13. Amateur

    Amateur

    Joined:
    Jan 12, 2013
    Posts:
    12
    Hey AaronC,

    Thanks for the scene there. I tried it in my existing project, still no shadows. So, created a new project and tried to import your package again, then Unity decided to crashed, lol. Unfortunately, Unity's bug reporter didn't load, so wasn't able to provide a crash report. I'll keep trying to see if I can break it some more.

    So something is definitely wrong with my computer and Unity V4.2. Perhaps a GPU related issue like orb suggested. Guess I'll wait and see when Unity Dev's patch 4.2! For the record, my laptop ( a newer laptop) reports in Device Manager an Intel HD 4600 and Nvidia Geforce GTX 780M, maybe it's too new :)

    Thanks again all for the support, greatly appreciated!
     
  14. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,037
    If it's a laptop with switchable graphics, I can see where it might go wrong. There have been strange issues with those before in other engines. Definitely something for Unity to look at. Use their crash reporter if you got it, and attach that minimal project!
     
  15. Amateur

    Amateur

    Joined:
    Jan 12, 2013
    Posts:
    12
    Hah, maybe I solved the problem, got shadows working! I did -force-d3d9 when unity starts, of course I had to avoid having a scene with any assets loaded in it on startup to avoid Unity crashing on startup. I'm sure it might crash at some point, but for now I've been able to create a new scene and enable shadows with Direct 3d 9 enabled.

    So, maybe it's an issue with Direct 3D 11? Might explain all the crash reports I'm seeing on the forums. Anyways, I'll keep playing with stuff to see what happens.

    Thanks again for all the help!
     
  16. MikeErty

    MikeErty

    Joined:
    Feb 24, 2013
    Posts:
    19
    I'm having a similar issue. I work at home on my laptop and the shadows are there, but when i do the same thing on my work pc at the office the shadows refuse to appear. The office pc is a lot more powerful than my laptop too... very odd.
     
  17. laih53053

    laih53053

    Joined:
    Nov 20, 2013
    Posts:
    1
    Hi, AaronC

    I was having the same problem with shadows not casting. But the weird part was that, I started up a project in Unity Pro and then moved it to another computer that only has Unity Free, the shadows cast perfectly Unity Free. Then I started another project from Unity Free and had all the setting set to the same as the previous project but the shadows won't cast. Then I imported your scene into my project, and in two different scenes with the same set up, and in the same project, one is casting shadow and the other is not...... The only possible solution I can think of is the scenes were originally built in Unity Pro??? Was your scene built in Unity Pro???

    I'm using Unity 4.2, the other project casts shadow fine on my computer so I'm sure the graphics card have no problem.

    Thank :)
     
  18. MadMapp

    MadMapp

    Joined:
    Nov 15, 2012
    Posts:
    49
    hi all, don know if this helps

    i just read this post as learnd about the new real time shadows in the new free unity,
    just so happen me and my partner were saying how" them zombies really need a shadow,

    so went in to my scene, clicked the directional lights changed the setting to hard shadows, and boom, instant shadows,
    i preceded to test my game,

    now in my game when the player is on foot the camera is close, its a 2.5D top down camera,
    when the player enters a car the camera rises up to give a larger view of the upcoming areas,
    i have a directional light which continues to rotate to fake sun rise, daytime,sun set, night time

    when the player is on foot, everything has a shadow, they are a bit blocky but all are working in realtime
    when the player enters a car and i move the camera up, there are no shadows at all
    all im doing is changing the cameras y position,

    Edit:
    ok i just went to my scene, and by zooming in and out to the floor surface in the inspector, strengthens and softens the shadows

    which explains why i have no shadows with my camera when set in a higher position,

    so perhaps you are having a issue like this also, perhaps your camera is to far away from the objects that are casting shadows
     
    Last edited: Dec 7, 2013
  19. Darkworth

    Darkworth

    Joined:
    Jan 19, 2011
    Posts:
    41
    One of our artists is having this same issue on his win 8 laptop. What he has to do every single time to get shadows working is to open the player settings (edit->project settings->player) and uncheck the use directx 11 box... then recheck it. Provided that Unity doesn't crash, (which it does about 40% of the time when doing this) shadows will instantly become visible after the re-enabling of dx 11. All in all the whole dx9-dx11 bit on win8 is totally fubar'd with Unity. We have these issues on every win 8 machine in use, but no issues at all on the win 7 machines. We have tried every suggested fix we could find and so far nothing has worked and we still have to mess with disabling / re-enabling dx11 every time we load a scene on the win8 boxes and dealing with the intermittent crashes that occur as a result.

    We have even had the project corrupted a couple times due to these crashes while the project files were in use (thank the game dev gods for source control!!!) This is definitely something that needs immediate attention as Win 8 has been out far too long for this to still be an issue! But in the meantime, here is what has "worked" for us (and i use the term "worked" very lightly lol) Hope it helps ease the pain at least a bit.
     
  20. allenwp

    allenwp

    Joined:
    Sep 4, 2013
    Posts:
    46
    In case it's useful for anyone who stumbles upon this thread. These were my findings on getting realtime shadows to work:

    http://answers.unity3d.com/questions/390676/how-to-cast-realtime-shadows.html#answer-729261

    First, check the shadow troubleshooting page: http://docs.unity3d.com/Manual/ShadowTroubleshooting.html

    Second, check your rendering path supports realtime shadows for the type of light you're using: http://docs.unity3d.com/Manual/RenderingPaths.html (in forward rendering, shadows can be given by up to 1 direction light only)

    Third, try changing between Dual and Single lightmaps. I don't know if this is universal, but my machine will only show realtime shadows when using dual lightmaps. Switching to single or directional lightmaps causes realtime shadows to disappear.

    Fourth, try forcing Direct3D 9 or 11 or OpenGL rendering in case you have a driver-related limitation.​