我想要呈现的纹理化四在D3D,其不使用纹理被渲染到四边形的顶点的α值。相反,它是使用纹理的α。

我想D3D使用它被放置在所述多边形的顶点的阿尔法。

我有 SetTextureStageState一个想法它必须做的,但我不能完全找到它尚未..

有帮助吗?

解决方案

确定,这里就是我的了:

D3DTSS 枚举(包含默认值对于D3DTSS_ *设置)

D3DTA 枚举

// where does the SRC color come from?
// why, the currently bound texture of course!
d3d->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
// Default:  D3DTA_TEXTURE (anyway.  So this setting is redundant.)

<强>大的变化COMES NEXT:

// let the alpha component be read from the
// diffuse color of the vertex..
d3d->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
// Default: D3DTA_TEXTURE (which would be "pull alpha from the texture")

// because my vertex declaration is set up to send 1 color, and
// D3DRS_DIFFUSEMATERIALSOURCE is set to D3DMCS_COLOR1, this means
// to use the vertex alpha i specify.  i think.

在其他地方根本算不上什么,从默认值的变化,但它在这里所以一切都可以看出:

// DEST where does the alpha value come from?  also the
// diffuse component
d3d->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_CURRENT);
// Default:  D3DTA_CURRENT.  I believe this means "the destination will
// be whatever the existing color in the framebuffer already is"

// setting up as is default, 
d3d->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_CURRENT);
// Default:  D3DTA_CURRENT.  No change.

我觉得作品。

此外理解:此链接包含旧但很整齐工具称为MFCTex:

“MFCTex程序”

因此,它很容易看到发生了什么事情,当您使用不同的参数的个数的效果。

我认识到这一点的不是的冷静的方式来做到这一点了,真是凉爽的方式已经有一段时间来写你自己的顶点和像素着色器。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top