Planetside Software Forums

General => Terragen Discussion => Topic started by: illustratedman on October 28, 2007, 01:25:46 PM

Title: Drystone walls any ideas?
Post by: illustratedman on October 28, 2007, 01:25:46 PM
Hi Folks, this may be a stupid question as I've only been experimenting with TG2 for about 24 hours, but I was wondering if anyone had any ideas or suggestions as to how I could go about trying to incorporate drystone walls in TG2?  See attached pic for a real world example.

I thought the best way to learn TG2 was by trying to recreate some familiar landscapes and as I'm in the North of England that means the North York Moors and Lake District for me.  However, this area is covered in a network of drystone walls and without them things just don't look right - to me anyway. 

I'm guessing it may be possible using an image map - as the walls are always a fixed height I reckon I ought to be able to use a bump map to extrude them out of an existing terrain so that they follow the undulations on the hills.  I reckon it also ought to be possible to somehow restrict a stone texture to the walls an maybe even get the fake stone shader to do the job?

[attachimg=#]Obviously if they were to be a feature of the foreground then I would model a high res section in another app and import it.  But I'm more interested in using them in the middle distance to give a sense of scale.

If anyone can think of a way or nudge me in the right direction Id very much appreciate it.

BTW sorry if I'm not using the correct terminology for TG2, I mostly work in Cinema 4D (although having much more fun with terragen right now).
cheers
alex

Title: Re: Drystone walls any ideas?
Post by: dhavalmistry on October 28, 2007, 01:45:23 PM
I am not aware of any techniques that can do that in terragen...the only way I could think of is to model in a modeling software and import it in TG2
Title: Re: Drystone walls any ideas?
Post by: Mahnmut on October 28, 2007, 02:10:37 PM
maybe you could create a kind of ridge and then cover it with a negative displacement of some net pattern, fractal or image.
image maps for displacements should be the easiest way in my opinion.
I´ll try it, if it works I´ll post you some results.
Best regards,
Jan
Title: Ok so far I have this
Post by: illustratedman on October 28, 2007, 04:06:07 PM
Thanks for the speedy replies guys.

After a lot of messing about I have this, which is pretty crude but does give me hope that it might be possible.
Main problem is trying to get the wall to follow the landscape.

Anyway have to stop for the night - real world to deal with.  Will have another bash at this in the morning.
Attached is my render, also a copy of the Tg2 file and the bump map of the wall that I used (had to convert it to a jpeg to attach it) if anyone wants to try it out (apologies for messy nodes - still have no idea what I;m doing).

cheers
alex
Title: Re: Drystone walls any ideas?
Post by: dhavalmistry on October 28, 2007, 04:54:42 PM
it is following the landscape....isnt it??...unless you have something else on your mind....
Title: Re: Drystone walls any ideas?
Post by: rcallicotte on October 28, 2007, 06:18:21 PM
Thanks, illustratedman.  This is an interesting idea.

DH - I think it stops on the hill toward the horizon, but that must be because the bitmap runs out.
Title: Re: Drystone walls any ideas?
Post by: bigben on October 28, 2007, 08:58:53 PM
The approach you're taking would have been my suggestion. You can also use the same image map now to restrict the distribution of a fake stones layer if you want to try adding rocks to the wall.  Not too sure how well it would work but it would be interesting to try.
Title: Re: Drystone walls any ideas?
Post by: Will on October 31, 2007, 05:30:03 AM
interesting project, keep us posted.
Title: Drystone wall progress…
Post by: illustratedman on October 31, 2007, 11:27:00 AM
Merging heightfields.

In my first attempt (see previous pix) the main problem was trying to combine the bump map of the wall with the heightfield. I just couldn't get the wall to properly follow the contour of the land.  I want the wall to sit on top of an existing terrain.  The only way I could get this work was to merge the original heightfield and the heightfield load  (the map of the wall).  However this is currently disappointing as the result alters the underlying terrain - I'm not sure if it's averging them or what, none of the merge settings I tried seemed to do the trick.  Another problem must be something to do with resolution of the image map as the wall appears to break-up and look spiky.  This increases with distance so must be something to do with the way that detail is relative to distance from the camera or, you know, something.

Combining terrains in worldbuilder.

It seemed to me that there ought to be a way of getting the wall – which is effectively just an image of a white line on a black background – to overlay on top of the existing terrain (whether it be an imported terrain, a generated heighfield or fractal terrain) so that the wall is a constant height above the terrain.  I decided to try this out in world builder (I'm using the latest free version).  Sure enough I found a way of combining my image of the wall with a terrain that allowed the wall to follow the undulations of the terrain and remain a constant height.  It was just a combine device with the 'add' setting. At first I was getting the same spiky effect with the wall, until a ran the image input through a clamp device that clipped the height.

The resulting combined terrain looked pretty good in worldbuilder and so I imported it into TG2 using heightfield load.  See attached image.
In pic 1 you can see that the wall fades out at the edges as the heightfield is blended.  In pic 3 you can see what happened when I tried to add the fake stones shader.  I realised that it was the fractal detail on the heightfield shader that was causing all the weirdness and as soon as I turned that off, pic 4, it started to look more like what I'd been expecting.  However this then meant that fractal detail was turned off for the entire heightfield and so the hill looks very smooth and unrealistic.  I'm guessing there is a way to restrict this to just the wall using the original bump map as a mask – although I haven't quite worked out how to do this yet as I'm basically using slope contraints to limit the grey colour and rocks to the wall – which is obviously not very satisfactory or accurate (this is why I haven't been able to get the top of the wall to match the sides yet).

Using Project X's Canyon shader.

After seeing Project X's post about his briliant canyon shader, I thought that it might be able to show me an alternative way of looking at the problem.  I started a new project with a fractal terrain and dropped in the canyon shader clip file - then tried to work out what it was doing – no joy I'm not that smart.

See attached pic.

However, I did find that by inverting the displacement and making it a little narrower the finished result is very close to what I was looking for – the sides of the wall are nice and steep and it follows all terrain at a constant height.  It proved to me that you can make a 'wall' in TG2 that crosses all terrain and sits on top of the terrain.

However, Project X's canyon shader is obviously the result of some very clever maths but I failed maths and went to art college, so I tend to think of things in terms of images.  What I'd like to be able to do is design my walls as a greyscale image so that I can have breaks and intersections and enclosures and little wobbly bits etc.  There must be a way of applying some of the clever maths in the canyon shader to my wall image map to create a more flexible result that combines everything I've learned so far.

I'm now sure that this drystone wall thing is possible in TG2 it's just a question of finding a recipe that works.

The search continues...
Title: oops
Post by: illustratedman on October 31, 2007, 11:32:56 AM
BTW apologies for rubbish spelling - new reading glasses.

cheers
alex
Title: Re: Drystone walls any ideas?
Post by: rcallicotte on October 31, 2007, 11:45:04 AM
This is good thinking.  I love your thinking outside of the box.
Title: Re: Drystone walls any ideas?
Post by: dhavalmistry on October 31, 2007, 12:57:20 PM
this is looking good..
Title: Re: Drystone walls any ideas?
Post by: Mr_Lamppost on October 31, 2007, 09:05:02 PM
Just a thought  :)

This may not give you enough control over the position of the walls or the shape of the fields but may be useful for filling the distance. 

A long time ago I generated a network of walls using the boundaries of Voronoi cells.  I was using POV-Ray but it should be possible in TG.  My guess would be to take the output of a Voronoi 3D Diff Scalar, pass it through a colour adjust and invert it. Then pass that to a displacement shader. 

Walls   ;)

Title: Re: Drystone walls any ideas?
Post by: Mr_Lamppost on October 31, 2007, 09:58:38 PM
I went away and did it or at least a first approximation  ;D

The walls are 2m high and a bit thick (change the colour adjust a little).   ;)

I have used a Voronoi 3D Cell Scalar as a blend between two colours to give variety to the fields.

I have used the function that generates the walls as a mask to prevent them getting covered with Grass.  You can use the inverse of this function to confine shaders to just the wqlls.

TGD attached  ;D
Title: Re: Drystone walls any ideas?
Post by: bigben on October 31, 2007, 11:30:22 PM
Taking a break from my masking monologue to chat about someone else's masking...  ;)

The results you've got are looking very promising but it sounds like you've made it way more complicated than it should be... or at least to what I was originally thinking of... so bear with me while I pass on some stuff I've learnt from my own expermients.

The mask image... your mask image is good, don't get me wrong, but I personally prefer LZW compressed TIFF, mainly because it preserves clean blacks and whites which can be important when masking. Working on a 0.5m wide wall I wouldn't go below 4 pixels/m for the resolution of your mask. In the sample below I made the wall 3m high so that it wouldn't look so wide.  As for total size... you could quite comfortably go up to 6000x6000 pixels without chewing up too many resources. The other change I made to the image was to drop the white level so that image was a bit sharper and there was a distinct band of white that would make up the primary displacement for the wall

OK enough of the techy stuff...  on to the wall....

Displacement
In the terrains section, add a displacement shader. Set the displacement to the height of the wall, direction: vertical only ... and connect the image map to the displacement function...  Bingo, one wall!

Masking the wall
To cover the entire wall with a surface (or fake stones) you need a mask that covers the entire width of the wall at the base. If you just use the image map as it is, your surface will only appear to cover the top half. Add a colour adjust shader and connect the image map to the input. Set the white level to 0.1 .... Now you have a mask that covers the bulk of the wall. Use this to mask a surface or as a density shader for fake stones.

Masking parts of the wall
But why stop there? Your walls usually have a single row of rocks along the top at a different orientation (or shape) to the rest of the wall. Add another colour adjust shader and set the black level to 0.95 ... now you have a mask to define the top of the wall... cool huh?  Add a second fake stones node and use this as the density shader and you now have a separate layer of rock along the top of the wall! Getting the right settings for the fake stones is another story ;)

Just for the hell of it... add a subtract scalar node, feed the first colour adjust node to input 1 and the seond to input 2 .... now you have a mask for the sides of the wall, should you happen to need one.

