Terrain Editor

Announcements and news updates to your projects using Urho3D.
Forum rules
If you have images or videos, you can attach them in the showcase post. Please use small thumbnail as link to original media resources.
When you post in this forum, you have to agree that Urho3D main website as well as the Facebook page have the permission to republish your post with all the related images or videos. The original images must have width larger than 890px for best viewing result in all the supported viewports by main website.

Terrain Editor

PostPosted by JTippetts » 19 Jan 2015, 02:48

Edit:
Another recent image:

Image

Edit:
Updated with some recent images.
Image
Image
Image

While waiting for Azalrion to finish an overhaul of the DetourCrowd stuff scorvi proposed (wink wink, nudge nudge) I started working a little bit on a simple terrain editor for Urho3D. It's pretty basic right now, only a few hours into it mostly on weekends when I'm not working IRL. You can find it at this clicky right here if you are interested in running rough, unpolished code. It'll run from unmodified Urho3DPlayer if you like. Just copy the TerrainEditorData to the Bin directory and add it as a Resource Directory. (Disclaimer: not currently tested from a vanilla Urho3DPlayer; also not tested in OpenGL. If you try it and run into problems, let me know.) To run, execute the file LuaScripts/testterrainedit.lua. (Did I mention it requires Lua support to be built in?)

Image

Additionally, it comes with the framework code for an enhanced player app that includes built in support for the vm branch of the Accidental Noise Library for noise function support.

The program supports a basic set of brushes: edit height, smooth height, 4 detail blend layers (using an enhanced version of the default TerrainBlend shader to support a detail layer in the alpha channel of the blend texture) masking and filters. The height editing is fairly reminiscent of the old Age of Mythology editor. It's serviceable, but the real power of a thing like this is in procedural support which is where the Filters come in, accessible via the toolbar menu.

Image

Filters are implemented as Lua scripts held in a certain directory that is scanned at startup. They specify parameters that can be tweaked, and upon a press of the execute button will perform their scripted action.

Image

So far, I've only implemented a small handful of test filters: one to Cliffify terrain (ie, set terrain to a cliff texture based upon its steepness), one to generate a fractal-based mottled pattern of dirt and grass and one to generate a generic fractal-based terrain with some tweakable parameters. As I refine this thing (and especially as I use it for other projects) that filter list is certain to grow. In order to use the included filters, the Urho3D player needs to be built with the ANL noise support.

Image

The program is really very simple. An editor component is implemented as a script object (it'll probably be done as a C++ component very soon) exposing some methods for painting to the various layers, and a UI component instances the UI widgets and hooks them all up. The UI is currently VERY unpolished and will certainly change as time goes by. There are a few issues (such as changing filter parameters not being persistent between sessions at the filters window) but for the most part it is functional. As of the time of this initial posting, importing and exporting from PNGs is not fully supported; you can do an export of the terrain map by pressing 's' and the blend map by pressing 'd'. 'a' takes a screenshot. I'm working on the New Terrain and Import/Export dialogs pretty much as we speak, though.

Anyway, if you're interested take a look. It'll be a project I work on occasionally as I require features, but it won't be a main focus item (especially once Azalrion gets moving).
Last edited by JTippetts on 07 Apr 2016, 01:02, edited 2 times in total.
User avatar
JTippetts
Active user
Active user
 
Posts: 129
Joined: 26 Jan 2014, 23:41
Location: United States

Re: Terrain Editor

PostPosted by vivienneanthony » 19 Jan 2015, 03:02

I'm going follow this. It seems like its something I am trying to implement on a different level.
Office Youtube Page -https://www.youtube.com/user/cgprojectsfx
Official Blog -http://cgprojectsfx.wordpress.com/
Official Deviant -http://cgprojectsfx.deviantart.com

Existence Source
https://sourceforge.net/projects/proteusgameengine/files/Existence/
User avatar
vivienneanthony
Have many posts
Have many posts
 
Posts: 546
Joined: 12 May 2014, 13:21
Location: United States

Re: Terrain Editor

PostPosted by weitjong » 19 Jan 2015, 03:22

Cool. I will definetely take a closer look. At first glance I see your include dirs in the main CMakeLists.txt are still hardwired for Lua and tolua++. The latest Urho master branch already contains the changes you requested in Urho GitHub Issues sometime ago.
YaoWT - Leave no window unbroken ♪ (^。^) 
User avatar
weitjong
Contributor
Contributor
 
Posts: 1094
Joined: 16 Jan 2014, 15:34
Location: Singapore, 新加坡

Re: Terrain Editor

PostPosted by devrich » 19 Jan 2015, 05:14

This is Awesome! Many thanks for working on this :D
Don't settle for what someone else made -- upPIC your own [:.:] at: http://DevRich78.com/upPIC
User avatar
devrich
Some active
Some active
 
Posts: 84
Joined: 09 Jan 2015, 07:46
Location: Usa

Re: Terrain Editor

PostPosted by rogerdv » 23 Jan 2015, 20:28

Great! Why isnt it part of the official editor? Because it is written in Lua? Is there going to be texture painting?
User avatar
rogerdv
Most active user
Most active user
 
Posts: 251
Joined: 03 Apr 2014, 17:37
Location: Cuba

Re: Terrain Editor

PostPosted by JTippetts » 24 Jan 2015, 02:48

I had thought about writing it as part of the editor, but decided not to because:

a) The editor is getting pretty complex, and I have only the tiniest familiarity with AngelScript and no desire to plunge into that codebase to integrate it, and
b) I decided I preferred a standalone approach rather than further complicating the editor. The editor UI is getting quite 'busy' and I didn't really want to deal with all that just for simple height editing.

