Author Topic: River/Lake model revisited (solved)  (Read 14541 times)

Offline bigben

  • Member
  • *
  • Posts: 2122
  • The Long Stranger rides again
    • Tinkering with Terragen
River/Lake model revisited (solved)
« on: September 01, 2008, 09:39:58 PM »
Hi All

As mentioned in another post I'm revisiting my river/lake model with the latest version

Terrain -> Masked opacity of default shader -> water shader
http://forums.planetside.co.uk/index.php?topic=1301.msg12986
This doesn't work anymore as the water shader appears across the entire terrain, poking out through the overlying surfacing.
12559-0

http://forums.planetside.co.uk/index.php?topic=1636.0
This approach is the one I'm testing at the moment.  The main problem with this at the moment is that at some camera angles there are triangular gaps in the river surface.  I'm investigating the cause of these to see if I can find a workaround.  My current suspicions are with the colour adjust node used to adjust the extent of the river surface. Dropping the white level to really small values (making the mask area wider... and sharper) seems to be a part of the problem. I had also suspected image resolution may play a part as I was really pushing the limits of resolution, but I don't think this is to blame.
12561-1

Here's a partial render showing the river layer rendering before the terrain.  As you can see the drop off at the edge of the river is very severe, and this combined with the contrast of the edge of the river appear to be causing the problem.
12563-2

I ran a series of renders using different white level values for the river mask (1, 0.75, 0.5, 0.25, 0.1, 0.05, 0.01)
12565-3

You can see how the width of the river surface is affected by this change, casting a shadow in the river bed when it doesn't extend beyond the river bank.  No glitches at this camera angle. Repeating at a lower camera angle today.  PS, the water transparency makes this approach very worth while... there's a lot of potential here.

« Last Edit: September 08, 2008, 10:12:26 PM by bigben »

Offline bigben

  • Member
  • *
  • Posts: 2122
  • The Long Stranger rides again
    • Tinkering with Terragen
Re: River/Lake model revisited
« Reply #1 on: September 01, 2008, 09:52:55 PM »
One last screengrab. Lowering the camera angle gave me this glimpse below the terrain before the preview render kicked in. This gives you a good idea of how this model works.
12567-0

Offline rcallicotte

  • Member
  • *
  • Posts: 9542
Re: River/Lake model revisited
« Reply #2 on: September 02, 2008, 12:51:41 AM »
Cool  I want to spend some time on this.  So many lessons, so little time.

Thanks BigBen.  Welcome back, again.
So this is Disney World.  Can we live here?

Offline bigben

  • Member
  • *
  • Posts: 2122
  • The Long Stranger rides again
    • Tinkering with Terragen
Re: River/Lake model revisited
« Reply #3 on: September 02, 2008, 08:46:49 PM »
Restarted the render last night. I'd increased the quality settings yesterday, but the render times were a little higher with the lower camera angle... it was still on frame 1 when I got home.  Here's frame 1 showing the river protruding through the terrain but not reaching the bank. Note the shadow on the surface and river bed.

The second image shows the increase in width from dropping the white level of the mask to 0.75. The defects in the surface have started to appear (triangular chunk missing on the right)
« Last Edit: September 02, 2008, 08:56:44 PM by bigben »

Offline bigben

  • Member
  • *
  • Posts: 2122
  • The Long Stranger rides again
    • Tinkering with Terragen
Re: River/Lake model revisited
« Reply #4 on: September 03, 2008, 09:14:14 AM »
Nearly fininshed the series..  Here are images for white values of 0.5, 0.25, 0.1 respectively.  The defects are  less severe than in earlier versions of TG2 which rendered more like the preview render above. What is interesting is that the last image looks fine while I was expecting it to get worse with lower white values. The next image is looking OK too which is promising.

Next will be exploring different render quality settings and checking different locations. These renders are Qualtiy 0.35, AA 3 which is well below my normal settings. I'll take suggestions as to which setting is most appropriate in this instance.... anyone?

Offline jo

  • Planetside Staff
  • *
  • Posts: 1729
Re: River/Lake model revisited
« Reply #5 on: September 03, 2008, 12:54:51 PM »
Hi Ben,

Just a random thought, but it seems to me you are doing the river surface by pushing one heightfield just slightly through another, right? In this case the dark artefacts you're seeing might be caused by something like "z fighting". Perhaps the renderer is having trouble with the two surfaces very close together.  This could be borne out by the two example images in the third post. If you increase the spacing between the two surfaces the problem may go away.

Regards,

Jo

Offline bigben

  • Member
  • *
  • Posts: 2122
  • The Long Stranger rides again
    • Tinkering with Terragen
Re: River/Lake model revisited
« Reply #6 on: September 03, 2008, 09:23:44 PM »
Hi Jo

Thanks for the feedback. Yes you're right. The river bed is a masked negative displacement of the terrain and the river is a copy of the terrain lowered by a smaller amount and then masked as well, dropping areas away from the river back to the planet surface.

I hope this is not the case, because that would make it very difficult to have shallow water.  My initial suspicions regarding the increase in contrast of the mask image were wrong, as the three lowest white levels set had no problems.

Given that the problem looks worse in the preview render (large triangular chunks missing across the top of the surface), and that the mask is based on an antialiased image, my first retry involved increasing the AA.

