Page 5 of 8

Re: Pictoric (was: New conversion algorithm)

Posted: Sun May 17, 2020 10:26 am
by 8bit-Dude
Just a quick question: can this algorithm be adapted to spew out AIC format pictures???

Re: Pictoric (was: New conversion algorithm)

Posted: Sun May 17, 2020 12:56 pm
by Dbug
8bit-Dude wrote: Sun May 17, 2020 10:26 am Just a quick question: can this algorithm be adapted to spew out AIC format pictures???
That's not actually a bad idea: Basically have the algorithm select the best combinations of ink, paper, invert, with a fixed set of color attributes on the left side of the screen.

Re: Pictoric (was: New conversion algorithm)

Posted: Mon May 18, 2020 12:05 am
by sam
Dbug wrote: Sun May 17, 2020 12:56 pm That's not actually a bad idea: Basically have the algorithm select the best combinations of ink, paper, invert, with a fixed set of color attributes on the left side of the screen.
Try to press the "RUN" button on the GrafX2 launch dialog while pressing the "a" key on the keyboard with the latest version on github. This restrict the color changes on the first column only. But this isn't what you really meant I guess. You'd probably want to add the fact that odd and even line uses the very same repeating color scheme, wouldn't you ? So this is a totally different algorithm: try all color 4-tuples on odd/even lines that minimize the total error on the screen. Am I right ?

Re: Pictoric (was: New conversion algorithm)

Posted: Mon May 18, 2020 5:10 am
by 8bit-Dude
sam wrote: Mon May 18, 2020 12:05 am Am I right ?
Exactly!!! And additionally, is it possible to optionally specify those two colors (rather than let the software choose)?

If you could produce a version that does this, then I would like to integrate it with 8bit-Unity. My own AIC encoder is quite poor at reproducing details.

For example, take a look at the attached conversion... can you do better?? (black areas were post-processed, to improve visibility)

Re: Pictoric (was: New conversion algorithm)

Posted: Mon May 18, 2020 8:51 am
by Chema
I must say I am impressed of the latest demos of 8-bit unity. Keep on with the good work!!!

Re: Pictoric (was: New conversion algorithm)

Posted: Mon May 18, 2020 11:41 am
by sam
8bit-Dude wrote: Mon May 18, 2020 5:10 am
sam wrote: Mon May 18, 2020 12:05 am Am I right ?
Exactly!!! And additionally, is it possible to optionally specify those two colors (rather than let the software choose)?
If you chose the 2 colors, then the algorithm reduces to a plain dither.

I'll see what I can do on that topic. Stay tuned.

Re: Pictoric (was: New conversion algorithm)

Posted: Mon May 18, 2020 11:59 am
by 8bit-Dude
Thanks!! I tried the current AIC mode of the script, but the result is not that much clearer than my current algorithm...
There are more details, but the dither makes the whole thing looks a lot more "noisier".

Re: Pictoric (was: New conversion algorithm)

Posted: Mon May 18, 2020 1:08 pm
by 8bit-Dude
Chema wrote: Mon May 18, 2020 8:51 am I must say I am impressed of the latest demos of 8-bit unity. Keep on with the good work!!!
Thanks Chema! There was a long period of inactivity, but the COVID situation actually gave me some free time to progress on it (funny how life is!). My next goal is to finish the 8bit-Hub prototype work, and release it as a product to the 8bit community.

Re: Pictoric (was: New conversion algorithm)

Posted: Mon May 18, 2020 4:05 pm
by sam
8bit-Dude wrote: Mon May 18, 2020 11:59 am There are more details, but the dither makes the whole thing looks a lot more "noisier".
Sure! Error diffusion is just that: add noise to simulate missing color. I'm about to think that ordered dither might be better for AIC but ordered dithering with Oric constraints is something different.

