Making holes

Started by John-117, March 09, 2010, 06:31:33 PM

Previous topic - Next topic

John-117

Hello everyone, this is probably really basic but how do you make a pit in the ground?

Specifically how do you make a 75m deep pit that is either a shear 50m wide square or a circle of the same diameter and steepness. 

I tried to use a bmp heightfield but the height is calculated from an altitude of 0m it seems so the same heightmap will produce a hole at higher altitudes and a skyscraper a lower altitudes.

Is there a way to just key in a location, depth and width for a hole and have it generated at the location relative to the height of the local terrain (preferably a simple way so it can be easily repeated)?

What I am trying to do is place building that is half in the ground and half out.  Normally this would not be a problem but the building in question will have a courtyard below the terrain height which will visible from the air.

Any help would be appreciated, thanks.

Hetzen

#1
Should be quite simple. Make a black and white image in a paint package to the overhead plan shape of your hole, then plug in a displacement shader and use an image map shader with your bitmap loaded in (you can set the position of your hole in the image map shader, as well as the width that your bitmap will cover in meters. Set the projection to Plan Y and raise it up off the ground slightly), to drive a negative displacement. If you are cutting into choppy terrain, and want the floor of your hole to be flat, then use the same image map shader to inverse blend mask what ever is creating your terrain, then use the displacement shader to raise or lower the hole floor to where you want it. It's also worth putting a slight blur in your bitmap to give your hole sides a very slight slope, Terragen doesn't like displacing at sheer 90 degrees, it will do it, but you won't have any facets on the sides of your hole for you to map or displace afterwards and you will get ugly streaks up the sides.

old_blaggard

...

Or you could use a crater shader, plugged into a shader array if you want it repeated.
http://www.terragen.org - A great Terragen resource with models, contests, galleries, and forums.

John-117

#3
@Hetzen  Thanks for your quick reply.  I am new to Terragen 2 and have not quite figured out the shaders yet.  While I seem to have done everything you said I don't see any hole.  What have I done wrong?

[attach=#]
Test image map.

[attach=#]
Displacement shader.

[attach=#]
Image map shader.

John-117

#4
@old_blaggard  Thank you, your crater shader idea seems to work fine.

Hetzen

You haven't done anything wrong, you just haven't finished the process. Firstly, you need to type a negative number into the displacment shader, currently you have '1', try a value of -50 for the time being (-50 means the displacment will be -50 meters). Secondly, your bitmap is 4x4 squares, and you've set the area that this image will cover as 1x1 meter, so each square at the moment is 25cm wide. So at the distance you have the camera, you aren't going to see anything. If you increase the size of the bitmap in the image map shader to say 100m by 100m, then you will see it. If not, then just move the y placement value up a bit more.

John-117

@Hetzen  Thank you for the correction, your image map method works very well (old_blaggard's crater shader idea is good for somethings but your idea gives more control and allows for far more complex shapes).

dandelO

You could also use the 'simple shape shader' to create the depression. You can make it square, circle, ellipse or an any number of sided polygon shape.

There is also edge profile options in there, just like in an image map shader(border blending) but with more options on the blending... :)

John-117

#8
In case someone else is new to Terragen 2 and needs to make holes here a is quick tutorial based on Hetzen's directions:

For Terragen 2, v2.1 (build 2.1.18.1)

Make the image map in an image editor of your choice:

To avoid completely vertical sides in your hole (which Terragen 2 does not render well) blur the final image map a little.

[attach=#]
The image map (here it seems that white equals depth).


Add a Displacement shader:

"Shaders > Add Layer > Displacement shader > Displacement shader"

In the displacement shader "Displacement multiplier" set the depth of your hole (in meters).

[attach=#]
Displacement shader settings (an image is worth a thousand words).


Add a Image map shader to the displacement shader:

In the displacement shader go to the "Function" and add "Create new shader > Displacement shader > Image map shader"

In the new image map shader set the "Projection type" to "Plan Y (edges = XZ)", the "Position" to the xyz coordinates desired for the hole and the "Size" to what scale you what the hole to be relative to your image map (1 pixel = 1 meter by default).

[attach=#]
Image map shader settings.


The result:

[attach=#]

John-117

#9
@dandelO Thanks for the tip, I'll try out.  I think though, that the image map method is best for my current needs.

Hetzen

Good little tutorial 6y4cd...

One question. Did you mix up your username with your password?

John-117

#11
Thanks.  Actually no, my first name is invariably taken on forums, I like to minimize my online identity and I have so many accounts that I use a password database program.  It automatically creates random user names and strong random passwords/phases for each individual site which are then stored in an encrypted database.  In addition you can use shortcut keys to log in automatically so in general it makes life a lot easier and more secure (which is a win-win scenario).

TheBlackHole

Try feeding your username into a 1337 translator ans see what comes out. Maybe change your public username (I think there's a public one and a private one used to log in) to something else?
They just issued a tornado warning and said to stay away from windows. Does that mean I can't use my computer?

John-117

"Try feeding your username into a 1337 translator ans see what comes out."  I had not thought of that one before though I think it would still be gibberish.

"Maybe change your public username (I think there's a public one and a private one used to log in) to something else?"  Yes I should look in to that "6y4cd93v" is kind of cryptic.  I probably ought to get a profile image as well come to think of it.