I first repeated the image with the worst defects, and while the small defects were still present the larger one was largely gone, making the original glitch look more like an incompletely rendered section of the terrain. Increased AA from 3 to 6 and while the render stalled about 1/3 of the way through (my home PC isn't the greatest) these errors were not present.  I'll take the files to work and try a repeat there.

The other thing I noted with this render is that the CLI output only had 3 numbers for the number of microtriangles rendered, changing every 1 - 1.5 hours even though the render was obviously progressing in between times. (piping the CLI output to a text file didn't work???   %terragen_path%\tgdcli.exe > %terragen_path%\log.txt ).

At least increasing AA to a value I normally render at anyway is making this look very promising.
« Last Edit: September 04, 2008, 03:05:47 AM by bigben »

Offline bigben

  • Member
  • *
  • Posts: 2122
  • The Long Stranger rides again
    • Tinkering with Terragen
Re: River/Lake model revisited
« Reply #7 on: September 04, 2008, 07:11:47 AM »
12594-0

Here's the partial render with AA=6. This time there are two large chunks missing. across the entire river.  I'll have to play around a bit more to see if I can find a way past this.

Offline bigben

  • Member
  • *
  • Posts: 2122
  • The Long Stranger rides again
    • Tinkering with Terragen
Re: River/Lake model revisited
« Reply #8 on: September 04, 2008, 12:11:17 PM »
Fighting back the Alzheimers... ;)

I have previously run tests with just the river terrain with the same glitches, so it's not a competition between the two surfaces.  From the quick test with <http://forums.planetside.co.uk/index.php?topic=4716.0> it would appear to be more related to the use of TER files than procedural terrains.

In my model I used a blending shader to mask the terrain. Trying a different approach now by displacing the area away from the river by a larger negative amount than the river. Crossing fingers.  ;)


Offline rcallicotte

  • Member
  • *
  • Posts: 9542
Re: River/Lake model revisited
« Reply #9 on: September 04, 2008, 05:17:18 PM »
This is like reading a blog.

Thanks for the information.  Braincells have begun to acclimate to your visitations.   :P
So this is Disney World.  Can we live here?

Offline bigben

  • Member
  • *
  • Posts: 2122
  • The Long Stranger rides again
    • Tinkering with Terragen
Re: River/Lake model revisited
« Reply #10 on: September 04, 2008, 08:49:23 PM »
I do tend to blog my posts when I'm working on something a) it helps me sort things out (thinking out loud) and b) you never know when someone chips in with a gem that gets you a lot further along.

And the next entry ...  ;)

12602-0

This image has uses an elevation adjustment of the river terrain followed by a large negative displacement of the terrain away from the river.  This means that the entire surface consists of the original TER whereas the previous model masked the TER.  This looks a lot more promising. There may be 2 minor glitches (far right and middle right) but the image is a bit too small to tell for sure. The edges don't quite look sharp enough.  I also changed the lighting to use a soft shadow. it's at least starting to look the way I wanted it to.

Time for  a larger render with higher quality and perhaps a smaller displacement of the terrain away from the river (-500m in this image).  Something for my work computer to play with over the weekend.  Here's the reference pic without the river and a bit of extra candy.
« Last Edit: September 05, 2008, 12:21:00 AM by bigben »

Offline rcallicotte

  • Member
  • *
  • Posts: 9542
Re: River/Lake model revisited
« Reply #11 on: September 04, 2008, 09:50:52 PM »
This looks good.  I can't wait to hash over this and then to see your final.
So this is Disney World.  Can we live here?

Offline bigben

  • Member
  • *
  • Posts: 2122
  • The Long Stranger rides again
    • Tinkering with Terragen
Re: River/Lake model revisited
« Reply #12 on: September 05, 2008, 06:33:16 AM »
... piping the CLI output to a text file didn't work???   %terragen_path%\tgdcli.exe > %terragen_path%\log.txt...

Sorted this one out. Different computer, this was set up in a shortcut. Works OK in a batch file.

The low quality render was progressing nicely at home when I left. The higher quality render kept crashing at work with odd C++ errors, but that'll learn me for trying to do some work at the same time. It's progressing further now that I've shut down some hungry Adobe apps  ;)

Offline bigben

  • Member
  • *
  • Posts: 2122
  • The Long Stranger rides again
    • Tinkering with Terragen
Re: River/Lake model revisited
« Reply #13 on: September 05, 2008, 09:43:54 AM »
Here's the low res render. Detail 0.35, AA 4, GI 1,1

The water surface is glitch free (that's an island near the centre of the image) but you can see why I wanted to use more extreme negative displacements for the areas away from the river.  The displacement in this one is only -50m, but there are cliffs that are higher than this and you can see some of the water on the cliffs on the right, and you also have to take into consideration additional displacements to the terrain which may expose a nearby water layer ... but I'm very happy with the river.  ;D

Rendering again with a displacement of -500m.

The clip file contains the basics of the river model.
« Last Edit: September 05, 2008, 09:48:17 AM by bigben »

Offline bigben

  • Member
  • *
  • Posts: 2122
  • The Long Stranger rides again
    • Tinkering with Terragen
Re: River/Lake model revisited
« Reply #14 on: September 05, 2008, 08:26:07 PM »
Here's another test from a higher camera position... still no glitches. The larger displacement here is -500m.

Another benfit of this approach is that it is MUCH faster to render than the masked terrain model. This image (640x480) took just under 5 hours to render, while the first Grand Canyon test above (320x240) using the masked terrain took just over 6 hours.

Rendering one last test from head high before I call this one a success.

 

anything