Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
On 16/07/2015 at 12:17, xxxxxxxx wrote:
User Information: Cinema 4D Version: Platform: Language(s) :
--------- Having an issue where a multiples bitmap will not keep its alpha when scaled.
bitmap is a multipass bitmap with alpha. That has been verified in code and with a render to disk.
The scaling is anamorphic.
MultipassBitmap *scaled_bitmap = MultipassBitmap::Alloc(20,60,COLORMODE_RGB); scaled_bitmap->AddChannel(true,true); bitmap->ScaleIt(scaled_bitmap,256,true,true);
What is saved is a tif without alpha. If I simply change to saving bitmap I get the correct render with alpha.
What can I do to keep the alpha and have it scale?
thank you, Ama
On 16/07/2015 at 13:43, xxxxxxxx wrote:
ScaleIt() is only defined in BaseBitmap which would make me think that it can't handle a MultipassBitmap properly or without some consideration. Or it is something about using AddChannel() - again only defined in BaseBitmap. Why do you not allocate using COLORMODE_ARGB or use the MultipassBitmap::AddAlpha()?
Hopefully you do not need to resort to GetLayers() and using ScaleIt() on each BaseBitmap in the returned array.
On 16/07/2015 at 13:46, xxxxxxxx wrote:
I was rendering a document and using the suggested functions in the documentation. MultipassBitmap seemed to be the only way it worked.
Originally posted by xxxxxxxx ScaleIt() is only defined in BaseBitmap which would make me think that it can't handle a MultipassBitmap properly or without some consideration. Or it is something about using AddChannel() - again only defined in BaseBitmap. Why do you not allocate using COLORMODE_ARGB or use the MultipassBitmap::AddAlpha()? Hopefully you do not need to resort to GetLayers() and using ScaleIt() on each BaseBitmap in the returned array.
Originally posted by xxxxxxxx
On 17/07/2015 at 06:47, xxxxxxxx wrote:
Hello,
MultipassBitmap actually overrides AddChannel() internally and does not create a "channel" but a alpha layer. But ScaleIt() is indeed a method that can only handle BaseBitmaps and their internal channels, so it cannot scale layers.
So you either stick to BaseBitmaps or you have to handle the layers/channels manually.
Best wishes, Sebastian
On 17/07/2015 at 07:01, xxxxxxxx wrote:
What is the appropriate way to create a basebitmap from the multiples bitmap with alpha?
Ama
Originally posted by xxxxxxxx Hello, MultipassBitmap actually overrides AddChannel() internally and does not create a "channel" but a alpha layer. But ScaleIt() is indeed a method that can only handle BaseBitmaps and their internal channels, so it cannot scale layers. So you either stick to BaseBitmaps or you have to handle the layers/channels manually. Best wishes, Sebastian
On 17/07/2015 at 07:30, xxxxxxxx wrote:
Is there a way to create a basebitmap with alpha to work with renderdocument?
On 20/07/2015 at 04:56, xxxxxxxx wrote:
as discussed on different threads, one must use a MultipassBitmap to render alpha layers with RenderDocument.
It seems there is no build-in functionality to handle your specific use case. So you might have to copy an alpha layer yourself into a BaseBitmap. This could look like this:
const Int32 alphaLayerCount = mpBitmap->GetAlphaLayerCount(); for(Int32 i = 0; i < alphaLayerCount; ++i) { MultipassBitmap* alphaChannel = mpBitmap->GetAlphaLayerNum(i); const Int32 h = alphaChannel->GetBh(); const Int32 w = alphaChannel->GetBw(); // create basebitmap BaseBitmap* temp = BaseBitmap::Alloc(); temp->Init(w, h, COLORMODE_RGBf); // copy UChar* buf= NewMem(UChar, w); Float32* rgbBuf = NewMem(Float32, w * 3); for(Int32 line = 0; line < h; ++line) { // get pixels alphaChannel->GetPixelCnt(0, line, w, buf, 1, COLORMODE_GRAY, PIXELCNT_0); for(Int32 x = 0; x < w; ++x) { // read UChar grey = buf[x]; Float greyF = Float32(grey) / 256.0; // write rgbBuf[3*x] = greyF; rgbBuf[3*x+1] = greyF; rgbBuf[3*x+2] = greyF; } // set pixels temp->SetPixelCnt(0,line,w,(UChar* )rgbBuf,3 * sizeof(Float32),COLORMODE_RGBf,PIXELCNT_0); } // free memory DeleteMem(buf); DeleteMem(rgbBuf); // create small bitmap and scale BaseBitmap* smallBitmap = BaseBitmap::Alloc(); smallBitmap->Init(400, 300, COLORMODE_RGBf); temp->ScaleIt(smallBitmap, 256, true, false); // show results ShowBitmap(temp); ShowBitmap(smallBitmap); // free memory BaseBitmap::Free(smallBitmap); BaseBitmap::Free(temp); }
best wishes, Sebastian
On 20/07/2015 at 05:01, xxxxxxxx wrote:
Thank you!