目前在winform中 用Directx做了一个3D模型,目前的问题是模型高的地方会高亮显示,而且颜色会变浅,对整个模型的展示有很大的影响。问题就是应该修改哪一部分来去除这个高光颜色变浅的问题。下面是截图和 光照与 材质的设定。
device.RenderState.Lighting = true;
device.RenderState.SpecularEnable = false;
LightsCollection lightsCollection = device.Lights;
//第一个灯光为点光源
lightsCollection[0].Type = LightType.Point;
lightsCollection[0].Ambient = Color.FromArgb(1, 1, 1, 1);
lightsCollection[0].Diffuse = Color.FromArgb(1, 170, 170, 170);
lightsCollection[0].Direction = new Vector3(1, -1, -1);
lightsCollection[0].Position = new Vector3(5, 5, 6000);
lightsCollection[0].Range = 10000;
lightsCollection[0].Attenuation0 = 0.06f;
lightsCollection[0].Enabled = true; //打开灯光
//材质设定
material = new Material();
material.Ambient = Color.FromArgb(1, 1, 1,1);
material.Diffuse = Color.FromArgb(1, 170, 170, 170);
device.Material = material;