Announcement

Collapse
No announcement yet.

[TUTORIAL] Quick Time-of-Day Setup

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #61
    Never mind i just found the issue the color curves default values were set to none. This is why its always good to pay attention to the log errors....lol

    Comment


      #62
      Just downloaded the updated BP wow its so clean in there now!
      12 CatBlack Studios - One man with a dream, to create amazing things...
      RPG Engine Toolkit: https://www.unrealengine.com/marketp...engine-toolkit
      Auto Terrain Cover V3: https://forums.unrealengine.com/show...ver-V3-Release
      Youtube: https://www.youtube.com/channel/UCuT...VDuzeIeJ6_j1pA
      Facebook: https://www.facebook.com/pages/12-Ca...52913014823124

      Comment


        #63
        @Keeperofstars, I didn't add a moon because you're only allowed to have one directional lamp per scene, so it's tricky. You'd have to use the same lamp for both sun and moon.

        @Shoiko, well, I was inspired by the screenshots you posted earlier of your version And I also wanted it to be easily readable if I was going to publish it.
        Fully dynamic Time of Day System blueprint: https://forums.unrealengine.com/show...e-of-Day-Setup Download it for free now!

        Comment


          #64
          are you just allowed one, or only one affecting the lighting? Would you be able to have two and toggle which one had effect? I could see the challenge with dusk and dawn though, but if you just have the moon appear and dis-appear a bit off of the dusk /dawn time frame, could work decently. Or would it be possible to have a heaving night light value, even if semi static in position or allow player to set the angle, that provided light at night, as to prevent it from full day to pitch black? Wouldn't need to exactly be moving dynamically but could provide a bit of lighting. But I'll have to go back and read the light section documents again. I thought it was just 1 directional light affecting. Granted since you have the light tied to the sky that makes things a bit tricker would need to figure a way to swap them run time without it looking glitchy. Can see where it's not at all an easy task though.

          Comment


            #65
            @Keepers
            Theres plenty that you can do, currently I have a static skylight that is set to 0.1 to add minor ambiance and it seems to work at night too. Theres many different ways to get this working.

            @greg
            I see the time is going in reverse, I havnt tried to fix it yet but I'll post it here if you havnt already fixed it.
            12 CatBlack Studios - One man with a dream, to create amazing things...
            RPG Engine Toolkit: https://www.unrealengine.com/marketp...engine-toolkit
            Auto Terrain Cover V3: https://forums.unrealengine.com/show...ver-V3-Release
            Youtube: https://www.youtube.com/channel/UCuT...VDuzeIeJ6_j1pA
            Facebook: https://www.facebook.com/pages/12-Ca...52913014823124

            Comment


              #66
              Great work so far guys! Perfect tutorial Tesla. I was stuck trying to figure out the time-of-day and this worked with exceptional ease.

              Also, very happy to see the community working together with this tutorial!

              Comment


                #67
                Originally posted by Shoiko View Post
                I see the time is going in reverse, I havnt tried to fix it yet but I'll post it here if you havnt already fixed it.
                Yup, 4.2 seems to have broken it. The rotator mathematics are messed up, I'll fix it and post the updated version when I get the chance. Thanks for catching the issue!

                Also, does anybody have any input on the stuck-at-noon problem? Because it does still happen when you set the day-cycle time high (~100), and I'm stumped.
                Fully dynamic Time of Day System blueprint: https://forums.unrealengine.com/show...e-of-Day-Setup Download it for free now!

                Comment


                  #68
                  Originally posted by gregdumb View Post
                  Also, does anybody have any input on the stuck-at-noon problem? Because it does still happen when you set the day-cycle time high (~100), and I'm stumped.
                  I'm pretty sure you're experiencing gimbal lock by adding rotation to the directional light. I can take a closer look Thursday if not sooner. Fantastic BP BTW. I had created a similar one driven by a Timeline, but I really like the way you have incorporated color curves.

                  Comment


                    #69
                    Alrighty, I've found a solution! (ty to lbraud for the idea )

                    In the skydome BP construction script, find the commented section that says "Set sun's pitch based on "Default Hour"" (it will be near the left side). Then go the "Make Rot" node in that section. Set the "Roll" input value for the node to equal 1 (by default it will be zero).

                    This should eliminate it getting stuck. I don't know if this is the right way to fix gimbal lock, or if there's a better method, but it works (If somebody does know a better method, please tell me!)
                    Fully dynamic Time of Day System blueprint: https://forums.unrealengine.com/show...e-of-Day-Setup Download it for free now!

                    Comment


                      #70
                      I've added a second direction light for a moon and just added the sun and moon to the original BP component. I need to also add a skylight to make even normal looking lighting as well. I'm going to add some dynamic atmosphere effects when i get on as well. heres a SS of night:


                      Click image for larger version

