# Thoughts on adaptive sampling

I’m thinking about the revolutionary ideas recently that amaze me: DLSS and OIDN(OpenImageDenoise).

I’ve tried the C4D default render and Redshift before I started to use Cycles.
One option that can significantly increase the rendering speed is `Denoise`

, beside it, there’s another rendering option: `Adaptive Sampling`

.
I think the arrangement of the two options is not a coincidence.

Along with DLSS, the three techniques remind researchers to seek a new approach aside from traditional computer graphics rendering algorithms. I’m not just saying that AI can be a powerful tool for rendering, Adaptive Sampling can yet be implemented without AI.

Maybe, the core of the ideas is to be lazy and mean. Ask these questions, why we need to render until full convergence, why we need to render all resolutions of a screen, and why do we need to distribute all blocks on screen with relatively the same computing power?

I’m trying to come up with a structured way of **finding questions**, which might not be so trivial.
Since we can work on the resolution, why can’t we work on some other thing? We could apply these thoughts to all variables.
Adaptive ray depth with respect to path, or adaptive resolution in different render blocks to be scaled up, and even different rendering methods in one scene(rasterize for volume rendering/ray tracing for details),
or we can apply the ideas of mipmap into other kinds of stuff other than textures.

Right… I’ll come back to adaptive sampling, since I have no knowledge in AI, I have to focus more on traditional algorithms :(

The basic idea is to give weight to different types of paths, SDS needs to be given more, and light sources need to be given less, flat surfaces with existing texture can be given less, etc. Concrete path types can experiment later.

[[experiment]]

Let’s think of a little more complex approach. The ‘derivative’ of a rendering process, which is quite intuitive yet.

BTW, if we have an error metric defined, it would be a lot easier.

The method of calculating error metric can be used to determine if a picture is an ACG picture or a photo. Complex error metrics may figure out fake noise or real noise.

In this paper, they present a way of use RGB buffer to estimate per pixel error. (Although I think it’s a CV field problem).

And we can get an approaching result through OIDN, we can get another way to calculate error metric.

\[e_p = \dfrac{\left|I^r_p - A^r_p\right| + \left|I^g_p - A^g_p\right| + \left|I^b_p - A^b_p\right|}{\sqrt{I^r_p + I^g_p + I^b_p}}\]It’s based on progressive sampling. If the error of a block is large, break it. $A$ is the previous image.

The idea of breaking the block is interesting. Can the block be integrated into something like… general AABB or KD-Tree block?

All right, it’s a render based approach, we cannot use it to determine if its an ACG picture :(

PBRT applies an even more simple way, pre-sample every pixel to get the expecting result, measure the error through this result.

I’ll implement these algorithms later in my homework, so this blog is not finished yet.