The International Simutrans Forum

PakSets and Customization => General Resources and Tools => Tools => Topic started by: VS on February 17, 2010, 10:13:04 pm

Title: Automatic adding of player colours
Post by: VS on February 17, 2010, 10:13:04 pm
Still working on this, but here is a preview of possible tool. It will process png files given as parameters and recolorize according to options.cfg in same folder as image.

http://files.[ simutrans [dot] us (site down, do not visit) ]/files/get/Oxqw_T3Xnu/recolorer.7z
Title: Re: Automatic adding of player colours
Post by: The Hood on February 18, 2010, 08:34:07 am
Sounds interesting.  Have I understood this tool correctly, i.e. could be used as follows?

1) render image in, say, black and pink
2) use tool to convert pink to player colour, black stays the same?

And does this work for 2 player colours?

This may solve the long-standing request for pak128.Britain vehicles in player colours without too much fuss...
Title: Re: Automatic adding of player colours
Post by: VS on February 18, 2010, 12:57:04 pm
Currently it works like this:

For every pixel,
    store current colour as best result but with high metric
    for every candidate colour,
        find metric
        and if metric is bettter than best result,
            store this result as best
    finally, replace original colour with the best result


metric is Euclidian distance in rgb space



Zeno has worked out a better (more automatic) workflow for Blender, so you might want to give that a test instead. It's based on taking the normal render (w. OSA) and masking with non-osa & shadeless render...
Title: Re: Automatic adding of player colours
Post by: Spike on February 18, 2010, 01:10:53 pm
I found that sqrt(r*r*2 + g*g*3 + b*b) often is closer to what human eye sees as "similar" colors than unbiased euclidean distance in rgb space.
Title: Re: Automatic adding of player colours
Post by: Zeno on February 18, 2010, 04:03:20 pm
Zeno has worked out a better (more automatic) workflow for Blender, so you might want to give that a test instead. It's based on taking the normal render (w. OSA) and masking with non-osa & shadeless render...
Actually I have a small app that is strictly based in my working workflow, thus is only applicable to that way of working and it hasn't any flexibility at the moment.
As VS explains, this way of doing things is based on mask and osa renders. If anyone wants more info on it contact me via PM or the IRC chat (or just post here).