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

NEW: Inbuilt raindrops and windscreen wipers

+7
LXQt
SylvesterChevrolet
Phonteus Nevolius
Dexter
Quork
zbx1425
leezer3
11 posters

Go down

NEW: Inbuilt raindrops and windscreen wipers Empty NEW: Inbuilt raindrops and windscreen wipers

Post by leezer3 Wed Nov 11, 2020 5:02 pm

http://vps.bvecornwall.co.uk/OpenBVE/Experimental/Raindrops.zip



The next version of OpenBVE will introduce a common (and rather overdue I think....) feature:
Inbuilt raindrops and windscreen wipers.

Whilst this has been possible since BVE4 with plugins, it's one of the more common features which should really have been included in the main program Smile
This is now available in the experimental build linked above, and will make it's way into the main builds in a few days or so hopefully.


Panel2.cfg


New section:
[Windscreen]
This supports the following arguments:

  • TopLeft : The top left co-ordinate of the drop area
  • BottomRight : The bottom right co-ordinate of the drop area
  • Layer : The panel layer on which the drops appear
  • NumberOfDrops : The total number of drops (positions are randomly generated each game launch)
  • DropSize : The size of a drop in pixels
  • RestPosition : The rest position (Left, right or -1 or 1)
  • HoldPosition : The hold position (Left, right or -1 or 1)
  • WipeSpeed : The speed in seconds for one pass (left to right) of the wiper.
  • DaytimeDrops : A comma-separated list of files to use for the daytime drop images. (If not specified, built-in will be used)
  • NighttimeDrops : A comma-separated list of files to use for the nighttime drop images. (If not specified, built-in will be used)
  • HoldTime : The time in seconds the wiper pauses when using intermittant wiping.
  • DropLife : The median life of a drop on the windscreen. Defaults to 10s

New global panel2 variables:

  • WiperPosition : The current position of the windscreen wiper, from 0 to 100.


Sound.cfg


New section:
[Windscreen]
This supports the following arguments:

  • RainDrop : The sound played when a drop hits the windscreen
  • WetWipe : The sound played when 20% or more of the total drops are visible
  • DryWipe : The sound played when 20% or less of the total drops are visible
  • Switch : The sound played when the wiper switch is pressed


Routefiles


New command:
.Rain Intensity Intensity should be a number from 0 to 100 representing the current rain intensity.

Backwards and Forwards Compatability


Trains using the new windscreen are compatible with routefiles using the old beacon based rain.
The .Rain command and beacon based rain *cannot* be mixed in one file.
At present, legacy trains do not recognise the .Rain command.


Last edited by leezer3 on Fri Nov 13, 2020 3:30 pm; edited 1 time in total

leezer3

Posts : 1961
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Gothpaladinus likes this post

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by zbx1425 Thu Nov 12, 2020 1:51 pm

Maybe a command to set an ambient loop sound for a route will be helpful.
For example Track.AmbientLoop Index; Path, to play a rain ambient noise on a specific section of a route. (Index or sth else to stop or change the SE at other point in a route, such as in a tunnel) There is currently not a way to do that, since doppler/announce does not fit this scenario, and run/flange noise are only played when the train is moving.
It can also be done via an ATS plugin, but I suppose it should not be train-specific.

The downside of this proposal is that I cannot think of another usage scenario other than rain.

BTW It would be fantastic if it can be utilized in ANIMATED 3dcabs.
zbx1425
zbx1425

Posts : 143
Join date : 2017-08-18
Location : China

https://www.zbx1425.cn

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by Quork Thu Nov 12, 2020 2:11 pm

