Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Objects and trees to cast real time shadows on terrain

Discussion in 'Editor & General Support' started by Majority, May 13, 2009.

  1. Majority

    Majority

    Joined:
    May 13, 2009
    Posts:
    7
    Hello, i am new here, and i think this engine is amazing, but i have a question; how the hell i can enable objects and trees to cast real time shadows on terrain? im a 3d artist not a game developer or a coder, sorry if this question was already ask and solved,
     
  2. antenna-tree

    antenna-tree

    Joined:
    Oct 30, 2005
    Posts:
    5,324
  3. Majority

    Majority

    Joined:
    May 13, 2009
    Posts:
    7
    Tanks for your reply, i read all on that topic, but i still cant' get it :?
    i do everything that, and nothing!

    what i want is enable all real time shadows on the terrain including the objects and trees shadows

    is there an step by step tutorial about this that i can read,

    sorry but this engine is new to me, i liked but i am on the beginning of the learning curve.
    again, sorry for the noob here, and tanks for your time :wink:
     
  4. antenna-tree

    antenna-tree

    Joined:
    Oct 30, 2005
    Posts:
    5,324
    I have to ask whether or not you're using Unity Pro... dynamic shadows are not available in Unity Indie.

    If you're using Pro then I'll make a real simple example scene that you can pick apart.
     
  5. Majority

    Majority

    Joined:
    May 13, 2009
    Posts:
    7
    i have the pro version, i realy appreciate your help :eek: tanks again!
     
  6. DocSWAB

    DocSWAB

    Joined:
    Aug 28, 2006
    Posts:
    615
    1. On the Terrain object inspector, check "Cast Shadows." and set lighting to pixel. (If you have calculated a lightmap, which you should, then it will use the lightmap at a distance).

    2. On the DIRECTIONAL light in your scene, set the render mode to pixel. Set the shadow type to hard or soft. Set the resolution to whatever your video card can handle. You may have to adjust the other settings as well.

    3. Make sure that other mesh-based objects have "cast and receive shadows" checked on them.
     
  7. Majority

    Majority

    Joined:
    May 13, 2009
    Posts:
    7
    tanks for you explanation i will try that
     
  8. Majority

    Majority

    Joined:
    May 13, 2009
    Posts:
    7
    It work! tanks!

    i make a test on the island Demo and it work fine, but wen i make a new project and a new terrain it didn't work so well, so, i must calculate the lightmap first? and then set the light to pixel?

    tanks again, your help was precious!
     
  9. DocSWAB

    DocSWAB

    Joined:
    Aug 28, 2006
    Posts:
    615
    Yes you have to calculate a lightmap manually at least once.
     
  10. Majority

    Majority

    Joined:
    May 13, 2009
    Posts:
    7
    Yes, tanks it work very well, and now i understand the logic of lightmap! 8)

    Another question, and the grass? have no shadow? well i try everything... i simply cannot make grass cast real time shadows on the terrain!
     
  11. antenna-tree

    antenna-tree

    Joined:
    Oct 30, 2005
    Posts:
    5,324
    Unfortunately grass and detail meshes are not affected by lights/shadows at the moment. They are affected by the lightmap though. Hopefully that will be fixed in the not too distant future.
     
  12. Majority

    Majority

    Joined:
    May 13, 2009
    Posts:
    7
    Well, i think is a "must have"

    for now, not having shadows on the grass is not a real problem for me, i can paint the shadows by hand, im working on a architecture project and the garden is a small garden with low grass, so...
    :wink:
     
  13. Haxen2000

    Haxen2000

    Joined:
    Oct 13, 2009
    Posts:
    5
    This helped me out a lot as well! One question I have, though, is how do you adjust when the shadows are drawn?
     
  14. DocSWAB

    DocSWAB

    Joined:
    Aug 28, 2006
    Posts:
    615
    Shadow rendering is taken from the quality settings if the light is set to use the quality settings.
     
  15. Haxen2000

    Haxen2000

    Joined:
    Oct 13, 2009
    Posts:
    5
    So would that explain the difference in the picture? All I did was zoom in on the scene.

    I am a beginner with Unity. Only been working with it for a couple weeks.
     

    Attached Files:

  16. DocSWAB

    DocSWAB

    Joined:
    Aug 28, 2006
    Posts:
    615
    Yes. The shadows show up at the distance set in the quality and lighting settings. You have to back the shadows into the lightmap (see wiki) for them to show up at a distance.
     
  17. jaxx0rr

    jaxx0rr

    Joined:
    Aug 25, 2013
    Posts:
    23
    the only way to get the dynamic tree shadow back once you have done a lightmap and changed your mind is to clear all lightmaps...