Old 20th May 2003, 10:38   #1
Magic.X
Major Dude
 
Magic.X's Avatar
 
Join Date: Feb 2002
Location: Leipzig / Germany
Posts: 859
Lightbulb Custom Blending Mode!

There should be a scriptable custom Blending mode where you could define the Blending yourselfes.

I would like to see this basically within the effect list (input & output) but everything else like buffers would be appreciated.

How should it work?

The layout & functions of the DM / SSC should do it, we only need 6 new vars:
-source#red
-source#blue
-source#green
-destination#red
-destination#blue
-destination#green

This way you can get the color values of the source frame as well as frame you want it to blend to, in coaxial or radial coordinates, as you like.

What can we do with it? Something like UnConeDs Channelshifter APE would be quite easy and as we can add loads of code hyperweird color effects would be possible, even better ones as within an dyn color movement.

*droooooooooool*


-=[The Ultimate VJ-Tool for AVS]=-

Hotlist 2.3 developement thread (old)
Magic.X is offline   Reply With Quote
Old 20th May 2003, 15:07   #2
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
forget it...winamp wont do it. i lost all hopes now. UnConeD has retired and no one else has such abilities.

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 20th May 2003, 15:54   #3
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
and it's already been suggested several times.
and i'm not even sure if it's such a good idea in the first place. ask yourself, what would you actually make with this?

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 20th May 2003, 16:55   #4
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
You do realize this would slow a preset to a crawl, right?

UnConeD is offline   Reply With Quote
Old 21st May 2003, 06:24   #5
Zevensoft
Major Dude
 
Zevensoft's Avatar
 
Join Date: Apr 2002
Location: Ballarat, Australia
Posts: 529
I see what he means, and no it's not as slow or bad as people think. It works like this...

The old formula: dst = src*alpha + dst*(1-alpha) for each component.

What he's suggesting: dst = src*alpha1 + dst*alpha2 + alpha3 for each component.

Basically, instead of just specifying alpha in a DM, you can specify alpha1 = 1 and alpha2 = 1 for additive, alpha1 = .5 and alpha2 = 1-alpha3 for 50/50 blend (original style), or even alpha1 = -1 and alpha2 = 1 for subtractive. Just imagine the weird effects possibly by playing around with alpha1, alpha2, and alpha3 (the bias).

1 | 2 | 3 | 4 | 3W | 4WW
Zevensoft is offline   Reply With Quote
Old 21st May 2003, 06:30   #6
Zevensoft
Major Dude
 
Zevensoft's Avatar
 
Join Date: Apr 2002
Location: Ballarat, Australia
Posts: 529
And yes, having r_alphax, g_alphax, and b_alphax wouldn't slow it down, since it recalcs the blend code for each component anyway.

1 | 2 | 3 | 4 | 3W | 4WW
Zevensoft is offline   Reply With Quote
Old 21st May 2003, 10:35   #7
Magic.X
Major Dude
 
Magic.X's Avatar
 
Join Date: Feb 2002
Location: Leipzig / Germany
Posts: 859
In fact i mean

