Re: [Algorithms] Alpha Channel
Brought to you by:
vexxed72
From: Scott J. S. <sjs...@um...> - 2000-08-26 23:50:52
|
A bit OT, but oh well: The 5551 format is not available in D3D. Only the 1555 format (alpha in the high bit) is. This is equivalent to the OpenGL 1_5_5_5_REV packed pixel format exposed in OpenGL 1.2. Direct3D only exposes the REV packed pixel formats (they don't call them reversed, of course), while OpenGL prefers the regular formats but does expose the REV formats in 1.2. You have to be very careful that you understand the formats correctly. The packed formats look the same on all machine architectures (i.e., 1_5_5_5_REV always has the alpha in the high bit), but OpenGL formats like GL_UNSIGNED_BYTE - GL_RGBA have components in different places depending on the endianness of the host machine. Even more OT: Color keying can actually be a win if you have a lot of 2d code interspersed with 3d code. Because of texture limitations, if you have a 2d-windowing system that need to run in a 3d window you'll probably end up compositing it in system memory, than slicing it into small tiles, each which is uploaded as a texture. On the other hand, you can probably do a 2d blt to the render target on most D3D hardware for 2d stuff, and this is far faster. (By way of comparison, the software driver at my employer runs the 2d stuff 3x faster than a Geforce2 without doing 2d blits). -- Scott Shumaker sjs...@um... On Sat, 26 Aug 2000, gl wrote: > > Take a look at the 'D3DFrame' texture loader code (part of the SDK) - it > does exactly that from alpha files. > > If you can use 16bit, choose the 5551 format if available, as 1 bit of alpha > is all you need. BTW, you are really describing colour keying, but don't > use it, as it's legacy and can cause all kinds of problems when combined > with alpha blending (search the archives for details). > -- > gl > > ----- Original Message ----- > From: "Pai-Hung Chen" <pa...@ac...> > To: <gda...@li...> > Sent: Saturday, August 26, 2000 9:08 PM > Subject: [Algorithms] Alpha Channel > > > > Hi, > > > > I want to use billboard in my program but cannot find a good way to create > > 32-bit bitmap with alpha channel of appropriate values. Basically I want > to > > create a bitmap of tree with leaves in various green colors (with alpha = > > 255) and all non-green colors transparent (alpha = 0) so that I can use it > > as the texture for my billboarded trees. It would be nice if I can > specify > > a non-green color C and make the alpha of all the pixels of color C in the > > bitmap to 0. Is there any program capable of doing that with 32-bit > bitmap > > with alpha channel? This may be off-topic and you could send your advise > to > > me off-line. > > > > Thanks in advance, > > > > Pai-Hung Chen > > > > > > _______________________________________________ > > GDAlgorithms-list mailing list > > GDA...@li... > > http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list > > > > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list > |