Planetside Software Forums

General => Terragen Discussion => Topic started by: monks on April 20, 2011, 09:31:30 PM

Title: Question about creating sea level
Post by: monks on April 20, 2011, 09:31:30 PM
Hi, I'm importing a terrain and it has the sea level set at 5486m. The sea creates a coastline on 3 sides of the terrain. How do I set up a water body to give me the sea level?

Thanks,
monks
Title: Re: Question about creating sea level
Post by: monks on April 21, 2011, 08:39:57 AM
I've tried changing the water level in the transform tab of the lake object, but whatever I set it to, it doesn't alter the hight of the lake. Even powers of ten don't make any difference.

monks
Title: Re: Question about creating sea level
Post by: Oshyan on April 21, 2011, 11:24:45 AM
That's certainly odd. It's working here in a simple test scene. Question 1: is your scene being constructed far from the coordinate origin? If you move your cursor over a foreground part of your scene, are the coordinates larger than 100km in either the positive or negative direction? Question 2: have you tried using a Lake object the default scene with a basic Power Fractal terrain, just to verify it works?

- Oshyan
Title: Re: Question about creating sea level
Post by: RArcher on April 21, 2011, 11:49:31 AM
If you are working with a really large area where the curvature becomes a major issue for the lake object it is sometimes easier to use a sphere object as the sea level instead of the lake plane.
Title: Re: Question about creating sea level
Post by: monks on April 21, 2011, 08:24:44 PM
...ermmm, sorry, it was the atmosphere I was looking at- I thought that was the sea level  ::) Water plane is ok.

I can see potential problems with that Ryan. As far as I know TG doesn't curve large imported flat terrains to the planet curvature right? If I set a plane of water at the seal level with a sphere won't it be off with the flat terrain?

If I used a georeffed terrain would that be properly projected with correct curvature?

monks

Title: Re: Question about creating sea level
Post by: RArcher on April 21, 2011, 09:17:59 PM
If you uncheck the "Flatten surface first" checkbox the terrain will go with the curvature. One issue with this though is that there would likely be some distortion near the corners of the terrain.
Title: Re: Question about creating sea level
Post by: monks on April 21, 2011, 09:54:52 PM
Ah, that's a cool feature. Luckily my terrain has sea in three of its corners, so I might get away with it.

I've added a sphere in Objects. So the new sphere object is by default the same radius as the original planet?
I'm guessing I need to have the radius set so that the sea surface is correct with the terrain coastline?
Do I assign shaders to this now in order to get an ocean?

monks
Title: Re: Question about creating sea level
Post by: Dune on April 22, 2011, 03:10:32 AM
Three times 'yes'. And uncheck 'shadows' in the sphere object. You could make a surface shader, no color, with the water shader as it's child as the replacement for the default shader of the sphere. Feed some extra displacement into the surface shader's input (again no color, just displacement). For foam, attach another surface shader between this one and the sphere, and blend this by a power fractal with a foam like pattern. You can color and displace this surface shader any way you want.
Title: Re: Question about creating sea level
Post by: monks on April 22, 2011, 08:22:17 AM
Thanks, I'll give your suggestions a try- my terrain doesn't seem to be curving correctly with the planet- I've unchecked flatten terrain first. In the attach you can see it seems to be aligned in the bottom left corner.

Would manually adding georef points correct the projection of a flat terrain? I do have georef points for the project.

I was reading on the boards and people seem to use lake objects quite a lot for seas. Are there disadvantages in doing that?

monks
Title: Re: Question about creating sea level
Post by: Dune on April 22, 2011, 08:51:48 AM
I don't know about georef points, never worked with them. You'll get that answered by someone else, no doubt.
The lake object is a (round) flat area, good for smaller terrains near 0/0/0, but not for whole planets. You could also use a (square) plane object as the basis for a lake, which has advantages (it can be tilted).
Title: Re: Question about creating sea level
Post by: monks on April 22, 2011, 09:54:22 AM
Maybe the problem in the pic is the one that Ryan mentioned. I didn't think it'd be that severe, but then this terrain is covering very large real world extents. I 'm considering the goereferenced route. In the long run it'll probably work out better to set up a tgd for my project data.