Hi Ho Silver... away!!! ......   ;D


PS. I have some UK Terrains that might be handy... http://www.path.unimelb.edu.au/~bernardk/terragen/terrains/ (http://www.path.unimelb.edu.au/~bernardk/terragen/terrains/) Scaffel Pike or Snowdon might have some suitable hills around them
Title: Re: Drystone walls any ideas?
Post by: illustratedman on November 01, 2007, 03:36:53 PM
Thanks so much for your help guys, haven't had a chance to try either of these out yet as I have a house full of noisey nieces today - but will give them a go as soon as I get a chance.

your help is very much appreciated.

cheers
alex
Title: Re: Drystone walls any ideas?
Post by: bigben on November 01, 2007, 06:33:21 PM
Finally enlarged Mr L's pic and it's very cool (very simple way of getting individually shaded fields) .... but.... it demostrates a point I made about masking the wall with the same data that you use for the displacement. The green surface extends half way up the wall. Had a play with the tgd and set up the same masks I used for the image map version (same principle, different input).

I also removed the complement node and changed the settings of the colour adjust node to do the same thing.  The colour adjust node is a wonderful little thing. You only need to complement a colour adjust shader IF the black AND white level are identical. If they are different, simply swap them around to do the complement at the same time.

[Edit] and if you stick with your hand drawn masks, you could colour the fields with a second image map, using the greyscale values to either set the blending between two surfaces of contrasting colour, or to generate multiple masks to give you total control over each field.... Have a look at http://forums.planetside.co.uk/index.php?topic=2571.msg25757#msg25757 (http://forums.planetside.co.uk/index.php?topic=2571.msg25757#msg25757) for an example[/edit]
Title: Re: Drystone walls any ideas?
Post by: bobbystahr on November 03, 2007, 02:16:13 PM
Well this is as far as I have been able to get it.This is taking off from my experiments with displacing roads and paths.  It seems that if you use a sharp as opposed to anti aliased map it works better...I also upped the dpi to 300. I have included in the zip, the full map and it is in my Public File Locker at my Renderosity homepage so should be open to at least members there but I think anyone can get at it. This is the URL:
http://www.renderosity.com/homepage.php?userid=77173   once there click on artist input and it goes to the Free Stuff, Locker, Tutorials, Blogs page. Title: DryStoneWalls.zip
You'll note in the Coverage Tab that I have adjusted the Coverage, Fractal Breakup and Fuzzy zone softness...this seems to control how high up the wall the grass comes or how low down the wall the brick comes. Dunno if this will be of use but thought I'd post it in any case.. ...
Title: Re: Drystone walls any ideas?
Post by: rcallicotte on November 03, 2007, 04:33:17 PM
Nice job, Bobby.
Title: Re: Drystone walls any ideas?
Post by: bigben on November 03, 2007, 07:15:20 PM
Nice one Bobby. I hadn't looked at the fuzzy zone softness for this... good thinking.

I think it should still work well with a smoothed imaged, particularly for lines at an angle. With an unsmoothed image you will get fine vertical jagged edges along the wall. The antialiasing works at the resolution of the image, so the higher the resolution, the sharper the image looks...  so increasing the resolution helps here too. 

You could also try using your image map as a displacement function to punch out the stones horizontally.
Title: Re: Drystone walls any ideas?
Post by: Mr_Lamppost on November 03, 2007, 07:35:59 PM
As I did say the Voronoi walls were a First Approximation and not intended to be a complete solution.  The same with varying the colour of the fields. Having proposed the method I decided to see if at actually worked.   :) 

I was aware of the masking problem but for a quick proof of concept didn't fix tham.  Now I have started I am going to have another look and see if I can "Texture" the walls.   

bigben Thanks for the tip about the Colour Adjust
Title: Re: Drystone walls any ideas?
Post by: bobbystahr on November 04, 2007, 10:55:06 AM
Quote from: bigben on November 03, 2007, 07:15:20 PM
Nice one Bobby. I hadn't looked at the fuzzy zone softness for this... good thinking.
.....
You could also try using your image map as a displacement function to punch out the stones horizontally.

Thanx Ben, calico...once in an area I find it best to slide all sliders every which way to see results...s'how I found the "fuzzy effect"...actualy all 3 adjustments in that area have impact on map placement so I recommend tweaking around with them a lot. Also I did mean to mention before that you can only apply one Projection type, as far as I've been able to sus out, so in order to get mapping correct on both direction walls I found in a previous experiment, noticably my experiment in approximating a Vue render   http://www.renderosity.com/mod/gallery/index.php?image_id=1520819
that I had to make my walls object in 2 parts...on the X axis and the Z axis and map accordingly with the Projection type relevant ie: Side X for the X axis and side Z for the Z axis. I also found that I had to rotate right my stone image so it appeared horizontal rather than vertical. RE: the displacement...had an idea that map resolution would help but my oh my does it ever impact render time with huge images...and I did bump it up a fair bit but I guess 10 wasn't enough. Hadn't tumbled to using smooth to eliminate those vertical lines...have to try that next...thanx for that tip.. ...