zoukankan      html  css  js  c++  java
  • DirectX 中的 Light 和 Material

      

    一、Light

    D3DLIGHT9能设置的光照类型有以下三种,分别是方向光、点光和聚光.

    D3DLIGHT_DIRECTIONAL Creates a directional light, a light that comes from everywhere at once, but shines only in one direction.
    D3DLIGHT_POINT Creates a point light, a light that emanates equally in all directions from one exact point.
    D3DLIGHT_SPOT Creates a spot light, a light that emanates in one direction from one exact point.

       在SetRenderState(D3DRS_AMBIENT, D3DCOLOR_XRGB(239, 239, 239)中,D3DRS_AMBIENT指环境光,经常设置成灰色或白色,这样应该会使得对物体的颜色控制更加容易,(结合Material属性)

      Ambient lights do just what they say: they make ambient light. Ambient lights are relatively simple. The only real adjustable property of anambient light is its color, as it has no specific source or direction.Usually this color is white or gray. The darker the gray, the darker theenvironment seems to be. Using pure white ambient light is the equivalent to just not using lights at all.

    二、Material

      material.Diffuse = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);    // set diffuse color to white
          material.Ambient = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);    // set ambient color to white
          d3ddev->SetMaterial(&material);    // set the globably-used material to &material

             

    Diffuse:This sets the color of diffuse light that will reflect off the surfaces rendered. The color put in here only has an effect on diffuse light. No other type.For simplicity (and realism) we will set all the diffuse values of this material to 1.0f.

    Ambient:Because we also have ambient light in our scene, we will need to include a material color for that type of lighting as well. We will set these values to 1.0f, just as in diffuse.

    注意:What happens is we set a material, and then any vertex drawn after that will be drawn with that material. It will be drawn that way until we set a different material.

              

  • 相关阅读:
    OCR中表格识别及WORD生成
    太阳能跟踪系统
    QA300太阳能移动电源
    OCR之表格识别
    2012112
    2012123
    2012121
    2011101
    201191
    2011828
  • 原文地址:https://www.cnblogs.com/StudipBird/p/3194392.html
Copyright © 2011-2022 走看看