Need help with alpha map border

Need help with alpha map border

stigatle
Enthusiast Enthusiast
601 Views
15 Replies
Message 1 of 16

Need help with alpha map border

stigatle
Enthusiast
Enthusiast
I'm using maxscript to copy one rendered image over another, i'm setting the transparecy also, on the one i'm lying on top.
The problem i'm having is this jagged line that follows the Alphamap.
So that the edges get's messed up..

Is there a way to fix this?

see attached pictures...

On picture i want all that is grey, to be grey all the way to the edge, not black\white line like this..

0 Likes
602 Views
15 Replies
Replies (15)
Message 2 of 16

Anonymous
Not applicable
Is the geometry being rendered gray? If so, a cheap fix might be to just make the background the same color.
0 Likes
Message 3 of 16

stigatle
Enthusiast
Enthusiast
No, it's full colour etc..
Its really annoying, because the one image is perfect, but the one i lie over get's messed up Alpha..
see attached image

white is the "original" image, the grey is a separate rendered image, that i need to put on top, but i need to keep the
alpha map as good as on the one in the backgroud there....

0 Likes
Message 4 of 16

Anonymous
Not applicable
What code are you using to copy the image?
0 Likes
Message 5 of 16

stigatle
Enthusiast
Enthusiast

grparr= #()
grparr = selectByName title:"Select groups you want to be transparent" buttonText:"Select Groups" filter:group showHidden:true single:false
if selection.count == 0 then (return 0)
c = 1
current_object = 0
select grparr
select grparr
bm1=render 640 alphaMultiplier:1.0 useAlpha:true --channels:#(#objectID, #mask,#normal,#node,#shaderTransparency,#weight)
hide $
bm3=render 640 alphaMultiplier:0.5 useAlpha:true --channels:#(#objectID, #mask,#normal,#node,#shaderTransparency,#weight)
c +=1
pasteBitmap bm1 bm3 type:#blend type:#blend alphaMultiplier:0.5 useAlpha:true--type:#blend
max unhide all
close bm1
display bm3
select grparr
clearSelection()
0 Likes
Message 6 of 16

stigatle
Enthusiast
Enthusiast
make two groups of objects, put them together, when running script, select one of the groups, then hit "select".
It'll then render 1 image with all geometry.
then hide everything except 1 group, then paste the one on top of the other, and make it transparent.
0 Likes
Message 7 of 16

Anonymous
Not applicable
Are the alphas pre-multiplied?
0 Likes
Message 8 of 16

stigatle
Enthusiast
Enthusiast
I have no idea.. i just cannot get this to work.. no matter what i've tried..
0 Likes
Message 9 of 16

Anonymous
Not applicable
pastebitmap? is that a function you wrote? I'm using max9 and I don't see it in the mxs help file.

If you have access to multiply instead of blend for the alpha that how it should be handled.
0 Likes
Message 10 of 16

stigatle
Enthusiast
Enthusiast
It is a new function in 3dsmax 2008..
0 Likes
Message 11 of 16

stigatle
Enthusiast
Enthusiast
pasteBitmap <src_bitmap> <dest_bitmap> (<src_box2> | <src_point2>) <dest_point2> maskColor:<color> type:{#paste | #composite | #blend} alphaMultiplier:<float>

NEW in 3ds Max 2008: Copies a block of pixels from src_bitmap to dest_bitmap.

The position of the source block is specified by src_box2 or src_point2, and the destination by dest_point2.

The width and height of the block is specifed by src_box2 or, if src_point2 is specified, by the remaining size of the source bitmap.

The width and height will be clamped to prevent either source or target overruns.

If maskColor: is supplied, pixels with this color in src_bitmap are not copied to dest_bitmap.

If type: is #paste (the default), the source is pasted on the destination ignoring all alpha.

If type: is #composite, the source alpha of the source is used:
clamp(R = S + D * (1-S.alpha))

If type: is #blend, the source alpha of the source is used:
R = S * S.alpha + D * (1-S.alpha)

For both type:#composite and type:#blend,
R.alpha = S.alpha + D.alpha * (1-S.alpha)

The type:#composite would typically be used for pre-multiplied alpha images.

If type: is #composite or #blend, the source alpha is multiplied by the alphaMultiplier: value, which defaults to a value of 1.0 if not supplied.

Only RGBA information is copied - no channel data is copied.
0 Likes
Message 12 of 16

stigatle
Enthusiast
Enthusiast
it says "The type:#composite would typically be used for pre-multiplied alpha images. "

but if i change to that the render looks like this:

0 Likes
Message 13 of 16

stigatle
Enthusiast
Enthusiast
and alpha looks like this:

0 Likes
Message 14 of 16

stigatle
Enthusiast
Enthusiast
Is there a way to access the alpha colour directly in a rendered image?
so that one can choose what colour you want it to be?
0 Likes
Message 15 of 16

Anonymous
Not applicable
You should be able to set the alpha value as a color value per pixel

(color 255 255 255 0 ) would give you a pixel that was white with a fully transparent alpha
0 Likes
Message 16 of 16

Anonymous
Not applicable
Is there a way to access the alpha colour directly in a rendered image?
so that one can choose what colour you want it to be?


Do you mean the color that shows up in the RGB channels where the alpha is transparent? The environment background color gets used for that.
0 Likes