Answer the question
In order to leave comments, you need to log in
Change of day and night when baking? Blending Lightmap?
Hello comrades.
There is a big city with a huge stake. objects.
You need to make a cycle for and night, you don’t need a lot of mind to make it with real lighting there. But maybe someone did it through Lightmap?
That is, we bake the day time, bake the night time (with the lights on from the windows, etc.) and then switch.
How to do it better? Or just a rough change of Lightmap (as a result of a sharp change of day to night), but is it possible to mix it up?
Answer the question
In order to leave comments, you need to log in
Try this code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Control_Sky : MonoBehaviour {
public Material[] materials;
public float[] times;
public Color color;
public Color color2;
public Light light;
IEnumerator sky (){
yield return new WaitForSeconds(times[0]);
RenderSettings.skybox = materials[1];
light.color = color;
yield return new WaitForSeconds(times[1]);
RenderSettings.skybox = materials[2];
light.color = color;
yield return new WaitForSeconds(times[2]);
RenderSettings.skybox = materials[3];
light.color = color;
yield return new WaitForSeconds(times[3]);
RenderSettings.skybox = materials[4];
light.color = color2;
yield return new WaitForSeconds(times[4]);
RenderSettings.skybox = materials[5];
light.color = color2;
yield return new WaitForSeconds(times[5]);
RenderSettings.skybox = materials[6];
light.color = color2;
yield return new WaitForSeconds(times[6]);
RenderSettings.skybox = materials[0];
light.color = color;
}
void Start()
{
RenderSettings.skybox = materials[0];
light.color = color;
}
void Update()
{
StartCoroutine(sky());
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question