Color Correcting the Dragon Box - 3 Part Spectacular

Discussion regarding the entirety of the franchise in a general (meta) sense, including such aspects as: production, trends, merchandise, fan culture, and more.

Moderators: General Help, Kanzenshuu Staff

crabshank1
Beyond Newbie
Posts: 123
Joined: Tue Nov 09, 2010 6:26 pm

Re: Color Correcting the Dragon Box - 3 Part Spectacular

Post by crabshank1 » Tue Jun 18, 2019 8:58 am

lansing wrote: Tue Jun 18, 2019 7:52 am
crabshank1 wrote: Mon Jun 17, 2019 10:43 pm
Captain Awesome wrote: Mon Jun 17, 2019 10:03 pm I've been following the whole time, I love seeing your work I'm just a bit out of my depth technically so I haven't responded!
LOL, I was wondering if I was just shouting into the wind, but thanks; I appreciate this. This is uncharted territory, but I think I'm close to something good. :)
Nobody responded because nobody knows what you are trying to do. Your instruction is very poor that I doubt a single person can follow.

And judging from your resulting images, what you're doing is pretty much adjusting levels + sharpening, tbh I don't really see much difference from the before and after. And your usage of dithering is wrong, dithering is used to smooths out flat area where there are banding. I have no idea what you're trying to do here, all I see is that you're sharpening the grains.
The source is full of artefacts. Do you see any in the after? (Note: It's because of the dithering.)
How does the white balance look?
I couldn't really say a definitive way to do it earlier, because I was experimenting and I decided to share my results as I went along. Also, I only have one episode to work with.

Also, the grain is part of the image and I'm sure you've seen the backlash Funimation are getting for their DNR.

Just to clear it up, I'm trying to:
  • Remove macroblocks
  • White balance
  • Adjust hue, saturation and value channels

User avatar
lansing
Beyond Newbie
Posts: 284
Joined: Mon Jan 06, 2014 1:49 am

Re: Color Correcting the Dragon Box - 3 Part Spectacular

Post by lansing » Tue Jun 18, 2019 2:06 pm

crabshank1 wrote: Tue Jun 18, 2019 8:58 am The source is full of artefacts. Do you see any in the after? (Note: It's because of the dithering.)
How does the white balance look?
I couldn't really say a definitive way to do it earlier, because I was experimenting and I decided to share my results as I went along. Also, I only have one episode to work with.

Also, the grain is part of the image and I'm sure you've seen the backlash Funimation are getting for their DNR.

Just to clear it up, I'm trying to:
  • Remove macroblocks
  • White balance
  • Adjust hue, saturation and value channels
How do you see artifacts on the originals when they are basically covered with grain on top? While I see a lot of visibly sharpened grain on your result images. DNR is not a bad thing, the thing with Funimation is that their choice of DNR sucks.

As for the white balancing, I don't really notice anything, the before and after looks much the same to me.

crabshank1
Beyond Newbie
Posts: 123
Joined: Tue Nov 09, 2010 6:26 pm

Re: Color Correcting the Dragon Box - 3 Part Spectacular

Post by crabshank1 » Tue Jun 18, 2019 6:11 pm

lansing wrote: Tue Jun 18, 2019 2:06 pm
crabshank1 wrote: Tue Jun 18, 2019 8:58 am The source is full of artefacts. Do you see any in the after? (Note: It's because of the dithering.)
How does the white balance look?
I couldn't really say a definitive way to do it earlier, because I was experimenting and I decided to share my results as I went along. Also, I only have one episode to work with.

Also, the grain is part of the image and I'm sure you've seen the backlash Funimation are getting for their DNR.

Just to clear it up, I'm trying to:
  • Remove macroblocks
  • White balance
  • Adjust hue, saturation and value channels
How do you see artifacts on the originals when they are basically covered with grain on top? While I see a lot of visibly sharpened grain on your result images. DNR is not a bad thing, the thing with Funimation is that their choice of DNR sucks.

As for the white balancing, I don't really notice anything, the before and after looks much the same to me.
The artefacts are very obvious to me in the hair, and also they were coloured which made white balancing much more difficult so I had to get rid of them in the least destructive way, so I chose dithering and it worked. Now, the white balance would be easier to do.

I then had the problem of multicoloured grain in areas that are supposed to be greyscale, so I needed to average it out to grey. I settled on making a shader (de-saturate dither.hlsl) that remaps the range of the RGB channels to a smaller range that you control the size (#define crushing) of, takes the saturation and value of the resulting image (that you can see with #define debug 1), and then remaps it back to 0-1. This introduces rounding errors into the calculations that reduces small differences (crushes them basically).

As for the white balance, see the my original calibration image, the one where the hair is sometimes reddish, sometimes green and blue. The hair is on average greyscale now.

Also, check out the images of Kai TFC I posted where I fixed the white balance, I explained how to do it too.

My goals in doing this were to find a consistent method to do this no matter how the image looked; to satisfy the purists who always say "grain is part of the image" and "you've crushed the blacks"; to allow precise adjustments to each colour channel and create a tool that tells you exactly which settings to use; to remove artefacts in the least destructive way.

If throwing DNR on the resulting images would make you happy, then go ahead but for me I think Funimation should just colour correct their raw scans and release those with minimal crop on Blu-ray. I suggest you try it yourself, download my tools and use the final shader chain I posted, I'm sure you could get to your idea of perfection. I'm happy to answer any questions and everyone would learn something.

crabshank1
Beyond Newbie
Posts: 123
Joined: Tue Nov 09, 2010 6:26 pm

Re: Color Correcting the Dragon Box - 3 Part Spectacular

Post by crabshank1 » Wed Jun 19, 2019 2:05 pm

I'm going to summarise this to make it easier to follow:
  1. Download AviSynth+, my .zip file containing AvsPmod and the required shaders, and the contents of my relevant GIthub repo.
  2. Import your video into AviSynth.
  3. Input the relevant code required to use shaders.
  4. Upscale your image. I recommend 2x or 4x the size of the final output (640x480 in this case).
  5. Using Shader("HSV dither.hlsl"), increase the standard deviation (by whole numbers works fine), for each RGB channel until the macroblocks disappear.
  6. Create an image made only of areas that are supposed to be greyscale, the more the better (I shall refer to this as the 'white balance calibration image')
  7. Load your image into AvsPmod and apply the same dithering shader that you made to make the macroblocks disappear, then downscale your image if necessary.
  8. To white balance, match all the RGB channels to one channel using the image histogram web page from my Github and the remap.hlsl shader. For example, the green channel in my white balance calibration image had no big dark patches in it whereas all the others did, so I chose to map the Red and Blue channels to the Green channel.
  9. Downscale your video.
  10. On this now downscaled image, using Shader("De-saturate dither.hlsl"), change the value of '#define crushing [value here]' until you're happy that the coloured noise you added from the dithering has disappeared from the blacks and that the blacks haven't been overly crushed.
  11. Make a copy of remap.hlsl, with which you will adjust the HSV channels and chain this onto Shader("De-saturate dither.hlsl").
  12. In the aforementioned new remapping shader, adjust the hues. For this I find the easiest way is to find out the current hues you wish to change, I just did it manually using hues from Hikari TV as reference and changing the hues in the image to them, but if any of these are less than 360° and you want to make them more than 0° or they are more than 0° and you want to make them less than 360°, you will need to rotate the hues and add the new hue after rotation as a fixed point.

    For example if you have a hue of 357° and you want to make it 7°, you will need to write

    Code: Select all

    static float rotate_hues = 10;
    and then add "7,7," as a point.

    If you have rotated, will you need to get the hues you wish to change again, as they will have changed.
That's where I'm up to so far, the next stage is remapping the saturation and value channels, but that's difficult for me at the moment as there's no reference for them. Obviously just add

Code: Select all

ExecuteShader(last, Input)
as the next line.

I hope this has clarified things, if not I will explain more.

crabshank1
Beyond Newbie
Posts: 123
Joined: Tue Nov 09, 2010 6:26 pm

Re: Color Correcting the Dragon Box - 3 Part Spectacular

Post by crabshank1 » Fri Jun 21, 2019 2:54 am

I was just thinking, because remapping the hues is so easy, you could have different versions with different colours for Z. E.g. one with full colour manga colours, one with Kai colours and one with cel colours. Using these as references might help with figuring out what the saturation channels should be like.

Hugo2003DBZ
Newbie
Posts: 24
Joined: Mon May 14, 2018 6:43 am

Re: Color Correcting the Dragon Box - 3 Part Spectacular

Post by Hugo2003DBZ » Fri Jun 21, 2019 3:37 pm

Dragon Box:
Image

Color Correction:
Image

crabshank1
Beyond Newbie
Posts: 123
Joined: Tue Nov 09, 2010 6:26 pm

Re: Color Correcting the Dragon Box - 3 Part Spectacular

Post by crabshank1 » Fri Jun 21, 2019 3:58 pm

Hugo2003DBZ wrote: Fri Jun 21, 2019 3:37 pm Dragon Box:
Image

Color Correction:
Image
CC looks off, what settings are you using?

My attempt (Dithered; RGB channels matched to value 0-255, chose this because it used the least remapping points thus less CPU power; crushing at 0.2):
Image

and the above with no crushing, just to compare:
Image

Hugo2003DBZ
Newbie
Posts: 24
Joined: Mon May 14, 2018 6:43 am

Re: Color Correcting the Dragon Box - 3 Part Spectacular

Post by Hugo2003DBZ » Fri Jun 21, 2019 4:52 pm

crabshank1 wrote: Fri Jun 21, 2019 3:58 pm

CC looks off, what settings are you using?
Filters of VirtualDub... :oops:
Image
crabshank1 wrote: Fri Jun 21, 2019 3:58 pmMy attempt (Dithered; RGB channels matched to value 0-255, chose this because it used the least remapping points thus less CPU power; crushing at 0.2):
Image

and the above with no crushing, just to compare:
Image
Interesting...

crabshank1
Beyond Newbie
Posts: 123
Joined: Tue Nov 09, 2010 6:26 pm

Re: Color Correcting the Dragon Box - 3 Part Spectacular

Post by crabshank1 » Fri Jun 21, 2019 6:07 pm

Hugo2003DBZ wrote: Fri Jun 21, 2019 4:52 pm
crabshank1 wrote: Fri Jun 21, 2019 3:58 pm

CC looks off, what settings are you using?
Filters of VirtualDub... :oops:
Image
crabshank1 wrote: Fri Jun 21, 2019 3:58 pmMy attempt (Dithered; RGB channels matched to value 0-255, chose this because it used the least remapping points thus less CPU power; crushing at 0.2):
Image

and the above with no crushing, just to compare:
Image
Interesting...
Yeah, I used the procedure I posted earlier in the thread (in the spoiler tag). It's experimental but it worked for this image as well. However, when I tried to correct the hues it created a large variance in some areas, i.e. Goku's gi on his left shoulder had a big range from red to orange, and his undershirt one of blue to purple :(

Hugo2003DBZ
Newbie
Posts: 24
Joined: Mon May 14, 2018 6:43 am

Re: Color Correcting the Dragon Box - 3 Part Spectacular

Post by Hugo2003DBZ » Fri Jun 21, 2019 6:30 pm

Image

Other attemp

crabshank1
Beyond Newbie
Posts: 123
Joined: Tue Nov 09, 2010 6:26 pm

Re: Color Correcting the Dragon Box - 3 Part Spectacular

Post by crabshank1 » Fri Jun 21, 2019 6:39 pm

crabshank1 wrote: Fri Jun 21, 2019 6:07 pm However, when I tried to correct the hues it created a large variance in some areas, i.e. Goku's gi on his left shoulder had a big range from red to orange, and his undershirt one of blue to purple :(
Caused by the dithering no doubt, so do the hues first,which means the new procedure looks like this:

  1. Download AviSynth+, my .zip file containing AvsPmod and the required shaders, and the contents of my relevant GIthub repo.

    First download and install Avisynth-Plus-r1576.exe http://avs-plus.net/ (Homepage link), then download and extract this .zip file somewhere https://1drv.ms/u/s!AjHPdv1_75reiQCdDWp ... M?e=B9T9PJ.

    Then all you need to do is change the cd and input variables' paths to where the files are on your system (from "To apply Remap README.txt"), paste it into the main console and it should work. I suggest that you create a new remap.hlsl file, with a different name, for each scene (/time interval) then encode.
  2. Import your video into AviSynth.
  3. Input the relevant code required to use shaders.
  4. Upscale your image. I recommend 2x or 4x the size of the final output (640x480 in this case).

  5. Make a copy of remap.hlsl, with which you will adjust the hues. For this I find the easiest way is to find out the current hues you wish to change, I just did it manually using hues from Hikari TV as reference and changing the hues in the image to them, but if any of these are less than 360° and you want to make them more than 0° or they are more than 0° and you want to make them less than 360°, you will need to rotate the hues and add the new hue after rotation as a fixed point.

    For example if you have a hue of 357° and you want to make it 7°, you will need to write

    Code: Select all

    static float rotate_hues = 10;
    and then add "7,7," as a point.

    If you have rotated, will you need to get the hues you wish to change again, as they will have changed.
  6. Using Shader("HSV dither.hlsl"), increase the standard deviation (by whole numbers works fine), for each RGB channel until the macroblocks disappear.
  7. Create an image made only of areas that are supposed to be greyscale, the more the better (I shall refer to this as the 'white balance calibration image')
  8. Load your image into AvsPmod and apply the same dithering shader that you made to make the macroblocks disappear, then downscale your image if necessary.
  9. To white balance, match all the RGB channels to one channel using the image histogram web page from my Github and the remap.hlsl shader. For example, the green channel in my white balance calibration image had no big dark patches in it whereas all the others did, so I chose to map the Red and Blue channels to the Green channel.
  10. Downscale your video.
  11. On this now downscaled image, using Shader("De-saturate dither.hlsl"), change the value of '#define crushing [value here]' until you're happy that the coloured noise you added from the dithering has disappeared from the blacks and that the blacks haven't been overly crushed.

crabshank1
Beyond Newbie
Posts: 123
Joined: Tue Nov 09, 2010 6:26 pm

Re: Color Correcting the Dragon Box - 3 Part Spectacular

Post by crabshank1 » Fri Jun 21, 2019 8:57 pm

Hugo2003DBZ wrote: Fri Jun 21, 2019 6:30 pm Image

Other attemp
My second attempt, I tried to match Kai hues and crushing is only at 0.14, because I didn't upscale as the amount of processing was too much. I applied all these shaders at 640x480:
Image

crabshank1
Beyond Newbie
Posts: 123
Joined: Tue Nov 09, 2010 6:26 pm

Re: Color Correcting the Dragon Box - 3 Part Spectacular

Post by crabshank1 » Fri Jun 21, 2019 9:06 pm

From now on, I will update the procedure like so, with additions/changes in green.
  1. Download AviSynth+, my .zip file containing AvsPmod and the required shaders, and the contents of my relevant GIthub repo.

    First download and install Avisynth-Plus-r1576.exe http://avs-plus.net/ (Homepage link), then download and extract this .zip file somewhere https://1drv.ms/u/s!AjHPdv1_75reiQCdDWp ... M?e=B9T9PJ.

    Then all you need to do is change the cd and input variables' paths to where the files are on your system (from "To apply Remap README.txt"), paste it into the main console and it should work. I suggest that you create a new remap.hlsl file, with a different name, for each scene (/time interval) then encode.
  2. Import your video into AviSynth.
  3. Input the relevant code required to use shaders.
  4. (OPTIONAL){Upscale your image. I recommend 2x or 4x the size of the final output (640x480 in this case).}
  5. Make a copy of remap.hlsl, with which you will adjust the hues. For this I find the easiest way is to find out the current hues you wish to change, I just did it manually using hues from Hikari TV as reference and changing the hues in the image to them, but if any of these are less than 360° and you want to make them more than 0° or they are more than 0° and you want to make them less than 360°, you will need to rotate the hues and add the new hue after rotation as a fixed point.

    For example if you have a hue of 357° and you want to make it 7°, you will need to write

    Code: Select all

    static float rotate_hues = 10;
    and then add "7,7," as a point.

    If you have rotated, will you need to get the hues you wish to change again, as they will have changed.
  6. Using Shader("HSV dither.hlsl"), increase the standard deviation (by whole numbers works fine), for each RGB channel until the macroblocks disappear.
  7. Create an image made only of areas that are supposed to be greyscale, the more the better (I shall refer to this as the 'white balance calibration image')
  8. Load your image into AvsPmod and apply the same dithering shader that you made to make the macroblocks disappear, then downscale your image if necessary.
  9. To white balance, match all the RGB channels to one channel using the image histogram web page from my Github and the remap.hlsl shader. For example, the green channel in my white balance calibration image had no big dark patches in it whereas all the others did, so I chose to map the Red and Blue channels to the Green channel.
  10. (OPTIONAL){Downscale your video.}
  11. (OPTIONAL){On this now downscaled image,} using Shader("De-saturate dither.hlsl"), change the value of '#define crushing [value here]' until you're happy that the coloured noise you added from the dithering has disappeared from the blacks and that the blacks haven't been overly crushed.

crabshank1
Beyond Newbie
Posts: 123
Joined: Tue Nov 09, 2010 6:26 pm

Re: Color Correcting the Dragon Box - 3 Part Spectacular

Post by crabshank1 » Sat Jun 22, 2019 10:28 am

The notorious Dragon Ball Episode 109:

Image

Image

Image

Image

Image

Image

Image

Image

Crushing at 0.08.

I will update the chain in a sec.

crabshank1
Beyond Newbie
Posts: 123
Joined: Tue Nov 09, 2010 6:26 pm

Re: Color Correcting the Dragon Box - 3 Part Spectacular

Post by crabshank1 » Sat Jun 22, 2019 10:40 am

  1. Download AviSynth+, my .zip file containing AvsPmod and the required shaders, and the contents of my relevant GIthub repo.

    First download and install Avisynth-Plus-r1576.exe http://avs-plus.net/ (Homepage link), then download and extract this .zip file somewhere https://1drv.ms/u/s!AjHPdv1_75reiQCdDWp ... M?e=B9T9PJ.

    Then all you need to do is change the cd and input variables' paths to where the files are on your system (from "To apply Remap README.txt"), paste it into the main console and it should work. I suggest that you create a new remap.hlsl file, with a different name, for each scene (/time interval) then encode.
  2. Import your video into AviSynth.
  3. Input the relevant code required to use shaders.
  4. (OPTIONAL){Upscale your image. I recommend 2x or 4x the size of the final output (640x480 in this case).}
  5. Make a copy of remap.hlsl, with which you will adjust the hues. For this I find the easiest way is to find out the current hues you wish to change, I just did it manually using hues from Hikari TV as reference and changing the hues in the image to them, but if any of these are less than 360° and you want to make them more than 0° or they are more than 0° and you want to make them less than 360°, you will need to rotate the hues and add the new hue after rotation as a fixed point.

    For example if you have a hue of 357° and you want to make it 7°, you will need to write

    Code: Select all

    static float rotate_hues = 10;
    and then add "7,7," as a point.

    If you have rotated, will you need to get the hues you wish to change again, as they will have changed.
  6. Using Shader("HSV dither.hlsl"), increase the standard deviation (by whole numbers works fine), for each RGB channel until the macroblocks disappear.
  7. Create an image made only of areas that are supposed to be greyscale, the more the better (I shall refer to this as the 'white balance calibration image')
  8. Load your image into AvsPmod and apply the same dithering shader that you made to make the macroblocks disappear, then downscale your image if necessary.
  9. To white balance, match all the RGB channels to one channel using the image histogram web page from my Github and the remap.hlsl shader. For example, the green channel in my white balance calibration image had no big dark patches in it whereas all the others did, so I chose to map the Red and Blue channels to the Green channel.
  10. To fix the value channel, open a frame (with blown out highlights) in GIMP and do Colors > Auto > Stretch Contrast. Which will create a reference image for the values, but most of the time this image will be basically the same. You then match your image to the one you just made in GIMP and paste the remapping points into the same file in which you white balanced (adjusted RGB channels).
  11. (OPTIONAL){Downscale your video.}
  12. (OPTIONAL){On this now downscaled image,} using Shader("De-saturate dither.hlsl"), change the value of '#define crushing [value here]' until you're happy that the coloured noise you added from the dithering has disappeared from the blacks and that the blacks haven't been overly crushed.

    Credit to ect5150 and jasonspidey71 for helping me get this far.

    This guide is nearly complete, the last hurdle is adjusting the saturation channel.

crabshank1
Beyond Newbie
Posts: 123
Joined: Tue Nov 09, 2010 6:26 pm

Re: Color Correcting the Dragon Box - 3 Part Spectacular

Post by crabshank1 » Sat Jun 22, 2019 11:26 am

A note about the dithering is that it looks much worse at 640x480 than when you upscale it beforehand.

crabshank1
Beyond Newbie
Posts: 123
Joined: Tue Nov 09, 2010 6:26 pm

Re: Color Correcting the Dragon Box - 3 Part Spectacular

Post by crabshank1 » Sat Jun 22, 2019 1:51 pm



crabshank1
Beyond Newbie
Posts: 123
Joined: Tue Nov 09, 2010 6:26 pm

Re: Color Correcting the Dragon Box - 3 Part Spectacular

Post by crabshank1 » Sun Jun 23, 2019 4:03 am

So, when I did a real-time playback in 32-bit Pot Player it said that the bitrate for my CC/Avisynth script was just under 250,000kbps (ouch!) and I thought it looked quite noisy, but when I checked the original it was noisy too and because my methods are extremely purist I obviously enhanced the noise too.

The good news is that anyone who wishes to do extra processing now has a much better source material upon which to do it. So if you want (temporal) degrain, Kai-ification, chroma blur or whatever, I suggest you don't do any crushing and then add these filters. I consider crushing to be kind of like these filters, but a purist version because the only way any detail is lost is because floating point numbers are finite.

I will share my shader files for E109 soon, maybe later today, and then maybe people can start adding whatever effects they want, I'm gonna keep my work strictly purist though :)

Can't wait to see other people's takes.

HakkaiBills93
Banned
Posts: 551
Joined: Fri Jul 07, 2017 3:04 pm

Re: Color Correcting the Dragon Box - 3 Part Spectacular

Post by HakkaiBills93 » Sun Jun 23, 2019 7:44 am

interesting work, i hope that your settings will be ok soon :)

Locked