Hi all,
Rather than use a "boxed" terrain generating app, I'm trying to learn using advanced terrain. Just a couple of questions, if someone can help out:
1. Looking at example code, they all seem to use a small (as far as I can tell) scaling factor; typically SET TERRAIN SCALE
obj num, 3, 0.6, 3. However, I have been using more on the order of SET TERRAIN SCALE
obj num, 500, 20, 500 to keep it from looking like the camera/player is standing on a bumpy throwrug. Is this appropriate, or am I really messing things up? My heightmap is 256x256 and my texture and detail images are 512x512 as in the examples.
2. Perhaps in relation to the above, I have found that the camera (or the terrain) shakes or vibrates at times; typically when I turn/pan the camera to the left. However, if I then turn/pan the camera (even slightly) back to the right, the shaking stops. One thing that did seem to help (but not completely eradicate it) was to place UPDATE TERRAIN at the very beginning of the DO LOOP, but I could be wrong about this having any effect on the problem.
System:
Athlon XP 2600
512 MB memory
GeForce FX 5200 w/256MB
If it helps, here is the code for building the terrain:
load image "terr_texture.bmp", texturemap
load image "terr_detail.tga", detailmap
make object terrain terrainobject
set terrain heightmap terrainobject, "heightmap.bmp"
set terrain scale terrainobject, 500, 20, 500
set terrain split terrainobject, 16
set terrain tiling terrainobject, 4
set terrain light 1, 1, -0.25, 0, 1, 1, 0.78, 0.5
set terrain texture terrainobject, texturemap, detailmap
build terrain terrainobject
And the DO LOOP code (the camera code borrowed from the Inca Pro code, if I recall correctly):
do
update terrain
dx#=mousemovex()*0.25
dy#=mousemovey()*0.25
camerasmoothx#=curveangle(dx#,camerasmoothx#,3.0)
camerasmoothy#=curveangle(dy#,camerasmoothy#,3.0)
playerpitch#=wrapvalue(playerpitch#+camerasmoothy#)
if playerpitch#>90.0 and playerpitch#<180.0 then playerpitch#=90.0
if playerpitch#>180.0 and playerpitch#<270.0 then playerpitch#=270.0
playeryaw#=playeryaw#+camerasmoothx#
Rotate Object playerobject,0,playeryaw#,0
move=0
strafe=0
if UpKey() then move=move+3
if downkey() then move=move-3
if rightkey() then strafe=strafe+3
if leftkey() then strafe=strafe-3
movespeed#=cam_speed#
movespeed#=movespeed#*gamespeed#
smoothmove#=curvevalue(move,smoothmove#,6)
smoothstrafe#=curvevalue(strafe,smoothstrafe#,6)
move object playerobject,movespeed#*smoothmove#
move object right playerobject,movespeed#*smoothstrafe#
Rotate camera camera,playerpitch#,playeryaw#,0
position object playerobject,object position x(playerobject),object position y(playerobject)-6.0*gamespeed#,object position z(playerobject)
RunCollisionPRO()
position camera camera,object position x(playerobject),object position y(playerobject)+100,object position z(playerobject)
framerate=screen fps()
sync
loop
Any insights will be much appreciated, and sorry for such a long-winded post