Alpha Channel
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 18/03/2008 at 18:38, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9.6+
Platform: Windows ; Mac OSX ;
Language(s) : C++ ;---------
Hi all,I need to call RenderDocument and get back the alpha channel.
I tried to pass a Bitmap with the alpha.. but seem that alpha is wrote in another layer.
How i can get the alpha?
(i'm in the MaterialData::InitGLImage)
Thanks in advance
renato -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/03/2008 at 06:12, xxxxxxxx wrote:
I have some problems too to get it to work. I asked the developers about it.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/03/2008 at 06:51, xxxxxxxx wrote:
Thanks Matthias,
i'm looking forward for your help
cheers
Renato -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/03/2008 at 09:49, xxxxxxxx wrote:
Still Nothing?
cheers
renato -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/03/2008 at 15:14, xxxxxxxx wrote:
I will post when I know the answer. Anyway it's eastern holidays here.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/03/2008 at 00:55, xxxxxxxx wrote:
The bitmaps in InitGLImage are special 16bit bitmaps and can be only filled with SetPixel/GetPixel and some other few functions. Here a working example that fills the alpha channel of the bitmap. You have to make sure that it exists, otherwise you have to create one of your own.
>
\> Bool SimpleMaterial::InitGLImage(PluginMaterial \*mat, BaseDocument \*doc, BaseThread \*th, BaseBitmap \*bmp) \> { \> if(bmp) \> { \> AlphaBitmap \*alpha = bmp->GetInternalChannel(); \> if(!alpha) alpha = bmp->AddChannel(TRUE, FALSE); \> \> LONG bw = bmp->GetBw(); \> LONG bh = bmp->GetBh(); \> LONG x,y; \> \> for(y=0; y<bh; y++) \> { \> for(x=0; x<bw; x++) \> { \> bmp->SetPixel(x, y, 255, 0, 0); \> bmp->SetAlphaPixel(alpha, x, y, 128); \> } \> } \> } \> \> return TRUE; \> } \>
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/03/2008 at 06:15, xxxxxxxx wrote:
Hello Matthias,
thanks for this but is exactly what i done the first time..
but what i need is to Call:RenderDocument before fill this 16bit bitmap.
so inside the InitGLImage i need to call renderdocument.. and get back the ALPHA.
thanks for now
renato -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/03/2008 at 06:22, xxxxxxxx wrote:
Please remember to set the PLUGINFLAG_MATERIAL_GLIMAGE flag in the RegisterMaterialPlugin() function.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/03/2008 at 06:24, xxxxxxxx wrote:
Yes, PLUGINFLAG_MATERIAL_GLIMAGE is set.
cheers
Renato -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/03/2008 at 06:26, xxxxxxxx wrote:
Hm, then I don't know what went wrong, it works fine here.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/03/2008 at 06:27, xxxxxxxx wrote:
I will check if RenderDocument can be called in InitGLImage().
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/03/2008 at 06:28, xxxxxxxx wrote:
Here is working good.. except that alpha is stored in a Unknown place.
Renato
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 28/03/2008 at 06:59, xxxxxxxx wrote:
So is this now workng for you or do you still need some help? What you mean with unkown place?
cheers,
Matthias -
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