Terrain modelling

If you feel like you're up to the challenge of building your own Ages in Blender or 3ds Max, this is the place for you!

Terrain modelling

Postby Sirius » Thu Aug 06, 2015 4:04 am

I'm starting a new thread split from Korman's, since we started discussing some things that were a bit off-topic. The beginning of the discussion was here.


Aloys wrote:Ah, right, I saw your earlier screenshot of that scene, looks nifty! :) I love the mix of high tech dome shaped buildings and a very wild landscape. Reminds me of some scenes in Star Wars
Thank you ! :) Actually, the main source of inspiration comes from a location in Schizm 2 (I can almost hear that game's music playing when I link to my Age). But there may be a Star Wars influence as well ;)

Also, to clarify: it's quite unlikely this place is ever going to be a fully-finished Uru Age. It's much too big, I doubt I'll ever finish it (especially since I'm never satisfied with things until I'm on par with Cyan's quality, which is impossible at that scale).
It's purpose is mostly to entertain me and train me to building, hopefully so I can work on smaller but good-looking Ages. While it's the starting point of this topic, I'm doing it more to discuss the technique I used to build it, and see how you guys would rather do it.


So ! Back to the mesh and its density...
Aloys wrote:The common misconception is that one need to have a lot of triangles for a terrain to look good. But that's not true, especially in a real time games. Most of the detail should be carried by textures.

Yeah, the terrain still has "a bit" too many polygons. Right now it's over 100,000 in total (without all extra meshes), but since it's textureless and since my PC can handle it, I won't lower it much for the time being (otherwise it's ugly !).
But I'll have to cut on mesh density eventually, as I'm well aware I'll need a lot of polygons for other meshes which are still pretty low-res currently (not to mention the domes aren't perfect occluders, and some of the inside might be visible from the outside, yikes !)
So yeah, optimisation of the canyon mesh is not quite done yet. The top plateau probably won't be seen from inside the canyon, so as you said I plan to work on reducing its density (or completely removing it... depends if the player can see a part of it or not).
Additionally, I think I'll devise some sort of automated LoD-building script. This will be useful eventually (if not for this Age, maybe for another).

BTW, I didn't use a grid terrain for my mesh - it all started with a simple plane, which I extruded and subdivided when needed. The rest is the awesomeness of the subsuft/displace/decimate combo.
In another Age I'm working on, the whole horizon landscape is built from a single plane, with very minor modifications - it's only using 30 faces in total (that's really the most basic you can do). But with the three previous modifiers, it results in really good terrain, which is completely customizable, and really easily.
Here is how it looks, with all modifiers to the right. This was done more recently with what I learned from the canyon mesh.
As for the canyon, here are the original meshes which are the ones I modify when needed, and here is the final output, which Blender creates itself. Alright, seen from here this is indeed too much vertices :P But I did say it isn't the final version.
I'm really fond of the displace modifiers I'm using - this works a bit like the voxel terrain generator I was using for Protergen (shameless self-advertisement ;) ), but with more control over the overall appearance of the Age.

Oh, and while we're at it, it seems the "easiest" way to model terrain is to sculpt it directly in a voxel editor - I didn't try it, but it seems you can easily create mountains, caves, etc with it.

Aloys wrote:Most of the detail should be carried by textures. (in most games normal maps would be used too, not so much in Uru; maybe baked in the lightmap? can we do that?).

Yeah, I also wish we could use normalmapping for objects. But although it's supported by Plasma (look at Todelmer's asteroids), it's tricky to setup (I think it doesn't look as good as in other games either, but maybe that's just me). Normalmapping also requires real-time lighting, which is pretty heavy and doesn't always look good (most of the time, when I use real-time lighting, Plasma uses tangent shading instead of normal :shock:).
However, it's possible to bake normalmapping to the lightmap itself, if you let Blender do it (that's also Deledrius' suggestion, and I think it will work well in Plasma). But you need a pretty big lightmap to do so.
That's what I'll do with the high-res mesh in the above picture, to bake it to a simpler mesh. But this will be once I'm sure I won't be needing extra modifications to the canyon mesh.

Deledrius wrote:Sirius, you might want to check out Blender's Dynamic Topology system. It's a quick way to get extra polygons only where you have additional detail, and you can still retopo later before export.
Sounds interesting, I didn't know about it. Thanks ! That would indeed prove very useful.


