Defer All Shading and Plastic Geometry/Shading

Started by WAS, August 22, 2019, 03:41:30 pm

Previous topic - Next topic

WAS

August 22, 2019, 03:41:30 pm Last Edit: August 22, 2019, 04:20:10 pm by WAS
Can someone explain what exactly the Defer All Shading does?

I'm, really for the heck of it, exporting a basic sand and rock shader from TG to make a PBR Material out of. Just a 1k tile. I am using MPD 0.6 and AA6.

I'm using the noise shader on all surfaces, and have a very rough PF that creates sand/dust roughness. However when I use Defer All Shading, it all but eliminates all noise in the shaders, and smooths all micro displacement. Added a zoomed in comparison.

Why does it do this? And how is this beneficial to rendering? I see it suggested to use a lot, and I think this may be why I have been noticing muddy/plastic/smooth terrains from people.
Check out my Terragen Discord: https://discord.gg/Vy5FRTE

Tangled-Universe

Matt should correct me if I'm wrong, as it's a tough subject, but I visualize the difference as follows:

Standard renderer = textures are evaluated and rendered on a per micropolygon basis = 1 shading point per micropolygon.
The higher the micropolydetail, the more faces, the more shading points, thus the smoother the result.
This is why without deferred rendering you need to render your scenes with micropolydetail >1, even up to 2.
The AA setting then tries to reduce noise between those shading points.

Deferred renderer = textures are calculated after micropolygons are generated, then the textures are being sampled using AA.
You can now have 64 shading points per micropolygon if you render with AA8(full), instead of 1. So you create a lot more texture info per micropolygon and it is also anti-aliased.
This is why with deferred rendering low micropolydetail values suffice in generating enough geometry for surface geometry detail and let the deferred pass based on AA setting do the same as increasing your micropolydetail to insane levels with the standard renderer.

The consequence is that any shader you designed for the standard renderer looks flat, simply because the "texture filtering" of the standard renderer is inferior.
Your sand looks flat now, because that's actually how your texture looks like when rendered properly. It looked grainy before, to some extent because of the renderer, not so much because of your shader.

The way I have explained this may be wrong, but I do know for sure it fits my observations and that this logic helps me make better choices for render settings.

I remember a topic by Mick Hazelgrove (mhaze) about high micropolydetail. There Matt and others shed some light on this. I'll see if I can find it, but you may beat me to it since you practically live here :P

WAS

August 23, 2019, 12:53:06 pm #2 Last Edit: August 23, 2019, 12:56:52 pm by WAS
Everything sounds right except for the last bit. See the shader is built with the noise shaders, which has pixel level noise down to micro scales (122mm) all the way up to planetary scales. It's so hard and noisy that's how it should be across renderers. If not,... Building shaders and the 3D previews etc is all broken if you gotta crop render and move camera all around just for a surface shader. :O also there is microdisplacement as well which just vanishes. Not a hint of shadow created from the roughing.

I honestly think defer all needs to be fine tuned with the Standard or PT renderer, and not change all your shaders and stuff that you can't plan for without rendering, slowing down the workflow significantly.
Check out my Terragen Discord: https://discord.gg/Vy5FRTE

WAS

Think of rendering advise. If people were rendering with MPD 2 they would be told that may be useless and they can get away with much less and AA. So when people pipe through defer all, it's essentially rendering in overkill at normal settings, and the way it handles shaders it's like texture filtering and actually augmenting the shaders look.

I dunno just feel the internal setting scales could be balanced better to not have such a radicle change to the scene. People are using this and it's destroying their shaders and flattening their scene imo

And not being able to build shaders for defer all like PT and SR is a big issue imo
Check out my Terragen Discord: https://discord.gg/Vy5FRTE

Matt

Deferred shading (or ray tracing), produces the more correct result. It is much closer to a simulation of photographing the surface. Each AA sample (subpixel sample) is shaded. The colour of a pixel is the average of the subpixels (although the pixel filter can change the weights of the contributing subpixels).

Micropolygon shading, on the other hand, is a rough approximation because it doesn't allow any colour changes smaller than a micropolygon. As you know, usually your micropolygons are a little bit larger than a pixel. Therefore the size of the micropolygon in world space depends on the distance from the camera, render resolution and other factors.

If you have a shader that produces random noise at a very small scale, micropolygon shading will cause this noise to change its size in world space depending on all of those factors. From an artistic standpoint, this kind of noise can be a useful tool because it's almost like it operates at the image level rather than world space. But it's important to realise that this is not going to realistically simulate a physical surface, and that it will be very different from what the deferred renderer or ray tracer produce because they are designed to faithfully recreate what that surface would look like to the camera. With deferred shading or ray tracing, every sample of your noise will be different but they will be averaged out to produce a pixel that looks similar to the one next to it. This is what would happen in real life if you had noise occurring at the millimetre scale but pixels that span centimetres or metres.
Just because milk is white doesn't mean that clouds are made of milk.

Matt

Or to put it another way... if you want features in the surface to be visible in the rendered image, the features need to be large enough that each pixel sees a different value. If you make your features too small, the renderer (or camera in the real world) will not see them.

A good way to avoid this problem is to use fractals that have multiple scales (octaves), so that you see details when you zoom in and you also see interesting features when zoomed out.
Just because milk is white doesn't mean that clouds are made of milk.

Tangled-Universe

August 23, 2019, 03:07:31 pm #6 Last Edit: August 23, 2019, 03:13:49 pm by Tangled-Universe
Quote from: WAS on August 23, 2019, 12:53:06 pmEverything sounds right except for the last bit. See the shader is built with the noise shaders, which has pixel level noise down to micro scales (122mm) all the way up to planetary scales. It's so hard and noisy that's how it should be across renderers. If not,... Building shaders and the 3D previews etc is all broken if you gotta crop render and move camera all around just for a surface shader. :O also there is microdisplacement as well which just vanishes. Not a hint of shadow created from the roughing.

I honestly think defer all needs to be fine tuned with the Standard or PT renderer, and not change all your shaders and stuff that you can't plan for without rendering, slowing down the workflow significantly.

122mm is 122.000 micrometer + Matt just beautifully explained why this is not of importance to the problems you experience.
Your fractals are capable of being much smaller than millimeters. I believe you can go as low as 10^-08 meters as smallest scale, which is 10 nanometer.
All nice and well, but the deferred vs standard rendering is more about the micropolygon size and that is determined not by the fractal, but by the micropolydetail slider.
Even on a smooth patch of fractal 10 meters large you can subdivide this into millimeter sized polygons and still experience the differences between deferred and standard rendering.

The PT uses deferred rendering, so your experience is exactly similar in terms of your textures. Shading and lighting differs though, because PT'ing is not the exact same thing as classic raytracing.
Quote from: WAS on August 23, 2019, 01:01:00 pmThink of rendering advise. If people were rendering with MPD 2 they would be told that may be useless and they can get away with much less and AA. So when people pipe through defer all, it's essentially rendering in overkill at normal settings, and the way it handles shaders it's like texture filtering and actually augmenting the shaders look.

I dunno just feel the internal setting scales could be balanced better to not have such a radicle change to the scene. People are using this and it's destroying their shaders and flattening their scene imo

And not being able to build shaders for defer all like PT and SR is a big issue imo

I don't know what Matt's vision for the future is, but personally I see the PT with its deferred rendering replacing the standard renderer completely. Simply because it offers microdisplacement detail AND superior indirect lighting + superior shading (reflections/refractions).

I can see why you are unhappy, because this difference interferes with your workflow at the design stage.

My advice would be to design the base of your scene with the standard renderer, like terrain/water/camera position etc.
Once you start texturing/shading then switch to defer all.
Unhappy with the indirect lighting? Then switch to PT.

This way your workflow is "future proof" with the big IF if this is indeed going to be TG's future, but I think/hope it will be. It's much much better.

WAS

August 23, 2019, 03:35:00 pm #7 Last Edit: August 23, 2019, 03:47:32 pm by WAS
Quote from: Matt on August 23, 2019, 02:54:52 pmFrom an artistic standpoint, this kind of noise can be a useful tool because it's almost like it operates at the image level rather than world space. But it's important to realise that this is not going to realistically simulate a physical surface,

Well, no. Like all physical surfaces, they incorporate substantial noise and chaos on a texture level. This is in fact gone over in "photo-realistic rendering" articles a lot. Noise. Not on a picture level like film grain, but surface quality. Nothing in real life is smooth, heck not even a "smooth" leaf, when you really look at it, not even a solid colour plastic toy due to surface imperfections and lighting or polymer mixing of colours. Adding noise in texture/material generators is common place, and seen in all high quality materials that aren't going for a smooth cell shaded like look and trying to be real-world.

I do know there are outdated materials and creation techniques where you use falt colours and textures because your renderer will introduce noise, but I'd say that is where it's not realistic, as this chaos is part of the material, not the atmosphere/eye.

Thinking of the progression of creating realistic skin compared to the past. It's heavily based on noise.

Quote from: Tangled-Universe on August 23, 2019, 03:07:31 pm122mm is 122.000 micrometer

It's a mix of noise from 122mm TO planetary scales. There should be noise all these scales.



Quote from: Tangled-Universe on August 23, 2019, 03:07:31 pmAll nice and well, but the deferred vs standard rendering is more about the micropolygon size and that is determined not by the fractal

So because the geometry is different, it changes the entire texture through filtering?

And this effect is not a problem in PT rendering at normal settings we often use, probably I guess due to the PT noise in general.

The issue I'm trying to point out that no one here is grasping, is we cannot build shaders in TG for the renderers we're moving forward too. Lol It so radically changes the look of shaders, how the heck can you build for that with such a huge variance of guess work?

With the PT at normal settings we often use for SR, even with increasing AA to get rid of noise, my shaders seem to work fine, but with Defer All, they are just broken. Noise is cancelled when that's the deliberate effect of the shader using hard noise variation and contrast, micro displacement is almost entirely loss.

Seems if we're moving forward with DA/PT over SR, the entire preview system for shaders needs to be overhauled as soon as possible. Not sure why it wasn't part of updates rolling out with these features. And no, RTP isn't a good substitute for node work imo - especially when incorporating displacement into the mix.
Check out my Terragen Discord: https://discord.gg/Vy5FRTE

Matt

Quote from: WAS on August 23, 2019, 03:35:00 pm
Quote from: Matt on August 23, 2019, 02:54:52 pmFrom an artistic standpoint, this kind of noise can be a useful tool because it's almost like it operates at the image level rather than world space. But it's important to realise that this is not going to realistically simulate a physical surface,

Well, no. Like all physical surfaces, they incorporate substantial noise and chaos on a texture level. This is in fact gone over in "photo-realistic rendering" articles a lot. Noise. Not on a picture level like film grain, but surface quality. Nothing in real life is smooth, heck not even a "smooth" leaf, when you really look at it, not even a solid colour plastic toy due to surface imperfections and lighting or polymer mixing of colours. Adding noise in texture/material generators is common place, and seen in all high quality materials that aren't going for a smooth cell shaded like look and trying to be real-world.

Of course. But what I'm saying is that these small details becomes invisible when the camera is too far away. That smooth leaf looks smooth because the camera can't resolve the microscopic details. In the same way, deferred shading and ray tracing will cause your microscopic details to disappear. If you want something to look like it has a noisy surface, your noise needs to be bigger than a pixel. Just like it does in photograph.

Quote from: WAS on August 23, 2019, 03:35:00 pm
Quote from: Tangled-Universe on August 23, 2019, 03:07:31 pm122mm is 122.000 micrometer

