Re: Alphablending



På Sat, 29 Apr 2006 13:07:10 +0200, skrev jukka@xxxxxxxxxxxx <jukka@xxxxxxxxxxxx>:

A question more about those alpha channels, in the images. How do you set them? i can't imagine you set them per pixel...

I can email the .asm source for the alpha blending (all 100
combinations!), if you want RosAsm version if you like. The sourcecode
been Open Source for the past five years and the license states that
modifications are okay.

Thas is _much_ appreciated. I really like that.
You can find my email by clicking on the first image at this page.
< http://szmyggenpv.com >

Btw. I worked on software rasterizers for years and alpha blending was
last stage of pixel pipeline before writing the color into the
framebuffer. There were already 100 combinations of alpha blending
alone, so there was simply too much code to write "by hand" in assembly
(!) to make renderer that does everything you want.

Is PixelShading, as done by hardware, related to this topic in some way`?
How can I do pixel shading in software, and what is it really?

I solved this by writing assembler code in small pieces, then combining
the pieces to form the final code when I knew everything. I use the
"alpha blending" as example, when I knew what blending was used, I took
that piece of code and appended to the end. Ofcourse there were issues
how to keep variables in registers and so on, which were quite easy to
solve: I used "virtual registers" and allocated real registers later..
when ran out of registers I did use memory as temporary storage (this
is called spilling I know now years later as studied compilers and
worked on some ;)

I also try to use only registers. And I am also real good at "spilling".....

This "stitching" technique is quite primitive, actually it is far
superior to compile and optimize the code after see the pixel drawing
innerloop as a WHOLE. Ofcourse, I didn't do function call per pixel,
for me the primitive was "scanline", even better primitive would been
vertical slice of the triangle but problem was that the code became a
bit too large for my tastes.

Why is Vertical slice a better primitive then Scanline? I ask because I found my Vertical line to me much slower then the Horizontal line.

Interesting bit, if you ever doing triangle rasterizer is to keep the
outer loop simpler is to use barycentrics and solve only the varyings /
interpolators you need, this way the outer loop is identical no matter
how many interpolators you got, the only difference is the amount of
vertex values you need to store. A fixed maximum of 4 (low number, I
know) worked great back then... two texture coordinates, and two
colors.. novadays that would be ridiculously low number. (z and 1/w
were always done fixed).

Blah blah.. I am going boinkers..

:)) It does not sound like blah blah to me. I find this topic interessting and would love to know more.

But theres several words here that I dont know what means. I can lookup barycentric coordinates, for instance, but I just did, and the first explanation wasnt very clear. Many thanks for your time if you like to explain it in human terms.

this is most fun stuff to program I
ever done so sorry if get started..

I can fully appreciate that. Having visual instant feedback produced from code you wrote can be quite exillirating. (I had great fun copycatting you Alpha demo for instance, even if it did not turn out to be the same). Its one of the reason I got interessted in programming. Its also why I dont mind walking in the footsteps of giants, because I found I could have just as much fun as they did, much in the same way a 40gig is still useful when all they are selling is 250 and 320 giga drives :)) I found the pleasure of rendering lines to be just as fun, even I play battlefield2 and Doom3 and can see that linerendering lags a little behind the bleeding age :))))

just saying that is why I don't
write assembler by hand very often, heh. :)

Writing assembler is pain in the ass, if you dont have an assembler that is created to make it a blessed experience. My best advice, even if I am not really in the position to giving any, I do it all the same :) - to anyone is, belive a little in Master Betov. RosAsm is really really something totally diffrent. I have tried asm inside of Delphi, (BASM) I have tried TASM, I have tried NASM. Compared to RosAsm, theese are tools to hit you in the head, foot and legs. I have been programming Delphi for several years, and I can swear that in 90% of the cases, this was more trouble then using the RosAsm assembler.

Its cool that you have libs and such in C. But its not a whole lot more trouble to create such "libs" also for asemblers. For the daytoday programming, theres just hand down nothing like asm when using a tool created for making this easy.

Yes. Asm is portable. In the same way that you can port C code. But i would rather prefer to write spesifically for each plattform. As in, if porting is found to be needed, this is because the thing you did is interessting enough to port. I think now, that thinking about porting until this point is clearyfied, can be a waste of time. I rather spend that time at trying to make something that could be worth porting.
If that ever happens by me, I rather wait for the guy that had spesific knowledge of the target OS, and let him do the port. And then just help out instead of trying to tackle everything between heaven and earth alone.



.



Relevant Pages

  • Re: ImageList_Draw and icons with alpha channel
    ... The AND mask represents the "Alpha Channel". ... Where the pixel is marked as "White", ... Using masks works for all bit depths and allows you to ...
    (microsoft.public.win32.programmer.gdi)
  • Re: Alphablending
    ... "paint" into the alpha channel.. ... Then you can use the rendered leaf as texture (with per pixel ... Its not diretcly a triangle, its a rectangle where only two sides are parallell and two are not. ... Barycentric coordinates, however, cannot. ...
    (alt.lang.asm)
  • Re: AlphaBlending Question
    ... In order to save some calculations over a number of transparent png files, I was attempting to ignore the ... Interestingly enough, when I set the RGBs of zero alpha pixels to 0, the AlphaBlend function works fine. ... simply ignore the pre-multiplication if the alpha channel is 0, then I see the a white/grey color for those pixels. ... component and is simply combined with the inverse-alpha multiplication of the current pixel. ...
    (microsoft.public.vb.winapi.graphics)
  • VESA/VGA BIOS emulation
    ... The Alpha SRM console supports a BIOS emulation callback routine (Alpha ... this function to set VGA video modes on a video card not currently ... that correspond to the emulated Intel x86 registers. ...
    (comp.os.vms)
  • Re: Longtime VMS system manager/programmer available
    ... Many people consider anything above assembler for HLL. ... Trick question on Alpha. ... Since MACRO-32 is a compiler on Alpha and Itanium, ...
    (comp.os.vms)