DirectXで点光源を使うときは、有効範囲(距離)の指定を忘れてはいけません。
下記は、C#の例ですが、
たとえば、平行光源なら、
ですが、点光源なら、
となります。
上記のソースコードは、こちらを参考にさせていただきました。
リンク:http://sorceryforce.com/programing/mdx/direct3d/stepup/sdkmesh.html
下記は、C#の例ですが、
たとえば、平行光源なら、
/// <summary> /// ライトの設定 /// </summary> private void SettingLight() { // 平行光線を使用 this._device.Lights[0].Type = LightType.Directional; // ライトの方向 this._device.Lights[0].Direction = new Vector3(1.0f, -1.5f, 2.0f); // 光の色は白 this._device.Lights[0].Diffuse = Color.White; // 環境光 this._device.Lights[0].Ambient = Color.FromArgb(255, 128, 128, 128); // 0 番のライトを有効 this._device.Lights[0].Enabled = true; // 0 番のライトを更新 this._device.Lights[0].Update(); }
ですが、点光源なら、
private void SettingLight() { // 平行光線を使用 this._device.Lights[0].Type = LightType.Point; // ライトの方向 this._device.Lights[0].Position = new Vector3(10.0f, -10.0f, 20.0f); this._device.Lights[0].Range = 100.0f; // 光の色は白 this._device.Lights[0].Diffuse = Color.White; // 環境光 this._device.Lights[0].Ambient = Color.FromArgb(255, 128, 128, 128); // 0 番のライトを有効 this._device.Lights[0].Enabled = true; // 0 番のライトを更新 this._device.Lights[0].Update(); } }
となります。
上記のソースコードは、こちらを参考にさせていただきました。
リンク:http://sorceryforce.com/programing/mdx/direct3d/stepup/sdkmesh.html