Planetside Software Forums

General => Terragen Discussion => Topic started by: Dune on August 22, 2019, 06:29:36 AM

Title: grain PT
Post by: Dune on August 22, 2019, 06:29:36 AM
In PT I see some grain in the shadowed side of the face (though the eyes look great, where in standard render they don't). Where could that come from? Skin is just a default shader with some (0.1) reflectivity and minor bump.
It's not hugely important, as I will probably render in standard mode with reflections of eyes totally off anyway (and do some postwork), but I'm curious nonetheless.
Title: Re: grain PT
Post by: Tangled-Universe on August 22, 2019, 07:43:11 AM
That's not grain if you'd ask me, but simply the PT being much more capable of sampling the texture of the sharp skin wrinkles of the dude's face.
Just compare your PT vs standard comparison and see how sharp the wrinkles are how that pattern is similar to your "grain".
That + the angle of the head results in an unfortunate combination, I think.
Title: Re: grain PT
Post by: Dune on August 22, 2019, 08:11:20 AM
That's what I have been thinking of indeed, the bump reflecting light in different directions, hence a more pronounced effect. I'll test one without bump...
Title: Re: grain PT
Post by: WAS on August 22, 2019, 12:29:22 PM
What is your AA settings?

PT is known for noise without high AA and slower render times. All real-time PT examples are just noise shows cause of this quirk of the renderer.

This is a issue I mentioned for Freeware as it's impossible to test the PT without substantial noise.
Title: Re: grain PT
Post by: Oshyan on August 22, 2019, 01:04:08 PM
That is likely just undersampling, i.e. noise due to not enough samples to resolve smooth output. Reduce Pixel Noise Threshold a bit and see if that helps.

- Oshyan
Title: Re: grain PT
Post by: WAS on August 22, 2019, 01:38:37 PM
Quote from: Oshyan on August 22, 2019, 01:04:08 PMThat is likely just undersampling, i.e. noise due to not enough samples to resolve smooth output. Reduce Pixel Noise Threshold a bit and see if that helps.

- Oshyan

What is the range of this by the way? It's not on a SPP I've seen elsewhere. It seems like a opposite kinda feature, where you "Reduce noise" rather than it just being a SPP setting.
Title: Re: grain PT
Post by: Matt on August 22, 2019, 03:53:42 PM
Reducing the pixel noise threshold may work, or may not if the anti-aliasing needs to be higher. Without knowing which is more efficient, I'd recommend leaving the sampler non-customised and simply increase AA. As long as 'customise' is not checked, you can try different AA values and it will automatically change the pixel noise threshold and other adaptive sampling settings. Once you customise it, however, the link is broken between AA and these other settings so you need to manage them yourself. You can revert to defaults by unchecking 'customise'.
Title: Re: grain PT
Post by: WAS on August 22, 2019, 03:56:36 PM
Quote from: Matt on August 22, 2019, 03:53:42 PMReducing the pixel noise threshold may work, or may not if the anti-aliasing needs to be higher. Without knowing which is more efficient, I'd recommend leaving the sampler non-customised and simply increase AA. As long as 'customise' is not checked, you can try different AA values and it will automatically change the pixel noise threshold and other adaptive sampling settings. Once you customise it, however, the link is broken between AA and these other settings so you need to manage them yourself. You can revert to defaults by unchecking 'customise'.

Is there no samples per pixel settings relating to this or is it just the reduce noise threshold calculated in some other fashion?
Title: Re: grain PT
Post by: Dune on August 23, 2019, 02:01:59 AM
I use AA6 by default, but I'll experiment a bit with higher AA and PNT. Thanks!
Title: Re: grain PT
Post by: Tangled-Universe on August 23, 2019, 04:24:37 AM
Quote from: Dune on August 23, 2019, 02:01:59 AMI use AA6 by default, but I'll experiment a bit with higher AA and PNT. Thanks!
A bit higher AA, yes.
A bit higher PNT, no.
Or did you not mean increasing both?
Title: Re: grain PT
Post by: Dune on August 23, 2019, 07:28:49 AM
Both, but separately, just to test both, and see which one serves best.
Title: Re: grain PT
Post by: Dune on August 23, 2019, 11:05:00 AM
Bigger test, and higher AA surely does the trick, though at a cost. But, boy, what in difference in nose hole!
Title: Re: grain PT
Post by: Tangled-Universe on August 23, 2019, 12:39:14 PM
Quote from: Tangled-Universe on August 23, 2019, 04:24:37 AM
Quote from: Dune on August 23, 2019, 02:01:59 AMI use AA6 by default, but I'll experiment a bit with higher AA and PNT. Thanks!
A bit higher AA, yes.
A bit higher PNT, no.
Or did you not mean increasing both?
Quote from: Dune on August 23, 2019, 07:28:49 AMBoth, but separately, just to test both, and see which one serves best.
I'm afraid you don't understand the AA vs PNT relationship/concept.
You do realize that increasing PNT along with AA is counter-productive in terms of quality?

Say, you render with AA4 with its default PNT of 0.075 and are not happy with the amount of noise.
Then you would increase from AA4 to AA8 and the renderer decreases the PNT to 0.0375.
The reason this happens is that the more AA samples you throw at your render the more noise you can remove. How is that noise defined? The PNT is (an arbitrary(?) or perhaps dimensionless) number which defines the "contrast" between subpixels. The lower the noise the lower the contrast the lower the pixel noise. The threshold simply tells the algorithm to keep shooting AA samples until the noise reaches a certain threshold, the PNT.
The rule then is "shoot more AA samples when adjacent pixel noise value is greater than the PNT value set by user" clamped by AA# squared.

So increasing PNT along with AA actually counteracts the increase of AA. Potentially/very likely.

If you increase AA4 to AA8 and keep PNT at 0.075 you may still end up with a better looking render, simply because AA4 was not supplying enough samples to reach the PNT of 0.075. AA8 offers sufficient samples to reach the PNT and then stops. If the PNT would be its default 0.0375 then it would use more samples to try to reach it with the maximum being 8 squared = 64 samples.
Consequently, if you set AA8 and PNT of 0.01 then you are asking the renderer to try to render a very smooth picture with only 64 samples max. The render will likely take as long as AA8 full sampling, since 64 samples in many cases is not sufficient for such a low PNT. Exception might be smooth areas like empty sky, but the principle generally applies.
Title: Re: grain PT
Post by: Dune on August 23, 2019, 12:47:17 PM
Thanks for your lengthy reply. I guess I know the gist, but more like a vague feeling than exact, so I'm glad you explained once again! But I didn't increase both, as the AA8 sample used the default threshold, and only in the AA6 did I increase it from default 0.05 to 0.1. Perhaps wrongly so, but I'll study your explanation more carefully tomorrow.
Title: Re: grain PT
Post by: Matt on August 23, 2019, 02:25:47 PM
The default value for "Pixel noise threshold" depends on the AA. Some default PNTs are:

AA 1: PNT 0.3
AA 2: PNT 0.15
AA 3: PNT 0.1
AA 4: PNT 0.075
AA 5: PNT 0.06
AA 6: PNT 0.05
AA 8: PNT 0.0375
AA 10: PNT 0.03
AA 12: PNT 0.025
AA 16: PNT 0.01875

It uses the formula PNT = 0.3 / AA
Title: Re: grain PT
Post by: Tangled-Universe on August 23, 2019, 02:56:21 PM
Thanks Matt!

Can you tell how you came up with 0.3?
Title: Re: grain PT
Post by: Matt on August 23, 2019, 03:49:23 PM
Quote from: Tangled-Universe on August 23, 2019, 02:56:21 PMCan you tell how you came up with 0.3?

I first added adaptive sampling to Terragen 2.1. The original algorithm simply looked at 4 samples, calculated their average value and calculated the differences between the 4 samples and the average. It added up those differences to produce a total contrast value. It's a bit more complex than that, but I don't think the details are important here. What I've described above is what happens when the samples are 1 pixel apart, and that's what we usually think of when we are looking at pixel noise. At subpixel levels the threshold is adjusted by another factor.

From that basic algorithm, I tried it with lots of different scenes and I decided what range of values I thought were good for the default. As you know, it's sometimes difficult to predict whether it's better to increase AA or decrease PNT or do both. The default value is based on the results I got at the time. I don't remember the range of defaults that I was considering, but I homed in on 0.3/AA. It could have been 0.25, but 0.3/AA produces nicer looking numbers than 0.25/AA for most of the AA values between 2 and 6. (You can see for yourself by calculating 0.25/AA for different AA values). I couldn't decide between 0.25 and 0.3 on any other basis so I chose 0.3 for this aesthetic reason.

Decisions made at the algorithm level would have changed these numbers. For example, if I had looked at 9 samples instead of 4, the default PNT would be a larger number. On the other hand, if I'd used 9 samples I might have decided to use the mean of the differences rather than the sum, and then that would make the equivalent PNT values smaller.

In Terragen 4.3 I added "Robust adaptive sampling" and improved upon it for 4.4. I wanted to keep the default values the same to reduce confusion and to minimize the number of things you have to change when switching between legacy and robust adaptive sampling. But there's a problem. Robust adaptive sampling is a very different algorithm and the old thresholds don't apply directly. To solve this, there is an internal mapping from PNT to the specific threshold that the Robust sampler uses. The specific mapping sometimes has to change as I improve the algorithm, and it's very specific to the algorithm. I had to calibrate that mapping based on lots of tests, with 2 major goals. The robust sampler should produce visibly better images than the legacy sampler for any given PNT (within reasonable values), and it should render the image faster. It doesn't always meet both of these goals, but they help me to constrain the range of possible ways to map PNT to the internal threshold used by the robust sampler. This might be tweaked again in future when improvements are made to the robust sampler.
Title: Re: grain PT
Post by: WAS on August 23, 2019, 04:06:44 PM
Quote from: Matt on August 23, 2019, 03:49:23 PMThe robust sampler should produce visibly better images than the legacy sampler for any given PNT (within reasonable values), and it should render the image faster. It doesn't always meet both of these goals, but they help me to constrain the range of possible ways to map PNT to the internal threshold used by the robust sampler. This might be tweaked again in future when improvements are made to the robust sampler.

I really have been liking the robust sampler. It is a little fast, at least from what i can tell, but the image quality seems better balanced between rough areas and flatter edges.
Title: Re: grain PT
Post by: Matt on August 23, 2019, 05:17:01 PM
Quote from: WAS on August 23, 2019, 04:06:44 PMI really have been liking the robust sampler. It is a little fast, at least from what i can tell, but the image quality seems better balanced between rough areas and flatter edges.

Nice to hear that. But what does "a little fast" mean?
Title: Re: grain PT
Post by: WAS on August 23, 2019, 05:23:15 PM
Quote from: Matt on August 23, 2019, 05:17:01 PM
Quote from: WAS on August 23, 2019, 04:06:44 PMI really have been liking the robust sampler. It is a little fast, at least from what i can tell, but the image quality seems better balanced between rough areas and flatter edges.

Nice to hear that. But what does "a little fast" mean?

I haven't really done to many comparisons besides "checking the quality", but it seems to be faster, not by a great magnitude, but from the progression of the bucket it seems quicker in areas. I'm not sure what's happening on the AA math side or if it's related to geometry and how AA samples it.
Title: Re: grain PT
Post by: Matt on August 23, 2019, 05:26:23 PM
Ah, that's good to hear :) The "but" made me think something wasn't right.