Trains getting old - dirt overlays

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

gigajum
Route Supervisor
Route Supervisor
Posts: 511
Joined: 08 Mar 2006 08:33
Location: Germany

Post by gigajum »

Julz wrote:visual cues for engine age (new / well used / time to replace) would be wonderful. I do hope this is implemented.
No it is not. Maybe it will, i hope so. It looks great :)
Hazen
Engineer
Engineer
Posts: 19
Joined: 24 Apr 2006 14:11

Post by Hazen »

I refined my idea a bit. I played around with ImageMagick and wrote a little script that applies a dirt map to an image.

Now assuming that in future the 32bit trains are in some kind of package (say a zip-packed file with a directory for all the sprites, for example, dv12.pak), it would be easy then to extract all the sprites and throw them to a script that converts the sprites to look dirty. After that the script makes a duplicate of the original train.pak and renames it something like dv12_dirt.pak and replaces the sprites with the dirty ones. So the only differences between dv12.pak and dv12_dirt.pak are the name and the sprites.

The point of this is, that the only thing that the code needs to do is:
- check if a train_name_dirt.pak exists
- use the train_name_dirt.pak when trains age is over X years

I dont' think that this kind of functionality would be too hard to implement in a patch. And of course, if train_name_dirt.pak isn't found, then everything would continue as normal.

One of the downsides of using this kind of script is that it takes around two seconds (on my computer, 1.8 GHz) to create the new sprite. So with 40 sprites per train and around 20 trains it would take close to half an hour to convert all.

On the upside, this should be easy to code and you could easily replace the dirtmap with your own, if you're not happy with it for a reason or another.

I'll leave you with the actual script, couple of samples (I borrowed Crazy Vaclav's grain hoppers from the wiki) and a dirtmap that I used.

Code: Select all

#!/bin/bash

#Dirtify script by Hazen, version 0.1
#Usage: ./dirtify train_image.png dirt_map.png

convert -level 10%,100%,1.0 $1 dark.png
composite -compose Dst_In -gravity center dark.png $2 mask.png
composite -gravity center mask.png  dark.png dirt_$1
mogrify -level 10%,100%,1.0 dirt_$1

rm dark.png mask.png
Edit: fixed the link
Attachments
dirtify dv12 sample
dirtify dv12 sample
dv12_sample.jpg (23.42 KiB) Viewed 2840 times
dirtify grain hopper sample (model by Crazy Vaclav)
dirtify grain hopper sample (model by Crazy Vaclav)
Grain-hopper_sample.jpg (65.82 KiB) Viewed 2840 times
dirt map used in these samples
dirt map used in these samples
dirt2.png (315.12 KiB) Viewed 2840 times
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Post by XeryusTC »

It looks nice on the locomotives, however the spheres have a big dent in them now :s. I think that dirt spots should be smaller and maybe more liniear so it looks like the dirt is actually comming from the round and was swept (right context?) against the train.
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
dmh_mac
Transport Coordinator
Transport Coordinator
Posts: 278
Joined: 25 Apr 2005 18:18

Post by dmh_mac »

I think the maximum amount shouldn't be much more than what you have at 1x dirtyfication. 2x is over the top...
richk67
Tycoon
Tycoon
Posts: 2363
Joined: 05 Jun 2003 16:21
Location: Up North
Contact:

Post by richk67 »

Hazen - nice pics, but I would increase the brightness and contrast with each successive layer. Like a fog filter on a camera, your overlay has the effect of reducing both.
OTTD NewGRF_ports. Add an airport design via newgrf.Superceded by Yexo's NewGrf Airports 2
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
User avatar
Ben_Robbins_
Tycoon
Tycoon
Posts: 1234
Joined: 20 Nov 2005 01:56
Location: Abu Dhabi, UAE

Post by Ben_Robbins_ »

I agree to dmh_mac, the 3rd one is a bit too far. Your dirt texture image has its dark dirty bits and light clean bits...could the clean bits not be invisible, opake....
Ben
dmh_mac
Transport Coordinator
Transport Coordinator
Posts: 278
Joined: 25 Apr 2005 18:18

Post by dmh_mac »

I think he's already using a subtractive blend.

Also opaque and invisible arent realy the same thing...
User avatar
Ben_Robbins_
Tycoon
Tycoon
Posts: 1234
Joined: 20 Nov 2005 01:56
Location: Abu Dhabi, UAE

Post by Ben_Robbins_ »

