I was trying to save some texture from 3D rendering scene,and then get them to reuse.
The big problem is that rgb value can not match its alpha value.I need some picture without black edge,so I must use rgb colors to divide its alpha value(Image manipulation software such as Photoshop can just deal with picture which alpha channel is nonpremultiplied.)
Unfortunally,the color is too light that some result value are cut off to 1.
So I turned to a technique called premultiplied alpha.(See more). Instead of using shaders,I just use separate alpha calculation.
For example:RenderState.SourceBlend = Blend.SourceAlpha;
RenderState.DestinationBlend = Blend.InverseSourceAlpha;
Now I add some renderstate.RenderState.SourceBlendAlpha = Blend.One;
RenderState.DestinationBlendAlpha = Blend.InverseSourceAlpha;
It works well.But when I try to handle following things:RenderState.SourceBlend = Blend.SourceAlpha;
RenderState.DestinationBlend = Blend.One;
RenderState.SourceBlendAlpha = Blend.One;
RenderState.DestinationBlendAlpha = Blend.One;
The result is totally wrong,can somebody tell me the reason?
PS:now I get the reason.When I use nonpremultiplied blend state,which is SourceAlpha and inverseSourceAlpha.The rgba value is definitely controlled within 0~1.But when I switch to
additive state,which is SourceAlpha and 1,the rgb values might be over one,thus cause the incorrect value.
Now my problem is how to control the alpha value,to make sure it keep all details and do not overflow at the same time?
Particle Blend Issue with premultiplied alpha
453 Views Asked by April At
0