I set up the sphere as you suggested Dune, but I can't see any evidence of a water shader in the preview.
I opened up the sphere shader, and changed the parent shader from the default to a Surface layer -> input node of water shader -> sphere shader. I changed the sphere radius to 1.2 just in case it was hidden underneath the planet shader.

Ah, looking at the sphere the default created does not share the same radius as the planet by default. It's only a sphere after all, that makes sense. I'm using the centre and radius for the planet now, and I'm seeing water in the preview.

monks
Title: Re: Question about creating sea level
Post by: monks on April 22, 2011, 09:57:46 PM
I tried using the georeffed terrain approach following Ryans's excellent tutorial but I don't think it has any real advantages for me, and it also adds a few complications too.
So I'll revert back to a flat heightfield. I don't think the sea as a sphere will work on such a large flat terrain extent. If I set my terrain to smaller real world extents, the curvature vs plane mismatch would be less of a problem but the whole point of this render is to capture the scale, so I think using image map shaders for the water is the simplest way to do it.

monks
Title: Re: Question about creating sea level
Post by: monks on April 25, 2011, 12:39:24 AM
I've been doing a bit of reading and experimenting.
I've tried the sphere with a water shader and unfortunately the terrain must be distorted when applied to the planet surface as it does not match the coastline. I've also tried a lake shader but that gives a flat surface so that's not suitable either.
Is it possible to just apply a water shader as a surface using an image shader as a mask?

monks
Title: Re: Question about creating sea level
Post by: freelancah on April 25, 2011, 12:52:48 AM
Have you checked this thread: http://forums.planetside.co.uk/index.php?topic=8793.15 ? Basically similar solution but change the paint shader to image map..
Title: Re: Question about creating sea level
Post by: monks on April 25, 2011, 08:07:13 AM
I'll take a look at this thanks freelancah. Another thing I could try is setting my terrain size smaller and see if the sphere object matches up better.

monks
Title: Re: Question about creating sea level
Post by: cyphyr on April 25, 2011, 08:24:07 AM
Monks, sorry but maybe I've missed something here but have you not un-ticked "Flatten surface first" in the displacement tab of your heightfield shader. Your terrain should now follow the curvature of your planet object and lakes and spheres should work as expected.
:)
Richard
Title: Re: Question about creating sea level
Post by: monks on April 25, 2011, 09:12:36 AM
Hey Richard...hmmm, it doesn't though.
Yes flatten first is unchecked. All displacement in shaders is turned off. I checked my terrain out in a couple of apps and selecting from terrain by height at the coastline shows the coastline is correct at all points, yet in the render the sea level is too high in the nearer area of the terrain. See pics comparison.
My calculation of the sea level on my terrain proved to be incorrect within TG. It should be: planet radius + (10 x 5486.4 m), x 10 since sea level = 5486.4m and I'm exaggerating the terrain height by 10. But I had to eyeball it and set it visually from repeated renders- it took me a while  :P
The terrain height is spanned both outside and inside Terragen so there are no hidden offsets in it.

One thing I wasn't sure about is the angular position of the sphere. It could be this. What is angular position?

monks

Title: Re: Question about creating sea level
Post by: cyphyr on April 25, 2011, 09:35:05 AM
Hmm, looks like Middle Earth?
It shouldn't make any difference how much you have exaggerated your terrain since sea level "should" be by definition at 0m since that's what sea level essentially is ...
Why your sea level is at 5486.4 m I don't know. If your sure that's the right height then try lowering your terrain (Heightfield Operator>Adjust vertical, type -5486.4 into the add height field). Your sea level "should"  now be at 0m now and again your sphere or lake object should work correctly.
:)
Richard

