[engine] Generate black backgrounds for art on install?

Discussion among members of the development team.

Moderator: Forum Moderators

silene
Posts: 1109
Joined: August 28th, 2004, 10:02 pm

Re: [engine] Generate black backgrounds for art on install?

Post by silene »

On trunk, unit types, units, and unit effects, can now use a small_profile= key in addition to the profile= key. When only the profile= attribute is present, the current behavior applies (that is, the file is used for small portraits, while transparent/ is inserted in order to find big portraits). When both attributes are present, the small_profile= key is used to describe the image used for small portraits.

Below is an example of using only the transparent portrait and discarding the black one.
Capture-Bataille pour Wesnoth - 1.9.3+svn-3.png
Can you guess which portrait was automatically generated by the engine?

In fact, the generated one should be quite obvious, since I purposely chose a portrait which I knew would suffer from downscaling artifacts. (I hope to get rid of them though.) Anyway, the goal is not to systematically generate downscaled portraits, but to do it whenever the artist feels there is no noticeable difference between the one obtained in Photoshop/Gimp and the one generated by the engine.

To make things clearer, here is the syntax that was used:

Code: Select all

small_profile="portraits/elves/transparent/marksman.png~CROP(0,20,380,380)~SCALE(205,205)"
profile="portraits/elves/transparent/marksman.png"
(In particular, notice that you can put whatever files and modifiers you wish in the two attributes.)

EDIT: uploaded a new image after fixing some bugs in the engine downscaler.
User avatar
sacred_chao
Posts: 32
Joined: December 15th, 2007, 11:53 pm

Re: [engine] Generate black backgrounds for art on install?

Post by sacred_chao »

Firstly, wow! That's brilliant work, Silene!
silene wrote:Can you guess which portrait was automatically generated by the engine?
EDIT: uploaded a new image after fixing some bugs in the engine downscaler.
I'm on a 17" LCD, so it might be more obvious on larger monitors, but I actually can't tell which portrait was downscaled. If that's one of the worse ones, it's amazing!
All things are true. Especially false things.
User avatar
bigkahuna
Posts: 657
Joined: September 11th, 2010, 6:24 pm
Location: In your mind.

Re: [engine] Generate black backgrounds for art on install?

Post by bigkahuna »

sacred_chao wrote:but I actually can't tell which portrait was downscaled
Same here. Sorry if you were trying to prove your point, silene :lol2:
Check out my campaign Sweet Revenge!
Join the new R2D forum!
User avatar
boru
Posts: 788
Joined: November 19th, 2009, 11:02 pm

Re: [engine] Generate black backgrounds for art on install?

Post by boru »

If you look at the small portraits in the game and compare them to the screenshot, it's very evident. The lines in the female marksman are much lighter and there is a loss of detail in the shading, especially in the brown areas of her outfit.

It's up to the devs and art team of course, but if you stripped out all the small portraits you'd only save a megabyte or so, so downloading a binary would still be a big project for people with bandwidth issues. Personally I prefer the higher quality art.
elf-comparison.png
elf-comparison.png (105.79 KiB) Viewed 7748 times
“It is written in my life-blood, such as that is, thick or thin; and I can no other.” - J.R.R. Tolkien

My campaign: Swamplings - Four centuries before the founding of Wesnoth, the first wolf rider emerges from a tribe of lowly swamp goblins.
User avatar
pauxlo
Posts: 1047
Joined: September 19th, 2006, 8:54 pm

Re: [engine] Generate black backgrounds for art on install?

Post by pauxlo »

boru wrote:If you look at the small portraits in the game and compare them to the screenshot, it's very evident. The lines in the female marksman are much lighter and there is a loss of detail in the shading, especially in the brown areas of her outfit.
Image
And in the right image the bow string crosses the shoulder armor, in the left one not. Does this really comes from "manual" versus "automatic" downsizing, or are you comparing an original and a retouched version?
silene
Posts: 1109
Joined: August 28th, 2004, 10:02 pm

Re: [engine] Generate black backgrounds for art on install?

Post by silene »

pauxlo wrote:
boru wrote:If you look at the small portraits in the game and compare them to the screenshot, it's very evident. The lines in the female marksman are much lighter and there is a loss of detail in the shading, especially in the brown areas of her outfit.
Image
And in the right image the bow string crosses the shoulder armor, in the left one not. Does this really comes from "manual" versus "automatic" downsizing, or are you comparing an original and a retouched version?
Notice that even the pose is different, e.g., the arms do not have their muscles in the same positions. So yes, he is comparing two different images and these changes are not caused by the rescaling.
User avatar
kitty
Retired Portrait Director
Posts: 1290
Joined: January 2nd, 2008, 3:29 pm

Re: [engine] Generate black backgrounds for art on install?

Post by kitty »

Wow, silene - thank you so much for putting work into this!

Actually this already looks pretty close to usable to me… If you continue working on this, could you perhaps use a portrait with semi-transparent fx and flowy hair (perhaps the male necromancer) as the sample image? Just to see how those would work out.

(And yes, there were two versions of the longbow woman around at one time, I can't really remember which one was the final one... But I can't imagine any scaling method causing this massive changes ;) )
User avatar
boru
Posts: 788
Joined: November 19th, 2009, 11:02 pm

Re: [engine] Generate black backgrounds for art on install?

Post by boru »

Silene & pauxlo, you're right. That's the small portrait from Wesnoth 1.9.3 and it's different from the transparent portrait in the same version. Shading is different and so is the skin color.

