Hilfe

TerrainShading

B3D

Aufruf

TerrainShading Terrain, shading

Parameter

Terrain Identität eines Terrains
shading 0=Shading ausschalten (Standard)
1=Shading einschalten


Rückgabewert

-


Beschreibung

Die Anweisung TerrainShading schaltet Schattierungseffekt für ein Terrain ein oder aus. Normalerweise ist dieser Effekt deaktiviert.

Wird Shading angewendet, dann kann es vorkommen, dass die Grafik auf einigen Grafikkarten etwas langsamer berechnet wird und LOD-PopUp's stärker wahrgenommen werden. Dafür erscheint das Bild echter - und nicht so eben.


Beispiel

Standardbeispiel:

Dieses Programm erstellt ein Terrain. Mit einigen Tasten kann man sich über das Terrain bewegen und einige Effekte ausprobieren:

Graphics3D 640, 480
SetBuffer BackBuffer()
camera = CreateCamera()
PositionEntity camera, 1, 1, 1
light = CreateLight()
RotateEntity light, 90, 0, 0
terrain = LoadTerrain("media\001.bmp")
ScaleEntity terrain, 1, 50, 1
grass_tex = LoadTexture("media\002.bmp")
EntityTexture terrain, grass_tex, 0, 1
terra_detail = 4000
vertex_morph = True

While Not KeyDown(1)
   If KeyHit(57) = True Then vertex_morph = 1 - vertex_morph
   If KeyHit(28) Then terra_shad = 1 - terra_shad
   If KeyDown(2) Then terra_detail = terra_detail - 10
   If KeyDown(3) Then terra_detail = terra_detail + 10
   If KeyDown(203) =True Then x# = x# - 0.1
   If KeyDown(205) = True Then x# = x# + 0.1
   If KeyDown(208) = True Then y# = y# - 0.1
   If KeyDown(200) = True Then y# = y# + 0.1
   If KeyDown(44) = True Then z# = z# - 0.1
   If KeyDown(30) = True Then z# = z# + 0.1
   If KeyDown(205) = True Then TurnEntity camera, 0, - 1, 0
   If KeyDown(203) = True Then TurnEntity camera, 0, 1, 0
   If KeyDown(208) = True Then MoveEntity camera, 0, 0, - 0.1
   If KeyDown(200) = True Then MoveEntity camera, 0, 0, 0.1
   TerrainDetail terrain, terra_detail, vertex_morph
   TerrainShading terrain, terra_shad
   x# = EntityX(camera)
   y# = EntityY(camera)
   z# = EntityZ(camera)
   terra_y# = TerrainY(terrain, x#, y#, z#) + 5
   PositionEntity camera, x#, terra_y#, z#
   RenderWorld
   Text 0, 0, "Mit Cursortasten verschieben"
   Text 0, 20, "Mit 1 oder 2 Detaillevel ändern"
   Text 0, 40, "Mit Leertaste Morphing ein/ausschalten"
   Text 0, 60, "Mit Return Shading ein/ausschalten"
   Text 0, 100, "Terrain Detail:" + terra_detail
   Text 0, 120, "Vertex Morphing:" + vertex_morph
   Text 0, 140, "Shading:" + terra_shad
   Flip
Wend
End

Übersicht 3D Grafik Terrain