It's a mix of noise from 122mm TO planetary scales. There should be noise all these scales.

If you have noise at large scales, they should appear similar in both deferred and non-deferred rendering. So I can understand why something seems wrong if those large noises are not visible. Maybe there is something in your shader that isn't doing what you thought it was?

QuoteThe issue I'm trying to point out that no one here is grasping, is we cannot build shaders in TG for the renderers we're moving forward too. Lol It so radically changes the look of shaders, how the heck can you build for that with such a huge variance of guess work?

With the PT at normal settings we often use for SR, even with increasing AA to get rid of noise, my shaders seem to work fine, but with Defer All, they are just broken. Noise is cancelled when that's the deliberate effect of the shader using hard noise variation and contrast, micro displacement is almost entirely loss.

Take another look at your noise setup. If large noises aren't apparent in the deferred render, then maybe they aren't being included somehow? Perhaps a mistake in the scales?

QuoteSeems if we're moving forward with DA/PT over SR, the entire preview system for shaders needs to be overhauled as soon as possible.

That's a good point. Shader previews need to work more like ray traced renders.

QuoteNot sure why it wasn't part of updates rolling out with these features. And no, RTP isn't a good substitute for node work imo - especially when incorporating displacement into the mix.

Updating everything in one release would be great, if it were possible. Holding back valuable render improvements until every part of the preview system is updated is a less attractive choice, IMO.
Just because milk is white doesn't mean that clouds are made of milk.

WAS

August 23, 2019, 04:25:35 pm #9 Last Edit: August 23, 2019, 04:29:22 pm by WAS
Yes, you are right, that leaf will be smooth, depending on pixel ratio. I mean take some of our high megapixer cameras where you can zoom on that leaf in the tree, and pick out vein or surface detail. Or the classic "Apple" demonstration where you can zoom in and see the surface grain and dimples from the full 100% image where, due to monitor scales, it's flushed out. This seems to be altogether smoothing the noise. If I'm exporting a 4k (or the overnighter 8k) texture, I should be able to zoom in on some of this detail, not have it all flushed away.

And I don't know if something is wrong. You could take a look at it yourself, I shared it in the file section. As far as the logic of the Multiply Function, it's multiplying the colour as variation 0-1 dots, and than for scales, using the differences shader which should difference these dots/blobs (on a larger scale) between the 0-1 noise.

And sorry, I don't mean to say it had to be perfect, but I just mean with these things being suggested to be used; defer all over SR by Oshyan and others, and PT for nice shadows with vegetation, I feel there is a set back cause it's hard to develop for these renderers currently. Not just colours and roughing, but micro-displacement especially apparently. What will be rough through previews (even RTP)  doesn't seem to even have a hint of roughness in Defer All. Apparently the micropolygons are magnitudes smaller than what they appear.
Check out my Terragen Discord: https://discord.gg/Vy5FRTE

Matt

I've plugged your TGC into the default project, guided by the screenshot you included in the file share. I can see that deferred shading and high AA is smoothing out the details, unfortunately.

I'm afraid I don't fully understand how the setup works. I guess most of the resulting noise is actually occurring on a very small scale, not the scales it would seem to be just by reading the parameters. I think it's somehow creating a lot of noise that is much smaller than a pixel. If so, it's a neat trick. I don't understand the setup well enough to know how far you'd have to zoom to make that noise apparent.
Just because milk is white doesn't mean that clouds are made of milk.

Matt

Quote from: WAS on August 23, 2019, 04:25:35 pmAnd sorry, I don't mean to say it had to be perfect, but I just mean with these things being suggested to be used; defer all over SR by Oshyan and others, and PT for nice shadows with vegetation, I feel there is a set back cause it's hard to develop for these renderers currently. Not just colours and roughing, but micro-displacement especially apparently. What will be rough through previews (even RTP)  doesn't seem to even have a hint of roughness in Defer All. Apparently the micropolygons are magnitudes smaller than what they appear.

