- Home /
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...
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!
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?
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
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.
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?
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;
}
}
Your answer
Follow this Question
Related Questions
"Tree Soft Occlusion Leaves" shader has been shafted? 0 Answers
Unity Tree transparency 1 Answer
Problem with unity tree billboarding 0 Answers
Can I animate built in TreeSoftOcclusionLeaves shader? 0 Answers