Alpha Channel
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/03/2008 at 07:10, xxxxxxxx wrote:
Hello Matthias,
i mean that i can't get the alpha channel from the bitmap passed in the renderdocumennt.
The RGB is correct and transferred to the 16bit image with setpixel, like you wrote... but nothing about alpha.
cheers
Renato -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/03/2008 at 05:22, xxxxxxxx wrote:
can you access the alpha at all?
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/03/2008 at 05:52, xxxxxxxx wrote:
Hello Matthias,
No, i can't get the Alpha.. If i provide a BMP + Alpha to renderdocument.. the alpha is always empty.. this is my problem.
thanks
renato -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/03/2008 at 06:18, xxxxxxxx wrote:
What does the document you send to RenderDocument()look like, just a plane with texture? Maybe you can provide a scene.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/03/2008 at 06:47, xxxxxxxx wrote:
yes Matthias, it's a 4 point polygon with a light and camera.. just this.
www.danieleficini.com/temp/prova2.rar
cheers
renato -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/03/2008 at 14:35, xxxxxxxx wrote:
Youhave to use a MultipassBitmap to access the Alpha of RenderDocument().
Here a working InitGLImage() function:
>
\> Bool SimpleMaterial::InitGLImage(PluginMaterial \*mat, BaseDocument \*doc, BaseThread \*th, BaseBitmap \*bmp) \> { \> if(bmp) \> { \> LONG bw = bmp->GetBw(); \> LONG bh = bmp->GetBh(); \> \> MultipassBitmap \*tmp = MultipassBitmap::Alloc(bw,bh,MODE_RGB); \> if(!bmp) return FALSE; \> \> AutoAlloc<BaseDocument> rdoc; \> if(!rdoc) return FALSE; \> \> BaseObject \*plane = BaseObject::Alloc(Oplane); \> if(!plane) return FALSE; \> \> Material \*mat = Material::Alloc(); \> if(!mat) return FALSE; \> \> mat->SetChannelState(CHANNEL_ALPHA,TRUE); \> BaseChannel \*ch = mat->GetChannel(CHANNEL_ALPHA); \> \> BaseContainer cdata; \> cdata.SetLong(BASECHANNEL_SHADERID, 1001162); \> ch->SetData(cdata); \> \> rdoc->InsertMaterial(mat, NULL, FALSE); \> \> TextureTag \*ttag = TextureTag::Alloc(); \> if(!ttag) return FALSE; \> \> ttag->SetMaterial(mat); \> \> GeData d(TEXTURETAG_PROJECTION_UVW); \> ttag->SetParameter(DescLevel(TEXTURETAG_PROJECTION),d,NULL); \> \> plane->InsertTag(ttag, NULL); \> \> BaseContainer \*data = plane->GetDataInstance(); \> data->SetReal(PRIM_PLANE_WIDTH, 100.0); \> data->SetReal(PRIM_PLANE_HEIGHT, 100.0); \> data->SetLong(PRIM_PLANE_SUBW, 1); \> data->SetLong(PRIM_PLANE_SUBH, 1); \> \> rdoc->InsertObject(plane, NULL, NULL, FALSE); \> \> BaseObject \*camera = rdoc->GetRenderBaseDraw()->GetEditorCamera(); \> if(!camera) return FALSE; \> \> camera->SetPos(Vector(0.0,100.0,0.0)); \> camera->SetRot(Vector(0.0,-pi/2.0,0.0)); \> \> BaseContainer rdata = rdoc->GetActiveRenderData()->GetData(); \> rdata.SetLong(RDATA_XRES, bw); \> rdata.SetLong(RDATA_YRES, bh); \> rdata.SetBool(RDATA_ALPHACHANNEL, TRUE); \> rdata.SetLong(RDATA_ANTIALIASING, ANTI_BEST); \> \> if(RenderDocument(rdoc, rdata, NULL, NULL, tmp, RENDERFLAG_EXTERNAL, th) == RAY_OK) \> { \> LONG x,y; \> for(y=0; y<bh; y++) \> { \> for(x=0; x<bw; x++) \> { \> AlphaBitmap \*alpha = bmp->GetInternalChannel(); \> if(!alpha) alpha = bmp->AddChannel(TRUE,FALSE); \> \> UWORD value = 0; \> tmp->GetAlphaPixel(tmp->GetChannelNum(0),x,y,&value;); \> bmp->SetAlphaPixel(alpha,x,y,value); \> } \> } \> } \> \> MultipassBitmap::Free(tmp); \> } \> \> return TRUE; \> } \>
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/04/2008 at 07:22, xxxxxxxx wrote:
Hello Matthias,
i'm sorry but tmp->GetChannelNum(0)
always return 0x00000000...
any suggestion?
cheers
Renato -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/04/2008 at 07:31, xxxxxxxx wrote:
Try to allocate an alpha for the MultipassBitmap tmp.
Otherwsie I would need some source code example to help you further.
>
\> tmp->AddChannel(TRUE,TRUE); \>
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/04/2008 at 10:19, xxxxxxxx wrote:
seem to work.. let me see.
Cheers
Renato -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/04/2008 at 08:33, xxxxxxxx wrote:
Ok thanks,
was easy.. at last ..
With multipass bitmap it work like i expect.
thanks for your support
renato