本文介绍了在Direct3D中实施Porter-Duff规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

应该使用哪些Direct3D渲染状态来实现Java的Porter-Duff合成规则(CLEAR,SRC,SRCOVER等)?

What Direct3D render states should be used to implement Java's Porter-Duff compositing rules (CLEAR, SRC, SRCOVER, etc.)?

推荐答案

我使用Java的程度不是很高,但是基于白皮书,它应该是渲染状态混合模式的相当简单的映射.

I'm haven't used Java too much, but based on the white paper from 1984, it should be a fairly straightforward mapping of render state blend modes.

当然,除了这些之外,您还可以做更多的事情,例如普通的alpha混合(SourceAlpha,InvSourceAlpha)或加性(One,One)等等. (我假设您是在问这些问题,因为您正在移植某些现有功能?因此您可能不在乎其他组合...)

There are of course more that you can do than just these, like normal alpha blending (SourceAlpha, InvSourceAlpha) or additive (One, One) to name a few. (I assume that you are asking about these specifically because you are porting some existing functionality? In that cause you may not care about other combinations...)

无论如何,这些都假定Add的BlendOperation且AlphaBlendEnable为true.

Anyway, these assume a BlendOperation of Add and that AlphaBlendEnable is true.

清除

SourceBlend = Zero
DestinationBlend = Zero

A

SourceBlend = One
DestinationBlend = Zero

B

SourceBlend = Zero
DestinationBlend = One

A胜过B

SourceBlend = One
DestinationBlend = InvSourceAlpha

B超过A

SourceBlend = InvDestinationAlpha
DestinationBlend = One

A in B

SourceBlend = DestinationAlpha
DestinationBlend = One

A中的B

SourceBlend = Zero
DestinationBlend = SourceAlpha

A out B

SourceBlend = InvDestinationAlpha
DestinationBlend = Zero

B出A

SourceBlend = Zero
DestinationBlend = InvSourceAlpha

A在B之上

SourceBlend = DestinationAlpha
DestinationBlend = InvSourceAlpha

A上的B

SourceBlend = InvDestinationAlpha
DestinationBlend = SourceAlpha

A xor B

SourceBlend = InvDestinationAlpha
DestinationBlend = InvSourceAlpha

束缚这些稍微复杂一点,并且需要向着色器多次传递或多次输入纹理.

Chaining these is a little more complex and would require either multiple passes or multiple texture inputs to a shader.

这篇关于在Direct3D中实施Porter-Duff规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-20 05:20