DirectX 9 Shading not linear?

334 Views Asked by At

I'm using managed DirectX9 with C#. I made a visualisation of a cnc machine.

On computer 1 it works perfectly. a round tube is bright grey on the left side, and the shading is linear to a dark grey.

On computer 2 i get something different (same code!): its just white on the left, dark grey on the right, but its not linear. Its still white to about 45% of the tube and dark at 55%. A shading is only between this points visible....

Any idea???

Looks like i use too bright light, but the code is exactly the same...

/Edit Ok here is a screenshot: Left is wrong shading, right is correct The computer with the problem is a i3 + Intel onboard graphic + Win7 64Bit The computer with the correct visualisation is a older Intel with onboardgraphic and XP 32Bit

Here are the settings for 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;
1

There are 1 best solutions below

0
On

I have news!!! computer1..n: Intel i7 integrated graphic or new graphic card: Software AND hardwarevertexprocessing: wrong

computer0: 32 Bit WinXP with old graphic card: Hardwarevertexprocessing: correct Softwarevertexprocessing: wrong

i tried to use shaders. But i get also wrong visualisations. I generate Normals for 3 vertices of a triangle by crossproduct of 2 vectors inside the triangle (and normalize them). But when i use this normal.XYZ values for pixelshader return value (rgb) it should look like a normal map. But some parts are just one color...

And the really crazy thing: its the same with a simple tutorial example from the internet!!!! Whats wrong with my code??????