Planetside Software Forums

General => Terragen Discussion => Topic started by: Dune on November 11, 2019, 05:01:44 AM

Title: hard edged polys
Post by: Dune on November 11, 2019, 05:01:44 AM
Is there no way to increase tolerance (or something) for smooth interpretation of the poly normals? I sometimes still have trouble getting, say a smooth bark. Even with plenty of polys (see wireframe) and welded and smoothed normals I still get some hard edges, with or without extra bump.
I wouldn't know where to find the culprit.
Title: Re: hard edged polys
Post by: Hannes on November 11, 2019, 09:07:13 AM
This bothers me as well, and I have no idea to avoid this. Sometimes even after recalculating normals in Poseray you get this.
And it's there even without any bump mapping?
Title: Re: hard edged polys
Post by: Dune on November 11, 2019, 10:26:33 AM
Yes, certain polys stick out like a sore thumb, indeed, no matter if smoothed in PR.
Title: Re: hard edged polys
Post by: j meyer on November 11, 2019, 12:32:01 PM
Not sure what you are refering to. I see two possible issues either the sharp
shadow line on the right or some little spots on the bottom left.
Don't know about the shadow line, but the little things might be caused by
'wrong' triangulation. If it is that, the only way to avoid that is to triangulate
manually, as far as I know, that is.
Title: Re: hard edged polys
Post by: WAS on November 11, 2019, 02:32:20 PM
It's weird that the smooth shading correctly interprets it. Like that hard edge in the shadow terminator where the knee starts to jet out.
Title: Re: hard edged polys
Post by: sboerner on November 11, 2019, 03:38:19 PM
Not seeing it either in this example. But I do run into this regularly and agree that it would be nice to be able to control the smoothing angle, individually, for placed objects.
Title: Re: hard edged polys
Post by: digitalguru on November 11, 2019, 04:05:46 PM
Could it be you have some duplicate vertices? You might have some vertices at the same position and this will cause the smoothing to fail at the edges shared by those verts.

Merging vertices with a low threshold or deleting duplicates might help.
Title: Re: hard edged polys
Post by: Matt on November 11, 2019, 04:32:32 PM
There are two problems here.

With bump mapping it's partly due to this what were talking about recently: https://planetside.co.uk/forums/index.php/topic,27221.0.html
I'm going to implement a solution to the bump issue soon.

However, even without bump mapping there is the shadow terminator problem which you will see in lots of renderers:

https://computergraphics.stackexchange.com/questions/4986/ray-tracing-shadows-the-shadow-line-artifact
http://wiki.povray.org/content/Knowledgebase:The_Shadow_Line_Artifact

I don't have a solution yet but I'm going to take another look at it soon. There are some ideas for me to try in that stackexchange link.

In the mean time, you'll need to heavily subdivide the object to the point where the polygons produce a visually smooth surface.
Title: Re: hard edged polys
Post by: WAS on November 11, 2019, 09:43:01 PM
Quote from: Matt on November 11, 2019, 04:32:32 PMThere are two problems here.

With bump mapping it's partly due to this what were talking about recently: https://planetside.co.uk/forums/index.php/topic,27221.0.html
I'm going to implement a solution to the bump issue soon.

However, even without bump mapping there is the shadow terminator problem which you will see in lots of renderers:

https://computergraphics.stackexchange.com/questions/4986/ray-tracing-shadows-the-shadow-line-artifact
http://wiki.povray.org/content/Knowledgebase:The_Shadow_Line_Artifact

I don't have a solution yet but I'm going to take another look at it soon. There are some ideas for me to try in that stackexchange link.

In the mean time, you'll need to heavily subdivide the object to the point where the polygons produce a visually smooth surface.


Stackexchange is really great tool for alternative ideas. Why is it the smooth shaded models seem to lack this problem? For a preview item its pretty ironic.
Title: Re: hard edged polys
Post by: Mid-Knight Acchan on November 11, 2019, 10:14:41 PM
Many 3D software deals with tessellation subdivisions, but can Terragen process objects?
Title: Re: hard edged polys
Post by: Dune on November 12, 2019, 02:57:05 AM
You can see it here.

Thanks for chiming in all. I do hope for a solution, as it's hardly viable to have to subdivide all trees (and other stuff) to be 100% smooth. Not easy too, as it's only the lower trunks that really need it, it needs a hand, not just a total subdivision (as usually, in my case, trunks and branches use the same texture). But I really though this was subdivided enough, seeing the wireframe.

Btw. it's not duplicated meshes or something like that, it's very clean.
Title: Re: hard edged polys
Post by: René on November 12, 2019, 03:39:36 AM
I also come across this regularly when sculpting rocks. I then add extra displacements to the model on a small scale. The hard edges are still visible but to a lesser extent because the shadow line is broken. This is of course not applicable on smooth surfaces but with rocks and trees it is no problem because they already have a rough surface.
Title: Re: hard edged polys
Post by: KyL on November 12, 2019, 05:08:51 AM
Quote from: WAS on November 11, 2019, 09:43:01 PMWhy is it the smooth shaded models seem to lack this problem? For a preview item its pretty ironic.

I was asking myself the same question, it is really frustrating to see the preview with a correct surface display.
But if you think about it, the shaded preview (non-RTP) doesn't have any shadows so the problem is simply not here.

In the first link there is a solution described as "One alternative that I've used successfully is to offset the origin of the shadow ray a short distance along the surface normal". This sounds like the Shadow Bias control you have in some software. However I don't ever remember having to deal with this parameter in other renderers so there must be indeed some internal solution to fix it.
Title: Re: hard edged polys
Post by: Dune on November 12, 2019, 05:21:56 AM
Offsetting didn't work in this case (though it did in some other cases earlier). The bump by image map (or pf added to displacement function in default shader) is of course different (only positive bump by whites) from a pf based displacement added to the default shader input, which gives positive and negative bump.
Title: Re: hard edged polys
Post by: Dune on November 12, 2019, 08:26:41 AM
It is actually a problem arising after version 4.4.36. So for the time being I have to use version 4.4.36 for this sort of things.
Title: Re: hard edged polys
Post by: Dune on November 13, 2019, 07:51:31 AM
So, how come this has changed since 4.4.36? I certainly hope it can be changed back!
Title: Re: hard edged polys
Post by: Matt on November 13, 2019, 10:03:54 PM
This is an open problem in computer graphics and you will see it in many renderers. In previous versions I allowed the bump map to modify the shading position, not just the normal. This is similar to the ray bias that some renderers let you set. But in Terragen this stops transparency from working on bump-mapped surfaces so I removed it. I'm trying to find a new solution now.
Title: Re: hard edged polys
Post by: Dune on November 14, 2019, 01:35:32 AM
Ah, I half understood, but now I see. So you actually have to rule it out as soon as transparency in objects starts playing a role. Or add a choice button... which in some cases with transparency as well as non-transparent bumpmapped objects would be a hard choice. But as said, for my work I can't use 4.4.44 anymore until you find that solution.
So, good luck!
Title: Re: hard edged polys
Post by: bobbystahr on November 24, 2019, 12:40:30 PM
watching this for a solution as I've run into that as well.
Title: Re: hard edged polys
Post by: Matt on April 08, 2020, 07:03:50 AM
I may have a solution to the low-poly terminator problem with smooth normals.

Before:

low-poly-terminators-before.jpg

After:

low-poly-terminators-with-fix.jpg
Title: Re: hard edged polys
Post by: Dune on April 08, 2020, 08:21:42 AM
Wow, that would be awesome, Matt!
Title: Re: hard edged polys
Post by: Hannes on April 08, 2020, 09:27:44 AM
YAY!!!! :)
Title: Re: hard edged polys
Post by: sboerner on April 08, 2020, 09:56:57 AM
Yes!  ;D
Title: Re: hard edged polys
Post by: KyL on April 08, 2020, 10:16:57 AM
awesome!
Title: Re: hard edged polys
Post by: WAS on April 08, 2020, 02:12:45 PM
Oh that looks nice. Is this just using the internal smooth normals in place now?