Giter Club home page Giter Club logo

u3dterraineditor's Introduction

U3DTerrainEditor

Simple terrain editor built using Urho3D. Note that this is very much a work in progress. Features come and go without warning or notice. At any given time, things could be just horribly, horribly broken.

Building

U3DTerrainEditor is built using the Urho3D engine. Follow the instructions for building Urho3D, and build the engine. Building the U3DTerrainEditor follows a similar process to building Urho3D; execute the cmake batch file of your choice, as detailed in Urho3D building instructions, and specify the parameter -DURHO3D_HOME=<Path to Urho3D build> to tell it where to find the engine.

Running

When building is done, it should create a bin/ folder in your build directory, inside of which will be copied the executable and the data folders. Follow the instructions for running the Urho3DPlayer to run, specifying LuaScripts/terraineditor.lua for the file to execute. For example, to run in a window you would execute TEdit.exe LuaScripts/terraineditor.lua -w on Windows. To run in a borderless window, you would execute TEdit.exe LuaScripts/terraineditor.lua -borderless. See the Urho3D documentation for other specifiable command-line options, many of which may or may not be relevant depending on the whims of chance and coding.

Using

Once you have successfully built and run the application (congratulations will be in order, given my tendency to break things horribly as mentioned earlier) you should be presented with a view something like this:

U3DTerrainEditor first view

Note again that things change quite often, so the actual view you see may be different.

In the upper left is a toolbar showing the various actions you can perform. From left to right the tool options are: Terrain Settings (allows changing terrain size, blend layer and mask size, terrain spacing parameters, etc...); Edit Height, Smooth Height, Edit Layer (for drawing textures on the terrain), Edit Masks, Node Graphs, Waypoint Splines (TODO: Implement waypoint groups), Filters, and Help (TODO: Implement Help).

Terrain Settings

Terrain settings

The Terrain Settings dialog allows you to change the size of the terrain, change the spacing parameters, Save/Load/Clear the terrain, change the size of the terrain texture blend layers and the mask texture, as well as Save/Load/Clear on those elements. (TODO: Some of these controls are still not hooked up completely.)

From this menu, the terrain heightmap may be exported and the blend maps that determine where the terrain texture layers are drawn may be exported as well. Heightmaps currently export as 16-bit heightmaps (with the height information encoded into the Red and Green channels, for higher resolution of height values).

Edit Height

Editing height

Selecting the Edit Height tool opens up a brush settings dialog from which the parameters of the height editing brush can be adjusted. Most of the editing brushes have a similar format, with sliders controlling the parameters. Typically, the parameters include Power, which determines how strongly the brush is applied; Radius, which determines the size of the brush area; Max, which caps the brush output to a given level, and Hardness which determines the brush sharpness. When in one of the editing modes such as Edit Height, the brush is applied by holding Left Mouse Button and dragging across the terrain. The effect is applied underneath a soft white cursor that projects against the terrain, rather than directly at the mouse cursor.

Power determines how strongly the brush is applied. When holding down LMB, height adjustments are continuously added to the heightmap based on the brush shape and settings. A higher Power adds height more quickly.

Radius determines the size of the brush area.

Max caps the terrain to a selected height. If you hold Ctrl and Left-Click somewhere on the terrain, it will read the terrain height underneath the center of the white editing cursor and set Max to that value; this makes it easy to match height to existing terrain.

Some terrain using various brush settings:

Terrain stuff

Camera controls and Movement

The camera may be adjusted using the scroll wheel to zoom in and out. You can also rotate the view by holding down the middle mouse button and moving the mouse side to side and up and down. The camera will zoom all the way in to ground level at its nearest zoom level, allowing you to see what the terrain looks like from the ground. Using WASD, you can simulate walking across the terrain, exploring it from ground view.

You can quickly drag the map around by holding Right Mouse Button and dragging. Movement is clamped to the edges of the terrain. When not in Edit Height mode, the camera will track to the surface of the terrain, so that zooming in with the scroll wheel will place the camera viewpoint at ground level, and moving will slide the camera up and down hills.

Smooth Height