I couldnt say what i ment right....basically, if the dirt jpg had a bright green layer behind it with opacity at 100% could the green still be seen
Ben
ZxBiohazardZx
Tycoon
Tycoon
Posts: 1534
Joined: 14 Mar 2006 12:46
Location: Netherlands

Post by ZxBiohazardZx »

Ben_Robbins_ wrote:I agree to dmh_mac, the 3rd one is a bit too far. Your dirt texture image has its dark dirty bits and light clean bits...could the clean bits not be invisible, opake....
i agree for the loco, on the oil car it kinda looks better (the grain one not)
User avatar
Crazy Vaclav
Traffic Manager
Traffic Manager
Posts: 242
Joined: 02 Dec 2005 17:01

Post by Crazy Vaclav »

They are all grain trucks. And I agree, 1x is enough.
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1793
Joined: 30 Mar 2005 09:43

Post by peter1138 »

This is, of course, already possible. With NewGRF (tm). However, the graphics there are probably too small to make much difference...
He's like, some kind of OpenTTD developer.
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

Peter1138: Yes, of course it is possible, but it would require doubling/tripling amount of sprites and sudden graphical changes.

The overlay would add just one or two images of dirt, and would be generated probably on the fly.
User avatar
charlieg
Transport Coordinator
Transport Coordinator
Posts: 323
Joined: 08 Oct 2003 14:07
Contact:

Post by charlieg »

Erm these dirty maps are so flawed.

Trains spend the majority of their time in motion. The other major factor is gravity. Therefore things do not just change colour or darken, but the dirt is either spread or dripped on the surfaces of a train. So your ideal dirtmap will contain elements of both.
Open source tycoon games
--
Free Gamer - open source and Free Software games
FreeGameDev forums - open source game development community
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

MeusH wrote:The overlay would add just one or two images of dirt, and would be generated probably on the fly.
Requiring ... how much processor power?
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

DaleStan wrote:
MeusH wrote:The overlay would add just one or two images of dirt, and would be generated probably on the fly.
Requiring ... how much processor power?
And that's the problem. It would allocate the sprite image and paste the dirt texture on non-transparent places of the sprite.

This is a nice idea, but it is purely cosmetic, with lot of possible effort for not a big benefit... Remind us post 0.7, maybye? :?
User avatar
Redirect Left
Tycoon
Tycoon
Posts: 7422
Joined: 22 Jan 2005 19:31
Location: Wakefield, West Yorkshire

Post by Redirect Left »

I actually like the way the spheres look like they are dented, it shows use over the years :)
Image
Need some good tested AI? - Unofficial AI Tester, list of good stuff & thread is here.
Ichi
Traffic Manager
Traffic Manager
Posts: 130
Joined: 18 Apr 2006 13:27
Location: Groningen, The Netherlands

Post by Ichi »

shouldn't there be a texture that shows the paint of the trains falling off? And showing some rust underneath it? That would make it way more realistic, since not only dust hits trains (rocks, birds, insects, cars, cows, people, etc.)
Hazen
Engineer
Engineer
Posts: 19
Joined: 24 Apr 2006 14:11

Post by Hazen »

charlieg wrote:Erm these dirty maps are so flawed.

Trains spend the majority of their time in motion. The other major factor is gravity. Therefore things do not just change colour or darken, but the dirt is either spread or dripped on the surfaces of a train. So your ideal dirtmap will contain elements of both.
and
Ichi wrote:shouldn't there be a texture that shows the paint of the trains falling off? And showing some rust underneath it? That would make it way more realistic, since not only dust hits trains (rocks, birds, insects, cars, cows, people, etc.)
Yes, paint falling off and dirt on specific places would be really nice and it would look more realistics, but it would mean that we would need a huge amount of individual dirt maps. Other way (which would achieve even better results) to make this would be to render all the models with dirt textures. Problem with both of these is the huge amount of textures and/or work that is needed to achieve this.

I'm trying to make this work with one (or maybe a couple) dirtmap, which would be applied to allready existing sprites. The result, of course, being far from ideal but still, I think, better than nothing. So not only one map has to work for all trains, it has to work on all trains on all angles (forty of them).
DaleStan wrote:
MeusH wrote:The overlay would add just one or two images of dirt, and would be generated probably on the fly.
Requiring ... how much processor power?
Is this so different from the realtime remapable colours that the same techniques couldn't be used? And if this is impossible, the possibility of generating the dirty sprites beforehand remains.
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 14 guests