Planetside Software Forums

Support => Terragen Support => Topic started by: WAS on May 24, 2020, 06:54:18 PM

Title: Sharp Edges Away from Camera Tears Terrain
Post by: WAS on May 24, 2020, 06:54:18 PM
I found this actually in a cliff project where I had the cliff really tight, but I actually thought it was because of my Vector Displacement warping, and so just moved past it with different settings.

However I'm working on some cracked mud shaders, and it's reappeared in a more controlled environment. Basically, any straight edge angle facing away from the camera creates line-tears towards the camera. On top of the line issue, shadows aren't working like the did before either with the geometry.

Example here is MPD 0.7 AA 6 SR but the same appears in PT at the same settings. This wasn't a issue with this same cracked shader that I used a long time ago for my dried pond with the bison skull, so it's appeared more recently. I can see what's creating it, there are weird jagged artifacts in the displacement calculation, which viewed directly are just little jagged marks, but when viewed away from the camera, tear through the terrain at the camera.

Is there a way to remedy this without insane render settings? This seems like a bug in approximation of edges. For example, if you have a perfectly straight edge on a planet, like from image based, you get nothing but streaks down the face, rather than a smooth face.
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: Matt on May 24, 2020, 07:02:02 PM
The micropolygons don't know how to align to your geometric shapes, so this is always going to happen to some extent. All you can do is mitigate it with higher micropoly detail and/or higher ray detail multiplier.
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: Matt on May 24, 2020, 07:05:18 PM
Quote from: WAS on May 24, 2020, 06:54:18 PMit's appeared more recently.

I don't think that's true, but as I often say, you'd need to test old versions with the same scene file to confirm that.
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: Matt on May 24, 2020, 07:09:21 PM
The hair-like shadows on the top faces look like they might be fixable though. Can you try some of the advanced options in Subdiv Settings?
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: WAS on May 24, 2020, 07:33:10 PM
You are probably right about the MPD (outside the tear lines) issue, but what I mean is the lines on the tops, only coming from the jagged shapes facing away from the camera are new. For example take my old pond, even back on freeware and my old PC. I'm sure this was MPD 0.4 - MPD 0.6 (as a max). AA was probably 6. https://planetside.co.uk/forums/index.php?action=dlattach;topic=24647.0;attach=82727;image

Same shader, though I have mixed the cracks mask with a tight and gapped version for realism. But the line tears towards the camera from lateral faces that are facing away from the camera aren't present. If this was exclusively just the MPD edge issue, it should be worse in this legacy image considering lower quality and resolution.
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: WAS on May 24, 2020, 07:37:54 PM
The MPD issue with edges can be "realistic" when fractal warping is applied and everything, but the lines coming inwards are always very straight and anomaly-esque looking.
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: WAS on May 24, 2020, 08:00:51 PM
Increasing RDM it didn't really help until reaching near or at 1, and even there doesn't fully stop the lines, while simultaneously nearly doubling render time.

Force edges didn't do anything and I tried a custom subdiv of 4096 and was no impact either. Seems just 0.9-1 on RDM is all there is but heavily hits render time, even before any real shading work.
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: Matt on May 24, 2020, 09:24:09 PM
Quote from: WAS on May 24, 2020, 07:33:10 PMYou are probably right about the MPD (outside the tear lines) issue, but what I mean is the lines on the tops, only coming from the jagged shapes facing away from the camera are new. For example take my old pond, even back on freeware and my old PC. I'm sure this was MPD 0.4 - MPD 0.6 (as a max). AA was probably 6. https://planetside.co.uk/forums/index.php?action=dlattach;topic=24647.0;attach=82727;image

Same shader, though I have mixed the cracks mask with a tight and gapped version for realism. But the line tears towards the camera from lateral faces that are facing away from the camera aren't present. If this was exclusively just the MPD edge issue, it should be worse in this legacy image considering lower quality and resolution.

Yeah, it does seem better in this render, I don't really see any hairline shadows.

I think it helps to reduce the depth of the cracks or make the edge softer, less sharp. That would be my advice here. The mixing you're doing in the old file probably helps to reduce the depth.

If the bug really is new, that's great because it'll be easier to fix. There are two ways to test this. Either (1) render one scene file in two versions of Terragen or (2) render two scene files in one version of Terragen. When the old render is a different scene file it might just be that the renderer handles the other scene file better, because there are dozens of variables to consider.
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: Matt on May 24, 2020, 09:45:34 PM
I have some other ideas what might be causing the hairline shadows. Can you send me the TGD?
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: WAS on May 24, 2020, 10:11:49 PM
I started working on a new project (it actually has a lot less bloat in the project, just the shader I've completed so far) but it has the same issue, so I'll send that one.

You mentioned softer edges but this is something i haven't quite figured out. The voronoi scalar is just a slant to it's center point, so I've had trouble trying to figure out how to manipulate this to get anything other than hard slants. I tried clamps but because of the slant of the voronoi it doesn't seem to work right using softness, or maybe I just wasn't doing it right (setting wise).

By the way, you are right about less amplitude but that's unfortunate because I did want to do some variations of all deep cracked mud like you get IRL where it can be upwards half the foot deep.
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: Dune on May 25, 2020, 01:44:09 AM
You do use a smooth step instead of a color adjust in the voronoi setup?
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: WAS on May 25, 2020, 02:15:10 AM
Nor for the cracks no. The issue with that is than mixing them. You get different intensities (enter my other topic about measuring scalars) which of course miz differently and yield different displacement results. A gapped smooth step or soft clamp voronoi will be much taller (more intense) than a tightly clamped (tight cracks) voronoi. 

I wonder how I could go about normalizing these different intensities mathematically so it can scale proportionately with setting changes. I know I'd need to figure out min and Max scalar values to be accurate
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: Dune on May 25, 2020, 02:20:50 AM
I'd say they mix the same way, as it's just a softer replacement of a hard-edged color adjust, but I don't know your setup of course. I can imagine triangular (or any) surfaces/vertices being hard-bent over 90ยบ without any smoothness causing trouble. In modeling it is also always adviced to at least smooth hard edges a little, so I guess the same is true for TG. It would certainly be easier to have a color adjust with a tickbox for smooth 'clamps' anyway.
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: WAS on May 25, 2020, 02:31:46 AM
I tried soft steps, and soft min-max and they both have similar effects. Think about the voronoi, it's just a slant to the center of the plotting points. So if you want a large gap between voronoi, you'd need to create a smooth step / min max at about half-way between the base, and max of the voronoi. Think of that half-way point as your displacement (Y). Now if you want to do a tight crack, you don't need to travel up the slant very far, thus, your ending point is much lower than the gaped points, creating much less displacement. A way to normalize these needs to be figured out to be work with large or low displacements where any variance from accuracy would be accentuated.

Here is a example with Maximum and Minimum scalars with softness values to create "rounded" edges for the tops of the straight edges. Tight edged voronoi is lower than the gaped voronoi because of the end-point of the clamps maximum (Soft minimum scalar) is lower in the original scalar.

This does of course entirely solve my problem so I'm trying to get it to work.

Edit: Also, I tried using the mixed setup to create a simple cracks mask that I could than use to just do negative displacement on a constant scalar at 1 (to multiply by the final amplitude), but unfortunately, the mixer starts showing through in the scalar because of how faint the resulting scalars are after soft clamping and having to ramp up BW and WP to get a hard white mask.
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: Matt on May 25, 2020, 04:15:27 AM
You are clamping to some value already, so perhaps you could clamp with a Smooth Step Scalar instead.
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: Dune on May 25, 2020, 04:17:21 AM
I should see some nodes to grasp this, so I may have a look myself. I always make the greys first, then use them to displace. So, "thinking of that half-way point as the displacement (Y)" is not how I would do it, or see it, but again, I may not grasp your method.
You also tried using a bias and gain scaler after the smooth steps? These are handy to have better control over once established soft corners.

Matt was just ahead of my latest reply, but that is what I meant as well. Soft clamping, so to speak.
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: WAS on May 25, 2020, 01:31:22 PM
I don't understand how this would help. It's just a smooth step from A to B, It's not like soft minimum / maximum scalar where I can target the end, and then how soft it's going to be to create a rounded edge towards the point of the voronoi... It'd just get hard edges in the soft step. Example is a voronoi stepped down to around area I need, but creates no soft edge on the upper limit. And because it's stepped so tight, I then can't create a soft edge after.
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: WAS on May 25, 2020, 02:25:32 PM
Quote from: Dune on May 25, 2020, 04:17:21 AMSo, "thinking of that half-way point as the displacement (Y)" is not how I would do it, or see it, but again, I may not grasp your method.

This is a good way to think about scalars though when doing basic disp. They're just Y data (height), so when thinking about how they're going to look in displacement, it's good to translate the raw scalars to displacement in your head. If you wanted tight cracks in your voronoi, you're working with the base of the scalar. I'm not going to show the node networks here as this is for a purchasable shader pack I'm working on. It's just sad Terragen has such a problem with hard edges, which are natural phenomenon in nature. This means, because of a limitation of TG I can't have a realistic setup to some of my references, and all must be like worn, older cracked muds. Same goes for truly vertical cliffs and their ledges without rounding them, which is not realistic always.

Terrible example but sorta how I would be envisioning it. In reality the soft minimum scalalr would more align with the base voronoi but wanted to show it without too much overlay
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: Matt on May 25, 2020, 02:54:49 PM
Quote from: WAS on May 25, 2020, 01:31:22 PMI don't understand how this would help. It's just a smooth step from A to B, It's not like soft minimum / maximum scalar where I can target the end, and then how soft it's going to be to create a rounded edge towards the point of the voronoi... It'd just get hard edges in the soft step. Example is a voronoi stepped down to around area I need, but creates no soft edge on the upper limit. And because it's stepped so tight, I then can't create a soft edge after.

Hard edge in = hard edge out. Don't clamp the input to the Smooth Step. Use the Smooth Step to do the clamping for you, then multiply it down to the correct height.
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: WAS on May 25, 2020, 03:17:50 PM
Quote from: Matt on May 25, 2020, 02:54:49 PM
Quote from: WAS on May 25, 2020, 01:31:22 PMI don't understand how this would help. It's just a smooth step from A to B, It's not like soft minimum / maximum scalar where I can target the end, and then how soft it's going to be to create a rounded edge towards the point of the voronoi... It'd just get hard edges in the soft step. Example is a voronoi stepped down to around area I need, but creates no soft edge on the upper limit. And because it's stepped so tight, I then can't create a soft edge after.

Hard edge in = hard edge out. Don't clamp the input to the Smooth Step. Use the Smooth Step to do the clamping for you, then multiply it down to the correct height.


Huh? I didn't... that's teh raw voronoi noise plugged to the smooth step. Like you said, hard in, hard out. So your comment doesn't make much sense to me. If I wanted "smooth" out, wouldn't I want the smooth clamped scalar? Not the raw, hard, voronoi? This doesn't help with the intensity issue though (if feeding soft scalar), and soft min/max scalars work much better alone.
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: WAS on May 25, 2020, 03:27:13 PM
I'd love to see an example. Voronoi is pretty easy to output and show an example. I don't know how it would help. Soft Minimum / Maximum Scalar does exactly what I need, but the resulting scalars are clamped to their intensities. I need a way to know their exact values or normalize them between 0 and 1.

Here is an example of soft minimum and maximum, as you can see, for the most part the edges have been softened, besides edges towards the center of the voronoi, but oh well, bias/gamma can help there I'm sure. Still though, tighter cracked setups are "lower" than the gapped cracks.
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: Matt on May 25, 2020, 03:39:03 PM
OK, well I'm afraid I don't understand your question.
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: WAS on May 25, 2020, 03:45:59 PM
What one? :o

This was about the tear lines coming towards the camera from edges facing away from the camera. It seems this can't be remedied without high RDM or softening the edges like I've done.

The issue I face with softening the edges is because I'm clamping at different parts of the voronoi scalar (end points) the intensities of these two different scalars are different. When mixed together they have different displacement. So I was wondering how to have these smooth edges and have it uniform between the two types so the displacement matches.

This is where my other topic about finding the actual scalar values of a map would come in handy. I could then just use math, but I'm in the dark so It's all a guessing game and trials. Knowing the absolute maximum and minimum scalars in a map is really beneficial, and honestly crucial to functions.
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: WAS on May 25, 2020, 03:49:29 PM
I also don't feel high RDM is a fix here, cause it doesn't fully fix the issue with the line tears, and in a full scene, micro displacements and textures, will cripple render times. Especially needing to exceed a value of 1 with already pretty high MPD.

In a world of PBR Materials now and microdisplacements and imperfection maps, I think we need a little more refinement of sharp edges etc. Despite you saying "You will get it" etc, this does appear to be severely remedied in other applications, such as Substance Designer and other renderers. It would be nice to see that level of detail in TG without blowing out settings. TG even has issues with PBR materials from substance designer etc where edges are involved.
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: Matt on May 25, 2020, 04:45:25 PM
It looks like the hairline fractures can be fixed by turning Fully Adaptive OFF.
 
Title: Re: Sharp Edges Away from Camera Tears Terrain
Post by: WAS on May 25, 2020, 05:10:32 PM
Sweet, I'll give that some tries. I wasn't sure what that was off the top of my head yesterday and just left it alone.