If you select Smooth Height on the tool bar, you have access to a tool for applying a smoothing effect. Smoothing omits the Max parameter, using only Power, Radius and hardness. The brush applies a wide-area blur affect across the region covered by the brush:

Smoothing terrain

Edit Layers

If you select Edit Layers on the toolbar, a new brush opens up with a palette of terrain textures that can be applied.

Editing terrain

Click on a texture swatch to begin editing that layer. On each swatch you can see a small up-arrow button. Clicking on that button will pull up a dialog that allows you to change the diffuse texture and normalmap to use for that layer. It will also allow you to change the layer scaling, or tiling size, of the texture.

Layer settings

Edit Masks

The editor provides 3 mask layers that can be painted to, and which can be used to mask off areas from change. Each of the editing brushes (Edit Height, Smooth Height, Terrain) has a checkbox to force using one or more of the Mask layers. You can use Masks to protect certain areas from change. Projects currently in progress will also allow masks to be inverted, once the UI changes are made to select them. Other tools, such as the Node Graphs tool (which is used for procedurally generating terrain) already implement mask inversion.

As an example of how masks are used, you can select Red mask, and paint an area.

Editing Mask

Then, a Node Graph can be applied, and instructed to use the inverse of the Red mask to guide where the output should happen:

Painting with a mask

The mask value scales the power of the brush or effect, so you can see that at the edges of the mask, where the mask value softens, some terrain editing happens, but in the areas where the mask is full power the terrain is protected. The masks are rendered as Red, Green and Blue overlays on the terrain. In the works are some UI changes that will allow showing/hiding the masks from view.

Using a mask also works with the Smooth Terrain and Edit Layer brushes. You can specify to use any of the masks, or even all of them if desired.

Terrain Generation

Painting terrain and height, imo, is only marginally useful, and even then mostly in the later stages of creating a map. In order to get things started, I find it far more useful to use procedural effects to create an initial map, then edit from there. The U3DTerrainEditor now provides preliminary functionality to create procedural noise functions. The procedural noise generation in U3DTE is based on the Accidental Noise Library. In the lower-right corner of the screen when you select Node Graph editor is a small window labeled Noise Node Groups, with a listview and a collection of buttons. This interface allows creating and managing groups of nodes, which comprise graphs of noise functionality. Click on New to create a new node group, then select a node group you wish to edit and click Edit. It will open a full-window pane with a UI allowing you to create chains of function nodes in a visual, graph-based manner:

Node graph interface

On the right of the window is an output node that is created for you. The output node includes a preview pane, which is used to preview the output of a node chain, and a set of controls for outputting the node function chain to any of the Height, Terrain Layers, or 3 Mask layers. On the left is a menu of node creation buttons. Click a button to create a node of the selected type, use LMB to drag it around, and drag on an output connector to drag a spline connection to another node's input connector, in order to make a graph connection.

After you have built your node graph, you can apply it to the heightmap or to any of the terrain layers or masks. For example, here is the above node graph applied as height:

Fractal terrain

You can get pretty elaborate with the nodes, as needed. Nodes on the UI pane can be dragged around by left-clicking and moving the mouse. Additionally, you can left-click and drag on the pane to move the whole set of nodes, and expose additional window area that can be used.

Of course, you can use a node chain to output to any of the layers, including the masks or the terrain texture layers:

Output node graph to terrain layer

You can also map a node group directly from the Noise Node Groups window, without going into Edit mode, using the Map Output button at the bottom of the window.

Waypoint Splines

Currently, this toolbar option does nothing. The editor does have the ability to allow you to specify splines, but the functionality has not really been formalized yet. As of now, you can create a spline of waypoints by pointing the mouse cursor at a location and pressing 'E' to generate a waypoint. When you have 4 or more waypoints, a spline curve preview will be generated connecting the waypoints, so that you can visualize the spline layout:

Spline

Waypoints track to the elevation underneath them. They can be removed in the reverse order that they are created using the 'Q' key. In the works is a more formalized system to manage groups of waypoints.

Filters