Name:	1_Moon.jpg
Views:	1
Size:	327.9 KB
ID:	1052078
                      12 CatBlack Studios - One man with a dream, to create amazing things...
                      RPG Engine Toolkit: https://www.unrealengine.com/marketp...engine-toolkit
                      Auto Terrain Cover V3: https://forums.unrealengine.com/show...ver-V3-Release
                      Youtube: https://www.youtube.com/channel/UCuT...VDuzeIeJ6_j1pA
                      Facebook: https://www.facebook.com/pages/12-Ca...52913014823124

                      Comment


                        #71
                        Also the time issue is that our pitch goes from up and down in undesired rotations for what you want. I'm going to change it to calculate the total rotation of the sun based on a 360 movement. What you are getting now is something like a rotation of -90 to +90 and after noon +90 to -90 which breaks the time calcs it seems.
                        12 CatBlack Studios - One man with a dream, to create amazing things...
                        RPG Engine Toolkit: https://www.unrealengine.com/marketp...engine-toolkit
                        Auto Terrain Cover V3: https://forums.unrealengine.com/show...ver-V3-Release
                        Youtube: https://www.youtube.com/channel/UCuT...VDuzeIeJ6_j1pA
                        Facebook: https://www.facebook.com/pages/12-Ca...52913014823124

                        Comment


                          #72
                          Okay, I've fixed it! I've actually overhauled the whole way time and rotation was calculated. Time is done first, then the sun's rotation is changed after that. I've also condensed everything into multiple functions, to improve readability. Check it out for yourselves!

                          Get the new version here: http://gregoryjb.blogspot.com/2014/0...day-setup.html

                          I've made a blog to make it easier to update. Also, I'm hosting the file on google drive, so the DL is a bit wonky (you have to go file-download after you click the link). I don't want a ton of ads and stuff though, so it's the best I could find

                          EDIT: Just wanted to note that by default, the time moves very slowly. Increase "Time Speed" to something like 1000 to fix this

                          EDIT2: @Shoiko, wait you are right, two sunlamps are possible! This is awesome news to me, I guess my earlier tests were mistaken.
                          Last edited by gregdumb; 06-20-2014, 01:33 AM.
                          Fully dynamic Time of Day System blueprint: https://forums.unrealengine.com/show...e-of-Day-Setup Download it for free now!

                          Comment


                            #73
                            I really like how you've broken the blueprint up into different functions. This makes it much easier for me to follow.

                            I have some suggestions for the public variables that show up in the editor:

                            * Day Cycle Time can be removed.

                            * I would move "Use24HrDay" and "Display World Time" to a new "Debug" category in order to clean up the "Time of Day" category.

                            * I think the scale of "Time Speed" is too small. Would a level designer really want to set the length of day down to the minute? The Number of real minutes in one game day would give you a scale of 1 to 1440. Currently the scale is 1 to 86,400 (assuming real-time is the maximum).

                            * You could get rid of "Use Day/Night" check box. If the level designer wasn't going to use the day/night cycle, then they wouldn't use the blueprint. Perhaps this is for testing. If that's the case, then it too could be put in the debug section.

                            Again these are just suggestions, do what you will!

                            I'm still puzzled about the sun getting stuck in the sky. I was about to make a test when I decided to check this thread first. I'm glad you were able to fix it. One question I have is why do the other two axes flip 180 degrees when you add more than 90 degrees to the third axis? You can do this in a blank project with any Actor. To test, if you set DirectionalLight's rotation to (0,0,0) in the Transform section of the editor, then drag Y to 80, both X and Z stay the same. If you instead drag it to 95, X and Z flip to 180 and Y becomes 85. Why does this happen? Wouldn't this throw off any "math" you were trying to perform in a blueprint? I think this is intended behavior of adding rotation, but I don't understand why.

                            I'm loving the blueprint and the community involvement. How can I help you to improve it?

                            Comment


                              #74
                              Originally posted by lbraud View Post
                              * Day Cycle Time can be removed.
                              Yep, I had a "D'oh!" moment after realizing I had left it in there when I uploaded it. I'll fix it for the next release (hopefully not toooo far away )

                              Originally posted by lbraud View Post
                              * I think the scale of "Time Speed" is too small. Would a level designer really want to set the length of day down to the minute? The Number of real minutes in one game day would give you a scale of 1 to 1440. Currently the scale is 1 to 86,400 (assuming real-time is the maximum).
                              I'm not 100 percent sure what you mean here. This is basically a ratio of gametime:realworldtime. For instance, setting it to 1 will give you 24hr days. Setting it to 4 will make 4 game minutes pass in 1 real world minute, so you'd have 6 hr days. If this isn't very clear then maybe I should change it back to the old way

                              Originally posted by lbraud View Post
                              * You could get rid of "Use Day/Night" check box. If the level designer wasn't going to use the day/night cycle, then they wouldn't use the blueprint. Perhaps this is for testing. If that's the case, then it too could be put in the debug section.
                              I do actually agree with this, as well as the other suggestions about the debug section. Cleaner is always better!

                              Originally posted by lbraud View Post
                              I'm still puzzled about the sun getting stuck in the sky. I was about to make a test when I decided to check this thread first. I'm glad you were able to fix it. One question I have is why do the other two axes flip 180 degrees when you add more than 90 degrees to the third axis? You can do this in a blank project with any Actor. To test, if you set DirectionalLight's rotation to (0,0,0) in the Transform section of the editor, then drag Y to 80, both X and Z stay the same. If you instead drag it to 95, X and Z flip to 180 and Y becomes 85. Why does this happen? Wouldn't this throw off any "math" you were trying to perform in a blueprint? I think this is intended behavior of adding rotation, but I don't understand why.
                              This is some weird engine-defined behavior. I've noticed it too, it's annoying. Also the fact that sometimes it will change 0 to something like 0.000000017 for no apparent reason. I would think it's to avoid gimbal lock, but it obviously still happens xD

                              Maybe related to this: I believe that UE4 uses +180 and -180, not full 360 rotation. I think I heard that in one of their tutorials (can't remember which one unfortunately). I also saw it when I was logging the rotation of my sun a while back. If there are any Epic devs here, comments on all this rotation stuff are welcome!

                              Anyway, I've changed my BP to clear and set the rotation every frame, instead of adding it. Seems to work much better, much less glitchy.

                              Originally posted by lbraud View Post
                              I'm loving the blueprint and the community involvement. How can I help you to improve it?
                              Well, your suggestions and comments are helping a lot! It's always awesome to get feedback from a mind other than your own. Amazing how many things one misses

                              Also, how do you guys think I should do the moon? Should it move at all, should it do a full circle or just move a bit...? (Thanks to Shoiko btw for showing me that moons are a possibility!)
                              Fully dynamic Time of Day System blueprint: https://forums.unrealengine.com/show...e-of-Day-Setup Download it for free now!

                              Comment


                                #75
                                i have it moving im caught up in moving so i haven't done much but one thing i had to do was during the day slow the rotation of the moon and speed up the rotation at night this is to insure the moon rotates out of view before the sun takes the moon sun target. other wise the mood would appear to blink away. Also added a skylight to help with night and day ambient light.

                                I also updated the constructor and added functions to make the script smaller. I don't have you last changes yet but here's what i got its not much:

                                https://mega.co.nz/#!IoBXCDSR!Nh3w2i...2956KIH8m1qko8
                                12 CatBlack Studios - One man with a dream, to create amazing things...
                                RPG Engine Toolkit: https://www.unrealengine.com/marketp...engine-toolkit
                                Auto Terrain Cover V3: https://forums.unrealengine.com/show...ver-V3-Release
                                Youtube: https://www.youtube.com/channel/UCuT...VDuzeIeJ6_j1pA
                                Facebook: https://www.facebook.com/pages/12-Ca...52913014823124

                                Comment

                                Working...
                                X