Wew ! That was a long post. But creating realistic low-poly terrain is really hard and complex, so it's interesting to see how different people do it :P
User avatar
Sirius
 
Posts: 1506
Joined: Mon Jul 26, 2010 4:46 am
Location: France

Re: Terrain modelling

Postby dendwaler » Thu Aug 06, 2015 12:00 pm

If you have a big terrain mesh and some big visual occluder meshes , then split the terrain mesh under the occluders .The more parts of terrain the betteri.
All objects that are visible , will be rendered in plasma completely.
Because the terrain is visible it will be rendered complete ,even the hidden part of it behind the occluder.If you split it in several parts you notice a better performance and the age can manage far more vertices then before in my experience. I have not enough technical knowledge of plasma to prove it, but in my current project this helped me to avoid lag for sure.
Those wonderfull Worlds are called " Ages" , because that is what it takes to build one.



Watch my latest Video Or even better..... watch the Cathedral's Complete Walkthrough made by Suleika!
User avatar
dendwaler
 
Posts: 936
Joined: Mon Jun 22, 2009 10:49 am
Location: Nederland

Re: Terrain modelling

Postby tachzusamm » Fri Aug 07, 2015 6:40 am

Interesting thread.

I remember that I once build a complete terrain (plateaus, hills, valleys, river channels) using Sculptris.
This was back in 2009/2010, when the first beta came out. Although most examples of it's usage are based on working with a sphere, it was also possible to start with a flat plane (or could be imported from Blender, I don't remember exactly).
The main advantage of creating terrain with Sculptris is that it uses adaptive tesselation. This means, you don't have to subsurf a plane with equally distributed faces to be able to model fine details in some areas, while flat areas contain too much unnecessary faces.
Instead, it sort of "inserts" more verticies and faces in the plane where needed, while leaving flat areas untouched. This is easily accessible with paint tools.
If you are careful while doing such modeling, the number of faces can be relatively low. Sure, you can easily overdo it by drawing too much detail (which can result in a huuuge amount of triangles), but there's also a nicely working face reduction tool included (as a paint tool, to be more precise).
The result looks really pleasing, because the tessalation algorithm tends to create hexagon type triangle conglomerates, which look more "rounded" than any other type of triangle arrangement.

Sculptris was written by Tomas Pettersson aka DrPetter from Sweden (http://www.drpetter.se/project_sculpt.html).
You can still get it for free from Pixologic: http://pixologic.com/sculptris/
User avatar
tachzusamm
 
Posts: 575
Joined: Thu May 29, 2008 2:03 am
Location: Germany

Re: Terrain modelling

Postby Aloys » Fri Aug 07, 2015 9:21 am

The whole subsurf>displace>decimate approach is what I'd call the 'procedural generation' approach. Very flexible, very fast, great if you want to experiment, or if you don't want to bother too much with modelling. But when it comes to exporting it in the game you always end up with a mesh that is either too heavy, or just not very clean. And by 'not very clean" I don't mean in a way that only you or other 3D artists will notice, but in way that even the players will notice. And then you need to touch it up by hand and it takes an awful lot of time.
Also, ior it to work well you really need to have a high-res mesh, you start lowering it too much with the decimate modifier you end up with something that isn't very different from a simple noise.
Finally if you want it to look really good you need to have your diffuse/spec textures reflect the displacement map you used; other wise you will lose most of the effect.

Basically this approach is great if you have no idea what you want your final terrain to look like, or if don't know what your Age as a whole will be like, because it enables you to 'fill in the blanks'. I do use that myself in the early stages of projects. But once you have an idea of where you are going it's better to ditch it and go with a more manual approach.

About cliffs
Cliffs and canyon are a rather specific thing, difficult to work with, more so than regular terrains. They are not as detailed as a mountain, they are much more 'flat' and because of that it is difficult to make those meshes look interesting.
In this regard it is a good idea to avoid using displacement maps entirely for very cliffs or canyons. Displace maps work well for mountains or regular terrains, because the fractal/noise/whatever algorithms used to generate them are well suited for that ('Perlin noise'? instant mountain!). And even bitmap textures can work well. But vertical features such as cliffs are a very different thing. Look at some of Cyan's cliffs: Ercana, or the Cleft. Here is a screenshot of Ercana:
Show Spoiler

Notice how the meshes themselves are very smooth; not much detail here It's all in the textures (and the lighting). Sirius: I saw you mention how you source most of your textures from CGTextures, it's a very good sources, and I think they have a whole category of rock textures specifically for cliffs. A key to having a good 'cliff face' texture is to have it look different on the top and bottom parts.(the top is usually more broken and the bottom is more dirty and has rocks that fell from the top; also if it has water it's darker) You can tile it horizontally, but ideally it shouldn't tile vertically. Or you can use 'decal' meshes with transparent textures at the top/bottom areas. Obviously if you cliff is too big, things get more complex. (as is the case with your canyon Age. :? ) Then at this point you need to make a more complex shader for your cliff with a mix of stencils and textures, and possibly a 'detail map' that you only see when your avatar is within a certain distance.. (not sure if you are familiar with those). Basically very large terrains of cliffs are always problematic :P (One of the many reasons why it is usually more useful to learn on small projects. Big projects present too many problems at the same time.)
User avatar
Aloys
 
Posts: 1968
Joined: Sun Oct 21, 2007 7:57 pm
Location: France (GMT +1)

Re: Terrain modelling

Postby Sirius » Sat Aug 08, 2015 11:53 am

Just checked the Dynamic Topology system in Blender, it's awesome ! I had no idea you could do that in real time without a tool relying on voxels to do the work.
Or maybe Blender uses voxels to some degree ? It still subdivides the mesh in a grid-like manner in some places. Well, what do I know...
I wonder how easy it is to unwrap and UV-map the object after that. It might be a bit harder to realign some parts of the mesh since there are a lot of vertices.

Speaking of which, sometime terrain unwrapping might not look correct no matter which UV unwrapping method you choose (especially with procedurally generated terrain which results in very bad final meshes ;) ). While it's generally unadvisable to use such terrain, I found a trick which allows you to unwrap these with almost no texture stretching and no seams.
It's in the article on GPUGems about procedural terrain, part 1.5: Texturing and Shading. It consists into projecting and blending three different textures on the mesh.
I used it for Protergen, since it's the perfect example of terrain you would not want to unwrap. It does require 7 or so layers in Plasma though, and a lot of UV layers too. Obviously that's not a perfect solution since because of all the UV layers the PRP can weight a lot more just because of the terrain mesh. Performance-wise, it didn't appear to be too much of a strain to Plasma, except at the edge of the world where the 1.3 million triangles caused a bit of lag :lol: Not the first time I go slightly overboard on the vertex count.

Dendwaler wrote:If you have a big terrain mesh and some big visual occluder meshes , then split the terrain mesh under the occluders .The more parts of terrain the better.
All objects that are visible , will be rendered in plasma completely.
Because the terrain is visible it will be rendered complete ,even the hidden part of it behind the occluder.If you split it in several parts you notice a better performance and the age can manage far more vertices then before in my experience.
This sounds like good advice (even though there aren't a lot of potential occluders in my canyon scene). Actually, designing the scene in such a way that there are a lot of potential occluders is probably for the best, since this way you can either use Plasma occluders or VisRegions to increase performances.

Tachzusamm wrote:I remember that I once build a complete terrain (plateaus, hills, valleys, river channels) using Sculptris.
Interesting. I did not know this program, but I've heard of ZBrush, which was designed by the same people it seems.

Aloys wrote:The whole subsurf>displace>decimate approach is what I'd call the 'procedural generation' approach. Very flexible, very fast, great if you want to experiment, or if you don't want to bother too much with modelling.
That's what's great with it :P
But you are right in saying once decimated the mesh is not really clean. From a distance it's generally fine, but at closeup it can be quite bad. This is actually why the beach in Denkasen doesn't look good: lack of vertices in some areas and not smooth enough, which results in ugly triangles which appear to be sticking out of the mesh.
And as with any procedural method, there is no "creativity" in the end mesh, since it just creates random bumps in the geometry.

Aloys wrote:Cliffs and canyon are a rather specific thing, difficult to work with, more so than regular terrains. They are not as detailed as a mountain, they are much more 'flat' and because of that it is difficult to make those meshes look interesting.
Indeed, this is especially hard for big meshes. Er'cana's canyon has a lot of seams or bad UV mapping due to its size. The upper cliff looks quite bad because the textures alone don't give much realism - it really misses normalmapping to give some finer details to the mesh.

Aloys wrote:A key to having a good 'cliff face' texture is to have it look different on the top and bottom parts.(the top is usually more broken and the bottom is more dirty and has rocks that fell from the top; also if it has water it's darker) You can tile it horizontally, but ideally it shouldn't tile vertically. Or you can use 'decal' meshes with transparent textures at the top/bottom areas.
I quite agree to this, although I may add: using a single horizontally-tiled texture for the cliff might not always look good, because usually the texture isn't big enough to cover it all realistically. It's probably better to do some clever stenciling/blending to get better results.

Aloys wrote:Basically very large terrains of cliffs are always problematic :P (One of the many reasons why it is usually more useful to learn on small projects. Big projects present too many problems at the same time.)
:lol: Indeed, that's why I don't think I'll ever be able to finish it. Still, it's fun to do and a good opportunity to learn things.
I may redo the canyon mesh at some point, and I'll be keeping all your tips in mind.
User avatar
Sirius
 
Posts: 1506
Joined: Mon Jul 26, 2010 4:46 am
Location: France

Re: Terrain modelling

Postby Aloys » Sat Aug 08, 2015 1:44 pm

I found a trick which allows you to unwrap these with almost no texture stretching and no seams.
It's in the article on GPUGems about procedural terrain, part 1.5: Texturing and Shading. It consists into projecting and blending three different textures on the mesh.

Ha yes, the good old triple axis planar projection. Cyan actually used that exact method on Riven back then. (using custom shaders they wrote for the 3D package they used: Softimage).
Doing that in real time is actually used quite often for terrains, especially in big strategy games or 'god games' where you can deform the terrain in real time. As you see it doesn't hit the framerate too hard and brings good results. In fact if you have a terrain that has a lot of vertical features it's basically the only solution. Good job on getting this to work in Plasma. :)

There is another solution but it won't work if your mesh is too smooth. The idea is to cut up the mesh in different pieces, to make it look like it's made of separate rocks, and UV map those individually. Here is the small terrain I'm currently working on:
TsaewTerrainMapping01.jpg
TsaewTerrainMapping01.jpg (78.51 KiB) Viewed 9107 times

It started as a simple ‘pillar’, but to make it more interesting and easier to work with I cut it up in several different large rocks. That enables me to map each one separately using the same texture, but moving it around a bit on each piece to make it look less repetitive. Also, to better blend the rocks together I added a bit of ‘fake lighting’ via vertex painting. (to make it look like ambient occlusion).
User avatar
Aloys
 
Posts: 1968
Joined: Sun Oct 21, 2007 7:57 pm
Location: France (GMT +1)

Re: Terrain modelling

Postby Tweek » Sat Aug 08, 2015 2:02 pm

I frequently break stuff up (and vertex paint lighting/shadows) like that. Works out pretty well and it makes things look more interesting.
Beneath - IC Blog.
Beneath: Ages of Tweek - FB Age Dev Page.
User avatar
Tweek
 
Posts: 692
Joined: Sat Sep 29, 2007 6:37 am

Re: Terrain modelling

Postby Aloys » Sun Aug 09, 2015 10:31 am

Speaking on the topic of mapping large continuous meshes (cliffs or flat-ish grounds) there is a simple but efficient trick to limit obviously tiling textures. The rough idea is as follow: use two tillable textures that uses different UV sets and merge them with a stencil texture (that also uses a different UV set). This is a technique that is often used, both in real time games, and even in high quality pre-rendered images. Cyan used it on Riven's terrains back in '97, can you spot a single repeating texture on the terrains?
I’d write a proper tutorial, but I don’t have Uru on the computer I’m currently using (Mac laptop), and I haven't done it in a while, so bear with me. :)

  • First you need 2 tileable textures that are relatively similar in style and size. For instance Sirius mentioned CGtextures.com, they have a number of Tiled Texture Sets which feature several similar textures that are fine for that. (this one is a good example).
  • Then you need a tileable stencil texture. That one is less difficult. Basically you want a highly contrasted 'cloudy' black and white texture. Something like this. (A high-res texture is not needed for this.)
  • Then in Blender make 3 separate UV sets for your mesh; one for each texture, and one for the stencil. Each one is mapped using a simple planar projection, but all three must be scaled at different sizes. Set 2 should be smaller than Set 1, and Set 3 will be larger than 1. (ideally Set 2 and 3 should be scaled around x0.6 and x1.3; avoid round numbers like x2 or x1.5 -- I'll explain why in a minute.
  • Finally in your material assign each of the two textures to UV set 1 and set 3 (the largest), and assign the stencil texture to UV set 2 (the 'smallest' one).

This way your textures will tile, but because of their different UVs, and because the stencil also has a different UV, they will never overlap. And you will never get a noticeable repetition, even on large areas. And because they are rather similar looking they will blend nicely. (also the reason we must avoid 'round' numbers when scaling UVs is that they will make texture perfectly overleap each other over a certain distance).

The final result shoud look something like this :
Image

Other things:
You can/should also rotate your UVs for the stencil, for added randomness. You can also do it for your textures, but only by small amounts, not more than 15°. Again, avoid round numbers.
Also, when you scale your UV for the second texture don't scale is up too much (ie: x1.8 or more) or in the final result the texture will look blurry..

Finally: don't quote me on the exact numbers, I'm doing this 'by the ear' under photoshop ;) don't hesitate to play around a bit with the settings.

This technique used along with the 'triple projection' trick Sirius mentionned in his previous post enables you to UV map rather nicely any kind of terrain of any size.. It takes a bit of work, but it's worth it. Large terrains can be a real pain to map and texture using 'simple' mapping, and usually you can see very easily repetitive textures..
User avatar
Aloys
 
Posts: 1968
Joined: Sun Oct 21, 2007 7:57 pm
Location: France (GMT +1)

Re: Terrain modelling

Postby Sirius » Mon Aug 10, 2015 1:57 am

Wow, nice ! I never thought about this, but as soon as you said "tileable stencil" I understood what you meant. I'm sure this will be useful to me (and I hope it can be useful to others too).

To break texture repetitiveness, I usually blend together two or more textures - depends the surface I need to cover. The main goal is to have more detail so the material looks good from both close up and farther away, but it can also make tiling less visible.
To do so, I use a first, large texture which covers most of the mesh. Then, I put the second texture, which covers less of the mesh, and produces more tiling. Then another smaller one, and so on.
For each texture, I use either multiplicative, subtractive or additive blending. This allows me to mix them all without requiring an alpha layer. The issue is that you may need to edit each texture to adjust the contrast, brightness, saturation or gamma so the resulting material doesn't end up having very weird/ugly colors.
This is what I did for the beach in Denkasen. Still not perfect from very close, but otherwise good enough IMHO.

Aloys wrote:Ha yes, the good old triple axis planar projection. Cyan actually used that exact method on Riven back then. [...] Good job on getting this to work in Plasma. :)
Hehe, yeah it's quite convenient sometimes (I didn't know it was used in Riven, although it's not really a surprise).
It's not particularly easy to setup for Plasma, though, especially since it requires UVmapping computed per vertex normal for the stencils (this is where programming knowledge is useful, since I don't think this is an option available in Blender).
Actually, I screwed up when making the material for Protergen: the "bottom" texture is ok, the "front" and "side" texture are less ok, and the top (grass) texture is completely wrong (I think I figured out the error but didn't yet correct it). And it's using way too many UVlayers, which means heavier PRP. I wish there were a way to use the vertex' coordinates as UV layer in Plasma, but I don't know if that's possible.

Aloys wrote:There is another solution but it won't work if your mesh is too smooth. The idea is to cut up the mesh in different pieces, to make it look like it's made of separate rocks, and UV map those individually. Also, to better blend the rocks together I added a bit of ‘fake lighting’ via vertex painting. (to make it look like ambient occlusion).
Indeed, I saw this in Cyan's Ages. The hand-made vertex coloring, while not being overly fancy, gives a nice and "smooth" ambiance to the scene. I believe that in a way, this is what gives Uru its unique visual style (which is why some Ages like Tweek's fit well in the game).


Aloys wrote:[...] and possibly a 'detail map' that you only see when your avatar is within a certain distance.. (not sure if you are familiar with those).
I'm coming back to that... I would like to use that detail fading with distance for Denkasen, but I'm not sure how to do this.
I've heard of using the "filter size" attribute in the texture's parameters to make a texture more transparent with each mipmapping level. I don't know if that's the best way to do this, since it means it's tied to the distance at which textures switch mipmap levels, and since the transition might be too visible.
There is also the possibility to tie the transparency of a layer to the realtime Z-buffer, so that this layer is visible only at close range, while another layer is displayed from faraway (as in the last part of this post). This looks pretty good, although it means fiddling in the PRP after it's exported.
User avatar
Sirius
 
Posts: 1506
Joined: Mon Jul 26, 2010 4:46 am
Location: France


Return to Building

Who is online

Users browsing this forum: No registered users and 0 guests