Terraining

Blitz3D Forums/Blitz3D Beginners Area/Terraining

Jellon(Posted 2004) [#1]
Could someone please explain a "height map" to me. I did a tutorial where they loaded a height map which was just a .jpg, so I created a black/white/grey .jpg and tried using it for my terrain, but when I test it, I get some really unexpected lighting effects. Such as I walk in a straight line and can see when I start walking and when I stop, but not inbetween, I only have 1 light. In fact, I can stand in a position and turn in a circle and only be able to see some of the time. Maybe "poping" related. Any how, I just want to know how to create a height map in a simple .jpg program. Thanks in advance for any help.


Rob Farley(Posted 2004) [#2]
A height map is exactly as you mentioned, a grey scale image, there's no more mystery to it.


_PJ_(Posted 2004) [#3]
According to the DOCs, only RED channel is used for the actual height details. Although of course, Greyscale images are far easier to see.


Rob Farley(Posted 2004) [#4]
Something to watch out for, as mentioned on another thread is a 16bit image does not have as much red detail as a 32 bit image and therefore will not be as smooth.


SoggyP(Posted 2004) [#5]
Hi Folks,

Also, check your terrain scale.

Later,

Jes


Jellon(Posted 2004) [#6]
Thanks for trying, but I already knew/tried all of that. All I know is when I use this other guy's terrain it works fine, but when I switch over to my terrain it goes black when I walk around. The only thing I change whatsoever is the image I'm using for the terrain. Both images are the same size and both are .jpg. I guess Blitz doesn't like me or something. I'm also having collision problems, I copy/paste someone elses code and just switch the names on things, and then it fails to work all in a sudden. Maybe game making isn't for me :/


_PJ_(Posted 2004) [#7]
Perhaps clipping is an issue. How much distance on average is there between your camera and the terrain?


Jellon(Posted 2004) [#8]
Clipping isn't an issue b/c someone else's terrain works but mine doesn't. If you want to see my code here it is, well the important stuff for the camera. I also have sky a textured sky and suff, but you don't need that I don't think. I see the sky, but the terrain goes black as I move around.

;CAMERA PIVOT
camera_pivot= CreatePivot()
EntityRadius camera_pivot,5
EntityType camera_pivot,PLAYER

;CAMERA
Global camera = CreateCamera(camera_pivot)
CameraRange camera,1,1000
CameraFogMode camera,1
CameraFogRange camera,60,200

;TERRAIN
Global terrain = LoadTerrain("Height2.jpg")
;TerrainDetail terrain,2500,True
ModifyTerrain terrain,16,16,.1
ScaleEntity terrain, 3,100,3
PositionEntity terrain,-160,0,-160
ter_tex = LoadTexture("mossyground.bmp")
EntityTexture terrain,ter_tex
EntityRadius terrain,0.2
EntityType terrain,SCENERY

;Position the camera
PositionEntity camera_pivot,0,5.6,0


Warren(Posted 2004) [#9]
I have no idea what I'm talking about but what is this for?

EntityRadius terrain,0.2

That might be causing Blitz to cull the terrain entity or something while you move the camera around.


Jellon(Posted 2004) [#10]
ok yeah, I used copy/paste from an example. But I've said it once and I'll say it again, it works perfectly fine if
I use:
Global terrain = LoadTerrain("Height2.jpg")
but doesn't work if I use:
Global terrain = LoadTerrain("BasicTerrain.jpg")
which is a black and white jpg i created in Windows Paint.


Stevie G(Posted 2004) [#11]
Can you see it from above ?

Positionentity camerapivot,0,500,0
Pointentity camerapivot, terrain


Jellon(Posted 2004) [#12]
I havn't tried it. I'm not working on terrain any more, working on collision which is giving me even more trouble. I tried doing cut/copy from my code, cutting out unneeded stuff like terrain, and then put it into it's own .bb file so I could ask other ppl to find my bug, and now I can't get it to not work. GAH!


SoggyP(Posted 2004) [#13]
Hi Folks,

which is a black and white jpg i created in Windows Paint.


Please can you post an image. If it is black and white you are going to get massive, horrible, jerky jumps.

You need a greyscale image, not a black and white one.

Later,

Jes


Rook Zimbabwe(Posted 2004) [#14]
I was given a good peice of advice when I first started in Blitz... Try to start slow... Small steps... It sounds like you are trying to run as opposed to walk...

I don't know what paint program you are using but if you google for MAPS NASA in images you will get more than a few nice maps... Put them in your paint program and make them Greyscale... Square them and then use them...


Jellon(Posted 2004) [#15]
I don't know how to use the forums here. I don't see any way to quote people, let alone try to post an image. Uh, I don't know the difference between a bmp with only black, white, and grey colors and a "greyscale" image. That maybe my problem. Thx, I'll try that out. As for running before walking, I'm not sure about that. I thought creating a simple bmp file with only black white and grey would be pretty simple.

The Paint I'm using is a program that comes with just about ANY Microsoft Windows. It's a very basic program. Btw, I got collisions working, yeah!