New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement SubsurfaceMaterial #84

Closed
wahn opened this Issue Dec 28, 2018 · 4 comments

Comments

Projects
None yet
1 participant
@wahn
Copy link
Owner

wahn commented Dec 28, 2018

This is how the C++ code renders subsurface scattering:

> cd ~/Graphics/Rendering/PBRT/pbrt-v3-scenes/subsurface
> ~/builds/pbrt/release/pbrt f15-7.pbrt

f15-7

We have to implement the Rust counterpart:

> pwd
/mill3d/users/jan/Graphics/Rendering/PBRT/pbrt-v3-scenes/sssdragon
> rg subsurface
dragon_250.pbrt
26:    Material "subsurface" 

f15-7.pbrt
25:    Material "subsurface" 

dragon_10.pbrt
26:    Material "subsurface" 

dragon_50.pbrt
26:    Material "subsurface" 

@wahn wahn added the enhancement label Dec 28, 2018

@wahn wahn self-assigned this Dec 28, 2018

@wahn

This comment has been minimized.

Copy link
Owner Author

wahn commented Dec 28, 2018

Don't forget to execute the last loop in compute_beam_diffusion_bssrdf() in parallel:

pub fn compute_beam_diffusion_bssrdf(g: Float, eta: Float, t: &mut BSSRDFTable) {
...
    // ParallelFor([&](int i) {
    for i in 0..t.n_rho_samples as usize {
           // TODO: execute in parallel
...
    }
    // }, t.n_rho_samples);
}
@wahn

This comment has been minimized.

Copy link
Owner Author

wahn commented Jan 11, 2019

This is how Rust renders the same scene (after commit b9c343a):

pbrt_50pc

I reduced the pixelsamples to 16, but there is something going wrong which needs debugging.

@wahn

This comment has been minimized.

Copy link
Owner Author

wahn commented Jan 14, 2019

I think I found the bug. The wrong BSDF pointer was used to call bsdf.sample_f(). After commit 63516c2 we get:

pbrt

That still used only 16 pixelsamples, so lets render the full 8192 samples and compare vs. the C++ version, before closing the issue.

@wahn

This comment has been minimized.

Copy link
Owner Author

wahn commented Jan 15, 2019

There is no difference between the images render by C++ vs. Rust:

sss_dragon

> imf_diff sss_dragon.png ~/Graphics/Rendering/PBRT/pbrt-v3-scenes/sssdragon/f15-7.png
sss_dragon.png /usr/people/jan/Graphics/Rendering/PBRT/pbrt-v3-scenes/sssdragon/f15-7.png: no differences.
== "sss_dragon.png" and "/usr/people/jan/Graphics/Rendering/PBRT/pbrt-v3-scenes/sssdragon/f15-7.png" are identical

Closing the issue ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment