Last edited by Adler; 15-11-11 at 09:44 AM.
What exactly is the point of the heightmap?
Posted via Mobile Device
Heightmap - Wikipedia, the free encyclopedia
Basically it has a series of points governed by how white a pixel is. Black being the lowest and white being the highest point. After which the computer can takes these points and draw a landscape. Its actually really simple to do. You parse the texture or image and use the pixel value as where the point is.
the heightmaps is then put into an array of 129x129 and then parsed accordingly storing the pixel value in each element. After that its a simple set of functions.
This loads the heightmap
and this function draws the heightmap on the screen taking into account the current view of the camera.Code:private void LoadHeightData(Texture2D heightMap) { terrainWidth = heightMap.Width; terrainHeight = heightMap.Height; Color[] heightMapColors = new Color[terrainWidth * terrainHeight]; heightMap.GetData(heightMapColors); heightData = new float[terrainWidth, terrainHeight]; for (int x = 0; x < terrainWidth; x++) for (int y = 0; y < terrainHeight; y++) heightData[x, y] = heightMapColors[x + y * terrainWidth].R / 5.0f; }
keep in mind these are not my functions as they are done differently but you get the idea. XNA is almost identical in every way to DX9 so you can get the general idea.Code:rotected override void Draw(GameTime gameTime) { device.Clear(Color.Black); RasterizerState rs = new RasterizerState(); rs.CullMode = CullMode.None; rs.FillMode = FillMode.WireFrame; device.RasterizerState = rs; Matrix worldMatrix = Matrix.CreateTranslation(-terrainWidth / 2.0f, 0, terrainHeight / 2.0f); effect.CurrentTechnique = effect.Techniques["ColoredNoShading"]; effect.Parameters["xView"].SetValue(viewMatrix); effect.Parameters["xProjection"].SetValue(projectionMatrix); effect.Parameters["xWorld"].SetValue(worldMatrix); foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); device.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, vertices, 0, vertices.Length, indices, 0, indices.Length / 3, VertexPositionColor.VertexDeclaration); } base.Draw(gameTime); }
Oh, and this is what it looks like after being drawn
![]()
let me ask, what can you do with the landskape it is drawing?
I thought that it maybe could be used for new maps etc, but, when I saw ur newest post about it, got me thinking if you will do it like the landskape u showed or like the landskape adler showed.!?
or maybe I should ask, what kind of Landscape editor are you after?
landscapes define the map. It tells where mountains, water, and the clouds. Landscapes are essential for any 3d game. Landscapes also hold all of the objects, sfx and textures defined in the map or in this game's case, the particular grid/cell the landscape defines.
The landscape editor I am working on will be an update to beast. It can be customizable meaning you could have a 100x100 map or 30x30 map. Its still in its early stages but the heightmaps are loading like they should. If I can I'll upload a video showing its progress. I'm going to use XNA 4 but if it gives me too much grief I'll slide back down to 3.1.
Added a vid of an early look at the world editor. Many things to do, but it will be awesome when it's done.
Threw this together in about a month, most of which was spent learning maxscript :I
The file formats are terrible but it's not that complicated.~
Oh also http://www.youtube.com/watch?v=fIqVhv96ozU
working on that myself actually. Since I don't know much maxscript myself, it will take some time as well.
btw, your name sounds familiar. Do I know you?
I used to be on here as MushroomSamba I believe, work for MonsterFlailFF as Addi ;o
Side note, Maxscript's a bitch.
Last edited by Addi; 20-11-11 at 01:20 AM.
Yes, I hate MaxScript a little bit. But I was able to start working on getting the files directly into max. Its being tested now. Should have a working version soon. I'll put pics as needed.
@Addi
Whats your msn? o;
Posted via Mobile Device
It's on my profile o~o
Personally, I think FlyFF would be a lot better off if someone were to rewrite the file formats. They could be made a lot cleaner and more efficient with very little trouble.
looks like a exact copy of this opensource xna editor...
http://www.youtube.com/watch?v=xgwmZ03vZbI