Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 /
  • Help Room /
avatar image
0
Question by KureKureciCZ · Jan 31, 2017 at 01:07 PM · realtimedirectional lightdaynight

Real life day-night cycle

I know, it sound wierd, but i want my game to have a day-night cycle, that would be EXACTLY the same as the real one. You look out of window, its night, you look to game, its night.

I dont know if only rotating directional light is enough to get a great effect...

Thanks for help ;)

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by HenryStrattonFW · Jan 31, 2017 at 01:56 PM

You would likely do a little more than just a rotating directional light. I've never done this sort of thing before, but here's how my brain approaches it at a quick glance.

Rotating lights as you said, but ensuring the colour, intensity and direction reflect the changes of the day/night cycle, so the day light might fade in intensity towards the end of the day, whilst another light starts ramping up from the other direction this light would be a colder blue light (or other depending on your scene).

You would also likely want to consider shifting the ambient colour, or skybox would want to somehow transition from a day to night scene as well.

There are all sorts of other things you may wish to do like shifting a more night appropriate ambient sounds etc. But it really depends on what game you're making, the style, etc.

Comment
Add comment · Show 4 · 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 KureKureciCZ · Feb 03, 2017 at 01:29 PM 0
Share

Yeah, i know that. I dont need to change the skybox, because there is no skybox :D The part i need to know, is getting info about time in day... ( or even live weather ) But i dont think its possible...

avatar image HenryStrattonFW KureKureciCZ · Feb 04, 2017 at 12:48 PM 0
Share

Oh i see, my apologies I misunderstood what part of this you were looking for. Well for the weather you would need to rely on a 3rd party service. I'm sure there are various services out there that would support some sort of API for weather data, but wouldn't have a scooby about that myself.

As for the time of day, that's very possible. You can use System.DateTime.Now for this, which gives you a DateTime object based on the current time/date settings on the system your game is running on (Granted users may have set their machines to not be accurate time/date but its quite unlikely and so this is probably a perfectly acceptable thing to base it on).

avatar image KureKureciCZ HenryStrattonFW · Feb 04, 2017 at 05:13 PM 0
Share

Oh thanks a lot!!! I did some math to map the 86400 to 360 and now it works!!!! thank you!

Show more comments
avatar image
0

Answer by Lord_meow_Sambo · Jun 30, 2019 at 12:29 PM

Hi there,

Just wondering what maths/code would I write to make this all work?

My game has planets and I want to make one of them a real world time.

Thanks.

Comment
Add comment · Show 1 · 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 Lord_meow_Sambo · Jul 04, 2019 at 01:53 AM 0
Share

What code would I type for C# to make it work and is it easy yo offset the time if I have a planet that is an hour behind?

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.

Follow this Question

Answers Answers and Comments

91 People are following this question.

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

Related Questions

effective lighting for moon (for a day night cycle) 0 Answers

Is there an ETA for Mixed Lighting on directional specular GI? 0 Answers

Google Play Realtime MP - Punish player who leaves room. 0 Answers

RealTime Lighting on Heavily Moving Environment: A Trick to Make it Happen (Maybe) 0 Answers

Directional Light Problem 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