1、將flare.dds和flarealpha.dds拷貝到工程目錄
2、創建shader resource view
HR(D3DX11CreateShaderResourceViewFromFile(md3dDevice, L"Textures/flare.dds", 0, 0, &mFlareSRV, 0)); HR(D3DX11CreateShaderResourceViewFromFile(md3dDevice, L"Textures/flarealpha.dds", 0, 0, &mFlareAlphaSRV, 0));
3、在Basic.fx中添加紋理
Texture2D gFlare; Texture2D gFlareAlpha;
4、設置紋理
Flare = mFX->GetVariableByName("gFlare")->AsShaderResource(); FlareAlpha = mFX->GetVariableByName("gFlareAlpha")->AsShaderResource();
5、在Basic.fx中將兩個texel的值相乘(component-wise multiply)
float4 flareTex = gFlare.Sample(samAnisotropic, pin.Tex); float4 flareAlphaTex = gFlareAlpha.Sample(samAnisotropic, pin.Tex); texColor = flareTex * flareAlphaTex;
6、搞定
相對龍書時的相對基礎內容鋪墊,這回帶來的DX11感覺則大有不同了, Algebra詳細地過了一遍,原版Amazon上實在太貴,上店家印了出來,很聰明,分成了上下冊......
0.0
去各大BBS找