What'd be important from my perspective, I don't see it in the video yet and it hasn't been done in any of the plugin based solutions I'm aware of: Let the wiper wipe only where it actually is. A big portion of the window is wet but not wiped, meaning the drops stay. Some ideas:
- drops move on the window. Depending on the speed (thus air flow) they move downward or upward. I don't think this needs to be a physically complex simulation, a very simplified model would suffice for the effect. Just add two variables: One is how many pixels a drop flows downward at standstill in a second (DropSpeed), the other one the threshold speed, at which drops stay still (meaning the upwards wind force and the weight are the same) (ThresholdSpeed). In this case the drop's y changes by delta(y) = DropSpeed * (ThresholdSpeed - speed) / ThresholdSpeed * delta(t)/1sec. This doesn't fully reflect reality (on curved windscreens like on high speed trains the drops tend to have curved paths; e.g. at certain speeds the ICE 3 even has sort of a vortex with drops flowing downward at the bottom of the window while going upard at most of the window), but it gets close enough for the atmosphere while coming at a rather low calculation cost.
- when the rain is strong enough, you don't have individual drops anymore in the unwiped portions of the window but a water film. This would be complex to model correctly, because you get all sorts of funny distortions, like through very uneven glass. But maybe it would be possible to have a slightly uneven alpha texture fading slowly in (and after the rain out again)?
- could we have a time-to-live for the drops as well? After all it does change a lot with climate, weather, material etc. how quick drops dry away. I'm thinking along the lines of it staying unchanged for 70% of the time and then scaling linearily down to 0 and fading into oblivion in the last 5% (so it doesn't become a black pixel at the end).
Quork
Quork

Posts : 1438
Join date : 2012-05-05
Age : 32
Location : Hofheim a.T., Hessen (Hesse), European Union

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by Dexter Thu Nov 12, 2020 7:37 pm

I can see this as an improvement, and a good one as well.
There is one question that comes to my mind, though... who is going to use it? We are getting new features to the sim, yet the building process (building a route) is still very unsophisticated and time-consuming. I suggest we also need to look at this process, otherwise people will turn away when they see it takes months or even years to build something decent...
Now don't get me wrong, I appreciate the hard work that is being put inti the sim. I would just like to see more people being able to use these additions.
Dexter
Dexter

Posts : 2153
Join date : 2011-07-08
Age : 38
Location : Brno, Czech republic

http://www.brnobve.eu

Quork and Gothpaladinus like this post

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by leezer3 Fri Nov 13, 2020 3:29 pm

Drop life was actually quite a decent idea-
I've implemented this (although not updated the video or build at the minute)

With regards to more people:
I know, but not a lot we can do Sad

Unfortunately, new content creation is always going to be a problem.
By far and away the largest and most complex part will always be 3D modelling, whether that's train exteriors or route structures.
There's really not a lot we can do to improve this, it's one of those things that you can either do or not at the end of the day.

On the flip side, adding both large (track followers, AI trains) and small convience features like this helps to sell the program to future new users.

Also, remember that there's a large library of existing content already Smile

leezer3

Posts : 1961
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by Quork Fri Nov 13, 2020 3:40 pm

I don't think that's the biggest issue. The whole 3D modelling can be done in other programs like Blender, so you have a big variety of WYSIWYG editors at your choice. But there is no such option for route building itself. I do believe this would make a difference. Are you still in contact with the LokSim3D team? Maybe it would be feasible to adapt the LS3D route editor for BVE routes? The formats aren't that terribly different after all.
Quork
Quork

Posts : 1438
Join date : 2012-05-05
Age : 32
Location : Hofheim a.T., Hessen (Hesse), European Union

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by leezer3 Fri Nov 13, 2020 4:20 pm

I didn't have much contact with the Loksim guys (other than clarifying a few bits in the object format), and I'm unfortunately not too sure that'd help just at the minute.

The issue is somewhat that whilst the two sims and formats are superficially similar (as for that matter is any railway simulator), under the hood they're very, very different.
OpenBVE's internal systems were designed from the outset to with BVE2 / BVE4 content in mind, and there are compromises everywhere in the code, which makes adding something else far more difficult than it looks.
From a very quick poke in a Loksim route, it's using some sort of tiled format, whereas BVE routes are linear. Whilst that's not insurmountable (would be handled in the parser), it still needs someone to write the parser itself, or to couple up the Loksim editor to generate the appropriate curves & from that world positions as it goes, which is essentially the same job just in the other direction.

On a purely personal level, I'm working on features as opposed to editors.

I suppose I could put up Route Builder on the main site, but that had it's own set of problems.

leezer3

Posts : 1961
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Gothpaladinus and Phonteus Nevolius like this post

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by Phonteus Nevolius Tue Nov 17, 2020 9:49 pm

