Windows and backdrops with gradients

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
boekabart
Transport Coordinator
Transport Coordinator
Posts: 333
Joined: 25 Aug 2005 09:44
Location: Eindhoven, Netherlands

Windows and backdrops with gradients

Post by boekabart »

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.
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 101 times
Patch Off and On - note that gradient might really help improve this patch.
Patch Off and On - note that gradient might really help improve this patch.
GradientPatch Compared.PNG (70.24 KiB) Viewed 655 times
GradientPatch_v1.00_for_r2905.diff
Version 1.00 for current trunk, rev 2905
(17.54 KiB) Downloaded 128 times
User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Post by bobingabout »

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]
boekabart
Transport Coordinator
Transport Coordinator
Posts: 333
Joined: 25 Aug 2005 09:44
Location: Eindhoven, Netherlands

Post by boekabart »

bobingabout wrote:erm, this would be better with 32bpp.
Really? DUH! But that's not in place yet, is it :shock:!?
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 :P ). Anyway, I personally think it is already an improvement now..... just my 2 cents and 18 kb of diff :wink: . I hope someone out there agrees with me and I definately think smth like this (more configurable, maybe) will be in later 32bpp releases.
boekabart
Transport Coordinator
Transport Coordinator
Posts: 333
Joined: 25 Aug 2005 09:44
Location: Eindhoven, Netherlands

Dithering!

Post by boekabart »

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!
Attachments
Nice!
Nice!
GradientPatch_Dithered.PNG (105.94 KiB) Viewed 2830 times
GradientPatch_v2.00_for_r2905.diff
Version 2.00 for Trunk (rev 2905), with dithering!
(19.28 KiB) Downloaded 105 times
boekabart
Transport Coordinator
Transport Coordinator
Posts: 333
Joined: 25 Aug 2005 09:44
Location: Eindhoven, Netherlands

EXE available

Post by boekabart »

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 :D ) so they may be strange (I, F and G mainly)[/url]
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Post by belugas »

I'd say it is quite refreshing indeed!
Dithering looks fantastic!

I just love new features :D
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

That's great! Pity new patches are not added to the trunk :( You will have to wait a long time...

Anyway, great job :wink:
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Post by SirkoZ »

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.
User avatar
thgergo
Route Supervisor
Route Supervisor
Posts: 391
Joined: 29 Mar 2005 12:44
Location: Hungary

Post by thgergo »

Good job, i like it :bow:
32bit would be better :wink:...
boekabart 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]
That dont works for me: wrong language files :(
Image
Image
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Post by belugas »

thgergo wrote:That dont works for me: wrong language files Sad
Same for me..
Even tried to recompile with current Trunk files for english and french..
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1732
Joined: 30 Mar 2005 09:43

Post by peter1138 »

MeusH, where did you get that idea? :-P
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

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.
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1732
Joined: 30 Mar 2005 09:43

Post by peter1138 »

That's not what I said at all, heh.
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Post by SirkoZ »

Well, it sure looks like it. Good thing we got the integrated nightly build. 8)
boekabart
Transport Coordinator
Transport Coordinator
Posts: 333
Joined: 25 Aug 2005 09:44
Location: Eindhoven, Netherlands

Post by boekabart »

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.
User avatar
StavrosG
Traffic Manager
Traffic Manager
Posts: 202
Joined: 13 Dec 2004 21:13
Location: Rodos, Greece
Contact:

Post by StavrosG »

MeusH 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.
I think they meant "stable" patches, not stale ;)
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.
boekabart
Transport Coordinator
Transport Coordinator
Posts: 333
Joined: 25 Aug 2005 09:44
Location: Eindhoven, Netherlands

Made the thing 32bpp

Post by boekabart »

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

Image
Check out the also-new filtered zoom mode! (left on, right off)
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 22 guests