XNA Terrain Editor
Screenshots
 
Videos
   

Comments
 
Derek - 32 months ago
This is pretty sweet, with source code included. Excellent work.
 
SteveKr - 31 months ago
Very great!
 
psycadelik - 31 months ago
Thanks :)

The next step should be to use quadtrees for a faster drawing and ray/terrain collision.
rhombus - 31 months ago
When I create a new map of rectangular size, like say 64x256, everything appears stretched out such as the height tool circle. Wireframe view shows that the polygons look correct and the tools seem to work fine, it's just the display of the map in normal view and the display of the tool circle that looks wonky.
rhombus - 31 months ago
BTW this is a great tool, I'm prolly going to use this with my game. I'll give proper credit of course. Another suggestion: with the height tools, have an inner circle and an outer circle with adjustable sizes, the inner circle would change the height map at the same rate within, then use a new value to determine the amount of slope between the inner and outer circles. It would also be great to have all the tools and menus as part of the editor view itself so it could be used as an in-game editor or at least work well full screen. I might dink around with doing that myself for fun.
gib - 31 months ago
Wow, very nice!

Can anyone post a quick example of how to load what you create in a xna game. Im a noob yet. when i save the project it creates and _.xml, _color.tga and _height.bmp files. I understand their use, roughly but how do i load them and display in my game1.cs project?

Thanks!
Gib
 
Derek - 31 months ago
I haven't looked through the source code but you'll likely need to rip out and integrate the code from the editor that displays the terrain.
 
psycadelik - 31 months ago
To rhombus:
Thanks, I'll be glad to see it being used by others :)
I'll fix the rectangular size problem of the texture, will look at using an inner circle for the height modification and texture painting.

I'm working on an ingame form system right now, and will be integrating it to the editor.

To gib:
Thanks, glad you enjoy it. As for using it in your own game, you will need a couple of things.. the heightmap class, Triangle class, parts of the MathExtra class, the XMLReader class, the Sun (and sunQuad) and Skybox of course, the camera/mousecam... Those are the main classes. The loading function (LoadTerrain) is located in HeightmapSettings.cs.
gib - 31 months ago
psyc,

You're really quite talented and I really appreciate that your building this AND the source code to learn off of.

Thanks for letting us know what classes we will need in our game to load the terrain as I was just stepping through the code now and looking at the LoadTerrain fxn trying to get a feel for how this all works.

I looked at Riemers.com on his terrain tuts but he's not covering how to load from an xml file so I did a search on xna terrain editors and boom found your UTUBE vid.

By the way, I thought we couldn't use windows forms in xna?? That's what I read a few months ago on the xna forum, that the xna framework didnt support it but here you are making it happen. I just noticed that it appears you actually wrote this in native C# and referenced in the using area, the xna framework. Is that a secret nobody knows about - that you can write an xna game in native c# like this and not use game studio express? I thought we had to use the latter? Man, this is what I wanted so I could make my windows forms for my game interface as a prototype (for a mmorpg where you have a logon screen, character generation, inventory system, ect).


You da man!

Thanks,
Gib
 
psycadelik - 31 months ago
Thank you, :)

I didn't know it was impossible to use windows forms, I just tried and it worked.. didn't ask myself why. I'm almost done developing my own system anyway, and I'll share that project as well, very soon.

I'm not using native c#, the game class has been renamed to Editor, thats all.

Anyway, thanks again for the comment.
gib - 31 months ago
Hey psy, found out(well this seems to have done the trick anyway) why you cant really use anything larger that a new project 64x64. Your're drawing too many triangles. in your device settings portion of code add this:

device.RenderState.CullMode = CullMode.ClockWise;

This only draws triangles that are visible. Otherwise, your "drawing" the "opposite side" of objects resulting in too much drawing and completely kills the frame rate. I was playing around with this after finding out why you recommend only doing a 64x64 grid but since I want to design a zone for mmo's - and those are huge I needed to find out why. i hanvent fully played with the program yet with this change though i did do a 256x256 project and this seems to work.

Gib
gib - 31 months ago
Well, I need to append to my last post. It seems to help but now when I raise up terrain, it seems to lock up the prog until i release the mouse button. At which time a little bump appears and then the frame rate goes from 2 back to 60

Gib
 
psycadelik - 31 months ago
Hey gib, the cull mode is already defined as clockwise in the heightmap class so I wasn't sure what you meant.. anyway, the lag problem (lock up) is due to the number of triangles being scanned for mouse picking, that could be solved by using quadtrees to scan only visible triangles, but it will take me some time to implement. Patience is a virtue ;)
gib - 31 months ago
I just read an article on Octree culling from http://www.thehazymind.com/ shortly after I posted last night :)

