Windows and backdrops with gradients
Moderator: OpenTTD Developers
-
- Transport Coordinator
- Posts: 333
- Joined: 25 Aug 2005 09:44
- Location: Eindhoven, Netherlands
Windows and backdrops with gradients
I've made a patch that allows you to turn on fancy looking 'gradients' for lots of the windows in OTTD. In my opinion, it gives OTTD a lot more modern look.
The result is pertty good already, although since we're currently still using a paletted drawing, the gradients are not always perfectly colored. I'm working on a dithering version for a little better results.
The patch is turned on by default since I think the performance hit is close to zero, I optimized the implementation pretty good.
I've attached a patch for both the 0401 and current trunk (2905). Have fun and I'll keep you informed on the developments with the gradient one.
The result is pertty good already, although since we're currently still using a paletted drawing, the gradients are not always perfectly colored. I'm working on a dithering version for a little better results.
The patch is turned on by default since I think the performance hit is close to zero, I optimized the implementation pretty good.
I've attached a patch for both the 0401 and current trunk (2905). Have fun and I'll keep you informed on the developments with the gradient one.
- Attachments
-
- GradientPatch_v1.00_for_r2355_(v0401).diff
- Version 1.00 for latest release, 0.4.0.1 aka rev 2355
- (17.47 KiB) Downloaded 117 times
-
- Patch Off and On - note that gradient might really help improve this patch.
- GradientPatch Compared.PNG (70.24 KiB) Viewed 1042 times
-
- GradientPatch_v1.00_for_r2905.diff
- Version 1.00 for current trunk, rev 2905
- (17.54 KiB) Downloaded 152 times
- bobingabout
- Tycoon
- Posts: 1850
- Joined: 21 May 2005 15:10
- Location: Hull, England
erm, this would be better with 32bpp.
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.
[/url]
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.
[/url]
-
- Transport Coordinator
- Posts: 333
- Joined: 25 Aug 2005 09:44
- Location: Eindhoven, Netherlands
Really? DUH! But that's not in place yet, is itbobingabout wrote:erm, this would be better with 32bpp.

No, actually when I started this thing I was shocked that it was all still hardcore paletted (that the actual pixelbuffer we write to is), I was hoping that the pixel buffer would be 32 bpp and that the translation would be done wherever someone writes to it. I'm pretty sure (from the diffs between 2355 and 2905) that the guys up there are working on that, though... Anyway, I still wanted to do this to show that Cris Sawyer could had been years ahead of XP and OSX with this, even in paletted mode. Wait till you see the dithered results (I'm actually eager to see them too


-
- Transport Coordinator
- Posts: 333
- Joined: 25 Aug 2005 09:44
- Location: Eindhoven, Netherlands
Dithering!
I finished a first version of dithering.
One little comment: It uses a static array to store all calculated gradient- and dither information, the total size of this array is now 256(colors)*64(gradient levels)*8(size of dithering info) bytes = 128 kb. Is this a problem on some of the platforms, if so I can rewrite it to a malloc. Still 128kb, but no longer in the static data segment.
The performance should be pretty good, no impact, I replaced the original memcpy with memcpys per 64 bits, shouldn't impact window drawing too much. The dithering and gradients are all precalculated (on first use, per window color) so no real impact in run-time from that.
A bit later I hope to post also the patch for the 0401 release, now only for the trunk! I hope you all like it, I'm pretty happy with it!
One little comment: It uses a static array to store all calculated gradient- and dither information, the total size of this array is now 256(colors)*64(gradient levels)*8(size of dithering info) bytes = 128 kb. Is this a problem on some of the platforms, if so I can rewrite it to a malloc. Still 128kb, but no longer in the static data segment.
The performance should be pretty good, no impact, I replaced the original memcpy with memcpys per 64 bits, shouldn't impact window drawing too much. The dithering and gradients are all precalculated (on first use, per window color) so no real impact in run-time from that.
A bit later I hope to post also the patch for the 0401 release, now only for the trunk! I hope you all like it, I'm pretty happy with it!
- Attachments
-
- Nice!
- GradientPatch_Dithered.PNG (105.94 KiB) Viewed 3217 times
-
- GradientPatch_v2.00_for_r2905.diff
- Version 2.00 for Trunk (rev 2905), with dithering!
- (19.28 KiB) Downloaded 146 times
-
- Transport Coordinator
- Posts: 333
- Joined: 25 Aug 2005 09:44
- Location: Eindhoven, Netherlands
EXE available
Note that in-game there are also a lot of places where the gradient improves the looks, the background of all icons, for instance.
I've put a compiled exe here: http://www.debb.nl/OpenTTD/OpenTTD_r290 ... Patch2.rar, the RAR includes the EXE (based on r2905) and the language files.
Language files that contain the right text for the patch setting:
* Romanian
* English + American
* Dutch
* Italian
* French
* German
Not all of them are my native tongue (only one of them in fact
) so they may be strange (I, F and G mainly)[/url]

Language files that contain the right text for the patch setting:
* Romanian
* English + American
* Dutch
* Italian
* French
* German
Not all of them are my native tongue (only one of them in fact

Well - the idea is nice and implementation too (visually), but in my opinion the dithering can be seen and is not good to watch for more time - for eyes the best would be smooth, which is pretty much the case in normal o/TTD.
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Good job, i like it
32bit would be better
...


32bit would be better

That dont works for me: wrong language filesboekabart wrote:I've put a compiled exe here: http://www.debb.nl/OpenTTD/OpenTTD_r290 ... Patch2.rar, the RAR includes the EXE (based on r2905) and the language files. (I, F and G mainly)[/url]

Well, it sure looks like it. Good thing we got the integrated nightly build. 

NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
-
- Transport Coordinator
- Posts: 333
- Joined: 25 Aug 2005 09:44
- Location: Eindhoven, Netherlands
About that wrong lang file: I checked at a friend just 1 hour ago, same problem. I guess I made a mistake somewhere, I guess it has to do with that wrong lithuanian lang file that has been in the trunk for a while already now (anyone in the devteam going to FIX that?!). I'll try again when i have time, 30 min or so.
I think they meant "stable" patches, not staleMeusH wrote:On IRC, where you've said only "stale" patches will be merged. I still don't get what you mean, but all I know is that devs are busy and they will not add user-made patches.

Then the devs got distracted with another conversation anyway (I happened to be in the channel then, but not paying much attention)
If ain't broken, don't fix it. | JabberID: stavrosg@jabber.org
Hello, I am a signature virus. Please copy me to your signature to help me spread.
Hello, I am a signature virus. Please copy me to your signature to help me spread.
-
- Transport Coordinator
- Posts: 333
- Joined: 25 Aug 2005 09:44
- Location: Eindhoven, Netherlands
Made the thing 32bpp
I made the whole render/blit engine in OpenTTD 32 bits just to make you guys who don't like dithering happy.
Well actually as a good practice for myself too.
THREAD HERE

Check out the also-new filtered zoom mode! (left on, right off)
Well actually as a good practice for myself too.
THREAD HERE

Check out the also-new filtered zoom mode! (left on, right off)
Who is online
Users browsing this forum: No registered users and 25 guests