BVE WorldWide
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Dynamic backgrounds

Go down

Dynamic backgrounds Empty Dynamic backgrounds

Post by LXQt Fri Feb 05, 2021 6:18 pm

Code:
<?xml version="1.0" encoding="utf-8"?>
<openBVE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  //Inital image
  <Background>
        <Time>00.00</Time>
        <Mode>FadeIn</Mode>
        <Repetitions>6</Repetitions>
        <Texture>night.png</Texture>
 <TransitionTime>3200</TransitionTime>
  </Background>
  //on 05:00, start fading it to sunset image
  <Background>
        <Time>05.00</Time>
        <Mode>FadeIn</Mode>
        <Repetitions>6</Repetitions>
        <Texture>evening.png</Texture>
        <TransitionTime>3600</TransitionTime>
  </Background>
  //on 06:00, start fading it to a blue sky image
  <Background>
        <Time>06.00</Time>
        <Mode>FadeIn</Mode>
        <Repetitions>6</Repetitions>
        <Texture>day.png</Texture>
        <TransitionTime>1800</TransitionTime>
  </Background>
  //on 16:00, start fading it to sunset image
  <Background>
        <Time>16.00</Time>
        <Mode>FadeIn</Mode>
        <Repetitions>6</Repetitions>
        <Texture>evening.png</Texture>
        <TransitionTime>5400</TransitionTime>
  </Background>
  //on 17:30, start fading it to night sky
  <Background>
        <Time>17.30</Time>
        <Mode>FadeIn</Mode>
        <Repetitions>6</Repetitions>
        <Texture>night.png</Texture>
        <TransitionTime>1800</TransitionTime>
  </Background>
</openBVE>  

I am trying to utilize the new dynamic backgrounds feature.
The route starts at 17:32, and the background is night. (The image defined on the first section). Isn't it supposed to be evening?
I just can't figure out why it's doing that. If I however wait for 24 hours, it would display a sunset image. Then fade out until 18:00
My best guess is since the start time is 17:32, the 16:00 image is not loaded (since it wasn't elapsed in the first place). And the game just uses the first image(?)

I am confused whats the correct approach, and is this even meant to be used with more than 2 backgrounds?
Any help would be appreciated, thanks

LXQt

Posts : 106
Join date : 2019-02-18
Age : 16
Location : Hong Kong

https://kennyhui.pp.ua

Back to top Go down

Dynamic backgrounds Empty Re: Dynamic backgrounds

Post by leezer3 Sun Feb 07, 2021 8:19 pm

This should work with more than one, no problem.

I think the issue is most likely that you're starting in the middle of a transition, although I'll have to test properly later on in the week.

Try starting the night background at 17.35 & I think the transition will likely work as you expect.

leezer3

Posts : 1785
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

Dynamic backgrounds Empty Re: Dynamic backgrounds

Post by LXQt Mon Feb 08, 2021 4:18 am

Nope, tried 17.35 and the sky is still night (both before and after 17.35)

(Dunno why it says "The message is too long" when I posts my image)

LXQt

Posts : 106
Join date : 2019-02-18
Age : 16
Location : Hong Kong

https://kennyhui.pp.ua

Back to top Go down

Dynamic backgrounds Empty Re: Dynamic backgrounds

Post by Midnight Express Ginga81 Mon Feb 08, 2021 10:50 am

At the starting simulation, I have to change to sunset background image.
I think that the Dynamic background(also lighting), not need have't write all day.
I want to change background quickly, so, I wrote TransitionTime to 1.
after transitiontime set to 1800, I changed night background perfectly.
This route starts 17:52, and change to the night background time is as about 18:20.
I think that the 'Time' is change start time.
And by the TransitionTime  minutes,  background is transformation smoothly.
Before the start time, we have to set default background by Transitiontime is 1.
I solved the problem in this way.
Code:
<?xml version="1.0" encoding="utf-8"?>
<openBVE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 
<Background>
 <Time>17.30</Time>
 <Mode>FadeIn</Mode>
 <Repetitions>6</Repetitions>
 <Texture>./sky3-sunset.png</Texture>
 <TransitionTime>1</TransitionTime>
</Background>
<Background>
 <Time>17.50</Time>
 <Mode>FadeIn</Mode>
 <Repetitions>6</Repetitions>
 <Texture>./sky3-night.png</Texture>
 <TransitionTime>1800</TransitionTime>
</Background>
</openBVE>

Midnight Express Ginga81

Posts : 66
Join date : 2016-09-25

Back to top Go down

Dynamic backgrounds Empty Re: Dynamic backgrounds

Post by LXQt Mon Feb 08, 2021 11:24 am

So I changed the first background (00.00) to 23.59 and it solves the problem, never thought it's that simple
The updated code is as follows:
Code:
<?xml version="1.0" encoding="utf-8"?>
<openBVE xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Background>
        <Time>23.59</Time>
        <Mode>FadeIn</Mode>
        <Repetitions>6</Repetitions>
        <Texture>night.png</Texture>
 <TransitionTime>1800</TransitionTime>
  </Background>
  <Background>
        <Time>05.00</Time>
        <Mode>FadeIn</Mode>
        <Repetitions>6</Repetitions>
        <Texture>evening.png</Texture>
        <TransitionTime>3600</TransitionTime>
  </Background>
  <Background>
        <Time>06.00</Time>
        <Mode>FadeIn</Mode>
        <Repetitions>6</Repetitions>
        <Texture>day.png</Texture>
        <TransitionTime>1800</TransitionTime>
  </Background>
  <Background>
        <Time>16.00</Time>
        <Mode>FadeIn</Mode>
        <Repetitions>6</Repetitions>
        <Texture>evening.png</Texture>
        <TransitionTime>5400</TransitionTime>
  </Background>
  <Background>
        <Time>17.32</Time>
        <Mode>FadeIn</Mode>
        <Repetitions>6</Repetitions>
        <Texture>night.png</Texture>
        <TransitionTime>1800</TransitionTime>
  </Background>
  <Background>
        <Time>18.00</Time>
        <Mode>FadeIn</Mode>
        <Repetitions>6</Repetitions>
        <Texture>night.png</Texture>
 <TransitionTime>7400</TransitionTime>
  </Background>
</openBVE>

Though I noticed that there's no transition at all between 05.00 and 06.00, can someone successfully reproduce it?

LXQt

Posts : 106
Join date : 2019-02-18
Age : 16
Location : Hong Kong

https://kennyhui.pp.ua

Back to top Go down

Dynamic backgrounds Empty Re: Dynamic backgrounds

Post by Midnight Express Ginga81 Mon Feb 08, 2021 11:41 am

3600sec=60minute.
So I think 5:00 to 6:00 is overlapping.
I think if you change 3600 to for examle 3000, I think perhaps it change.

Midnight Express Ginga81

Posts : 66
Join date : 2016-09-25

LXQt likes this post

Back to top Go down

Dynamic backgrounds Empty Re: Dynamic backgrounds

Post by LXQt Mon Feb 08, 2021 11:49 am

Midnight Express Ginga81 wrote:3600sec=60minute.
So I think 5:00 to 6:00 is overlapping.
I think if you change 3600 to for examle 3000, I think perhaps it change.

Opps sorry, logic error there. It's all fine now Very Happy

LXQt

Posts : 106
Join date : 2019-02-18
Age : 16
Location : Hong Kong

https://kennyhui.pp.ua

Gothpaladinus and Midnight Express Ginga81 like this post

Back to top Go down

Dynamic backgrounds Empty Re: Dynamic backgrounds

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum