Main Menu

Alpha mode

Started by Crystal Noir, May 21, 2008, 04:59:20 AM

Previous topic - Next topic

Crystal Noir

Hello all,

I've got a little problem....

I understand that :

- If I want a sprite with an alpha add I have to set up the drawing mode with 2+16
- If I want a sprite with an alpha level (for transparency/intensity) I have to set up the drawing mode with 2+4
- If I want to play with color, I have to set up the drawing mode with 2+4096

But...

If I want a sprite with all of these, How can I do it ??

If I want a sprite with alpha level (to play with intensity/transparency), alpha add, to simulate lightning and play with color ?

I tried 2+16+4096 but it doesn't work :D

Got an idea ?

Thx in advance.

thaaks

That's exactly what I struggled with in my testcase for your "Lighting" thread with the candle demo!

I got the impression that it's not working although combinations (alpha add plus slowly alpha fading) would be great and looking at those power of 2 constants it could work.

Kevin: Does it? Should it?

kevin


You can't combine more than a pair of draw modes.. It generates too much code :)

So you want to  add a constant color to the src pixels, then add the result to the destination buffer ?

ie.

  SrcPixel=SrcPixel+Colour

  DestPixel=DestPixel+SrcPixel

Crystal Noir

yes but if we want to scale a sprite + set a different color + have a simulated light (add), + alpha channel transparency we can't if I understand...

Your idea is good for the color, but I have the same pb with add and alpha transparency....

Look at my candle (first post with my Zip file), I can combine all of these :) I use an alpha add only but I can set up alpha transparency and vectors color of the 3D sprite at the same time :)

I don't understand how I can do this here.

kevin


  PB1.63  doesn't have "3D sprites"   see FAQ

Crystal Noir

#5
I already know that, I mean, the question is : Is it possible with the 1.70 version so ? ;) (I don't have precise it)

kevin


It's possible in both :)

Crystal Noir

ok but how ? I would like to have these 3 effects at the same time.

kevin


  Vertex colouring simply multiples the current texel (src pixel) with the interpolated vertex colours in texture space.   If  they (vertex colours) are all the same then it's just multiplying the a constant colour with the source texel.    You can simulate this by simply premultiing the texture.  Then the render only has to fetch and add the pixels together (src + dest),   rather than interploate/fetch/multply/add.  So the cost per pixel is lower.

   See BlitImageAlphaMult.