Saving a terrain made in blitz...Again
Blitz3D Forums/Blitz3D Beginners Area/Saving a terrain made in blitz...Again
| ||
I know I posted this problem a while back and tried some of your suggestions the best I could, so now I have this terrain maker working and it saves a terrain but it saves it with out any terrain detail. Neos wrote a function for me(thank you Neos) to save terains but it is just saving a flat plane. I don't have a clue why its not saving correctly. One thing I can say is that the saved terain does carry some of the detail just none of the hight changes. In other words it saves as a plain, but when viewed in wireframe mode I can see that it is adding vertices where the hills should be. I will try to put some screen shots in my next post but for now here is the code. Please help? |
| ||
This code will run now I have disabled the texures and model so you all can run it and check it out. It looks a lot better when its textured. If you want to run it here are the official docs... Do this first! Press 1 on keypad to fix camera to the marker position. arrow keys to move marker and camera a and z to raise or lower terrain f1 - f5 to change modes f1 free roming mode (lets you move around without changing the terrain.) f2 wireframe veiw f3 - f5 changes different drawing styles 1 on keypad again changes camera views L = light position at marker position - on numberpad to change lightrange and coneangles 1 on numberpad to change light color (randomly) space bar for general help instructions (not finished yet but works 8 times) esc to quit |
| ||
The code still doesn't work, as your still loading them. So basically, you saving your terrain, then loading it back in, but the mesh loads in as a flat plain? I assume that's what your wanting, is to convert a terrain, into a mesh? |
| ||
The Terrain starts as a flat plane When I begin the program. Then I raise various points in the terrain to make it look like trenches or hills or whatever, what I want is to save the end result of the terrain as untextured landscape, not nessesarily a mesh. A hightmap would be better. Right now Neos's function saves a.......somthin witch I can veiw in another program I made last night. The problem is its truncating the land scape when I save, (just in the saved version) so when I load it into another program all I get is a flat plain again. I want the landscape. One interesting fact, is that the saved terrain does have a lot of extra vertices, wher the hills should be You Know what I meen? In flat plane you only have 4 vertises right? "So basically, you saving your terrain, then loading it back in, but the mesh loads in as a flat plain?" Yes but I am not loading it back into the above program just another one I made for viewing it. Heres that one. Graphics3D 640,480 SetBuffer BackBuffer() Global camera=CreateCamera() lite=CreateLight(3) RotateEntity lite,90,0,0 Global terra glassgrid_tex=LoadTexture("_tex/crossgrid.bmp") terra = LoadTerrain("myterrain2.b3d") ;EntityTexture terra,glassgrid_tex PositionEntity terra,0,-20,0 PositionEntity camera, EntityX(terra)+20,EntityY(terra)+10,EntityZ(terra)-10 While Not KeyDown(1) If KeyHit(57) = True Then enable=1-enable WireFrame enable RenderWorld Flip Wend End |
| ||
So, is this just to tough or impossible to do? Is that why I can't seam to get many responces? Am I excomunicated? Is anyone out there? Is it a laim question and I should already have it figured out? Has anyone tried it out? If not Please do so now cuz it's cool. I know probably bin done before, but not by me. So can I get a Whomp-Whomp??? |
| ||
I think that the TerrainHeight() command returns values between 0 and 1, so in your save terrain function you need to multiple it with 255 to get a useable color out of it, Only a guess though: Anyway try changing the line: hgt# = Floor(TerrainHeight#(terra, x, y)) To: hgt# = Floor(TerrainHeight#(terra, x, y))*255 Hope this helps. |
| ||
I added that line and it works better but still not propper. Now instead of saving it as a flat plain it is at least saving it with some of the terrain detail but only 1 unit high. I found a save terrain funcion in the code archives and it does the exact same thing. |
| ||
. |
| ||
A heightmap is grayscale with a range from 0-255, but when loaded with the "loadterrain" command is converted to values between 0-1. That is why if you are saving a terrain out as a heightmap you need to multiply by 255 as Jeppe expained. When you have loaded the terrain then use the "scaleentity" command to set the scale of the terrain. The Y value determines how high the hills and how low the valleys. I hope that helps somewhat. |
| ||
Yep that helped lots. So it finaly works! Also you just awnswered another queston I just posted. Thanks all. |
| ||
You're welcome. I'm glad that it helped, I wasn't sure it was what you were looking for. |