I've made a few recent commits. A quick hack to implement the basic editing tasks in C++ rather than Lua, for better performance. Modified the test filters to use the mask layer (toggled with a check flag). For example, you can paint an area with the mask tool:

Image

then run the genericfbm fractal filter, with Use Mask selected, to apply the filter only to the masked area:

Image

And the result is that the filter is applied only in the selected region:

Image

Currently in the works is the ability to select a brush that will add checkpoints, or waypoints, to a list as you click. Filters can access the checkpoint list to do tasks such as road-building, ie by interpolating the curve formed by the checkpoints and smoothing/raising/lowering the terrain along the curve. Or tasks such as interpreting the checkpoint list as a closed region and converting it to a mask. Stuff like that.
User avatar
JTippetts
Active user
Active user
 
Posts: 129
Joined: 26 Jan 2014, 23:41
Location: United States

Re: Terrain Editor

PostPosted by setzer22 » 26 Jan 2015, 10:02

THANK YOU! :D

I heavily rely on terrains for my Project and this is editor is going to be a huge time saver!
User avatar
setzer22
Some active
Some active
 
Posts: 99
Joined: 26 Aug 2014, 14:28
Location: Spain

Re: Terrain Editor

PostPosted by rogerdv » 26 Jan 2015, 12:06

Aboutr the editor UI getting too crowded, I have been thinking to propose to separate editor functions like Torque does. Torque editor has different screens for different tools: one mode for UI editing, one for scene editing, one for terrain, and so on.
User avatar
rogerdv
Most active user
Most active user
 
Posts: 251
Joined: 03 Apr 2014, 17:37
Location: Cuba

Re: Terrain Editor

PostPosted by JTippetts » 26 Jan 2015, 13:20

I've been working on a draft of a Road Builder filter. The current waypoint system lacks a UI; you add waypoints with the W key and remove with the Q key. When I get to polish stage I'll add a real UI for it. The Road Builder filter requires at least 4 waypoints (to feed to a cubic spline). So once you have built a terrain, you use W to add a few waypoints:

Image

The road builder filter gives you a few options to control things such as road width, fadeout distance of the road bed and paving texture, which detail texture layer to use for the paving, and the number of steps to tessellate each segment of the spline.

Image

After tweaking the parameters to your taste, hit execute and wait for a little while. (The procedure is currently non-optimized, requiring three rasterization passes.) And the result:

Image

Grab the smooth brush and go to town on the rougher spots to make it nicer:

Image

Note that you do have to consider your waypoint placement carefully. The filter gets elevation heights at the spline knots (waypoints) and interpolates between them, so it will happily bridge and carve the hell out of things:

Image

Working on this brings back memories, as I am digging through my archives all the way back to 2005 to a nearly identical project I was working on using a custom engine. Urho3D makes it a lot easier to add new features, though.
User avatar
JTippetts
Active user
Active user
 
Posts: 129
Joined: 26 Jan 2014, 23:41
Location: United States

Re: Terrain Editor

PostPosted by devrich » 26 Jan 2015, 13:29

Brilliant! :D

Many thanks JTippetts for working on this ( i know i said that already but this is great! ) :D
Don't settle for what someone else made -- upPIC your own [:.:] at: http://DevRich78.com/upPIC
User avatar
devrich
Some active
Some active
 
Posts: 84
Joined: 09 Jan 2015, 07:46
Location: Usa

Next

Return to Showcase

Who is online

Users browsing this forum: No registered users and 1 guest

cron