U3DTerrainEditor also provides the ability to apply filters to a terrain. Filters are small Lua scripts housed in the TerrainEditorData/LuaScripts/TerrainEditFilters folder. They are accessed using the Filters button on the main edit tool toolbar in the lower left. Clicking the Filters button brings up a window listing the available filters on the right. Selecting a filter brings up a set of options in the pane on the left, and an Execute button.

Filters

Currently, only a small number of filters are implemented, but it's easy enough to add more as needed. The most useful ones are:

Erosion

Erodes a heightmap using a simple droplet-based erosion filter. Controllable simply through a specifiable Power parameter. Clicking execute on the filter will erode the terrain.

Erosion

Cliffify

Uses the slope of the heightmap at a given location to set a terrain layer value:

Cliffify

Cavity

Calculates a cavity map to detect depressions or cavities, and uses it to apply a terrain layer:

Cavity

Road Builder

The Road Builder filter uses a spline to generate a road. Splines are a sort of unfinished feature that still has a lot of work to be done. Currently, to create a spline, you use the 'W' key to place points on the terrain. The points are projected from the mouse cursor, rather than the editing cursor, and they track to the elevation even if it changes. Place 4 or more points, and a preview ribbon will be shown depicting the spline.

Spline preview

Waypoints can be erased using 'Q'. This will be an area for improvement in the future.

With a spline, if you set some parameters in the Road Builder filter and hit Execute, the filter will create a road following the spline. It will carve the road bed, and apply the specified terrain layer as a paving strip.

Road filter

Care should be taken in locating the waypoints, as the spline takes elevation from the waypoints and will happily bridge or carve its way across/through any terrain.

River builder

The river builder is similar to the road builder, in that it uses a spline. However, instead of carving a road it carves a river-bed, with the stipulations that it only descend from starting point to ending point, and that it can have different widths for the start and end point. Thus, care should again be taken in locating the spline knots, with consideration as to how the river should run through the crossed terrain.

River builder

Screenshots

Screen1 Screen2 Screen3

The Future

There are a lot of things I would like to do with this. I'd like to elaborate on the waypoints system, to allow groups of waypoints with toggles to show/hide the preview ribbon, as well as specify the width(s) of the preview ribbon to better visualize how it will appear as a road or river of a specified width. I'd like to re-vamp the save/load/import/export system, and implement a system for saving/loading node groups. I'd like to make the node group stuff a bit more useful, perhaps implement the ability to import from libraries of commonly-used node graphs, to eliminate some redundancy. Lots of things I'd like to do, but this project really isn't my main focus so it'll probably happen fairly slowly.

u3dterraineditor's People

Contributors

jtippetts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

u3dterraineditor's Issues

“Help” do not work

Description: After press the “Help” button nothing changes
Repro steps:

  1. Press the “Help” button
    Expected: Open a help manual
    Priority: High

application crashes at launch

application crashes at launch
tested on:
Win 7 64, Intel Q8400, Nvidia GT 640, Dx11
Win 7 64, Intel E8400, ATI Radeon HD 4800 Series, Dx11

untitled-1

Clear button do not works

Description: After “Clear” button presses nothing changes, terrain not cleared

image

Repro steps:

  1. Make some hills on terrain
  2. Press the “Clear” button
    Expected: Terrain was cleared
    Priority: Medium

Unable to Build using current Urho3D HEAD library

Hi there, I have been having problems trying to build the terrain editor using a Urho3d library build from current HEAD.

When building with Visual Studio 14 I receive the following error:
Error C4716 'anl::CKernel::operator=': must return a value TEdit c:\users\user\desktop\u3dterraineditor-master\thirdparty\accidental-noise-library\vm\kernel.h 164

I replaced the accidental-noise-library with the latest one committed, but it results in further different errors:

Error LNK2019 unresolved external symbol "void __cdecl anl::RegisterANL(class asIScriptEngine *)" (?RegisterANL@anl@@YAXPAVasIScriptEngine@@@Z) referenced in function "void __cdecl LoadScriptBindings(class asIScriptEngine *)" (?LoadScriptBindings@@YAXPAVasIScriptEngine@@@Z) TEdit C:\Users\USER\Desktop\U3DTerrainEditor-master\Build\LoadBindings.obj 1

Error LNK2019 unresolved external symbol _Direct3DCreate9@4 referenced in function "private: bool __thiscall Urho3D::Graphics::CreateInterface(void)" (?CreateInterface@Graphics@Urho3D@@AAE_NXZ) TEdit C:\Users\USER\Desktop\U3DTerrainEditor-master\Build\Urho3D_d.lib(D3D9Graphics.obj) 1

Error LNK2019 unresolved external symbol _D3DCompile@44 referenced in function "private: bool __thiscall Urho3D::ShaderVariation::Compile(void)" (?Compile@ShaderVariation@Urho3D@@AAE_NXZ) TEdit C:\Users\USER\Desktop\U3DTerrainEditor-master\Build\Urho3D_d.lib(D3D9ShaderVariation.obj) 1

Error LNK1120 3 unresolved externals TEdit C:\Users\USER\Desktop\U3DTerrainEditor-master\Build\bin\TEdit_d.exe 1

Furthermore I rebuilt the Urho3d library using OpenGL selected which reduced the error down to:

Error LNK2019 unresolved external symbol "void __cdecl anl::RegisterANL(class asIScriptEngine *)" (?RegisterANL@anl@@YAXPAVasIScriptEngine@@@Z) referenced in function "void __cdecl LoadScriptBindings(class asIScriptEngine *)" (?LoadScriptBindings@@YAXPAVasIScriptEngine@@@Z) TEdit C:\Users\USER\Desktop\U3DTerrainEditor-master\Build\LoadBindings.obj 1

It is a real shame I cannot get this to work because it seems like such a wonderful tool. Perhaps there are binary files people could download somewhere, or maybe I am missing something obvious?

MingW(64) build fails with undefined references