Yeah, I think we can make some improvements here. The RTP doesn't shade polygons the way it should right now. It shades it more like a low-detail micropoly render, which is wrong. That fix is on the to-do list.
Just because milk is white doesn't mean that clouds are made of milk.

WAS

Quote from: Matt on August 23, 2019, 05:05:05 pmI've plugged your TGC into the default project, guided by the screenshot you included in the file share. I can see that deferred shading and high AA is smoothing out the details, unfortunately.

I'm afraid I don't fully understand how the setup works. I guess most of the resulting noise is actually occurring on a very small scale, not the scales it would seem to be just by reading the parameters. I think it's somehow creating a lot of noise that is much smaller than a pixel. If so, it's a neat trick. I don't understand the setup well enough to know how far you'd have to zoom to make that noise apparent.

Could it be that the Defer All is interpreting them smaller? I made another setup, which is just simple stones, and it incorporates low colours for small scale rough divots in the stone, that should be noticeable at this scale (according to the previews which really may be the issue), as well as the noise shader, and while the texturing is indeed a little more rough than it is without the noise or small detail roughing, it's very muddles for how close we are to the stones, micro displacement, and texturing.

The difference from the closest rock, to a rock just one step further away seems to extreme of a falloff.

PS the offset in the rocks surface node is causing weird side issues. Not the right compute normal scale for amplitudes I'm using I think.
Check out my Terragen Discord: https://discord.gg/Vy5FRTE

Matt

Quote from: WAS on August 23, 2019, 05:29:26 pmCould it be that the Defer All is interpreting them smaller?

I don't think so.

Quote(according to the previews which really may be the issue)

Yeah, I think that's the issue. Sub-micropoly surface details are not reliably reproduced in the previews.
Just because milk is white doesn't mean that clouds are made of milk.

Tangled-Universe

Quote from: WAS on August 23, 2019, 03:35:00 pmSo because the geometry is different, it changes the entire texture through filtering?

And this effect is not a problem in PT rendering at normal settings we often use, probably I guess due to the PT noise in general.
No the geometry is not different, the way the geometry is being evaluated by SR or defer all (DA)/PT is different.
Matt and I pointed that out pretty clearly I think.

You seem to stick on the idea that defer all and PT are different in this, they are not.

Quote from: WAS on August 23, 2019, 03:35:00 pmThe issue I'm trying to point out that no one here is grasping, is we cannot build shaders in TG for the renderers we're moving forward too. Lol It so radically changes the look of shaders, how the heck can you build for that with such a huge variance of guess work?

With the PT at normal settings we often use for SR, even with increasing AA to get rid of noise, my shaders seem to work fine, but with Defer All, they are just broken. Noise is cancelled when that's the deliberate effect of the shader using hard noise variation and contrast, micro displacement is almost entirely loss.

Seems if we're moving forward with DA/PT over SR, the entire preview system for shaders needs to be overhauled as soon as possible. Not sure why it wasn't part of updates rolling out with these features. And no, RTP isn't a good substitute for node work imo - especially when incorporating displacement into the mix.

I think our replies clearly show we actually do grasp what you are trying to say, just read again my last post with my suggested workflow.
It shows I do understand it, but that you don't like the suggestion and think -rightfully!- it should not work this way is something completely different ;)

There are issues with the 3D preview/RTP and how incoherent it is with deferred rendering, but mocking the difference between SR and DA/PT is based on comparing apples with oranges.
So yes, you are absolutely right about these issues/differences. Yes you are right the preview/RTP at some point should develop along with the renderer, but for now this is what it is and I offered you a workflow while trying to explain why that should work.
As an experienced TG'er all I can suggest to make things less painful for the time being, while Matt tries to improve this which is a lot of work, is to do basic quick scene setup using the SR and anywhere from texturing/shading DA and perhaps PT if you want fancy indirect lighting and/or better reflections, for instance.