Free Terrain Mesh system
Blitz3D Forums/Blitz3D Programming/Free Terrain Mesh system
| ||
| Hi all ! I decide ti give my terrain system without occulusion system in a speciale License Agreement version. This Height Performance Terrain Mesh System is base on Tile mesh system who are child of a primary mesh. If you want more informations ask me ... The heightmap must be in n^2+1 pixel width (129,257,513,1025 ... ) Look at the code to use it |
| ||
| Eole, I'm a blithering idiot -- any chance for some example usage to look at?? |
| ||
| er.... Ditto :) |
| ||
| Oki a little example ... th QTS_V1.bb is the engine |
| ||
| Eole, Blitz keeps crashing with the demo. It doesn't seem to like my heightmap. Can you provide the heightmap you used when you tested the demo? I keep getting an "Offset out of range" error on: Function QTS_MatrixIndex( x,z) Return (( z * QTS_HeightMapSize) + x) End Function QTS_HeightMapSize value is: 256 |
| ||
| Read my post you must use a n^2+1 Heightmap size : Heightmap size : - 257 - 513 - 1025 Try with an heightmap of 513X513 |
| ||
| Would not work with 257x257 only got it to run at 513x513. I did notice that there are visible lines between each patch - I assume this is since the normals are not calculated correctly at the joins? nice though :) How does it's speed compare to blitz terrains? have you done any tests? |
| ||
| Hi, It also looks like you create a new surface for each patch... Is this not bad practice? |
| ||
| Ok ! >>Would not work with 257x257 I see, the lib it's not really finish, somewhere there is a FOR NEXT with 513-1 step this walue must be egal at the width oh the heightmap not only 513 >> I assume this is since the normals are not calculated correctly at the joins? Yes, I use the build in update normal >> How does it's speed compare to blitz terrains? have you done any tests? It's little more speed than a blitz terrain, the objectiv it's to manage a lot of range object You can attach object on each patch of the terrain, so when a patch is hide, all the child are hide too .. With this, you can't test all the objects on terrain :-) After when a patch is visible you can test if the child are in a correct distance from the camera etc ... >Hi, It also looks like you create a new surface for each >patch... Is this not bad practice? Actualy I stop it, I work on 3D Space FPS Shooter :-) alone :-( |
| ||
| You will find lovely young french ladies to work on your space shooter. |
| ||
| You mind if I "try" and make some improvements? |
| ||
| Do you have samples of Height, grass, detail, and tree? So we can see what it looks like with the right images. |
| ||
Have added simple movement code to the example
Include "QTS_V1.bb"
Graphics3D 800,600,32,2
SetBuffer BackBuffer()
; Creating the terrain
QTS_CreateTerrain( "heightmaptest.png",4,5)
ScaleEntity QTS_Terrain,10,10,10
PositionEntity QTS_Terrain,-513*10/2,0,513*10/2
; Add texture to it
texture = LoadTexture("Grass.jpg")
QTS_TextureTerrain(texture,0.5,1)
texture = LoadTexture("detail.jpg")
QTS_TextureTerrain(texture,0.01,0)
; Add object on patch
;treee = LoadMesh("demo\tree.b3d")
;ScaleMesh treee,0.2,0.2,0.2
;HideEntity treee
For i=0 To 1000
x = Rnd(-256*10 , 256*10)
z = Rnd(-256*10 , 256*10)
; Get the mesh of this position
parent = QTS_GetMesh(x ,z,10 )
; Get height a point x,z
y# = QTS_TerrainY#(x,z)
;tmp = CopyEntity( treee )
; The patch will be the parent
;PositionEntity tmp,x,y,z
;EntityParent tmp,parent
Next
; Camera
Global AxisCamera = CreatePivot()
Global camera=CreateCamera(AxisCamera)
PositionEntity camera,0,1.78,0
CameraRange Camera,1,10000
CameraClsColor camera,50,0,200
PositionEntity AxisCamera,0,160,0
EntityRadius AxisCamera,2
EntityType AxisCamera,1
; Light
light = CreateLight()
PositionEntity light,1280,100,1280
CameraFogColor camera,52,57,40
CameraFogRange camera,800,1500
CameraFogMode camera,True
Tp_OldTime = MilliSecs()
HidePointer()
;HideEntity QTS_Terrain
While Not KeyHit(1)
QTS_UpdateTerrain( camera , 2000 )
If KeyDown(30) MoveEntity camera,0,2,0
If KeyDown(44) MoveEntity camera,0,-2,0
If KeyDown(200) MoveEntity camera,0,0,5
If KeyDown(208) MoveEntity camera,0,0,-5
If KeyDown(203) TurnEntity camera,0,1,0
If KeyDown(205) TurnEntity camera,0,-1,0
RenderWorld()
Flip False
Wend
|