The RGB source values (the frame you're blending form, the just calculated one):
alpha_r_s
alpha_b_s
alpha_g_s

And the RGB destination values (the frame you're blending to):

alpha_r_d
alpha_b_d
alpha_g_d

Only little changes with awesome possibillities.

[Edit] Atero, i WOULD make some great color movements. Doing something like a channelshifter including blending between modes would be some of the easiest thing s you coud do. It would be a new way to render objects, as you can define colors now. It would be f**king great!


-=[The Ultimate VJ-Tool for AVS]=-

Hotlist 2.3 developement thread (old)
Magic.X is offline   Reply With Quote
Old 21st May 2003, 11:52   #8
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
Okay now I just don't get it. How would you do a channelshifter with this setup? You'd need a 3x3 matrix of coefficients for both source and destination... otherwise there is no way to swap information between channels.

Though you have to remember that the whole blending pixels thing is done through very fast MMX assembly code. AVS doesn't split the channels into separate components, it works with all 3 at once.

The alpha_r_s/d, alpha_g_s/d, alpha_b_s/d thing would only work with positive alpha's in the range 0..1 with the exception that one of the two sets can be completely negative.

This is how alpha blending is done:
* 32-bit pixel 00R1G1B1 is mmx-unpacked into 0000_00R1_00G1_00B1
* 32-bit pixel 00R2G2B2 is mmx-unpacked into 0000_00R2_00G2_00B2
* pixel 1 is multiplied by 0000_00S1_00S1_00S1, where S1 is its alpha value * 256 (_ = separator, the whole is a 64-bit number).
* pixel 2 is multiplied by 0000_00S2_00S2_00S2 where S2 = (256 - S1)

After multiplication, the two pixels are added together, so each channel will contain a value between 0 and 65536 (2^16). Then the lower bytes are discarded and the result is packed back into a 32-bit color.

This means that (alpha1+alpha2) always has to be 0..1 (and both alpha1 and alpha2 separately separately as well). Otherwise after multiplication and addition, the channels will not fit into 16-bits and overflow occurs.
This is also what happens with convolution.ape when the sum of all values in the matrix is > 256.

Negative alpha values could be allowed for one of the two, by simply subtracting the colors instead of adding them.

Instead of one alpha value, you could allow several alpha values so that instead of 0000_00S1_00S1_00S1 you multiply by 0000_00A1_00B1_00C1 (3 separate alpha values).

The only thing you could do is NOT use MMX, but then it would indeed be ultra-slow.

UnConeD is offline   Reply With Quote
Old 21st May 2003, 13:56   #9
Zevensoft
Major Dude
 
Zevensoft's Avatar
 
Join Date: Apr 2002
Location: Ballarat, Australia
Posts: 529
Damnit, and I here I am thinkin MMX was high and mighty. At least you explained it in terms I could understand, no DUnCe.

1 | 2 | 3 | 4 | 3W | 4WW
Zevensoft is offline   Reply With Quote
Old 22nd May 2003, 10:48   #10
Magic.X
Major Dude
 
Magic.X's Avatar
 
Join Date: Feb 2002
Location: Leipzig / Germany
Posts: 859
UnConeD, this is fore sure nothing for an selfmade APE, this would be a supercomplex high end plugin - which in fact could only be made by the nullsoft guys.

To answer the MMX Question: do you think DM works without MMX? Nope. So this is possible too with seperated color channels.

How can i do Channelshifting? Simple we switch on beat between 6 modes

This is an example for mode 1 (RGB -> BRG):
col_r_d=col_b_s
col_g_d=col_r_s
col_b_d=col_g_s

This is an example for 50/50 blending:
col_r_d=(col_r_d)/2+(col_r_s)/2;
col_g_d=(col_g_d)/2+(col_g_s)/2;
col_b_d=(col_b_d)/2+(col_b_s)/2;

This shows how we do 50/50 on red channel, max blending on green channel and source red -> destination blue channelshifting at once:
col_r_d=(col_r_d)/2+(col_r_s)/2;
col_g_d=max(col_g_d,col_g_s);
col_b_d=col_r_s;

Understood now what i meant? (Sorry for the confusing expression "alpha" in my last post "COLOR" describes best what i mean)


-=[The Ultimate VJ-Tool for AVS]=-

Hotlist 2.3 developement thread (old)
Magic.X is offline   Reply With Quote
Old 22nd May 2003, 11:12   #11
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
Magic.X: what you're describing would be ULTRA slow. Trust me, even Nullsoft couldn't speed that up.

Compare it to a superscope with n=320*240=76800.

UnConeD is offline   Reply With Quote
Old 22nd May 2003, 12:38   #12
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
Magix, UnconeD told me this before, you will have to split RGB values of the color, then do all the alpha-blending stuff, then convert this back to color. I have played around all this stuff when I was making Dynamic Clear Screen and now understand parts of it.

btw. This will have to be so many times!

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 22nd May 2003, 20:28   #13
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
unconed - i think magic is suggesting this would work the same way as dm, with a much smaller amounts of calculations per frame (say 28x24x3=2016). this would still be far too slow though...equivalent to three seperate complex dynamovs.

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 23rd May 2003, 01:56   #14
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
Err atero, the formulas HAVE to be evaluated per pixel. No way around that.

UnConeD is offline   Reply With Quote
Old 23rd May 2003, 02:01   #15
dirkdeftly
Forum King
 
dirkdeftly's Avatar
 
Join Date: Jun 2001
Location: Cydonia, Mars
Posts: 2,651
Send a message via AIM to dirkdeftly
...how come...?

"guilt is the cause of more disauders
than history's most obscene marorders" --E. E. Cummings
dirkdeftly is offline   Reply With Quote
Old 23rd May 2003, 10:34   #16
Magic.X
Major Dude
 
Magic.X's Avatar
 
Join Date: Feb 2002
Location: Leipzig / Germany
Posts: 859
Anyway, i think debating about "possible", "impossible" or "possible but überslow" aint the right way.

Most of you will agree thast this effect would kick ass, so why don't put it into the whishlist???

Besides, by now there are more powerfull optimized programming methods out there than MMX. There gotta be a way to do this, or how do modern Animation or Photoediting progs handle their work?


-=[The Ultimate VJ-Tool for AVS]=-

Hotlist 2.3 developement thread (old)
Magic.X is offline   Reply With Quote
Old 23rd May 2003, 14:17   #17
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
Magic.X: easy, they don't work real-time :P.

UnConeD is offline   Reply With Quote
Old 24th May 2003, 04:36   #18
sidd
Major Dude
 
sidd's Avatar
 
Join Date: May 2003
Location: Australia
Posts: 1,353
so if that idea would be so slow, how come your channel shifter aint?
Im pressuming that you cant use mmx at all for that.
sidd is offline   Reply With Quote
Old 25th May 2003, 22:11   #19
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
Because channel shifter just switches the channels around without doing any processing on them.

Here are the instructions I use to process one pixel in the eax register.

e.g.
RBG:
xchg ah, al;

BRG:
mov dl, al;
shr eax, 8;
bswap eax;
mov ah, dl;
bswap eax;

BGR:
bswap eax;
shr eax, 8;

GBR:
mov edx, eax;
bswap edx;
shl eax, 8;
mov al, dh;

GRB:
shl eax, 8;
bswap eax;
xchg ah, al;
bswap eax;
shr eax, 8;


As you can see, the amount of instructions depends on the mode, because of the way an x86 processor is layed out.
Doing a custom blend mode would require at least 40-50 lines of assembly code per pixel and that would be in the case of optimized compiled assembly. In reality, the code you type yourself would be executed slowly and inefficiently because writing a decent, optimizing compiler is waaay out of the scope of this project.

UnConeD is offline   Reply With Quote
Old 26th May 2003, 08:54   #20
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
Simple and fast rgb swaping example is given with Render / Picture II source

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 26th May 2003, 10:32   #21
Magic.X
Major Dude
 
Magic.X's Avatar
 
Join Date: Feb 2002
Location: Leipzig / Germany
Posts: 859
Quote:
Originally posted by UnConeD
Magic.X: easy, they don't work real-time :P.
My Photoediting prog gives me a realtime preview (fullsized) so i can adjust the effect and add it if i'm done. Whats the Diffrence now?

This effect is just the same as a blend only DM - perpixel manipulation. If you like we could specify a rastersize (just as the DM has) to save some rendering power.

Anyway, we shouldnt drop the idea just because we think its impossible. This is a WHISHlist not a READYSOLUTIONSlist


-=[The Ultimate VJ-Tool for AVS]=-

Hotlist 2.3 developement thread (old)
Magic.X is offline   Reply With Quote
Old 26th May 2003, 11:25   #22
sidd
Major Dude
 
sidd's Avatar
 
Join Date: May 2003
Location: Australia
Posts: 1,353
MagicX, good point.. but if you use a grid, like the dm's, how do you calculate inbetween pixels? Bilinear wont work.
sidd is offline   Reply With Quote
Old 26th May 2003, 12:50   #23
UnConeD
Whacked Moderator
 
UnConeD's Avatar
 
Join Date: Jun 2001
Posts: 2,104
Eh?
MagicX... AVS has to render at 20-30 FPS. That means maximum 50 ms to do this effect, and that's for a preset including ONLY this effect.
A much more realistic target would be 5-10ms or less.

Your photoshop might look 'realtime', but it probably has a latency of about 300-400ms.

Anyway I'm tired of discussing this. If you're so convinced it IS possible, then by all means, pick up a C++/ASM book and start coding!

UnConeD is offline   Reply With Quote
Old 27th May 2003, 10:35   #24
Magic.X
Major Dude
 
Magic.X's Avatar
 
Join Date: Feb 2002
Location: Leipzig / Germany
Posts: 859
This is so depressing...!


-=[The Ultimate VJ-Tool for AVS]=-

Hotlist 2.3 developement thread (old)
Magic.X is offline   Reply With Quote
Old 20th June 2003, 17:32   #25
jonasc1
Member
 
Join Date: Aug 2002
Location: Norway
Posts: 78
Send a message via AIM to jonasc1
Maybe if it was a plugin like an Ape with a extra blend mode. some APE's have blend modes. so since it works in an ape so why should it not work alone in a way the AVS understand it. So wath im sayin is not a scriptable blend mode system but as an plugin writen in some computer language like APE's.
Did anyone get it?
jonasc1 is offline   Reply With Quote
Old 20th June 2003, 17:49   #26
mikm
Major Dude
 
mikm's Avatar
 
Join Date: May 2001
Location: somewhere else
Posts: 1,286
don't revive threads, god damn it!!!

Anyways, if we wanted to access buffers, an APE could not handle that. APEs are .dll's and are written in c++


and please read the rest of the thread. I think you do not understand what you or anybody else is saying.

powered by C₈H₁₀N₄O₂
mikm is offline   Reply With Quote
Old 21st June 2003, 15:07   #27
shreyas_potnis
Major Dude
 
shreyas_potnis's Avatar
 
Join Date: Jan 2003
Location: Mumbai, India
Posts: 787
jonasc1, did you read the previous stuff?

http://home.iitb.ac*****~shreyaspotnis
shreyas_potnis is offline   Reply With Quote
Old 23rd June 2003, 14:55   #28
Magic.X
Major Dude
 
Magic.X's Avatar
 
Join Date: Feb 2002
Location: Leipzig / Germany
Posts: 859
Unlikely, or he did'nt understands it maybe this discussion got too technified.

I recently downloaded the new Athlon 64 tech docs to see wheter there is a solution to this problem.

With the lack of Buffer Access it could be done as an APE. The main question now is only the speed.


-=[The Ultimate VJ-Tool for AVS]=-

Hotlist 2.3 developement thread (old)
Magic.X is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Visualizations > AVS > AVS Wishlist

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump