NEW: Inbuilt raindrops and windscreen wipers
+7
LXQt
SylvesterChevrolet
Phonteus Nevolius
Dexter
Quork
zbx1425
leezer3
11 posters
Page 1 of 1
NEW: Inbuilt raindrops and windscreen wipers
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
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.
New section:
[Windscreen]
This supports the following arguments:
New global panel2 variables:
New section:
[Windscreen]
This supports the following arguments:
New command:
.Rain Intensity Intensity should be a number from 0 to 100 representing the current rain intensity.
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.
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
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
Gothpaladinus likes this post
Re: NEW: Inbuilt raindrops and windscreen wipers
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.
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.
Re: NEW: Inbuilt raindrops and windscreen wipers
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).
- 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- Posts : 1438
Join date : 2012-05-05
Age : 32
Location : Hofheim a.T., Hessen (Hesse), European Union
Re: NEW: Inbuilt raindrops and windscreen wipers
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.Quork and Gothpaladinus like this post
Re: NEW: Inbuilt raindrops and windscreen wipers
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
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
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
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
Re: NEW: Inbuilt raindrops and windscreen wipers
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- Posts : 1438
Join date : 2012-05-05
Age : 32
Location : Hofheim a.T., Hessen (Hesse), European Union
Re: NEW: Inbuilt raindrops and windscreen wipers
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.
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.
Gothpaladinus and Phonteus Nevolius like this post
Re: NEW: Inbuilt raindrops and windscreen wipers
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.
fcancalon likes this post
Re: NEW: Inbuilt raindrops and windscreen wipers
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)
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)
Re: NEW: Inbuilt raindrops and windscreen wipers
Still, good news that the source code is available. Maybe at one time someone will be inspired to take that project further.
Re: NEW: Inbuilt raindrops and windscreen wipers
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.
-Sylvester.
SylvesterChevrolet- Posts : 16
Join date : 2020-08-15
Location : GreenDale
Re: NEW: Inbuilt raindrops and windscreen wipers
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
Re: NEW: Inbuilt raindrops and windscreen wipers
TrainEditor2 saves as train.xml, doesn't it? (Oh, my memory, which barely exists )
Re: NEW: Inbuilt raindrops and windscreen wipers
Some further improvements are now in the next build (documentation will be updated shortly).
These are as follows:
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:
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.
Gothpaladinus and Phonteus Nevolius like this post
Re: NEW: Inbuilt raindrops and windscreen wipers
Is that an example using a 3D Panel or just a 2D one ?
Manuel18- Posts : 75
Join date : 2012-10-18
Age : 30
Location : Caracas,Venezuela
Re: NEW: Inbuilt raindrops and windscreen wipers
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
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
Re: NEW: Inbuilt raindrops and windscreen wipers
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
Midnight Express Ginga81 likes this post
Re: NEW: Inbuilt raindrops and windscreen wipers
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- Posts : 3
Join date : 2021-01-15
Re: NEW: Inbuilt raindrops and windscreen wipers
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.
Re: NEW: Inbuilt raindrops and windscreen wipers
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- Posts : 313
Join date : 2016-08-20
Re: NEW: Inbuilt raindrops and windscreen wipers
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
Re: NEW: Inbuilt raindrops and windscreen wipers
I use custom normals a lot and if would definitely use them if I have to build some curved glass, so...whoops
Putting them directly in the texture seems like a much better idea tho
Putting them directly in the texture seems like a much better idea tho
Delsin- Posts : 313
Join date : 2016-08-20
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|