I didn't know you where doing further work on this, that's fantastic!

Gib
 
psycadelik - 31 months ago
The next update will add my xWinForms controls so the program can work in fullscreen (optional of course, as will be the resolution), and some fixes (the rectangular size bug in particular).

Then I'll begin working on using quadtrees, and the tutorial I will base myself on can be viewed here:
http://www.gamedev.net/reference/programming/features/quadtrees/

It makes more sense using quadtrees for a terrain, since octrees are the three-dimensional analog of quadtrees.
http://en.wikipedia.org/wiki/Octree)
 
psycadelik - 31 months ago
 
VirtualHermit - 29 months ago
Thanks for posting this tool and especially the code!
Hope you are able to continue work on this.
Usurper - 23 months ago
Hello Psy - I'm using Windows Vista Premium and when I startup your program my mouse is stuck inside the editor window (invisible of course) and I can't do anything without the mouse! I tried alt+enter and all kinds of remedies. And thanks for this, even though I haven't got to use it yet.
 
psycadelik - 23 months ago
Hello Usurper,

If the C key doesn't work, get rid of vista hehe
Usurper - 23 months ago
C works, thanks Psy.
ggf - 23 months ago
I can DL it, once its done getting ready it opens a IE the it closes and brings me back to start. wat do i do?
 
psycadelik - 23 months ago
I don't know what you're doing ggf.. just save as, unzip and run..
durg78 - 23 months ago
Psy,
I've made a modification to your HeightMap class. I noticed that when using the height modification tools on a map of 256x256 it was deathly slow. Looking at the code I noticed that it was calling UpdateVertices() from MoveVertices(), and the UpdateVerticies was updating every vert of the map. I changed it to update only the ones that have been changed by the tool. I did the same for the SmoothVertices() method. I also removed the call to SetUpIndices() from within UpdateVertices(). This gave a dramatic speed improvement. I didn't see a need to modify or recreate the indices since there aren't new verticies being created/removed. However, since I'm now skipping the call to SetUpIndices(), I need to make a call to SetUpCollision() so the Tri's are updated with the new Vert positions. Anyway, I am now able to use these tools on large maps without the major loss in fps, and thought it might be something you may want to look into. :D
 
psycadelik - 23 months ago
Durg, that's great :) , you think you could send me the modified class? I'll put a thank you note in the readme of the editor hehe. And I'm sure some people would appreciate the update. (ericgrossinger_at_gmail_dot_com)
durg78 - 23 months ago
Yup, I planned on sending it to ya. I just have to tidy things up a bit. ;)
 
gax1488 - 22 months ago
Sorry need help on installing terrain editor, everytime i try to run terrain editor on my computer it says XNA Terrain Editor has encountered a problem and needs to close. We are sorry for the inconvenience. please can you help me..thanks..
gib - 22 months ago
Great minds think alike durg, I did something similar in another project example I was using to learn off of. Where you going to post your solution?
 
psycadelik - 22 months ago
drug's modifications are being implemented in the editor which should be updated pretty soon, sorry for the long wait..
gib - 22 months ago
awsome!
halloamt - 22 months ago
Nice project, the only thing is that it has a bug with loading files in another than the project direcotry. You can cancge that quite easily if you add
String path = Directory.GetParent(filename).ToString() + Path.DirectorySeparatorChar;
in line 620 and 660 and change the lines wich load the or save the files to use the path.
halloamt - 22 months ago
I fixed another bug, maybe if I find more, can I send you a patch or the whole project and you create a patch from that ?
halloamt - 22 months ago
If you have a file open an dthen you load another one and save that new file the old one is overwritten. To change that add
Editor.mapName = filename;
somewhere in HeightmapSettings.LoadTerrain(string filename)
 
psycadelik - 22 months ago
Thank you for the comment, and noticing me about those bugs.
If you have more than those two you can send me a patch or the whole project and point me to the changes made. Also, you could use a pm next time so the comments don't get cluttered with these bugs..
gib - 22 months ago
Hi psy, will you be putting the optimization out from durq soon?
 
