@david w
The reason you are only getting two textures is that the normals for your terrain vertices all seem to be (nx,ny,nz)=(0,1,0). The shader uses this to calculate the slope (it just uses ny). So all the terrain is interpreted as flat. The only remaining dimension is the altitude - high will give one texture, low will give another.
Fix those normals (I couldn't see any lines changing the normals in your code) and you should start seeing the other two textures.
[
Edit: just seen the following function
GenerateNormalsForLimb. It is obviously not working as intended.]
[
2nd Edit: Yes, it probably is working as intended - you've generated the normals BEFORE you randomly change the height of the terrain. You need to recalculate them every time you change the heights. I'll do a bit more experimenting.]
[
3rd Edit: The following two changes to your code allow the normals to be recalculated. You then see all four textures at various places. I haven't checked to see if the normals are in fact correct though:
LOCK VERTEXDATA FOR limb land,1,2
for a=0 to get vertexdata vertex count()-1
height# = rnd(200)
SET VERTEXDATA POSITION a,GET VERTEXDATA POSITION X(a),height#,GET VERTEXDATA POSITION z(a)
next a
GenerateNormalsForLimb(1, 1) ` *** added this line
unlock vertexdata
LOCK VERTEXDATA FOR limb land,1,2
if spacekey() = 1
for a=0 to get vertexdata vertex count()-1
height# = rnd(200)
SET VERTEXDATA POSITION a,GET VERTEXDATA POSITION X(a),height#,GET VERTEXDATA POSITION z(a)
next a
GenerateNormalsForLimb(1, 1) ` *** added this line
endif ` *** also put this before the next line (?)
unlock vertexdata
]
In your example, ny = 1 will interpolate between grass and sand depending on altitude, ny = 0 will interpolate between rock and gravel. Values inbetween will give you a mixture of all four textures.
@TinTin
Quote: "@GG Sorry for the delay, it's been hectic this weekend."
Me likewise - and the recent fine weather here has forced me to venture outside and catch up with some very overdue gardening. It's raining today so I might get some coding things off my list - which seems to be growing daily for some reason.