Anyway I've improved the tool a lot:
  1. I've added a bit of documentation for GrafX2 (I had to remove the #!env stuff. I don't know how to keep them both). The AIC converter is now called when you press on the "c" key while pressing the "Run" button (this is a common key between us & fr keyboard as "a" was mapped to "q" on many non-fr keyboards.)
  2. When you press "c" while pussing the "Run" button, a new UI dedicated to AIC mode pops up:
    aic_choose.png
    aic_choose.png (213.48 KiB) Viewed 272945 times
    Using it you can select both the odd and even line color (0 will let the tool choose the best color for you).

    You can also tune the error damping factor. The closer it is to 1, the more the error is propagated downward. Usually this is set to something like 0.998, but as AIC doesn't have that many color available, so it is reduced down to 0.7. You can experiment with it and tell here which value seem to work the best for you (value of 0 disable the error propagation completely, resulting in much less colorful image, but less noisy as well which might be a good choice. I can't tell, I haven't experimented that much. Maybe 0.3 is the best compromise, please test & report.)

    By default conversion takes about 40secs on my machine because the tool compares all the 6x6=36 combination of odd/even lines color. But you can speed up by roughly two using the "Even <= Odd" entry. It adds extra constraints on the color pairs to be tested. Let's name c1 the color for odd lines, and c2 the one for even lines. If your choice is
    • 1, then only pairs where c1<=c2 are accepted (eg. couple 3,6 is possible but not 6,3)
    • -1, then only pairs where c2<=c1 are accepted (eg. 6,3 is possible, but not 3,6)
    • 0 then all c1,c2 are possible, even c1==c2 making it a monochrome picture.
  3. If you are happy with the settings, you can press "OK" and get the result.
    result.png
    result.png (124.16 KiB) Viewed 272945 times
    The tool indicates the chosen color pair in the bottom line with "AIC=c1,c2" (here c1=3, c2=6)

    You can compare the result between non AIC and AIC output here:
    result.png
    result.png (119.51 KiB) Viewed 272945 times
    AIC does not look that bad to me in spite of the missing "green" color for the leafs.

Re: Pictoric (was: New conversion algorithm)

Posted: Mon May 18, 2020 11:21 pm
by sam
sam wrote: Mon May 18, 2020 4:05 pm I'm about to think that ordered dither might be better for AIC but ordered dithering with Oric constraints is something different.
Well...
maybe.gif
maybe.gif (4.14 KiB) Viewed 272926 times
maybe_not.gif
maybe_not.gif (4.81 KiB) Viewed 272926 times

Re: Pictoric (was: New conversion algorithm)

Posted: Tue May 19, 2020 1:49 am
by 8bit-Dude
I actually quite like the one called "maybe".
What settings did you use to generate that one?

Re: Pictoric (was: New conversion algorithm)

Posted: Tue May 19, 2020 4:26 am
by 8bit-Dude
I picked up your latest version, and ended up using: err_att = 0.2 ~ 0.3, with aic = {{3,6}}
The results are pretty good imo!!! If you don't mind, I would like to integrate PictOric inside 8bit-Unity.

Re: Pictoric (was: New conversion algorithm)

Posted: Tue May 19, 2020 5:15 am
by 8bit-Dude
AH AH!!!! I found the ultimate trick!!!!

If I apply my AIC palette to the input image (21 colors that represent all possible combinations between AIC rows), then the result through Pictoric is much more vivid and colorful! I am really happy with the look of this! :D :D :D

Re: Pictoric (was: New conversion algorithm)

Posted: Tue May 19, 2020 7:36 am
by ibisum
Looks pretty good, and this is going to be an exciting release for Oric .. and it should be noted that the sitting guy on the left could just get a bit more white-space around his head area and it'd be a lot more clear to the player that its an entity for interaction.

Re: Pictoric (was: New conversion algorithm)

Posted: Tue May 19, 2020 9:27 am
by sam
8bit-Dude wrote: Tue May 19, 2020 1:49 am I actually quite like the one called "maybe".
What settings did you use to generate that one?
It is generated by the next version in the pipe. That version will contain some nice enhancements
  1. An algorithm to generate "Ordered" dithered image on the ORIC (NEW!). This works with AIC and non AIC.
  2. A setting panel to fine-tune things
  3. Persistent settings that are reused when you launch the tool again. This mean there is no need to go to the panel settings if you have found nice parameters.
  4. Some bugfixes (ofc).
Examples of what AIC can do in the future version (all without ordered dither which is better for cartoon-like pictures IMHO):
431877__magician_p.tap.png
431877__magician_p.tap.png (4.16 KiB) Viewed 272874 times
14mq23t.tap.png
14mq23t.tap.png (5.78 KiB) Viewed 272874 times
1142919-mandrill.tap.png
1142919-mandrill.tap.png (5.2 KiB) Viewed 272874 times
At the moment I use Bayer matrices which are a power of two in size. These aren't exact divisor of an Oric video-byte (6 pixel), so this could create some unwanted color clashes. I have build a promising 3x3 matrix that I need to check. The problem is that this leads to an explosion of parameters. I need to simplify this (or complexify the UI :-/ ).

Notice: :idea: If you have picture you want me to test, please provide a link to them and I'll try to see what I can do for them.