• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Agggust · Jan 04, 2013 at 11:03 PM · shadertreecycleleavesday

Tree Leaves are light up at night

Hey guys I am currently using a day/night cycle script that rotates a direction light 360 degrees in a certain amount of time. But when the light is at the position when it is supposed to be dark the leaves to the trees are still light up. I believe this may be a problem with the Shader but i am not sure. I am using the indie version so if that is the reason then...

Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Hyperion · Jan 04, 2013 at 11:21 PM 0
Share

Hey, I have the same issue!

All my plants (except trees) are dark when it's dark, but the trees stay light when close, and when I get far far away, they get dark!

avatar image Agggust · Jan 04, 2013 at 11:41 PM 0
Share

With me this is happening to my plants and trees D:

avatar image Hyperion · Jan 06, 2013 at 10:36 PM 0
Share

Well, what exact plants and trees are you using?

$$anonymous$$ultiple options: 1) $$anonymous$$aybe, your tree/plant objects have use light probes checked on. 2) Try different plants, and if that doesn't work, could you please give a picture so I can see the issue visually?

avatar image Agggust · Jan 07, 2013 at 12:05 AM 0
Share

it does this with all my tee/plant objects and light probes are unchecked.

http://s1336.beta.photobucket.com/user/August_Taylor/media/Pic_zps7b6f4ae8.png.html?sort=3&o=0

link to the picture

avatar image Hyperion · Jan 07, 2013 at 01:36 AM 0
Share

In my game, I have trees that look pretty much the same, and they're pretty lit up. Are you using sycamores? In the picture, I also noticed that your character is lit up, too.

Please check my answer.

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by cgcookie · Jan 07, 2013 at 12:42 AM

This is either because: A - The leaves are unlit which is quite likely, therefore you will need to darken these according to the time of day B - The leaves are translucent, meaning the light shines through and illuminates the other side of the leaf, less likely in your case.

Solution: Use javascript to set the shared material color tint according to the time of day: http://docs.unity3d.com/Documentation/ScriptReference/Material.html

 renderer.material;// will edit just that objects material.
 renderer.sharedMaterial;// will edit all of them

Does this help answer your question?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0
Wiki

Answer by Hyperion · Jan 07, 2013 at 02:10 AM

Well, I tried deleting the directional light in my game, and it made the trees dark as well, but when I made it look away from the trees, it maintained them lit! Then, I tried the equivalent of deleting the light, which is making the intensity to 0, and the trees turned dark. So I can surmise that you need to lower the intensity of your light.

Unfortunately, the directional light (at 1.3 intensity) is so strong that it shines onto my terrain at the completely opposite angle, but if I lower the intensity it isn't strong enough (too far away). I found the answer. Changing the direction of the light doesn't help. Change the intensity through code. Just use a true/false check to change magnitude of intensity over time. I've gotten this code to darken the light, I'm working on making the light lighten again.

 var day=true;
 
 
 /* Darken the light completely over a period of seconds 


   
 function Awake()
 {
     GetComponent(AudioSource); //background music
 }
 
 function Update () {
     if (day)
     {
         Invoke("DaySwitch",5);
         light.color -= Color.white / 2.0 * Time.deltaTime;
     }
     if (day==false)
     {
         Invoke("DaySwitch",5);
         light.color+=Color.white / 2.0 * Time.deltaTime;
     }
 }
 
 function DaySwitch()
 {
     if (day){
         day=false;
     }
     if (day==false){
         day=true;
     }
 }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

"Tree Soft Occlusion Leaves" shader has been shafted? 0 Answers

Tree Creater won't render mesh leaves. 2 Answers

Unity Tree transparency 1 Answer

Problem with unity tree billboarding 0 Answers

Can I animate built in TreeSoftOcclusionLeaves shader? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges