Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se |
|
|
|
|
#1 | Link |
|
Movie buff & shine
Join Date: Jan 2004
Location: Logan, the only hole above ground.
Posts: 257
|
New!! - Bleach Bypass filter
Inspired by my attempts to create a glow/bloom filter, and stumbling upon a tutorial about imitating a bleach bypass in AfterEffects, I decided to take a shot at creating the filter in AVISynth...
Previews can be found here.... http://actionman133.isa-geek.net/.../bleachbypass.html I should give credit Didée for writing FastGaussBlur (), which is used to provide a mask for some subtle blooming.... The settings are as follows: BleachBypass (clip, output, preview) output determines which image comes out. 0 returns the source image 1 returns the draft bleach bypass, no bloom applied 2 returns the full bypass, with blooming incorporated (default) preview will compare the original frame to the filtered frame. 0 returns the fully filtered frame (default) 1 returns half the image as the source, the other half as filtered. 2 presents all the used images for debugging purposes
__________________
I'm a boxer who can Bob () & Weave (). I like to Overlay () punches and Blur () his vision to ShowFiveVersions (). My KO punch will always Pulldown ().TimeStretch () and all he will hear is Tone (). |
|
|
|
|
|
#2 | Link |
|
Registered User
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
|
An old post I know, but anyone know where I might find this 'Bleach Bypass' filter (the above link is dead) ?
I'm not so much interested in the bloom/glow aspect, more in acheiving that 'dramatic-earthy-almost metallic/pewter' type effect.
__________________
Nostalgia's not what it used to be Last edited by WorBry; 24th March 2010 at 15:22. |
|
|
|
|
|
#3 | Link |
|
Registered User
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
|
OK, no takers, and I see Actionman133 hasnt been around the forum for a while.
So I'm putting together a method based on bits and pieces from the 'film-look' thread (I know, film-look....yawn, ho-hum) and various After Effects/PS/Gimp recipes. I'm want to process entirely in YV12 and found this (MaskTools based) YV12Overlay function in the 'film look' thread, which in part meets my needs: http://forum.doom9.org/showthread.ph...432#post641432 Adapted it like so: Code:
function yv12overlay(clip a,clip b,float "luma_opacity", float "chroma_desat")
{
yExpr="x "+string(luma_opacity)+" * y 1 "+string(luma_opacity)+" - * +"
uvExpr="x "+string(chroma_desat)+" * y 1 "+string(chroma_desat)+" - * +"
return mt_lutxy(a,b,yexpr=yExpr, uexpr=uvExpr, vexpr=uvExpr, Y=3, U=3, V=3)
}
Clip a = original source clip (Pal DV 25p progressive anamorphic) Clip b = greyscale of source clip to which has been applied a 'filmic' S-curve (luma only), using the Levels > Curve function in FFDShow (encoded HuffYuv-YV12). In this way I can vary both the degree of contrast modulation (introduced by the overlayed luma S-curve) and chroma desaturation. I know there are other things to consider, like simulated film-grain, glow, tint (maybe) etc, which I might look at later, but as a basic method I'm quite pleased with the results. This said, several of the AE/PS/Gimp recipes that I've come across recommend using a 'multiply' mode for merging the layered clips/images, which really gives a better representation of the contrast 'look' I am after. I can do this in AVISynth using the (internal core) Layer filter, but that means converting to YUY2. I'm sure the same can be done in YV12 with Masktools. Could anyone advise how I might modify the mt_Lutxy expressions in above YV12Overlay to acheive this, or else suggest an alternative....maybe mt_merge with an appropriate mask? Many thanks.
__________________
Nostalgia's not what it used to be Last edited by WorBry; 28th March 2010 at 05:10. |
|
|
|
|
|
#4 | Link |
|
Registered User
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
|
If anyone is interested
, actually now that I've examined the 'multiply' blending approach (using Layer filter in YUY2) with a wider range of clips, I realize that it's best suited for well and evenly exposed shots (outdoors on sunny days etc), that in, any case, could benefit from some darkening. For indoor and other unevenly lit shots, I find it over-darkens and loses detail in shadows rather too much. Maybe for digitized film images and professional-level digital camcorders and still cameras with a wide dynamic range, its a different story. But generally, with my consumer level DV camcorder (Panasonic GS400) I find that I can get more acceptable results by adjusting the overlayed luma S-curve at the lower end. So, I'll stick with my existing YV12Overlay method for now. This said, it would be nice to have a YV12 overlay function that incorporates the various layer blending modes (merge operations) commonly found in imaging software. The AVSynth core Overlay filter can do all of them, and Layer has some. Again, I'm sure all of this is possible in YV12 with Mask Tools. I'd have a go at putting one together myself if someone could help with the respective mt_lut expression calcs. Nuff said. One other thing, I've based my workflow on the assumption that the Levels>Curves function in FFDShow can work with YV12 without changing the color format - is this so, or does it convert to RGB and back?
__________________
Nostalgia's not what it used to be Last edited by WorBry; 29th March 2010 at 03:50. |
|
|
|
|
|
#5 | Link |
|
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,407
|
Oh well, the frame contrast issue, once more ...
A maybe-interesting reading reading as of recent: this thread, with emphasisis on this post. For what it's worth, here's three simple MaskTools functions: Multiply, inverse Multiply, and "128-centered Contrast Multiply" Code:
function mt_layer_mul(clip c1, clip c2)
{ mt_lutxy(c1,c2,"x y * 255 /",U=2,V=2) }
function mt_layer_invmul(clip c1, clip c2)
{ mt_lutxy(c1,c2,"256 256 x - 256 y - * 256 / -",U=2,V=2) }
function mt_layer_centermul(clip c1, clip c2)
{ mt_lutxy(c1,c2,"y 128 < x y * 128 / y 128 > 256 256 x - 128 y 128 - - abs * 128 / - x ? ?",U=2,V=2) }
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
|
|
|
|
|
#6 | Link |
|
Registered User
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
|
Thanks Obi-Wan. "Much to learn, I still have"
So, would I be right in concluding that the Inverse Multiply function corresponds to, what is commonly referred to as 'screen' mode blending in AE/PS and the like? And is the '128-centred-multiply' function essentially the same as 'overlay' mode, where 'multiply' is applied to values <128 and 'screen' to values >128 (cant get my head around the reverse polish syntax for the calc) ? If not, what would that mt_lutxy expression be? Why 255 for the 'multiply' but 256 for the other two? Edit: Tried 'overlay' blend mode in Gimp 2 with a frame grab. Rather different result to '128-centred multiply' - darkened shadows, lightened highlights. Actually, with lightly reduced opacity it gives a quite decent 'bleach by-pass' effect (at least in terms of what I am looking for), without resorting to pre/post curve adjustment. Makes sense, since it effectively amounts to an S-curve.
__________________
Nostalgia's not what it used to be Last edited by WorBry; 29th March 2010 at 19:47. |
|
|
|
|
|
#7 | Link | ||||
|
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,407
|
Quote:
Quote:
Quote:
Quote:
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
||||
|
|
|
|
|
#8 | Link | |
|
Registered User
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
|
Quote:
Thanks.
__________________
Nostalgia's not what it used to be Last edited by WorBry; 29th March 2010 at 20:40. |
|
|
|
|
|
|
#9 | Link |
|
Registered User
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
|
@Didee,
I've been experimenting with a few other 'blend modes'. 'Hardlight', as I understand, is simply a reversal (with respect to layers) of '128-centred multiply' (aka "Overlay"): Code:
function mt_layer_hardlight(clip c1, clip c2) # commuted 128_Centred Multiply
{ return mt_lutxy(c1,c2,"x 128 < y x * 128 / x 128 > 256 256 y - 128 x 128 - - abs * 128 / - y ? ?",U=2,V=2) }
"Soft light" appears to be a milder form of "Overlay", but I'm struggling to find a suitable formula, or at least one that easily translates to reverse polish. Furthermore, the various imaging suites appear to approach 'soft light' in different ways. For example, I found this set of blend formulae for Photoshop: http://www.nathanm.com/photoshop-blending-math/ But an attempt to translate 'Soft Light' formula using mt_polish gave just " y 128 < 2 x", which is clearly nonsense. Any chance you could help me out (again) with a suitable mt_lutxy expression ? ![]() Edit: Came across this earlier post of yours on 'Hardlight': http://forum.doom9.org/showthread.ph...132#post703132 Well that kinda blows my notion of 'Hard Light' being a simple layer reversal of 'Overlay' out of the water. BTW - in those 4 YV12Hardlight variants what is function of the 3-tiered (HL1) lut expressions? Is it to create an internal gradation of the effect, maybe to avoid discontinuance?
__________________
Nostalgia's not what it used to be Last edited by WorBry; 6th April 2010 at 18:42. |
|
|
|
|
|
#10 | Link |
|
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,407
|
"128" is the common center point used for the [0,255] range. Blame the restrictions of 8-bit colorspaces.
In any case, you need a neutral element for the do-nothing case. Using 127.5 as center is not good because you cannot do "nothing". And when you're going to use the result of mt_makediff(this,that) as the modifier clip, this one is 128-centered, too. Even worse: when the blend formula is centered to 127.5, then you can not *correctly* use the result of mt_makediff() as modifier clip: in that case, it will introduce a drift, because 128 would be supposed to do nothing. Also, don't forget to think out of the box - all these blending modes are not only useful for just modifying the overall frame contrast. You could also use them e.g. for sharpening tasks, and such. For which the presence of a discretely available center element is mandatory.
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
|
|
|
|
|
#11 | Link |
|
Registered User
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
|
Thanks for your explanation. In that case, I remain stumped on a suitable '128-Centred' formula for Softlight.
Based on the 'original' formula : Code:
Result= (((255-x) * ((x * y)/255)) + (x * (255-((255-x) * (255 - y))/255))) / 255 Code:
mt_lutxy(Clp1, Clp2, "255 x - x y * 255 / * x 255 255 x - 255 y - * 255 / - * + 255 /", y=3, u=2, v=2) Code:
SFL = " x 128 < 255 x - x y * 255 / * x 255 255 x - 255 y - * 255 / - * + 255 / "+String(Opac1)+" * x 1 "+String(Opac1)+" - * + " SFL = SFL + " x 128 > 255 x - x y * 255 / * x 255 255 x - 255 y - * 255 / - * + 255 / "+String(Opac2)+" * x 1 "+String(Opac2)+" - * + " SFL = SFL + " x ? ? " mt_lutxy(clp1,clp2, SFL, y=3, U=2, V=2) Code:
SFL = " x 128 < 256 x - x y * 256 / * x 256 256 x - 256 y - * 256 / - * + 256 / "+String(Opac1)+" * x 1 "+String(Opac1)+" - * + " SFL = SFL + " x 128 > 256 x - x y * 256 / * x 256 256 x - 256 y - * 256 / - * + 256 / "+String(Opac2)+" * x 1 "+String(Opac2)+" - * + " SFL = SFL + " x ? ? " mt_lutxy(clp1,clp2, SFL, y=3, U=2, V=2) ....both give this sort of pitting/stippling when a greyscale image is overlayed with pure black or white.....which I dont think should happen. http://www.mediafire.com/file/2wzwgm...%20overlay.png http://www.mediafire.com/file/m3ino2...%20overlay.png Converting to a 'If x<128 then, this......or Else (everything else)' resolves it (which is how I have it now in Blend_MT) but then it is not '128-centred' in terms of a neutral anchor point? Maybe, the SoftLight formula is a different case (for the reasons I suggested above) or is it possible to derive a workable half-equation solution (for x<128 and x>128) that doesnt upset the balance? I couldnt find one, and so resorted to using the 'full' formula for both halves.
__________________
Nostalgia's not what it used to be Last edited by WorBry; 12th May 2010 at 14:40. |
|
|
|
|
|
#12 | Link |
|
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,407
|
Obviously your LUT strings are somehow skewed. Assuming that the 1st clip is the "base" clip and the 2nd clip is the "modifier" clip, you would check for y>/<128, not x. Value 128 on the base clip doesn't need any special handling. Value 128 on the overlay clip is which needs to be checked.
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
|
|
|
|
|
#13 | Link |
|
Registered User
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
|
For sure, that fixes it, but then it's back to this issue of which clip the blend should be referencing/respecting. All of the descriptions for SoftLight I have seen say that (like Overlay) it references (and so reflects the characteristics - highlights, shadows) of the base clip e.g blending with black or white (as the top layer) doesnt result in pure black or white (as Hardlight does). But then I'm thinking, if it does the intended job, which it does, what the heck. So, I'll take your advice on the 'using y instead of x'. Thanks.
Modified the SoftLight formula in Blend_MT_alpha2 (post# 26) accordingly.
__________________
Nostalgia's not what it used to be Last edited by WorBry; 12th May 2010 at 17:55. |
|
|
|
|
|
#14 | Link |
|
Registered User
Join Date: Nov 2006
Posts: 4
|
I once tried to emulate a filmlook by using softlight/hardlight/overlay formulas, and got them stitched into a GPU shader filter (well, actually, Phaeron did the code, not me)
![]() The core calculation for softlight was: A = 1st layer (you can use colorgradients or grayscale on this) B = 2nd layer (ie. background) C = resulting composite Code:
if (A < 0.5)
C = (2 * A - 1) * (B - B * B) + B;
else
C = (2 * A - 1) * (sqrt(B) - B) + B;
http://forums.virtualdub.org/index.p...7&t=14597&st=0 The shader and the code: http://www.loadusfx.net/virtualdub/filmfxguide.htm In the examples I used it to just slightly colorgrade the video, but you can crank up the volume and do some mad stuff with it. Version 1.7.3 is based on a cineon style exposure, and it's here: http://www.loadusfx.net/virtualdub/F...FX%20v1.7.3.fx The code on my part is a bit goofy, I haven't cleaned it up + the terms are odd. But it's a tweaker's heaven with the sliders and all. I hope you can get some help from those. ^^ |
|
|
|
|
|
#15 | Link |
|
Registered User
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
|
Thanks for your input. I was beginning to wonder if anyone was interested in film-looks anymore.
If I'm not mistaken (always a possibilty), your Softlight code is based on the Photoshop formula, of which there seem to be various interpretations...some maybe incorrect. I do, at some point, intend to derive a workable mt_lutxy equation based on the Photoshop formula, to see how it compares with the 'Gimp-based' equation that I am using (references in post#22 ); it's interesting to note though that in some versions of Gimp (mine included) they used the same formula for Overlay and SoftLight - I understand this has now been changed. Your VDub Shader filter looks interesting (bearing in mind that this is a sub-forum for AVISynth useage). Of course, there are lots of things you can do with RGB, in terms of chroma, that are not so easy to replicate in YUV colorspace. My objective was to process entirely in YV12, without intermediate color space conversions, and mimimize, as far as possible, multi-stage layering (as it relates to the respective luma and chroma planes). The 'bleach' component of your filter is of interest, and I'll look at that some more. I did experiment quite a bit with a single 'contrast curve-desaturation' blend stage (using a greyscale overlay clip), but decided to keep them separate. That way you can independently control the strength of the luma contrast curve and the degree of chroma desaturation. In fact the SelSah (Selective Saturation & Hue) function that I put together allows you to restrict the saturation control to a defined luma range. Plus, you can choose which clip you want to use for 'controlling' the saturation, which might be the original clip or the blend product. This is relevant, because if one chooses to 'partially desaturate' (not a good term I know), the pattern will be influenced by the shape of the luma curve (that's just the way the function works)...which can be put to some advantage. Out of interest how do you install your filter? I've never used this type of VDub filter. Edit: Well I can see some instruction for installation in the virtualdub.org forum thread, but where do I find the GPUFilter vdf? Edit: Could you just clarify your definitions for the layers. As I understand your terminology: A = First Layer appears refer to the image ('modifier' as Didee more aptly puts it) that will be overlayed on top of the base image. B = Second Layer (i.e. background) I take to mean the base image. If so, this seems contrary to convention (in terms of 'layer' orientation), although consistent with Didee's assertion that it should be the 'modifier' clip that is referenced in partitioned equation. As you might have noted from my foregoing posts, I get hung up on this issue, not least because there are (supposed) Photoshop formulae out there that appear to have got things mixed up (for some modes). This, oft referred to, source being a case in point: http://www.nathanm.com/photoshop-blending-math/
__________________
Nostalgia's not what it used to be Last edited by WorBry; 14th May 2010 at 03:14. |
|
|
|
|
|
#16 | Link |
|
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,001
|
Ehmm you should be able to use that Shader with AviShader for Avisynth
![]() http://forum.doom9.org/showthread.php?s=&threadid=87295
__________________
all my compares are riddles so please try to decipher them yourselves :) It is about Time Join the Revolution NOW before it is to Late ! http://forum.doom9.org/showthread.php?t=168004 Last edited by CruNcher; 14th May 2010 at 00:14. |
|
|
|
|
|
#17 | Link |
|
Registered User
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
|
But it's still RGB though, isnt it? Believe me, if there was an AVISynth filter for generating custom curves (natively) in YV12, I likely wouldnt have gone down this blend mode road; 'possible', of course, with mighty Masktools v2, but way, way way, beyond my capabilities.
Still looking for this ethereal GPUFilter vdf plugin. If it's relevant, I'm running a GeForce 8400M GS card, Vista (SP2), Core2Duo CPU, DirectX 10.0. Dont really want to mess with the registry ('missing' dll's etc) if that's what it invloves.....I still have the scars. Edit: Loadus. Actually, from the information in your 'Film Fx' filter guide, I'm already pretty familiar with the processes involved. What intrigues me is the 'bleaching' effect. OK, I understand that in the 'normal process' adjustments are made in a greyscale copy and that this is applied to the original image with a Softlight blend. For the 'bleaching' component it is stated that: "The bleaching in the shader is done by reversing the effect of the shader. When bleaching, all the curves and gamma sliders are reversed. When the bleach is set to null (the slider is in the center) the EffectCurves and EffectGamma have no effect.... ....The effect layer of the shader is a grayscale copy of the original image and it is blended to the original using "SoftLight" blending, common in image editing programs. All the EffectCurves and EffectGamma's are done to that grayscale effectlayer". I'm wondering then if the 'bleaching' really just amounts to an opacity adjustment of the final Softlight blend?
__________________
Nostalgia's not what it used to be Last edited by WorBry; 14th May 2010 at 03:18. |
|
|
|
|
|
#18 | Link |
|
Registered User
Join Date: Nov 2006
Posts: 4
|
The SoftLight formula used in my code is from Paint Shop Pro (I guess it's "SoftLight Legacy" or similar in Photoshop) - basically an Overlay calculation that doesn't allow highlight tones from clipping over (ie. classic SoftLight that I use in almost all photo editing).
The bleach effect is done by making the overlay image negative/inversed. If you then apply a blur into the overlay layer (say, radius 20 on a 720 x 480 clip) you'll get a tonemapping effect, similar to the 'HDR' photostuff that peeps do. ^^ EDIT: If you're still looking for the filter, it's here: http://www.virtualdub.org/beta/gpufilter-0.6.zip Last edited by Loadus; 15th May 2010 at 17:35. |
|
|
|
|
|
#19 | Link | |||
|
Registered User
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
|
Thanks for your reply.
Quote:
Quote:
. I shoot most of my DV stuff in (Panasonic) 'Procinema' mode' which, apparently, uses some electronic jiggery-pokery in the signal amplification to extend the dynamic range (as claimed). Actually, it's a pretty good starting point for some of this 'film-look' stuff, aside from the pseudo-progressive (frame) motion, which I find a little too jittery, and the pesky aliasing to deal with. Waiting for further improvements in the 50p/60p and low-light capability of AVCHD cams before I make the jump to HD. Quote:
__________________
Nostalgia's not what it used to be Last edited by WorBry; 15th May 2010 at 20:39. |
|||
|
|
|
|
|
#20 | Link |
|
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,407
|
Of the various histogram-pictures that you have posted, each and every single one shows clipping. For evaluation, you probably want to add a final
ConvertToRGB32(matrix="PC.601") before returning.
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|