3D Game Programming with directx 11 Exercise answers 8.3, programming8.3
Chapter 8 Question 3
1. Copy flare. dds and flarealpha. dds to the project directory.
2. Create a 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. Add a texture in Basic. fx.
Texture2D gFlare;Texture2D gFlareAlpha;
4. Set texture
Flare = mFX->GetVariableByName("gFlare")->AsShaderResource();FlareAlpha = mFX->GetVariableByName("gFlareAlpha")->AsShaderResource();
5. multiply the two texel values in Basic. fx (component-wise multiply)
float4 flareTex = gFlare.Sample(samAnisotropic, pin.Tex);float4 flareAlphaTex = gFlareAlpha.Sample(samAnisotropic, pin.Tex);texColor = flareTex * flareAlphaTex;
6. Get it done
Introduction to 3D game programming with directx 11
Compared with the basic content of longshu, The DX11 feeling is quite different this time. Algebra has gone through it in detail, and the original Amazon is too expensive, the store printed it out. It was very smart and divided into the next book ......
Introduction to 3D Game Programming with DirectX 11 PDF thanks
0.0
Go to BBS