Next update is done! Not too much to show in this update. I’ve mainly been working on cleaning up code and getting things more organized, but there are a few things I’ve added that are new. I thought I would wait to update the game builds until the next update when there should be wind in the game. I was also able to get a good start on the explanation of how to create the seasonal transitions textures and materials. It’s definitely going to be quite lengthy
https://forums.unrealengine.com/core/image/gif;base64
.
First addition is that the teleporter room is inside of it’s own level now, which loads and unloads from memory. That way it’s not taking up computer resources when the player isn’t near a teleporter. It took a while to get it working because of the way the teleporters need to be linked in the code, and since the ones in the teleport room don’t always exist if they haven’t been created yet, it was causing problems for the ones in the landscape. I finally got it all working though.
The biggest visible thing though is I was able to implement moon phases for all the lighting at night, both for the actual moon light and the ambient light. So the brightness of the nighttime corresponds to how much the moon is lit now. While I was working on this, there was another really interesting thing I was able to add that I hadn’t thought of before. When I was looking up information on the brightness of the moon at different phases, I ran across this article that had a graph of how bright the moon is during each phase, but also how bright it is as it gets higher in the sky: http://home.earthlink.net/~kitathome/LunarLight/moonlight_gallery/technique/moonbright.htm
After seeing this, I realized I hadn’t implemented any kind of atmosphere to how bright the sun and moon are throughout the day or night. Then I realized that’s the real reason why the sun is a different intensity during the winter, because it doesn’t rise as high in the sky and the light has to travel through more of the atmosphere. So after implementing that, the intensity of the sunlight throughout the day is governed by how high it is in the sky and the intensity of the winter light behaves more like the real world now. The way I had been doing it before was according to the temperature, so the colder the average temperature was, the less bright the sun was. It worked pretty well in the end, but this other way is definitely much better and the brightness ended up being about what I had set it to before. I’ll also be able to add modifiers to the brightness according to things like humidity later down the road. All in all, adding those two things made all of the lighting quite nice, and you get much more of a sense of time of day. Here are a bunch of screenshots of the different intensities:
Twilight to Afternoon:
https://forums.unrealengine.com/core/image/gif;base64
https://forums.unrealengine.com/core/image/gif;base64
https://forums.unrealengine.com/core/image/gif;base64
https://forums.unrealengine.com/core/image/gif;base64
https://forums.unrealengine.com/core/image/gif;base64
https://forums.unrealengine.com/core/image/gif;base64
Intensities in Teleport Room:
https://forums.unrealengine.com/core/image/gif;base64
https://forums.unrealengine.com/core/image/gif;base64
https://forums.unrealengine.com/core/image/gif;base64
Winter:
https://forums.unrealengine.com/core/image/gif;base64
Morning to Afternoon - Fall:
https://forums.unrealengine.com/core/image/gif;base64
https://forums.unrealengine.com/core/image/gif;base64
https://forums.unrealengine.com/core/image/gif;base64
https://forums.unrealengine.com/core/image/gif;base64
https://forums.unrealengine.com/core/image/gif;base64
https://forums.unrealengine.com/core/image/gif;base64
https://forums.unrealengine.com/core/image/gif;base64
Moon Intensities:
No Moon:
https://forums.unrealengine.com/core/image/gif;base64
Half Moon:
https://forums.unrealengine.com/core/image/gif;base64
Moon at Different Heights:
Horizon:
https://forums.unrealengine.com/core/image/gif;base64
https://forums.unrealengine.com/core/image/gif;base64
https://forums.unrealengine.com/core/image/gif;base64
Moon Up Higher:
https://forums.unrealengine.com/core/image/gif;base64
Unreal related
There were a couple things on the code side of things that I thought could be helpful to someone.
The first one is about the skylight. It turned out to be a bit of a challenge trying to get one skylight to work for both the night and day because the skylight needs to be able to recapture the environment when the lighting is changing during sunrise and sunset and at night vs day, but at night, all it captures is black, so I had to have a way that at night I could increase the intensity to get a little bit of fill light, then lower the intensity as the sun was rising and the sky was becoming brighter. It also needs to have a different intensity at night that is based on both the moon phase and a separate calculation for the atmosphere based on the moon’s position instead of the sun. Here is the final result I arrived at:
https://forums.unrealengine.com/core/image/gif;base64
https://forums.unrealengine.com/core/image/gif;base64
Hopefully it’s fairly self explanatory for anyone used to working with blueprints. Basically it uses the sun’s Y rotation to figure out whether it’s day or night, then interpolates between the value needed for day and the value needed for night, during a certain transition phase. Although the result looks simple, getting to this point was quite difficult with all of the different factors that have to be accounted for and took a lot of trial and error.
The other idea is about loading streaming levels. Normally for doing things like loading a saved game, I put all the code inside of a function in the Game Mode class. Then whenever the game needs to load or save data, I just call that function, but I’m not able to do that with the streaming levels because they have a timer associated with them that can’t be used in a function. I was going to try doing it with a Macro, but they can’t be called in other Blueprints because of the way Macros work. So the idea I had was to put all the code associated with loading the level inside of the Game Mode. Then wherever the level needs to load, use a Blueprint Interface to execute the code in the Game Mode whenever the level needs to load. Here is how it looks in the Editor:
https://forums.unrealengine.com/core/image/gif;base64
https://forums.unrealengine.com/core/image/gif;base64
It really works quite well, and is almost like having a function that can be called anywhere. I realize it’s probably not the most amazing idea
https://forums.unrealengine.com/core/image/gif;base64
, but, because of having so many different places and ways that the Teleporting room needs to load, and needing to do it through Blueprints instead of streaming volumes, I had started having to duplicate code in various places, and having it this way really organized things nicely.
I think that’s everything. As I had mentioned before, I thought I would try to work on wind next. Now that I have low-growing bushes that won’t get much wind and tall trees that get a lot of wind, I’ll be able to experiment with getting the wind intensity right for both.
Thanks for looking