3D Game Programming with directx 11 Exercise answers 8.3, programming8.3

Source: Internet
Author: User

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
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.