我正在使用带有 C# 的托管 DirectX9。我做了一个数控机床的可视化。
在计算机 1 上它运行良好。圆形管在左侧是亮灰色,阴影是线性到深灰色。
在计算机 2 上,我得到了不同的东西(相同的代码!):左边是白色,右边是深灰色,但不是线性的。它仍然是白色到大约 45% 的试管和黑暗的 55%。阴影仅在此点之间可见....
任何想法???
看起来我使用了太亮的光,但代码完全一样......
/Edit 好的,这是一个屏幕截图: 有问题的计算机是 i3 + Intel 板载显卡 + Win7 64Bit 具有正确可视化的计算机是带有板载显卡和 XP 32Bit 的旧 Intel
以下是 DirectX 的设置:
PresentParameters aPresentParams = new PresentParameters();
aPresentParams.Windowed = true;
aPresentParams.DeviceWindow = theControl;
aPresentParams.DeviceWindowHandle = theControl.Handle;
aPresentParams.SwapEffect = SwapEffect.Copy;
aPresentParams.EnableAutoDepthStencil = true;
aPresentParams.AutoDepthStencilFormat = DepthFormat.D16;
CreateFlags aCreateFlags = CreateFlags.HardwareVertexProcessing;
itsDevice = new Device(0, DeviceType.Hardware, theControl, aCreateFlags, aPresentParams);
itsDevice.RenderState.AntiAliasedLineEnable = true;
itsDevice.RenderState.CullMode = Cull.None;
//some materials...
itsMaterialBasic.Diffuse = Color.LightGray;
itsMaterialBasic.Ambient = Color.FromArgb(0, 80, 80, 80);
itsMaterialBasic.Specular = Color.Red;
itsMaterialBasic.SpecularSharpness = 1000.0f;
//...
itsDevice.RenderState.Lighting = true;
itsDevice.Lights[0].Type = LightType.Point;
itsDevice.Lights[0].Diffuse = Color.LightGray;
itsDevice.Lights[0].Range = 10000f;
itsDevice.Lights[0].Falloff = 10f;
itsDevice.Lights[0].Direction = new Vector3(-5, -28, 10);
itsDevice.Lights[0].Position = new Vector3(1000, 2000, 3350);
itsDevice.Lights[0].Attenuation0 = 0f;
itsDevice.Lights[0].Update();
itsDevice.Lights[0].Enabled = true;
itsDevice.RenderState.ShadeMode = ShadeMode.Phong;
itsDevice.RenderState.SpecularEnable = true;
itsDevice.RenderState.SpecularMaterialSource = ColorSource.Color1;
itsDevice.RenderState.Ambient = Color.FromArgb(110, 110, 110);
itsDevice.RenderState.AmbientMaterialSource = ColorSource.Color1;