wiki.sine.space | sinespace

Difference between revisions of "Day/night cycles"

From wiki.sine.space
Jump to: navigation, search
(Environmental Cubemaps)
 
(19 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]
  
 
+
This wiki entry describes how to set up day and night on your Sinespace region using the Day Night Cycle Script component.
 
+
'''Level:'''
+
* Beginner Unity/Space
+
 
+
'''Goals:'''
+
* Implement Day/Night cycle on a region
+
----
+
This wiki entry describes how to set up day and night on your space region using the Day Night Cycle Script component.
+
  
 
First you will need a directional light to which to attach the script component.  A directional light was included when you created a new scene.  If one isn't in the hierarchy panel (maybe you deleted it), you'll need to add one.  Go to the menus at the top of the editor window and click Game Object - Light - Directional Light.  
 
First you will need a directional light to which to attach the script component.  A directional light was included when you created a new scene.  If one isn't in the hierarchy panel (maybe you deleted it), you'll need to add one.  Go to the menus at the top of the editor window and click Game Object - Light - Directional Light.  
Line 16: Line 8:
  
 
----
 
----
{| border="0"
+
{| border="1"
 
! [[File:Adddaynightscript.png]]
 
! [[File:Adddaynightscript.png]]
 
|-
 
|-
Line 25: Line 17:
 
|}
 
|}
 
----
 
----
 +
 +
===Component Settings===
 +
 +
====Preview====
 +
Preview is where you can toggle on and off 'Preview Enabled' to be able to see the lighting for different times of day in your Unity scene. You can drag the Preview Time of Day along to see what different times of day look like. The slider is set to 0 to begin with, this is midnight. 0.5 is midday. You should disable the preview before uploading the region.
 +
 +
====Clock Set-up====
 
By default, the light will be particularly harsh, the cycle will be set to 1440 minutes (a full 24 hr day), and start from mid night. You can modify the duration as you wish. Toggle the "Use local System Clock" on will use your local timestamp instead of using server time.
 
By default, the light will be particularly harsh, the cycle will be set to 1440 minutes (a full 24 hr day), and start from mid night. You can modify the duration as you wish. Toggle the "Use local System Clock" on will use your local timestamp instead of using server time.
  
If you pick "Use Fixed", the time will be locked, you can set the time you want fix by modify the slider bar of "Fixed Time of Day", the value is from 0 to 1, corresponding the color bar of sun.
+
If you pick "Use Fixed", the time will be locked, you can set the time you want fixed by modify the slider bar of "Fixed Time of Day", the value is from 0 to 1, corresponding the color bar of sun.
  
Next drag the "Sun light" object into the Sun Light slot, if you create the region by using quick start, then it's the object called "Sun" controls the sun light.  
+
====Sun Light====
 +
Next drag the "Sun light" object into the Sun Light slot. If you create the region by using quick start, then it's the object called "Directional Light" that controls the sun light. You can find the Quick-start region by going to Assets>Sample Art>Quickstart in the Project window.  
  
Toggling the 'Use local System Clock' and 'Shader send time of day' together will align your day/night cycle with your real-world local time. I'm uncertain how that will play out if your day length is other than 24 hrs. Finally, if you want to see the sun in the sky, slot the 'Sun' light source type in the 'Flare' slot.
 
  
Selecting some type of shadows and adjusting them will produce that effect.
+
{| border="1"
 +
! [[File:Quickstartregion.png|700px]]
 +
|-
 +
!
 +
|-
 +
! ''Fig. 2: How to find quickstart''
 +
|-
 +
|}
  
You can add events like playing music. The events trigger is set to Dawn, Midday, Dusk, and Midnight.
 
  
If you have water-like things in your scene, you can attach its material to the water material slot, which can make the light affect to the water too.
 
  
There are additional qualities that one can employ to various ends; I'll leave it to the reader to explore and deploy these according to their needs. This should be a great start however, adding 'outdoor' environmental lighting to your scene.
+
{| border="1"
----
+
! [[File:Directionallight2.png]]
{| border="0"
+
! [[File:Lightdetaildaynight.png]]
+
 
|-
 
|-
 
!  
 
!  
 
|-
 
|-
! ''Fig. 2: Directional light details''
+
! ''Fig. 3: Directional Light Settings''
 
|-
 
|-
 
|}
 
|}
----
+
 
A huge thanks and a shout out to Adam Frisby and the Sinewave team for implementing this feature, and to Adam Frisby for walking me through this such that I could get it done right (and make a wiki entry about it ;)
+
 
{{UI}}
+
If white light is too harsh for you, you can change the color of this by changing the 'Sun Light' color on the Day /Night cycle component,  not on the directional light.
{{Video}}
+
 
 +
You will need to change the 'Flare' setting on the Directional Light so that the flare is set to Sun. You can do this by clicking on the circle next to the Flare box, and choose Sun.
 +
 
 +
====Environmental Cubemaps====
 +
This is to update the reflection probes in the region. The 'Update Cubemap Frequency' number is in seconds, so if you want to update the cubemap frequency every 30 seconds, leave it as it is. This basically changes the amount of light reflection on objects in the region, e.g. at night time you don't want reflective surfaces to reflect too much light.
 +
 
 +
====Sun Light====
 +
This is where you drag in the directional light for the 'Sun'. You can set the color of the sunlight here, and also set the Sun Offset Rotation and Sun Rotation Axis. The Sun Offset Rotation and Sun Rotation Axis control the value of the movement of the sun during the day time. If you don't need a custom trail of movement for the sun, just leave it as default.
 +
 
 +
