Blog column>Comprehensive column>DirectX11 game development
  • DirectX11 game development
  • DirectX is the mainstream technology of PC game development, DirectX11 is a popular version of the DirectX, which means a higher performance, which makes the DirectX 11 added a lot of wonderful potential. I will share my knowledge of the DirectX11, with all the charm of the computer real time rendering graphics.
  • Subscribe

Latest update

[integrated] Realization of DirectX11 plane mirror

The realization of the plane mirror in nature has many objects in the surface are very smooth, you can reflect the object like a mirror. This section describes how to simulate the mirror effect in the 3D application. For simplicity, we reduce the task difficulty, only to achieve a mirror effect in the plane. For example, a smooth car can reflect the object around; however, the body is a smooth surface, rather than the plane. We don't choose this object. We will render objects in a smooth marble floor or in a mirror, in other words, we can only achieve the mirror effect on the plane. To achieve the mirror effect in the program,...

Directx11 Direct3D Game development Mirror Graphics

[integrated] DirectX11 depth / template state

The first step is to fill a ID3D11DepthStencilState instance with a D3D11_DEPTH_STENCIL_DESC instance: struct D3D11_DEPTH_STENCIL_DESC{typedef BOOL DepthEnable; / / True / / default default: D3D11_DEPTH_WRITE_MASK_ALL D3D11_D...

Directx11 Direct3D Depth Template Game development

[integrated] DirectX11 template test

In the process as described above, we can use the template buffer to block certain regions of the background buffer from the template buffer to block the process as described above. Judge a specific pixel can write back buffer operation is known as template test (the stencil test). In fact, this is: if (StencilRef & StencilReadMask value &StencilReadMask) Pixel accept Else Pixel reject...

Directx11 Direct3D Template Test Game development

[integrated] DirectX11 template

Template 1 what is the template? In front of the blog has introduced the concept of depth, so here only explain the concept of the template. Template buffer (buffer stencil) is a kind of off screen (off-screen) buffer used to achieve special effects. The size of the template buffer is the same as the background buffer and depth buffer, that is, the template buffer of the ij pixel corresponding to the background buffer and depth buffer ij pixel. We refer to the "attention" in 4.1.5 section when specifying a template buffer, which always shares the same memory space with the depth buffer. Especially as the name...

Directx11 Direct3D Cache Template Game development

[integrated] DirectX11 fog

Fog 1 Why do you need the fog? When we simulate certain types of weather conditions in the game, we may use the fog effect (see chart below). In addition to its own use, the fog has some additional effects. For example, the fog can be used for masking the rendering process unnatural artifacts, avoid the occurrence of jump out. Cuan (popping) refers to due to the movement of the camera, make originally in the far plane behind the objects suddenly entered the frustum body, never visible become visible; this looks like is suddenly jump to the scene inside. The problem can be masked by the addition of fog in a certain distance. Note...

Directx11 Direct3D Game development Fog Fog

[integrated] DirectX11 clipping pixels

Why do you need to cut pixels 1? Sometimes, we want to completely drop a source pixel, so that it no longer accept subsequent processing. This work can be achieved by the HLSL's built-in function clip (x). This function can only be used in the pixel shader, when x<0 discards the current pixel, so no longer accept follow-up treatment. The function is very useful in rendering the wire mesh. That is, it is very suitable for rendering those completely opaque or completely transparent pixels. Wire mesh with alpha channel. Clip function will drop those pixels with black alpha value,...

Directx11 Direct3D Game development Graphics Clipping pixels

[integrated] Alpha DirectX11 channel

Alpha channel 1 diffuse reflection map control Alpha channel in RGB hybrid, the source alpha component can be used to control the transparency. Mixed equation in the source color from the pixel shader. We will see in the last chapter, we will diffuse material alpha value as the pixel shader output alpha. That is, diffuse reflection map of the alpha channel can be used to control the transparency. PS float4 (pin VertexOUT): SV_Target { ... / / from the diffuse material and texture...

Directx11 Direct3D Game development Alpha channel Transparent

[integrated] DirectX11 hybrid

Hybrid example 1 color write to the assumption that we hope that the original target pixels remain unchanged, that is not to be any other numerical coverage, nor with the current grating source pixels are mixed. This algorithm is very useful when we want to write data in the buffer zone and only to the depth / stencil buffer. To achieve this algorithm, the source pixels can be set to D3D11_BLEND_ZERO, the target mixing coefficient is set to D3D11_BLEND_ONE, and the mixed operator is set to D3D11_BLEND_OP_ADD. Using a scheme, the mixed equation can be simplified as follows...

Directx11 Direct3D Mixed Graphics Game development

[integrated] DirectX11 create a mixed state

Create a mixed state 1 how to create a mixed state in DirectX 11? We have discussed the mixed operator and mixing coefficient, but we have not said how to use these values in Direct3D. These hybrid parameters are controlled by the ID3D11BlendState interface. We can create this interface by filling a D3D11_BLEND_DESC structure and calling ID3D11Device:: CreateBlendState method to create the interface: ID3D11Device: HRESULT: Crea...

Directx11 Direct3D Mixed Mixed state Game development

[integrated] DirectX11 mixed equation

Mixed equation 1 what is mixed? Consider the following diagram. We start rendering the scene from the terrain and the crate, first draw the terrain, then draw the crate, the terrain and the box of the pixel in the back buffer. Then use the hybrid (blending), the water body is drawn to the back buffer, so that the water body pixels and the background buffer zone in the terrain, crate pixel integrated. In a way, we can see the terrain and the crate through the water body. In this chapter, we mainly explain the hybrid technology, which can be the current raster pixel (also known as the source pixel) and the background buffer in the pixel (also known as the target pixels) mixed (fusion...

Directx11 Direct3D Mixed Mixed equation Game development

[integrated] DirectX11 compressed texture format

Why do you need to compress the texture in the texture format 1? A virtual scene may load the hundreds of pieces of texture, and texture will occupy a large number of GPU memory (remember, we must let all texture resides in the GPU memory. Only in this way the shader to quickly texture access). The advantage of using these formats is that they can be stored in GPU memory, and when used by GPU in real time. Another advantage of storing textures into DDS files is that it can reduce the amount of disk space. 2 what are the compressed texture I format? To ease the GPU memory pressure, Direct3D provides...

Directx11 Compression Texture Game development Direct3D

[integrated] DirectX11 terrain texture sample Demo

Terrain texture demo program 1 terrain texture Demo introduced in this example, we want to add texture to the terrain and water body. First of all, we must in the terrain tile a grass texture. Due to the large terrain mesh, if we directly stretch the texture, then each triangle can only get a few texture elements. In other words, it is not enough for the surface to provide high texture resolution; we will be affected by the multiplier problem. So, we should be on the ground flat on the grass grid texture, and obtain high resolution. Secondly, we want to make the body of water body to be translated by a time function, which makes the water body appear more real...

Directx11 Terrain Texture Grid Game development

[integrated] DirectX11 to transform the texture

What is the significance of the transformation of the texture to the 1 texture coordinate transformation? As mentioned before, the texture coordinates represent the 2D points on the texture plane. Therefore, we can do the same as the other coordinates, the texture coordinates for translation, rotation and scaling. Here are some examples of the transformation of the texture: 1 along the wall to draw a brick texture. The texture coordinates of the vertices of the wall are within the range of [0,1]. We multiply each texture coordinate by 4, so that the interval is expanded to [0,4], and the texture is repeated 4 times on the wall 4 times. 2 draw a white cloud texture on a clear blue sky (that is, on a sky ball). Pass one...

Directx11 Direct3D Texture Transform Game development

[integrated] DirectX11 addressing mode

What is the addressing mode of the addressing mode 1? What kind of? Texture must be used in order to form a vector valued function T (U, V) = (R, G, B, a). That is, when given a texture coordinate (U, V), [0,1]2, the T function returns the texture color (R, G, B, a). Direct3D allows us to 4 different ways of extended the range of the function (known for addressing mode): repeat (wrap), border color, border color, interception (clamp) and mirror (mirror). Two

Directx11 Direct3D Addressing mode Game development

[integrated] DirectX11 crate sample Demo

The crate Demo1. specifies the texture coordinates of the GeometryGenerator:: the CreateBox produces the texture coordinates of the box, so that the entire map image is mapped to each side of the box. For the sake of simplicity, we only show the front, back, and top. Note that we omit the coordinates of the normal and tangent vector of the vertex structure. GeometryGe ne rator: void: ateBox Cre (width float, height float, depth float, Mesh...

Directx11 Direct3D Game development Texture Graphics

[integrated] DirectX11 as the material of the texture

The texture of the material 1 will be integrated into the texture of our material / lighting system? To integrate textures into our material / modulate system, we can modulate the ambient light and diffuse light to the texture color, but not to include the high light term (which is often referred to as "with late add"). With late add. / / Modulate LitColor = texColor* (ambient + diffuse) + spec; the above operation to each pixel...

Directx11 Direct3D Texture Texture of material Illumination

[integrated] DirectX11 texture sampling

Texture sampling 1 HLSL texture sampling means that we know that the Texture2D object is used to represent texture in the effect file. However, there is an associated with the texture of SamplerState objects (sampler). It is used to describe how to use filters to access texture resources. Here are some examples of it: / / in multiplication, reduction, multistage progressive use of linear filtering texture. MySampler0 SamplerState { Filter = MIN_MAG_MIP_LINEAR; }; / /...

Directx11 Texture sampling Multiple gradual sampling Direct3D

[integrated] DirectX11 filter

DirectX11 filter 1 multiplication (magnification) is a phenomenon that the texture mapping element should be considered as a discrete color sampling on a continuous image; it should not be considered as a rectangular area. So the question is: when we specify the texture coordinates (U, V) and any texture elements are not what will be the result? This problem occurs in the following situations: when the observation point is close to a wall in the scene, the wall will be enlarged, and it will cover the entire screen. If the resolution of the display is 1024 x 1024, the resolution is 256 * 256,...

Directx11 Direct3D Filter Linear filtration Anisotropic filtering

[integrated] DirectX11 create and enable texture

Create and enable texture 1 to create texture step texture data is usually stored on disk image files. We need to read it, and load it into a ID3D11Texture2D object (see D3DX11CreateTextureFromFile). However, a texture resource is cannot be bound directly to the rendering pipeline; we need to create a texture a shader resources view (ID3D11ShaderResourceView), and the then bind a view into the pipeline. This process can be divided into two steps: 1 call D3DX1...

Directx11 Direct3D Texture Game development Graphics

[integrated] DirectX11 texture coordinates

What is the texture coordinates 1? Direct3D's texture coordinate system consists of a U axis and a V axis representing the vertical direction of the image. Coordinates (U, V) specifies an element texture, we will be the element that texture elements (texel, the translator's note: texel is the abbreviation for texture element), where 0 < u, V is less than or equal to 1. Note that the positive direction of the V axis is "vertical" (see Figure 8.2). In addition, the normalized coordinate interval is set to [0,1], because it can make Direct3D have a single...

Directx11 Direct3D Texture Game development Graphics

  • Columnist:Sinat_24229853
  • Create time: 2015-09-24
  • Article number: 85
  • Browse quantity: 5503

Popular article

Latest comments