We don't happen to have the source code for RouteBuilder, do we? I don't think it was open source... Could it be used as the basis for a newer routebuilder is what I'm wondering about. Uwe Post could tell us more about that.
Phonteus Nevolius
Phonteus Nevolius

Posts : 120
Join date : 2017-10-05
Location : Hungary

https://phonteusnevolius.wordpress.com

fcancalon likes this post

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by leezer3 Tue Nov 17, 2020 11:12 pm

Source code:
https://code.google.com/archive/p/routebuilder/

It was released as GPL-3 in ~2011 after a Russian chap (IIRC the one with the flash based object bender / tree generator) asked Uwe.
Haven't touched it or looked at it TBQH. (Not to mention the fact I don't do Delphi)

leezer3

Posts : 1961
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by Phonteus Nevolius Wed Nov 18, 2020 7:27 pm

Still, good news that the source code is available. Maybe at one time someone will be inspired to take that project further.
Phonteus Nevolius
Phonteus Nevolius

Posts : 120
Join date : 2017-10-05
Location : Hungary

https://phonteusnevolius.wordpress.com

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by SylvesterChevrolet Tue Dec 15, 2020 2:27 pm

This sort of upgrade to the simulator is greatly appreciated, however I feel the sound tracks in traineditor (1 not 2) is insufficient. 2 for accelerating and 2 for de-accelerating. While I don't wish to sound ungrateful, I do think it's about time we have 4 or more for accelerating and de-accelerating. There is a way to implement infinite tracks via maths and .animated files but I, myself am not the brightest when it comes to numbers. I much prefer the graph approach taken in traineditor. Back on subject, it looks splended and I can't wait for more core updates like this to improve the simulator's experience

-Sylvester.
SylvesterChevrolet
SylvesterChevrolet

Posts : 16
Join date : 2020-08-15
Location : GreenDale

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by LXQt Tue Dec 15, 2020 2:40 pm

If I remember correctly, the new train.xml specification (Which is intended to replace train.dat) will allow more than 2 tracks. There should be an converter to the new format, however it seems it's not fully implemented yet. Looking forward to the future of OpenBVE
LXQt
LXQt

Posts : 114
Join date : 2019-02-18
Location : Hong Kong

https://lx862.com

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by Phonteus Nevolius Tue Dec 15, 2020 3:48 pm

TrainEditor2 saves as train.xml, doesn't it? (Oh, my memory, which barely exists Smile )
Phonteus Nevolius
Phonteus Nevolius

Posts : 120
Join date : 2017-10-05
Location : Hungary

https://phonteusnevolius.wordpress.com

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by leezer3 Sun Jan 10, 2021 6:11 pm

Some further improvements are now in the next build (documentation will be updated shortly).



These are as follows:

  • Structure.Weather added. This allows developers to assign an appropriate animated object to show raindrops etc.
  • The .Rain command has had a second parameter added- WeatherStructureIndex , which controls the weather object shown from that point onwards.
  • .Snow command added. This works identically to the .Rain command, but uses snowflake textures instead.


Rain and snow can be mixed in a route as you like, and as in the video above will show appropriate random flake / drops based upon the following probabilities:

  • Base probability for a drop / flake to appear is the greatest of the rain and snow intensity.
  • The snow intensity is then used as the probability that it *is* a snowflake.

leezer3

Posts : 1961
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Gothpaladinus and Phonteus Nevolius like this post

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by Manuel18 Mon Jan 11, 2021 1:53 pm

Is that an example using a 3D Panel  or just a 2D one ?
Manuel18
Manuel18

Posts : 75
Join date : 2012-10-18
Age : 30
Location : Caracas,Venezuela

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by Midnight Express Ginga81 Mon Jan 11, 2021 3:13 pm

This is very nice!
Thank you very much for adding!

By the way, this rain animation is only for 2D panel?
When at the oute-view mode, rain and snow is showing at 3D area?

This sample movie is stopping.
So I don't know that when the driving train is running,  rain and snow animation is relate with Z axis.

Is the snow animation is waving?

My solution, for outer-view, I created for rain/snow animated object.
This idea is 2D and 3D both realistic animation.
The snow is wavy move.
https://www.youtube.com/watch?v=0rp0mHcGWeQ