====Sun Shafts====
 +
The Sun Shafts image effect simulates the radial light scattering (also known as the “god ray” effect) that arises when a very bright light source is partly obscured.
 +
Here you can change the colors of the sun shafts. You can check the 'Update Sun Shafts' to keep the sun shafts updated when objects are placed in the region.
 +
 
 +
====Ambient Light====
 +
This will change the ambient light in the region. You can change the sky color, Equator color (This is the horizon area) and the ground color.
 +
 
 +
====Fog====
 +
You can change the colors for fog here and change the fog minimum curve and maximum curve. The fog curves set the minimum distance and maximum distance of fog which in turn changes the amount of fog at certain times of day. You can click on the fog bar to change the curve between the values of 0 and 1.
 +
 
 +
====Water Set-up====
 +
If you have water-like things in your scene, you can attach its material to the water material slot, which can make the light affect to the water too.  You can change the colors for the water here if you wish.
 +
 
 +
====Events====
 +
You can add events like playing musics, animations. The events trigger is set to Dawn, Midday, Dusk, and Midnight. You can set this up to notify specific animators as well.
 +
 
 +
====Shader Parameters====
 +
Toggling the 'Use local System Clock' and 'Shader send time of day' together will align your day/night cycle with your real-world local time.
 +
The Shader Send Color option will send the colors under the shader bar to the Lighting, meaning the lighting will change to these colors at certain times of day.
 +
 
 +
 
 
{{Creation Navbox}}
 
{{Creation Navbox}}
{{Tutorials Navbox}}
+
{{Component Navbox}}

Latest revision as of 11:05, 16 January 2019


This wiki entry describes how to set up day and night on your Sinespace region using the Day Night Cycle Script component.

First you will need a directional light to which to attach the script component. A directional light was included when you created a new scene. If one isn't in the hierarchy panel (maybe you deleted it), you'll need to add one. Go to the menus at the top of the editor window and click Game Object - Light - Directional Light.

You'll need to add the Day Night Circle component (script) to your directional light. You can create a new empty object to attach with this component.


Adddaynightscript.png
Fig. 1: Adding the Day Night Script component to the directional light

Component Settings

Preview

Preview is where you can toggle on and off 'Preview Enabled' to be able to see the lighting for different times of day in your Unity scene. You can drag the Preview Time of Day along to see what different times of day look like. The slider is set to 0 to begin with, this is midnight. 0.5 is midday. You should disable the preview before uploading the region.

Clock Set-up

By default, the light will be particularly harsh, the cycle will be set to 1440 minutes (a full 24 hr day), and start from mid night. You can modify the duration as you wish. Toggle the "Use local System Clock" on will use your local timestamp instead of using server time.

If you pick "Use Fixed", the time will be locked, you can set the time you want fixed by modify the slider bar of "Fixed Time of Day", the value is from 0 to 1, corresponding the color bar of sun.

Sun Light

Next drag the "Sun light" object into the Sun Light slot. If you create the region by using quick start, then it's the object called "Directional Light" that controls the sun light. You can find the Quick-start region by going to Assets>Sample Art>Quickstart in the Project window.


Quickstartregion.png
Fig. 2: How to find quickstart


Directionallight2.png
Fig. 3: Directional Light Settings


If white light is too harsh for you, you can change the color of this by changing the 'Sun Light' color on the Day /Night cycle component, not on the directional light.

You will need to change the 'Flare' setting on the Directional Light so that the flare is set to Sun. You can do this by clicking on the circle next to the Flare box, and choose Sun.

Environmental Cubemaps

This is to update the reflection probes in the region. The 'Update Cubemap Frequency' number is in seconds, so if you want to update the cubemap frequency every 30 seconds, leave it as it is. This basically changes the amount of light reflection on objects in the region, e.g. at night time you don't want reflective surfaces to reflect too much light.

Sun Light

This is where you drag in the directional light for the 'Sun'. You can set the color of the sunlight here, and also set the Sun Offset Rotation and Sun Rotation Axis. The Sun Offset Rotation and Sun Rotation Axis control the value of the movement of the sun during the day time. If you don't need a custom trail of movement for the sun, just leave it as default.

Sun Shafts

The Sun Shafts image effect simulates the radial light scattering (also known as the “god ray” effect) that arises when a very bright light source is partly obscured. Here you can change the colors of the sun shafts. You can check the 'Update Sun Shafts' to keep the sun shafts updated when objects are placed in the region.

Ambient Light

This will change the ambient light in the region. You can change the sky color, Equator color (This is the horizon area) and the ground color.

Fog

You can change the colors for fog here and change the fog minimum curve and maximum curve. The fog curves set the minimum distance and maximum distance of fog which in turn changes the amount of fog at certain times of day. You can click on the fog bar to change the curve between the values of 0 and 1.

Water Set-up

If you have water-like things in your scene, you can attach its material to the water material slot, which can make the light affect to the water too. You can change the colors for the water here if you wish.

Events

You can add events like playing musics, animations. The events trigger is set to Dawn, Midday, Dusk, and Midnight. You can set this up to notify specific animators as well.

Shader Parameters

Toggling the 'Use local System Clock' and 'Shader send time of day' together will align your day/night cycle with your real-world local time. The Shader Send Color option will send the colors under the shader bar to the Lighting, meaning the lighting will change to these colors at certain times of day.