Graphics Reference
In-Depth Information
This example code shows the key parameters setting of the BasicEffect
instance in XNA:
basicEffect.VertexColorEnabled = true;
basicEffect.LightingEnabled = true;
basicEffect.PreferPerPixelLighting = true;
basicEffect.AmbientLightColor=mainform.AmbientLightColor;
basicEffect.DirectionalLight0.Enabled = true;
basicEffect.DiffuseColor = mainform.DiffuseLightColor;
Vector3 terrainPos =
GetTerrainCenterPos(cameraSat.PlatLong,cameraSat.PlatLat);
Vector3 lightDirection = GetSunDir(terrainPos);
basicEffect.DirectionalLight0.Direction = lightDirection;
basicEffect.DirectionalLight0.DiffuseColor =
Color.White.ToVector3();
Figure 7-8 shows the contrast effects between lighting off and on.
Fig. 7. Lighting off effect (LOD at level 7) Fig. 8. Lighting on effect(LOD at level 7)
azimuths of the sun =225° altitude of the
sun =30 °
5
Representing Effects of Prototype System
5.1
Running Environment
CPU: Intel(R) Core(TM) i7-2670QM CPU @2.20GHz 8core;
Main Memory: 8G;
Graphics Card: NVIDIA GeForce GTX 670M;
OS: Windows7 64bit.
5.2
Some Hill Shading Effects
The experimental data of height-color mapping table as shown in the following table
(Table 2).
Search WWH ::




Custom Search