x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Day / Night Cycle with state

Hello,

I have checked lots of forum and hub questions related to this question (lots of topics around there) yet couldn't find the tip I am looking for. Anyway, I was experimenting different conditions with the blueprint system. Since I am pretty new in Unreal Engine, I have a few questions related my day / night cycle attemt. First of all, I will be trying to push my limits forward by making my scene as realistic as I can. Therefore it will use a lot of GPU, so I will try to decrease the CPU / GPU usage to prevent more hassle.

Here is my question: I am trying to create 2 states: Day and Night. With a key input, it will switch the state. Imagine sandbox games where day/night cycles effect the whole city lights. Hopefully, I have only one flat

In day state:

  • Sun will be on top

  • Fill lights will be on

  • Night lights will be off

In night state:

  • Sun will be on bottom

  • Fill lights will be off (might be on with changed values, not sure yet)

  • Night lights will be on

I have already created the cycle with a timeline to demonstrate the flow and attached one of my light BP's to make them on and off. It is working flawless, yet considering I have other light sources needs to be BP and codes within them, it sounds like I am computing unnecessary things.

I have something in my mind to simplify that logic above, but not sure if it will work. Is there a way to create such states within a variable so I can simply get Sun position to determine if different light bp's are all on or off? I have doodled the states into nodes with pen, and logically it makes sense yet I have no idea how to achieve those with real unreal nodes.

I imagined Day and Night states predefined seperately in BP's and cast to Level BP where the sun state calculated to set a state into 1 and the other 0 (or switch, haven't used it tough) If this makes sense, am I supposed to get all scene lights into those state BP's to set all values 1 or 0? If so, how is it possible to cast 1 from Level BP to those states to activate different light sources?

Sorry if I made it more confusing with my ideas :) Thanks so much for your help!

Product Version: Not Selected
Tags:
more ▼

asked Mar 21 '15 at 11:03 AM in Blueprint Scripting

avatar image

Excalith
8 7 9 10

avatar image Excalith Mar 21 '15 at 11:36 AM

Okay, just before I post this question someone posted an answer to a different post that covers most of my questions with using tags to switch different lights. I will try to implement the logic into my blueprint which uses sun rotation to activate those lights instead of using trigger based key input. I promise if I can manage to find a solution, I will post the blueprint here!

The other post helped me to get started with a different logic is here: - Post: https://answers.unrealengine.com/questions/196634/need-help-and-ideas-for-my-lightswitch-and-lamp-sy.html - Tutorial: https://www.youtube.com/watch?v=HXVeu2-vmaw

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Finally I managed to solve the Day/Night Cycle BP! Now it is working flawless. As I promised above, here is the BP I used. I am sure there are better ways to make it more performance efficient, yet that's all I could do for now. Hope this helps!

To sum it up First of all, I tagged every light as night or day in order to group them in blueprint to prevent toggling them one by one.

On Event Begin Play;

  1. I repositioned the sun location (couldn't do it on editor)

  2. Get all Light classes and picked only Light_Day tags I did before and added them to Light Group Day

  3. Get all Light classes and picked only Light_Night tags I did before and added them to Light Group Night

On Key Input

  1. I used branch to decide if the sun is on top or not

  2. If true, timeline animation makes it night by going through 270 to 90 and after 1.5 secs delay (before it gets dark completely) visibility of lights in those groups are changed.

  3. I false, timeline animation makes it day by going through 90 to 270 and after 1.5 secs delay (before it gets light completely) visibility of lights in those groups are changed.

Here is the Level BP I made Cycle BP

cyclebp.jpg (703.2 kB)
more ▼

answered Mar 21 '15 at 03:17 PM

avatar image

Excalith
8 7 9 10

avatar image samdax Sep 08 '17 at 05:44 PM

HI! can you please upload the image bigger? it's hard to see ^_^

nice work!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

HI! can you please upload the image bigger? it's hard to see ^_^

nice work!

more ▼

answered Sep 08 '17 at 05:44 PM

avatar image

samdax
1 1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question