多重紋理混合Multipass texture blending

Direct3D 應用程式可透過在多個轉譯階段套用各種紋理到基本類型,達到多項特效。Direct3D applications can achieve numerous special effects by applying various textures to a primitive over the course of multiple rendering passes. 針對此一行動的常用字詞為多階段紋理混色The common term for this is multipass texture blending. 多重紋理混合的一般用途為藉由套用數種不同紋理的多重色彩,模擬複雜光源和著色模型的效果。A typical use for multipass texture blending is to emulate the effects of complex lighting and shading models by applying multiple colors from several different textures. 這類應用方式稱為光線對應One such application is called light mapping. 請參閱光線與紋理對應See Light mapping with textures.

附註  有些裝置是能夠在單一行程中的基本項目上套用多個材質。Note   Some devices are capable of applying multiple textures to primitives in a single pass. 請參閱紋理混合See Texture blending.

 

如果使用者的硬體不支援多重紋理混合,您的應用程式可以使用多重紋理混合來達到相同的視覺效果。If the user's hardware does not support multiple texture blending, your application can use multipass texture blending to achieve the same visual effects. 不過,當使用多重紋理混合時,應用程式無法維持可行的畫面播放速率。However, the application cannot sustain the frame rates that are possible when using multiple texture blending.

若要在 C/C++ 應用程式中執行多重紋理混合︰To perform multipass texture blending in a C/C++ application:

  1. 請在紋理階段 0 設定紋理。Set a texture in texture stage 0.
  2. 選取想要的色彩和 alpha 混合引數與作業。Select the desired color and alpha blending arguments and operations. 預設值適用於多重紋理混合。The default settings are well-suited for multipass texture blending.
  3. 在場景中呈現適當物件。Render the appropriate objects in the scene.
  4. 在紋理階段 0 設定下一個紋理。Set the next texture in texture stage 0.
  5. 設定呈現狀態以視需要調整來源和目的地混合因素。Set the render states to adjust the source and destination blending factors as needed. 系統根據這些參數,在呈現目標表面中混合新紋理與現有像素。The system blends the new textures with the existing pixels in the render-target surface according to these parameters.
  6. 視需要盡量使用紋理重複步驟 3、4 及 5。Repeat Steps 3, 4, and 5 with as many textures as needed.

相關主題Related topics

材質透明混色Texture blending