So in answer to your original question, Silene, yes I can guess but not correctly.

EDIT: Looking at some old versions of Wesnoth, the discrepancy between the small portrait and the main portrait of the female elvish marksman stretches back at least to Wesnoth 1.6. I don't think there were large portraits in 1.4, but here's the 1.4 small portrait: http://svn.gna.org/viewcvs/wesnoth/bran ... iew=markup

To my nonartist eyes it seems to be the same as the small portrait in 1.9.3.
“It is written in my life-blood, such as that is, thick or thin; and I can no other.” - J.R.R. Tolkien

My campaign: Swamplings - Four centuries before the founding of Wesnoth, the first wolf rider emerges from a tribe of lowly swamp goblins.
silene
Posts: 1109
Joined: August 28th, 2004, 10:02 pm

Re: [engine] Generate black backgrounds for art on install?

Post by silene »

kitty wrote:If you continue working on this, could you perhaps use a portrait with semi-transparent fx and flowy hair (perhaps the male necromancer) as the sample image? Just to see how those would work out.
Here are two examples. The first and third image are the original ones, the second and fourth ones are scaled down version of the transparent portraits.
necromancer1.png
necromancer1.png (40.96 KiB) Viewed 7686 times
necromancer2.png
necromancer2.png (39.07 KiB) Viewed 7686 times
guard1.png
guard1.png (41.31 KiB) Viewed 7686 times
guard2.png
guard2.png (38.17 KiB) Viewed 7686 times
For the record, the MSE distortions are respectively 0.035% and 0.028% for these two portraits. So it's an error 5 times too big for me to even consider using the downscaled one in place of the original one. Typically, it means that either the graphic software used a different downscaling algorithm than Wesnoth, or both the transparent portrait and the small one were downscaled from a third one, or the artist postprocessed the image. For instance, the guard armor looks way too sharp for me to be able to achieve similar results by just downscaling the transparent portrait.
User avatar
sacred_chao
Posts: 32
Joined: December 15th, 2007, 11:53 pm

Re: [engine] Generate black backgrounds for art on install?

Post by sacred_chao »

The dwarf is indeed a bit fuzzier. :( The necromancer looks pretty good to me.
silene wrote:Typically, it means that either the graphic software used a different downscaling algorithm than Wesnoth, or both the transparent portrait and the small one were downscaled from a third one, or the artist postprocessed the image.
Hmm. So is it possible to use a better scaling algorithm in Wesnoth? Presumably that would be of benefit to the game as a whole, not just for this purpose (eg. when you zoom in and out of the battlefield).
All things are true. Especially false things.
User avatar
Iris
Site Administrator
Posts: 6798
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Re: [engine] Generate black backgrounds for art on install?

Post by Iris »

I believe Kitty mentioned to me back in the day that a common practice of hers when downscaling portraits was to apply an Unsharp mask filter on the final 205x205 image. I don't remember whether any generic parameters were used or it was an ad hoc procedure.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
silene
Posts: 1109
Joined: August 28th, 2004, 10:02 pm

Re: [engine] Generate black backgrounds for art on install?

Post by silene »

shadowmaster wrote:I believe Kitty mentioned to me back in the day that a common practice of hers when downscaling portraits was to apply an Unsharp mask filter on the final 205x205 image. I don't remember whether any generic parameters were used or it was an ad hoc procedure.
Theoretically, the cardinal theorem of interpolation theory (aka Nyquist-Shannon's) states that unsharping should be done on the original image, not on the final one. More precisely, it states that a signal to be downscaled has to satisfy Nyquist's criterion. In other words, it has to go through a low-pass filter first. I guess a Gaussian blur with a dimension of twice the scaling factor would be a good candidate in general, but I suppose it depends on the specifics of the image.
User avatar
kitty
Retired Portrait Director
Posts: 1290
Joined: January 2nd, 2008, 3:29 pm

Re: [engine] Generate black backgrounds for art on install?

Post by kitty »

Hmm, there are definitely visible differences between my and tsi's versions of the portraits and the ones you generated. But honestly the differences don't look too bad to me. I'd like to hear what the other portrait artists have to say to this minimal quality loss. I think I could live with it.

Regarding the sharpness issue, it's true that I sharpen (not unsharpen!) my portraits a tad. When I generate the 400x400 .png I apply the Photoshop sharpen filter at about 25% (depending on the pic, but that's generally a good estimate). But then I use this version to generate the 205x205 on black version which doesn't get any special treatment.
User avatar
thespaceinvader
Retired Art Director
Posts: 8414
Joined: August 25th, 2007, 10:12 am
Location: Oxford, UK
Contact:

Re: [engine] Generate black backgrounds for art on install?

Post by thespaceinvader »

I normally do a bit of sharpening too - by 10 in GIMP for the 400x400 and 25 for the 205x205.
http://thespaceinvader.co.uk | http://thespaceinvader.deviantart.com
Back to work. Current projects: Catching up on commits. Picking Meridia back up. Sprite animations, many and varied.
User avatar
DEATH_is_undead
Posts: 960
Joined: March 4th, 2007, 3:00 pm
Location: Northern United States

Re: [engine] Generate black backgrounds for art on install?

Post by DEATH_is_undead »

Remember every tool you wish to use on your art has to be in Wesnoth's game engine, which will take about one of the portrait's saved memory itself.
3P MP Scenario - Great Dwarves Escape
The best way to learn is to follow. In order to learn WML, you have to follow other's work, and check their codes.
Post Reply