Skip to content
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

Differentiable Mipmap #599

Draft
wants to merge 33 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a8b350d
mipmap constructor
Feb 25, 2023
d2a2701
eval_1
Feb 26, 2023
477a96d
running mipmap for 1 channel
Feb 27, 2023
3fa88b7
test with ray differential
Feb 27, 2023
0d1a660
minor change
ziyi-zhang Feb 27, 2023
19f0df2
working mipmap under vector mode
Feb 27, 2023
0503de4
merge
Feb 27, 2023
202c7df
optimize eval level
Feb 28, 2023
baf8a79
test with pbrt
Feb 28, 2023
bf47cfb
trilinear sanity check
Mar 2, 2023
f81e67f
box and max(duv_dxy) seems to be better
Mar 2, 2023
20be5f4
spp=8 with pbrt
Mar 2, 2023
c5a92cc
mipmap ewa
Mar 8, 2023
78cb540
use pbrt way to calculate radius
Mar 9, 2023
337046e
working but slow ewa
Mar 13, 2023
16e265d
tensor downsampling
Mar 17, 2023
1aabb65
working differentiable trilinear
Mar 17, 2023
9032a10
trying to grad_replace ewa
Mar 17, 2023
b9511d9
2D mipmap without implementing query
Mar 20, 2023
c376564
back to array of textures
Mar 21, 2023
dd7be27
failing vcall
Mar 21, 2023
dc03a18
compiled texture vcall
Mar 22, 2023
282b251
working mipmap with vcall, but failed with ad
Mar 22, 2023
aa9bbc4
failing backward vcall
Mar 23, 2023
d05a311
change template
Mar 23, 2023
0f32c4e
working vcall ewa and trilinear
Mar 24, 2023
127b6b2
working 3 channel
Mar 24, 2023
26f912c
working 3 channel ewa
Mar 28, 2023
9c03f17
add interpolate_spectral
Mar 28, 2023
49edec3
no spectral support for mipmap; add clamp to downsampling
Mar 30, 2023
624b7fa
fix evalEWA3 bug
Mar 31, 2023
470b51b
working mipmap and replace_grad ewa
Jun 27, 2023
c152f39
Merge branch 'master' into mip
Axiwa Jun 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/mitsuba/core/ray.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ struct RayDifferential : Ray<Point_, Spectrum_> {
void scale_differential(Float amount) {
o_x = dr::fmadd(o_x - o, amount, o);
o_y = dr::fmadd(o_y - o, amount, o);
d_x = dr::fmadd(d_x - d, amount, d);
d_y = dr::fmadd(d_y - d, amount, d);
d_x = dr::normalize(dr::fmadd(d_x - d, amount, d));
d_y = dr::normalize(dr::fmadd(d_y - d, amount, d));
}

DRJIT_STRUCT(RayDifferential, o, d, maxt, time,
Expand Down
11 changes: 6 additions & 5 deletions include/mitsuba/render/bsdf.h
Original file line number Diff line number Diff line change
Expand Up @@ -572,12 +572,13 @@ typename SurfaceInteraction<Float, Spectrum>::BSDFPtr SurfaceInteraction<Float,

/// TODO: revisit the 'false' default for autodiff mode once there are actually BRDFs using
/// differentials
if constexpr (!dr::is_diff_v<Float>) {
if (!has_uv_partials() && dr::any(bsdf->needs_differentials()))
// if constexpr (!dr::is_diff_v<Float>) {
if (dr::any_or<true>(bsdf->needs_differentials())){
compute_uv_partials(ray);
} else {
DRJIT_MARK_USED(ray);
}
}
// } else {
// DRJIT_MARK_USED(ray);
// }

return bsdf;
}
Expand Down
Binary file added notebook/figures/check16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions notebook/figures/meshes/Plane-v4.pbrt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Converted from "Plane.obj" by obj2pbrt
# Scene bounds: (-25.000000, 0.000000, -52.500000) - (25.000000, 0.000000, 2.500000)
# Name "Plane"

AttributeBegin
# Material unspecified in OBJ file
Shape "trianglemesh"
"point2 uv" [ 0 0 1 1 0 1 1 0
]
"integer indices" [ 0 1 2 0 3 1 ]
"normal N" [ 0 1 0 0 1 0 0 1 0 0 1 0 ]
"point3 P" [ 25 0 2.5 -25 0 -52.5 -25 0 2.5 25 0 -52.5 ]
AttributeEnd
15 changes: 15 additions & 0 deletions notebook/figures/meshes/Plane.obj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Blender v3.5.0 Alpha OBJ File: 'plane.blend'
# www.blender.org
o Plane
v -25.000000 0.000000 2.500000
v 25.000000 0.000000 2.500000
v -25.000000 0.000000 -52.500000
v 25.000000 0.000000 -52.500000
vt 1.000000 0.000000
vt 0.000000 1.000000
vt 0.000000 0.000000
vt 1.000000 1.000000
vn 0.0000 1.0000 0.0000
s off
f 2/1/1 3/2/1 1/3/1
f 2/1/1 4/4/1 3/2/1
34 changes: 34 additions & 0 deletions notebook/figures/meshes/Plane.pbrt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Converted from "Plane.obj" by obj2pbrt
# Scene bounds: (-25.000000, 0.000000, -52.500000) - (25.000000, 0.000000, 2.500000)


# Name "Plane"
AttributeBegin
# Material unspecified in OBJ file
Shape "trianglemesh"
"point3 P" [
25 0 2.5
-25 0 -52.5
-25 0 2.5
25 0 -52.5
]
"normal N" [
0 1 0
0 1 0
0 1 0
0 1 0
]
"point2 st" [
0 0
1 1
0 1
1 0
]
"integer indices" [
0 1 2
0 3 1
]

AttributeEnd


Binary file added notebook/figures/mi_r.exr
Binary file not shown.
Binary file added notebook/figures/mi_ref.exr
Binary file not shown.
Binary file added notebook/figures/rcheck16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading