Page 2 of 3

Re: [Feature request] Posterization effect

Posted: Sat May 09, 2020 5:30 pm
by pango
Thanks mate :D

I spent most of the day trying to optimize it further, but it's hard! Shaders really don't like branching (and do like unrolling), and the non-trivial k-d tree algorithm is all about decimating a search tree...

The best I managed so far is to increase k-d tree depth by one, going from 8 leaf functions to 16, and consequently to usually test 18 colors instead of 36. But ShaderCompiler takes ages, the Unity Editor complains about some timeout after 600s, the shader eventually compiles anyway and works perfectly. Not sure it's too safe though :shock:
All attempts to speed up compilation resulted in either no change (the optimizing compiler undoing all my modifications) or code that doesn't compile (if I try to handle my own stack, the compiler complains it can't unroll my main loop).
Unless somebody comes with a totally new approach I guess it'll stay as-is... in any case, I'm learning about shaders...
And now I understand why barely anybody tried such insane idea :D (only a few using the naive approach on shadertoy)

-

Posted: Mon Jun 15, 2020 8:03 pm
by Lokkrin Zhataros
-

Re: [Feature request] Posterization effect

Posted: Mon Jun 15, 2020 10:44 pm
by pango
Thanks!

Palettization outputs RGB values taken from classic palette (from ART_PAL.COL to be precise).
So it has to be some color rendering difference after that step (darker/more saturated color is probably related to a higher gamma value).
(it could also be that plain DFU output - before post-processing - is brighter/more saturated than classic Daggerfall output, so palettization still picks color from classic palette, but has to pick more saturated colors. I think that's less likely though, but you can use Shift-F11 to dynamically switch post-processing on/off and check).

-

Posted: Tue Jun 16, 2020 6:29 am
by Lokkrin Zhataros
-

Re: [Feature request] Posterization effect

Posted: Tue Jun 16, 2020 9:47 am
by pango
Are you using default DFU lighting? (All ambient lightings to 1.0, player item based lighting off) It seems DFU uses less ambient lighting in your examples
I don't have DFU at hand to experiment right now, but I should probably do that.

By the way there has been a related discussion before on reddit: https://www.reddit.com/r/daggerfallunit ... nights_of/ (on brightness alone)

-

Posted: Tue Jun 16, 2020 11:45 pm
by Lokkrin Zhataros
-

Re: [Feature request] Posterization effect

Posted: Thu Jul 02, 2020 5:19 pm
by MasonFace
I wonder how linear vs gamma lighting will effect this.

Re: [Feature request] Posterization effect

Posted: Thu Jul 02, 2020 6:28 pm
by pango
We'll see, palettization does nothing about color balance, it just rounds each pixel's color to the closest one found in a palette, so balance may have to be fixed elsewhere.

On that topic, in 0.10.24 I've added 3 very dark grey values to the classic palette, that had no value between (0,0,0) and (15,15,15). That should help a bit with all low light condition, and as you mentioned they're a lot more of those in DFU than in classic. For example it should help at dawn and dusk times.
It makes the dungeons slightly less claustrophobic, but I think it's globally a good move:
darkness before.jpg
darkness before.jpg (133.76 KiB) Viewed 1797 times
darkness after.jpg
darkness after.jpg (134.15 KiB) Viewed 1797 times

-

Posted: Sun Jul 05, 2020 11:52 pm
by Lokkrin Zhataros
-

-

Posted: Mon Jul 06, 2020 2:34 am
by Lokkrin Zhataros
-