psycadelik - 22 months ago
Alright, I will upload an update shortly (later today) that will include the quadtree modification added by Drug, but be advised it's not used to speed up the rendering, yet, but only to speed up the mouse ray collision detection. (The size of the map is still limited to 256x256 for now, for bigger maps you will have to wait for the new heightmap classes that I'm working on, which uses cells)
gib - 21 months ago
I was wondering If I am starting to understand terrain texture splatting; I was following the flow of your code psy and you make a color map. After a person "paints" on another selected texture, is your code making one large texture files by combining the rgba "layers" like Reimers describes in his tuts on HLSL, and then reloading that new terrain texture so theres only one real texture file, along with the heightmap(bumpmap) file?

I had tried FreeWorld3d editor and in his documentation he said not to forget to "collapse" the terrain layers into 1 before saving your scene. So to me it seemed like a light went on after I weaved my way through your programs code logic last night.

Did I understand correctly? On the XNA forumns, a gent by the name of LordIkon mentioned doing terrain painting ala Reimer's tuts style but then your only limited to 4 textures total for terrain. Doing a "collapse" of the layers (rgba) into a new texture file(bmp, jpg, png) and then reloading after the paint would allow a person to have a real nice looking landscape then right - since you end up back with just 1 layer.

Did you make your HLSL .fx files wth NVIDIA's tool or do you just know that much about how to code in that lang? I love the groundcursor and of course none of the texture terrain painting is possible without it right?

Sorry for the long post. I guess I'd just mainly like to know if what I said is correct so I know I am learning things correctly. I assume I need to spend alot more time in your code and reimers tuts yet though :)

Thanks!
Gib
 
psycadelik - 21 months ago
You are correct, each time a pixel is modified, the colormap is rebuilt and then passed on to the shader to draw the textures layers, and there can be a 5th layer which would be the base (if rgba = 0).

I don't use any shader tools, I'm having problem making most of them work correctly hehe, so I learn by looking at other shaders and tutorials/help files. The groundCursor position is needed obviously, the texture is just a decoration.

Riemers tutorials are very good, I used them alot when I started the editor.

Here's another good page talking about texture blending : http://www.jenkz.org/articles/terraintexture.htm
gib - 21 months ago
Hi psy,

I've been studying your code(when I get free time now and then) but seem to be struggling in getting a port of your shader and c# code for the ground cursor. I was just wondering if you would ever consider breaking up your project into mini tutorials(ala Reimers) for that groundCursor technique? I hate to ask but I am sure I am not the only one that would appreciate it. :) I realize though that probably would take some time.

Thanks,
Gib
 
psycadelik - 21 months ago
It's pretty simple actually, in the shader, the coordinates for the cursor will be between 0 and 1 (textureCoordinates), therefore you just divide the mouse world XZ location (obtained by ray/terrain collision) by the map XZ size and voila! I don't think im gonna start writing tutorials, I got enough on my plate as it is, sorry.
 
psycadelik - 21 months ago
I forgot to mention that you'll have to offset the texture by -half the texture size (divided by the map size).
bugmaster - 19 months ago
Please add a hook n the esc key, how many times do you go out to get a texture or something and the habit of hitting esc to get back to normal and blap all your work is gone...
bugmaster - 19 months ago
and how about a selector for camera movement speed? or at least a shift-arrow at 2x the speed to get around, that would be cool
smadaluap - 18 months ago
Is there anything I'm doing wrong here as I can't get this to run under Vista Home Basic. I've got XNA installed on my PC running XP but not on my Vista laptop. I've installed the XNA redist. and the .NET 3.5 Compact Redist, yet it won't run at all and reports that it's crashed before it even starts.
Thanks.
smadaluap - 18 months ago
Is there anything I'm doing wrong here as I can't get this to run under Vista Home Basic. I've got XNA installed on my PC running XP but not on my Vista laptop. I've installed the XNA redist. and the .NET 3.5 Compact Redist, yet it won't run at all and reports that it's crashed before it even starts.
Thanks.
WILEz - 17 months ago
This project is fantastic!
Can you post a simple source code to render a terrain whit heightmap_multilayer effect?
Please log in to leave a comment
About This Project
  By psycadelik
Added June 25, 2007
Updated April 15, 2008 - View Updates
Create or modify heightmaps and color distribution maps.

Rise, lower, flatten or smooth the terrain.
Generate a random terrain.
Paint textures on your terrain.
Day-Night lighting cycle.
Import/Export heightmaps and colormaps
Save/Load Terrain xml files

and more..

(Updated for XNA 2.0)
Status Complete, with more features planned
Tags XNA terrain editor world
Category Tools
Platform Windows
Includes Executables/Binaries Source Code
URL
Project Rating
4 ratings
Please log in to
rate this project
Views: 22128
Comments: 45
Favorited: 7 times


Related Links
Copyright 2007 GameProjects.com