Page 1 of 1

Color table problems

Posted: Fri Apr 10, 2020 11:28 am
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

Re: Color table problems

Posted: Wed Apr 15, 2020 10:14 pm
by Point
first do you have photoshop, graphic converter, gimp, or some other photo editing program?

Image

Re: Color table problems

Posted: Thu Apr 16, 2020 12:38 pm
by Formation
Yes I have gimp and a batch editor plugin for it.

Re: Color table problems

Posted: Fri Apr 17, 2020 11:59 am
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.

Re: Color table problems

Posted: Fri Apr 17, 2020 8:00 pm
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

Re: Color table problems

Posted: Sat Apr 18, 2020 11:39 am
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:

Re: Color table problems

Posted: Sun Apr 19, 2020 9:03 pm
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.

Re: Color table problems

Posted: Sun Apr 19, 2020 11:26 pm
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!