A thought: Is the terrain a bitmap rather than a geotiff? If so the sea level is set at an arbitrary height, well its not set at all really.
If your using a greyscale bitmap (bmp, tiff (not geotiff) etc) you will need to make two heightmaps, one from sealevel to the top of your highest peak and the other from sealevel to the bottom of your lowest sea trench. Using image map shaders plugged into displacement shaders (NOT Heightfield load) displace the heightmap above sealevel positively and the below sealavel negatively.
Title: Re: Question about creating sea level
Post by: monks on April 25, 2011, 10:53:33 AM
Middle Earth yes  ;)
I have set up like that so that we can model the bathymetry as well. It'd be nice to set the water colour and opacity as a function of depth.
Well in essence I've been doing what you just said by altering the sphere radius. The terrain is a .ter. I didn't go with the georeffed route.
Maybe there's a distortion or inaccuracy produced by the size- I've set the terrain to 4000 km across (the correct scale), but I'm happy to go smaller if that corrects the sea level.
It suggests some kind of distortion. You can see in the pic that as soon as I bring the sea level lower to correct the southern region, the sea level needs to be higher around the island indicated. So it's impossible to set it.
I tried turning off warp by normal in the base colours shader, but that didn't help.

monks
Title: Re: Question about creating sea level
Post by: monks on April 25, 2011, 12:03:51 PM
I've noticed that the Sphere radius is being rounded up by 5m. I set it and then open up another shader and then go back into the sphere and it's being rounded. That can't help.

monks
Title: Re: Question about creating sea level
Post by: monks on April 25, 2011, 03:45:24 PM
Hey guys, I've found the source of the problem. It is the terrain size that is causing accuracy problems.

Here's a shot of the terrain at half res, scaled to 2000 Km. The coastline is set to the figure I stated: radius of sphere +(10 x 5486.4) metres. As you can see the coastline is now correct- or near as damn it. With a tweak I might be able to solve the last remaining problems in the south.
There must be accuracy problems with the curvature at that scale. Will that or can that be addressed with the 64 bit version?

Thanks for your help with this   ;)



Title: Re: Question about creating sea level
Post by: Oshyan on April 27, 2011, 11:54:34 PM
monks, I'd like to see if this is actually a bug, or if there's some other setting that can be tweaked to make this work. Can you share your terrain file(s) and TGD, maybe on the ME-DEM FTP?

- Oshyan
Title: Re: Question about creating sea level
Post by: monks on April 28, 2011, 09:17:29 AM
 ok, I've uploaded the terrain and the tgd.

[link expired]

[link expired]

The only thing I can think of is that I've got too many heightfield shaders- still left in there from the default project. I've turned the fractal displacement off in them though, and I've not genned any terrain.

Vertical exag =10. The coastline should be: planet radius + (5486.4 x 10). The span of the ter is set there too (0.1 - 9375.91) - that may produce an error of 1m (ie, 0.1 x 10) but not enough to cause the problems.
The project is set to 4000 Km. When you change that to 2000 Km you'll see the coastline become a lot closer to how it should be.

monks
Title: Re: Question about creating sea level
Post by: RArcher on April 28, 2011, 11:06:51 AM
I haven't downloaded your project but had a quick thought...  Where is the 0,0 point set for your terrain?  If you have it set to the lower left corner which is the default I believe, then the inaccuracies due to the curvature would radiate out from this point, which could explain why the left half is closer to being accurate than the right half.  If you set your terrain to "Position Centre" then the curvature inaccuracies should be a little more even on both sides perhaps.

Or this could be complete crap thinking and terrible advice  ;)
Title: Re: Question about creating sea level
Post by: monks on April 28, 2011, 01:11:07 PM
  ;D...the terrain is set to centre. The only thing I can think of is the shaders left in place- but I turned everything off which might alter things. Sea level was checked in two apps, so I know that's correct.

monks