The MinGW library libsetupapi.a does not get linked properly when building with MingW/MSYS, leading to an undefined reference error at link time ( undefined reference to `__imp_SetupDiGetClassDevsA' and others).

Proposed small fix to CMakeList.txt is attached.

CMakeLists.txt

After incorrect Terrain Spacing value must error message

Description: If apply any incorrectly value to “Terrain Spacing” then user cannot mind what is wrong

Repro steps:

  1. Set “Terrain Spacing” to ‘test123’ value
    Expected: Error message like tips “ERROR: Incorrect value”
    Priority: low

After 0 or chars Terrain Spacing value do not apply changes

  1. After 0 or chars Terrain Spacing value do not apply changes

Description: If apply 0 or any incorrectly value to “Terrain Spacing” then other values cannot be applied to Terrain Spacing until restart editor

image

System info: resolution – 1920x1080, borderless mode
Repro steps:

  1. Set “Terrain Spacing” to 0 or ‘test123’ value
  2. Try to set any correctly value to “Terrain Spacing” (“1” for example)
    Expected: Value can be changed after set 0
    Priority: low

Crashes after “Execute” at “Build Road”, “River Builder v1.0” or “Road Builder v2.0”

Description: When user press the “Build Road”, “River Builder v1.0” or “Road Builder v2.0” editor will be closed with error:

image

Repro steps:

  1. Press the “Filters” button
  2. Choose “Build Road”
  3. Press “Execute”
    System info:
    [Fri Jul 27 00:50:03 2018] INFO: Opened log file Urho3D.log
    [Fri Jul 27 00:50:03 2018] INFO: Created 3 worker threads
    [Fri Jul 27 00:50:03 2018] INFO: Added resource path C:/Users/Sosnoed/Desktop/U3DTE/U3DTE/Data/
    [Fri Jul 27 00:50:03 2018] INFO: Added resource path C:/Users/Sosnoed/Desktop/U3DTE/U3DTE/CoreData/
    [Fri Jul 27 00:50:04 2018] INFO: Set screen mode 1920x1080 windowed monitor 0 borderless
    [Fri Jul 27 00:50:04 2018] INFO: Initialized input
    [Fri Jul 27 00:50:04 2018] INFO: Initialized user interface
    [Fri Jul 27 00:50:04 2018] INFO: Initialized renderer
    [Fri Jul 27 00:50:04 2018] INFO: Set audio mode 48000 Hz stereo interpolated
    [Fri Jul 27 00:50:04 2018] INFO: Initialized engine
    [Fri Jul 27 00:50:04 2018] INFO: Added resource path C:/Users/Sosnoed/Desktop/U3DTE/U3DTE/TerrainEditorData/
    [Fri Jul 27 00:50:04 2018] INFO: Loaded Lua script LuaScripts/terraineditor.lua
    [Fri Jul 27 00:50:04 2018] INFO: Loaded Lua script LuaScripts/Utilities/Sample.lua
    [Fri Jul 27 00:50:04 2018] INFO: Loaded Lua script LuaScripts/thirdpersoncamera.lua
    [Fri Jul 27 00:50:04 2018] INFO: Loaded Lua script LuaScripts/terraineditUIoriginal.lua
    [Fri Jul 27 00:50:04 2018] INFO: Loaded Lua script LuaScripts/terrainselectui.lua
    [Fri Jul 27 00:50:04 2018] INFO: Loaded Lua script LuaScripts/editingbrush.lua
    [Fri Jul 27 00:50:04 2018] INFO: Loaded Lua script LuaScripts/Class.lua
    [Fri Jul 27 00:50:04 2018] INFO: Loaded Lua script LuaScripts/editheightui.lua
    [Fri Jul 27 00:50:04 2018] INFO: Loaded Lua script LuaScripts/smoothheightui.lua
    [Fri Jul 27 00:50:04 2018] INFO: Loaded Lua script LuaScripts/editmaskui.lua
    [Fri Jul 27 00:50:04 2018] INFO: Loaded Lua script LuaScripts/ui.lua
    [Fri Jul 27 00:50:04 2018] INFO: Loaded Lua script LuaScripts/buildcomposite.lua
    [Fri Jul 27 00:50:04 2018] INFO: Loaded Lua script LuaScripts/filterui.lua
    [Fri Jul 27 00:50:04 2018] INFO: Loaded Lua script LuaScripts/saveloadui.lua
    [Fri Jul 27 00:50:04 2018] INFO: Loaded Lua script LuaScripts/nodegraphui.lua
    [Fri Jul 27 00:50:04 2018] INFO: Loaded Lua script LuaScripts/tableshow.lua
    [Fri Jul 27 00:50:04 2018] INFO: Loaded Lua script LuaScripts/anlnodes.lua
    [Fri Jul 27 00:50:04 2018] INFO: Executed Lua script LuaScripts/terraineditor.lua
    [Fri Jul 27 00:50:04 2018] ERROR: Could not find resource Models/Box.mdl
    D3D11
    buildroad.lua
    cavity.lua
    cliffify.lua
    erosion.lua
    flow.lua
    riverbuilder.lua
    roadbuilder2.lua
    buildroad.lua
    cavity.lua
    cliffify.lua
    erosion.lua
    flow.lua
    riverbuilder.lua
    roadbuilder2.lua
    Used mem: 3641.1416015625
    Paving Width: 5
    Segment steps: 10
    Length scale: 0.1

Priority: High

Any Binaries?

Project still active? Any binaries available somewhere?

garbage collection in memtest.lua

The garbage collection problem seems to go away if instead of

function DoThing() local c for c=1,10000000,1 do local c=Color(1,1,1,1) end end
one does

function DoThing() local c for c=1,10000000,1 do local c=Color:new(1,1,1,1) c:delete() end end
If I replace DoThing() in this way in memtest.lua, it won't allocate large amounts of memory anymore. Wouldn't using :new and :delete heal the issue with the growing garbage collection table ?

I Really Dont Know How To Use This!

What I Can See Is White!!!
White Filled With My Screen With Some UI!
If I Use The Middle Mouse To Rotate My View,I Can See The SkyBox,And White!

The Problem Is Happened On Win10 With Dx11

In U3DTerrainEditor-master\CMake\Modules\UrhoCommon.cmake
It Was Forced To Use DX11 On WinDows Platform.
But In U3DTerrainEditor-master\bin\TerrainEditorData\LuaScripts\terraineditUIoriginal.lua
The TerrainEdit8 Technique Is Called,But There Is No TerrainEdit8.hlsl

It Was OK To Use OPENGL,But It Was Wrong To Use DX11

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.