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.

              

  • 相关阅读:
    chaos —— 混沌
    《菊与刀》original 的阅读
    《菊与刀》original 的阅读
    十六进制(二进制)编辑器
    十六进制(二进制)编辑器
    Hopfield 神经网络及稳态性的证明
    Hopfield 神经网络及稳态性的证明
    OpenGL(一)绘制圆、五角星、正弦曲线
    NYOJ 8 一种排序(comparator排序)
    oc 第五天(内存管理)
  • 原文地址:https://www.cnblogs.com/StudipBird/p/3194392.html
Copyright © 2011-2022 走看看