mmp / pbrt-v4

Source code to pbrt, the ray tracer described in the forthcoming 4th edition of the "Physically Based Rendering: From Theory to Implementation" book.
https://pbrt.org
Apache License 2.0
2.81k stars 431 forks source link

Sampler stratified what produces the noise ? #267

Closed SkybuckFlying closed 2 years ago

SkybuckFlying commented 2 years ago

Sampler "stratified" "bool jitter" [false] "integer xsamples" [1] "integer ysamples" [1]

This setup above uses one ray per pixel I think, through the center according to the documentation. On some renders it looks good, probably simple scenes, but most scenes I have tested there is still lots of noise in the image.

What causes the noise ?

shadeops commented 2 years ago

What causes the noise can be very big topic depending on how much you want to learn about the noise and sampling.

My recommend would be to first start getting more familiar with pathtracing in general. Depending on your goals and how much background knowledge you already have you can start with the basic with things like Disney's Practical Guide to Path Tracing or the various DCC's help which explain some of the core concepts from a user's standpoint, for example Houdini's Sampling and Noise

If you want to interact with pathtracing as a developer I would suggest starting with the Ray Tracing in One Weekend Series. You'll start producing images right away and slowly add functionality as you work through the examples. This way you can experience first hand some the issues that arise with pathtracing.

When you want to go deeper and dig into the theory, math and code of pathtracing, then it is time to checkout Physically Based Rendering, (which is what this code base represents).

For general questions about pathtracing Github Issues might not be the best format because of the limited audience and slightly off-topic nature as they don't pertain to issues with the source code. A better format might be the The Raytracing Sub-Reddit or The Graphics Programming Discord

SkybuckFlying commented 2 years ago

The image quality of PBRT is very low with only 1 sample. It seems there is a difference between 1 sample per pixel and 1 sample per ray and such.

I think ray tracers could be compared quality wise by limiting the number of samples to 1 per pixel or 1 per ray.

This may show some numerical issues. I suspect PBRT may have some big numerical issues based on the low image quality.

Video two, produces a better picture than PBRT:

https://www.sidefx.com/docs/houdini/render/sampling.html

Which is strange.

mmp commented 2 years ago

That comparison doesn't really make sense for a number of reasons. Also, feel free to use Houdini's renderer instead.

In any case, @shadeops is right; these are not pbrt bugs and please stop filing pbrt issues as a way to learn how rendering works. I encourage studying the area more carefully.

SkybuckFlying commented 2 years ago

Which integrator would give the best image quality results for 1 sample per pixel or per ray ?

SkybuckFlying commented 2 years ago

Why would it not make sense ? Throwing a whole bunch of rays at it would make any rayracer look better ? Especially if it does sub sampling or something and then averages it... doesn't yet mean the math is good, then again maybe it is, have not made up my mind yet... I see many gaps in the low ray count image... some of that is caused by random sampling, but why random sample if samples is 1 ? would it not make more sense to sample at center of screen pixels, and only start sampling around it if more samples are possible... ?

SkybuckFlying commented 2 years ago

I assume PBRTv4 "creates rays" from the camera into the scene and then reflects those of of objects ? Or does it work vice versa and does it collect 'photons' as they happen to hit some virtual pin hole camera ?

mmp commented 2 years ago

Please study the resources you've been pointed at. This is not the forum to learn how rendering works. Regrettably, I am going to ban you from submitting further issues here.