Midnight Express Ginga81

Posts : 144
Join date : 2016-09-25

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by leezer3 Mon Jan 11, 2021 9:26 pm

Manuel18 wrote:Is that an example using a 3D Panel  or just a 2D one ?

At the minute, this isn't hooked up for 3D panels.
This is because you'd need to place the drops manually on the windscreen object.
There isn't really a standard for this at the minute, not to mention the fact that getting the rotation right would be a pain for auto-generation.


They need to be placed following this rule for the wiper code to work:
Take the width of the windscreen to be swept, and divide this by the number of drops.
This gives you the horizontal drop interval.
Drops are placed starting from drop zero on the LEFT.
Vertical placement can be random.
The animated function used is RainDrop[dropIndex] / SnowDrop[dropIndex] , returning 1 if the drop is lit, 0 otherwise.

If you're happy placing the drops, I can add the necessary initialisation code to panel.animated too, that's no trouble.

Midnight Express Ginga81 wrote:By the way, this rain animation is only for 2D panel?
When at the oute-view mode, rain and snow is showing at 3D area?

This sample movie is stopping.
So I don't know that when the driving train is running,  rain and snow animation is relate with Z axis.

The rain animation in the video is a simplistic (and relatively poor) external object. It just uses the TextureShiftFunction on some faces which are perpendicular to Rail0.
See the attached file- I think it's probably using a very similar principle to yours.

To make this work better in 3D, it would want another 3-4 faces aligned with Rail0, but you'd have to play a bit with the exact spacing to get things right.
(Remember that both 2D and 3D cabs are rendered in overlay mode, so the rain face will never appear in the cab)
Attachments
NEW: Inbuilt raindrops and windscreen wipers Attachment
Rain.zip You don't have permission to download attachments.(2 Kb) Downloaded 5 times

leezer3

Posts : 1961
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Midnight Express Ginga81 likes this post

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by SS1 Fri Jan 15, 2021 3:50 pm

Apologies if I've missed something here, (haven't had a chance to test the zip file), but how does this rain work with regard to exterior views?
SS1
SS1

Posts : 3
Join date : 2021-01-15

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by leezer3 Fri Jan 15, 2021 8:56 pm

SS1 wrote:Apologies if I've missed something here, (haven't had a chance to test the zip file), but how does this rain work with regard to exterior views?

The weather object will be shown, but there's no mechanism for placing on an exterior (at the moment at least)

I'm thinking about generating a 3D cab variant too (fundamentally, all this wants is to generate the drops on a 2D plane as per the current and then rotate this), but getting it right may well be complex.

leezer3

Posts : 1961
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by Delsin Sat Jan 16, 2021 2:45 am

What about adding small 2D drops (which are not exactly 2D, a single face with drop texture) to an object specified in panel.animated and shifted a bit along its normals (to support non-flat glass panes) by an amount also specified there? if processing a glass texture "on the fly" to draw drops in it won't be easier and faster.
Delsin
Delsin

Posts : 313
Join date : 2016-08-20

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by leezer3 Sat Jan 16, 2021 11:07 am

Delsin wrote:What about adding small 2D drops (which are not exactly 2D, a single face with drop texture) to an object specified in panel.animated and shifted a bit along its normals (to support non-flat glass panes) by an amount also specified there? if processing a glass texture "on the fly" to draw drops in it won't be easier and faster.

That's essentially what I'm proposing above, but generating a flat face on the fly.
Shifting along normals is going to get problematic fast if the face is anything close to non-flat or the developer has used custom normals.

Drawing drops on a glass texture is a potential solution (this is basically what the motion blur code does), but at the minute I'm working small Razz

leezer3

Posts : 1961
Join date : 2011-08-23

http://www.bvecornwall.co.uk

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by Delsin Sat Jan 16, 2021 2:41 pm

I use custom normals a lot and if would definitely use them if I have to build some curved glass, so...whoops Laughing

Putting them directly in the texture seems like a much better idea tho
Delsin
Delsin

Posts : 313
Join date : 2016-08-20

Back to top Go down

NEW: Inbuilt raindrops and windscreen wipers Empty Re: NEW: Inbuilt raindrops and windscreen wipers

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

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