Color table problems

A forum for discussing map making ideas and problems for the Myth series.
Post Reply
Formation
Posts: 4
Joined: Fri Apr 10, 2020 11:10 am

Color table problems

Post by Formation »

Hey guys I’m pretty new to making units in oak and I’m trying make my rendered images (rendered in blender) all have the same color table. I have literally no idea how to do this and any help would be hugely appreciated. Thanks!

~Sean aka Formation
User avatar
Point
Posts: 1805
Joined: Mon Mar 22, 2004 12:58 pm

Re: Color table problems

Post by Point »

first do you have photoshop, graphic converter, gimp, or some other photo editing program?

Image
if one does not learn from the failings of the past they are likely to suffer its return.
Formation
Posts: 4
Joined: Fri Apr 10, 2020 11:10 am

Re: Color table problems

Post by Formation »

Yes I have gimp and a batch editor plugin for it.
User avatar
Melekor
Site Admin
Posts: 2449
Joined: Sat May 01, 2004 12:10 am
Contact:

Re: Color table problems

Post by Melekor »

If you have rendered all of your sequences from the same camera position, so that all of your renders are lined up, you can use Oak's "build standard collection" tool (in the Tools menu). It handles almost all of the collection building process for you, including indexing.

Basically, the tool wants the renders arranged in a folder structure, one folder per sequence (animation).

e.g.

Code: Select all

myunit/walk/
myunit/attack/
myunit/taunt/
Then you select the "myunit" folder in the tool, fill in the options and click OK.

The images in each folder are sorted by filename and then the frames and views are filled out in order from the sorted images. The tool defaults to 8 views per sequence, meaning the images are ordered like this

Code: Select all

                views
frames 1  2  3  4  5  6  7  8
       9 10 11 12 13 14 15 16
                (etc)
If you tick the checkbox for "frames then views ordering", then they are ordered as

Code: Select all

       views
frames  1 9   etc
        2 10
        3 11
        4 12
        ..
If the number of views for your unit isn't the default of 8, you will have to use the script mechanism to specify it for each sequence. This is done by creating a text file that goes into the folders that the tool will read.

The script should be named "script.txt" and it can be placed in the root folder myunit/script.txt as well as in each animation folder, myunit/walk/script.txt etc. If a folder has no script, it inherits the script from its parent.

An example script file showcasing all the possible parameters:

Code: Select all

(3 3 2 1 2)
Frames 5
Views 5
BitmapOrder FramesThenViews
The first parameter is called the "frame mapping" which can be used to permute or duplicate frames.
BitmapOrder can be either FramesThenViews or ViewsThenFrames.
Frames and Views - self explanatory.

The reg. point X, Y fields are used to specify where the bottom of the sprite is. This is typically somewhere between a unit's feet - check out other collections in the editor to see where you should set this.
User avatar
Point
Posts: 1805
Joined: Mon Mar 22, 2004 12:58 pm

Re: Color table problems

Post by Point »

or ya what Melekor said...

Melekor: How does oak decide on the best color table for all the images?


Form: I have used photoshop batches always though should be similar for gimp... try out oak to see if can handle your task if not I can walk you through a way to generate a good batch for unifying all your images before import. -PT
if one does not learn from the failings of the past they are likely to suffer its return.
User avatar
Melekor
Site Admin
Posts: 2449
Joined: Sat May 01, 2004 12:10 am
Contact:

Re: Color table problems

Post by Melekor »

Point wrote:Melekor: How does oak decide on the best color table for all the images?
It computes a color table using k-means clustering of all the pixels of all in the input images. Specifically, it uses the WSM-C algorithm described in this paper: https://arxiv.org/pdf/1011.0093.pdf

Color tables produced using this method are very high quality, in absolute, and certainly relative to old school methods used by photoshop.

I believe the WSM-C algorithm is very close to being as good as it gets without using fancy modern techniques like deep learning. I can imagine how you could improve the results using an integrated quantization/remapping approach using perceptual loss functions, but that would be a multi-month research project to implement and probably require a beefy GPU to run :wink:
Formation
Posts: 4
Joined: Fri Apr 10, 2020 11:10 am

Re: Color table problems

Post by Formation »

Point: I have imported the images into gimps batch editing plug and there’s no way to make all of the images use the same color table. Every time I import the images they get corrupted with red or pink pixels all over them.
User avatar
Point
Posts: 1805
Joined: Mon Mar 22, 2004 12:58 pm

Re: Color table problems

Post by Point »

Melekor, that certainly sounds better than custom building a color table in photoshop....

Formation, I have never created or run a batch in gimp so not sure though it sounds like trying out the Oak structure is the way to go... I never got it to work though didn't put much effort into it. Try following Melkor's guide above if your creation doesn't have all the regular sequences or more of them improvise. Have fun with it and See you in the game!
if one does not learn from the failings of the past they are likely to suffer its return.
Post Reply