Skip to content

Commit

Permalink
diff example for glass surface
Browse files Browse the repository at this point in the history
  • Loading branch information
W-Solaris committed Dec 10, 2023
1 parent 10889ed commit 17dc35b
Show file tree
Hide file tree
Showing 23 changed files with 365 additions and 298 deletions.
Binary file modified cbox-diff/renders/cbox-diff.exr
Binary file not shown.
Binary file modified cbox-diff/renders/cbox-ref.exr
Binary file not shown.
202 changes: 202 additions & 0 deletions cbox-diff/scenes/cbox-diff/cbox-diff-glass.luisa
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
// mat_cbox

Surface cbox-glass-tall : Glass {
Kr : Constant {
v { 1.0, 1.0, 1.0 }
requires_grad { true }
range { 0.00001, 0.99999 }
}
Kt : Constant {
v { 1.0, 1.0, 1.0 }
requires_grad { true }
range { 0.00001, 0.99999 }
}
eta : Constant {
v { 1.5 }
}
roughness : Constant {
v { 0.001 }
requires_grad { true }
range { 0.00001, 0.99999 }
}
}

Surface cbox-glass-short : Glass {
Kr : Constant {
v { 1.0, 0.976, 0.403 }
//v { 1.0, 1.0, 1.0 }
//requires_grad { true }
//range { 0.00001, 0.99999 }
}
Kt : Constant {
v { 0.972, 1.0, 0.745}
//v { 1.0, 1.0, 1.0 }
//requires_grad { true }
//range { 0.00001, 0.99999 }
}
eta : Constant {
v { 1.5 }
}
roughness : Constant {
v { 0.005 }
//v { 0.001 }
//requires_grad { true }
//range { 0.00001, 0.99999 }
}
}

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 }
}
}

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

Surface cbox-white-2 : Matte {
Kd : Constant {
v { 0.725, 0.71, 0.68 }
//v { 0.3, 0.3, 0.9 }
//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 }
}
}

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 }
}
}

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

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

Shape cbox-left-wall : Mesh {
file { "../../meshes/cbox-parts/left-wall.obj" }
surface { @cbox-red }
}

Shape cbox-right-wall : Mesh {
file { "../../meshes/cbox-parts/right-wall.obj" }
surface { @cbox-green }
}

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


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-glass-tall }
}

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


Shape cbox : Group {
shapes {
@cbox-left-wall,
@cbox-ceiling,
@cbox-floor,
@cbox-right-wall,
@cbox-back-wall,
@cbox-tall-box,
@cbox-short-box,
@cbox-light
}
}

Film film : Color {
resolution { 1024 }
exposure { 0 }
}

FIlm display : Display {
base { @film }
}

Camera camera : Pinhole {
position { 0.0, 1.0, 5.0 }
fov { 27.8 }
spp { 64 }
film { @display }
file { "../../renders/cbox-diff.exr" }
filter : Gaussian {
radius { 1 }
}
target : Image {
file { "../../renders/cbox-ref.exr" }
}
}

//Integrator pt : MegaRadiativeDiff {
Integrator pt : MegaReplayDiff {
sampler : Independent {}
depth { 10 }
rr_depth { 5 }

display_camera_index { 0 }
save_process { true }
loss : L2 {}
iterations { 100 }

optimizer : Adam {
learning_rate { 0.006 }
}
}

render {
spectrum : sRGB {}
cameras {
@camera
}
shapes {
@cbox
}
integrator { @pt }
}
143 changes: 143 additions & 0 deletions cbox-diff/scenes/cbox-diff/cbox-ref-glass.luisa
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
// mat_cbox

Surface cbox-glass-tall : Glass {
Kr : Constant {
v { 1.0, 0.243, 1.0 }
}
Kt : Constant {
v { 1.0, 0.525, 0.854}
}
eta : Constant {
v { 1.5 }
}
roughness : Constant {
v { 0.1 }
}
}

Surface cbox-glass-short : Glass {
Kr : Constant {
v { 1.0, 0.976, 0.403 }
}
Kt : Constant {
v { 0.972, 1.0, 0.745}
}
eta : Constant {
v { 1.5 }
}
roughness : Constant {
v { 0.005 }
}
}

Surface cbox-white : Matte {
Kd : Constant {
v { 0.725, 0.71, 0.68 }
}
}


Surface cbox-green : Matte {
Kd : Constant {
v { 0.14, 0.45, 0.091 }
}
}

Surface cbox-red : Matte {
Kd : Constant {
v { 0.63, 0.065, 0.05 }
}
}

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

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

Shape cbox-left-wall : Mesh {
file { "../../meshes/cbox-parts/left-wall.obj" }
surface { @cbox-red }
}

Shape cbox-right-wall : Mesh {
file { "../../meshes/cbox-parts/right-wall.obj" }
surface { @cbox-green }
}

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


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

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

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


Shape cbox : Group {
shapes {
@cbox-floor,
@cbox-ceiling,
@cbox-left-wall,
@cbox-right-wall,
@cbox-back-wall,
@cbox-tall-box,
@cbox-short-box,
@cbox-light
}
}

Film film : Color {
resolution { 1024 }
exposure { 0 }
}

Camera camera : Pinhole {
position { 0.0, 1.0, 5.0 }
fov { 27.8 }
spp { 64 }
film { @film }
file { "../../renders/cbox-ref.exr" }
filter : Gaussian {
radius { 1 }
}
}

Integrator pt : MegaPath {
sampler : Independent {}
depth { 10 }
rr_depth { 5 }
}

render {
spectrum : sRGB {}
cameras {
@camera
}
shapes {
@cbox
}
integrator { @pt }
}
File renamed without changes.
Binary file removed cbox/cbox.exr
Binary file not shown.
Loading

0 comments on commit 17dc35b

Please sign in to comment.