Skip to content

Commit

Permalink
differentiable rendering from python now available
Browse files Browse the repository at this point in the history
  • Loading branch information
jkxing committed Jan 25, 2024
1 parent 13bbda3 commit 9bd86a5
Show file tree
Hide file tree
Showing 20 changed files with 1,040 additions and 628 deletions.
Binary file modified cbox-diff/renders/cbox-diff.exr
Binary file not shown.
72 changes: 13 additions & 59 deletions cbox-diff/scenes/cbox-diff/cbox-diff-matte.luisa
Original file line number Diff line number Diff line change
@@ -1,61 +1,28 @@
// mat_cbox
Surface cbox-white : Matte {
Kd : Constant {
//v { 0.725, 0.71, 0.68 }
v { 0.1, 0.1, 0.1 }
requires_grad { true }
range { 0.00001, 0.99999 }
v { 0.725, 0.71, 0.68 }
}
}

Surface cbox-white-1 : Matte {
Kd : Constant {
v { 0.2, 0.8, 0.2 }
requires_grad { true }
range { 0.00001, 0.99999 }
}
}

Surface cbox-white-2 : Matte {
Kd : Constant {
v { 0.3, 0.3, 0.9 }
requires_grad { true }
render_grad_map { true }
range { 0.00001, 0.99999 }
}
}

Surface cbox-white-3 : Matte {
Kd : Constant {
v { 0.4, 0.4, 0.4 }
requires_grad { true }
range { 0.00001, 0.99999 }
}
}

Surface cbox-white-4 : Matte {
Kd : Constant {
v { 0.5, 0.3, 0.3 }
Surface cbox-tex : Matte {
Kd : Image {
file { "picture1.jpg" }
semantic { "albedo" }
requires_grad { true }
range { 0.00001, 0.99999 }
}
}

Surface cbox-green : Matte {
Kd : Constant {
//v { 0.14, 0.45, 0.091 }
v { 0.8, 0.5, 0.1 }
requires_grad { true }
range { 0.00001, 0.99999 }
v { 0.14, 0.45, 0.091 }
}
}

Surface cbox-red : Matte {
Kd : Constant {
//v { 0.63, 0.065, 0.05 }
v { 0.9, 0.9, 0.9 }
requires_grad { true }
range { 0.00001, 0.99999 }
v { 0.63, 0.065, 0.05 }
}
}

Expand All @@ -67,7 +34,7 @@ Shape cbox-ceiling : Mesh {

Shape cbox-floor : Mesh {
file { "../../meshes/cbox-parts/floor.obj" }
surface { @cbox-white-1 }
surface { @cbox-white }
}

Shape cbox-left-wall : Mesh {
Expand All @@ -82,40 +49,28 @@ Shape cbox-right-wall : Mesh {

Shape cbox-back-wall : Mesh {
file { "../../meshes/cbox-parts/back-wall.obj" }
surface { @cbox-white-2 }
surface { @cbox-tex }
}


Shape cbox-light : Mesh {
file { "../../meshes/cbox-parts/light.obj" }
light : Diffuse {
emission : Constant {
//v { 10, 10, 10 }
v { 45.0, 45.0, 45.0 }
}
}
}

Shape cbox-tall-box : Mesh {
file { "../../meshes/cbox-parts/tall-box.obj" }
surface { @cbox-white-3 }
}

Shape cbox-short-box : Mesh {
file { "../../meshes/cbox-parts/short-box.obj" }
surface { @cbox-white-4 }
}


Shape cbox : Group {
shapes {
@cbox-left-wall,
@cbox-ceiling,
@cbox-floor,
@cbox-ceiling,
@cbox-left-wall,
@cbox-right-wall,
@cbox-back-wall,
@cbox-tall-box,
@cbox-short-box,
@cbox-light
}
}
Expand All @@ -132,8 +87,8 @@ FIlm display : Display {
Camera camera : Pinhole {
position { 0.0, 1.0, 5.0 }
fov { 27.8 }
spp { 64 }
film { @display }
spp { 16 }
film { @film }
file { "../../renders/cbox-diff.exr" }
filter : Gaussian {
radius { 1 }
Expand All @@ -143,7 +98,6 @@ Camera camera : Pinhole {
}
}

//Integrator pt : MegaRadiativeDiff {
Integrator pt : MegaReplayDiff {
sampler : Independent {}
depth { 10 }
Expand Down
23 changes: 10 additions & 13 deletions cbox-diff/scenes/cbox-diff/cbox-ref-matte.luisa
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// mat_cbox
Surface cbox-white : Matte {
Kd : Constant {
v { 0.725, 0.71, 0.68 }
Kd : Image {
file { "picture1.jpg" }
semantic { "albedo" }
}
}

Expand Down Expand Up @@ -53,15 +54,6 @@ Shape cbox-light : Mesh {
}
}

Shape cbox-tall-box : Mesh {
file { "../../meshes/cbox-parts/tall-box.obj" }
surface { @cbox-white }
}

Shape cbox-short-box : Mesh {
file { "../../meshes/cbox-parts/short-box.obj" }
surface { @cbox-white }
}


Shape cbox : Group {
Expand All @@ -71,8 +63,6 @@ Shape cbox : Group {
@cbox-left-wall,
@cbox-right-wall,
@cbox-back-wall,
@cbox-tall-box,
@cbox-short-box,
@cbox-light
}
}
Expand All @@ -82,6 +72,11 @@ Film film : Color {
exposure { 0 }
}

FIlm display : Display {
base { @film }
}


Camera camera : Pinhole {
position { 0.0, 1.0, 5.0 }
fov { 27.8 }
Expand All @@ -97,6 +92,8 @@ Integrator pt : MegaPath {
sampler : Independent {}
depth { 10 }
rr_depth { 5 }

display_camera_index { 0 }
}

render {
Expand Down
Binary file added cbox-diff/scenes/cbox-diff/picture1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ license = { file = "LICENSE" }
[tool.scikit-build]
cmake.minimum-version = "3.18"
cmake.build-type = "Release"
cmake.args = ["-GNinja","-Wno-dev"]
cmake.args = ["-GNinja"]
sdist.reproducible = false
wheel.expand-macos-universal-tags = true
wheel.packages = []
build-dir = "build/{wheel_tag}"
build-dir = "build/{wheel_tag}-ninja"

[project.optional-dependencies]
test = ["pytest"]
Expand Down
Loading

0 comments on commit 9bd86a5

Please sign in to comment.