Skip to content

Commit be57ba8

Browse files
committed
fix(ui): restrict usage of surface rendering to JIT mode
1 parent b048ad6 commit be57ba8

File tree

1 file changed

+68
-47
lines changed

1 file changed

+68
-47
lines changed

src/testbed.cu

Lines changed: 68 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,6 @@ std::vector<vec3> Testbed::crop_box_corners(bool nerf_space) const {
731731
tlog::info() << a.x << "," << a.y << "," << a.z << " [" << i << "]";
732732
}
733733
}
734-
735734
return rv;
736735
}
737736

@@ -1124,6 +1123,7 @@ void Testbed::imgui() {
11241123
ImGui::SameLine();
11251124
ImGui::Checkbox("per-image latents", &m_nerf.training.optimize_extra_dims);
11261125

1126+
11271127
static bool export_extrinsics_in_quat_format = true;
11281128
static bool extrinsics_have_been_optimized = false;
11291129

@@ -1547,7 +1547,22 @@ void Testbed::imgui() {
15471547
}
15481548

15491549
if (m_testbed_mode == ETestbedMode::Nerf && ImGui::TreeNode("NeRF rendering options")) {
1550+
if (!jit_fusion()) {
1551+
ImGui::BeginDisabled();
1552+
if (m_nerf.surface_rendering) {
1553+
tlog::warning() << "JIT fusion is disabled, disabling surface rendering.";
1554+
}
1555+
1556+
m_nerf.surface_rendering = false;
1557+
}
1558+
15501559
ImGui::Checkbox("Surface rendering", &m_nerf.surface_rendering);
1560+
if (!jit_fusion()) {
1561+
ImGui::SameLine();
1562+
ImGui::Text("(requires JIT fusion)");
1563+
ImGui::EndDisabled();
1564+
}
1565+
15511566
if (!m_nerf.surface_rendering) {
15521567
ImGui::BeginDisabled();
15531568
}
@@ -2117,24 +2132,26 @@ void Testbed::draw_visualizations(ImDrawList* list, const mat4x3& camera_matrix)
21172132

21182133
float xyscale = (float)m_window_res[m_fov_axis];
21192134
vec2 screen_center = render_screen_center(m_screen_center);
2120-
mat4 view2proj = transpose(mat4{
2121-
xyscale,
2122-
0.0f,
2123-
(float)m_window_res.x * screen_center.x * zscale,
2124-
0.0f,
2125-
0.0f,
2126-
xyscale,
2127-
(float)m_window_res.y * screen_center.y * zscale,
2128-
0.0f,
2129-
0.0f,
2130-
0.0f,
2131-
1.0f,
2132-
0.0f,
2133-
0.0f,
2134-
0.0f,
2135-
zscale,
2136-
0.0f,
2137-
});
2135+
mat4 view2proj = transpose(
2136+
mat4{
2137+
xyscale,
2138+
0.0f,
2139+
(float)m_window_res.x * screen_center.x * zscale,
2140+
0.0f,
2141+
0.0f,
2142+
xyscale,
2143+
(float)m_window_res.y * screen_center.y * zscale,
2144+
0.0f,
2145+
0.0f,
2146+
0.0f,
2147+
1.0f,
2148+
0.0f,
2149+
0.0f,
2150+
0.0f,
2151+
zscale,
2152+
0.0f,
2153+
}
2154+
);
21382155

21392156
mat4 world2proj = view2proj * world2view;
21402157
float aspect = (float)m_window_res.x / (float)m_window_res.y;
@@ -2161,24 +2178,26 @@ void Testbed::draw_visualizations(ImDrawList* list, const mat4x3& camera_matrix)
21612178
float fly = focal.y;
21622179
float zfar = m_ndc_zfar;
21632180
float znear = m_ndc_znear;
2164-
mat4 view2proj_guizmo = transpose(mat4{
2165-
fly * 2.0f / aspect,
2166-
0.0f,
2167-
0.0f,
2168-
0.0f,
2169-
0.0f,
2170-
-fly * 2.f,
2171-
0.0f,
2172-
0.0f,
2173-
0.0f,
2174-
0.0f,
2175-
(zfar + znear) / (zfar - znear),
2176-
-(2.0f * zfar * znear) / (zfar - znear),
2177-
0.0f,
2178-
0.0f,
2179-
1.0f,
2180-
0.0f,
2181-
});
2181+
mat4 view2proj_guizmo = transpose(
2182+
mat4{
2183+
fly * 2.0f / aspect,
2184+
0.0f,
2185+
0.0f,
2186+
0.0f,
2187+
0.0f,
2188+
-fly * 2.f,
2189+
0.0f,
2190+
0.0f,
2191+
0.0f,
2192+
0.0f,
2193+
(zfar + znear) / (zfar - znear),
2194+
-(2.0f * zfar * znear) / (zfar - znear),
2195+
0.0f,
2196+
0.0f,
2197+
1.0f,
2198+
0.0f,
2199+
}
2200+
);
21822201

21832202
ImGuizmo::SetRect(0, 0, io.DisplaySize.x, io.DisplaySize.y);
21842203

@@ -4260,16 +4279,18 @@ void Testbed::reset_network(bool clear_density_grid) {
42604279

42614280
// Instantiate an additional model for each auxiliary GPU
42624281
for (auto& device : m_devices) {
4263-
device.set_nerf_network(std::make_shared<NerfNetwork<network_precision_t>>(
4264-
dims.n_pos,
4265-
n_dir_dims,
4266-
n_extra_dims,
4267-
dims.n_pos + 1, // The offset of 1 comes from the dt member variable of NerfCoordinate. HACKY
4268-
encoding_config,
4269-
dir_encoding_config,
4270-
network_config,
4271-
rgb_network_config
4272-
));
4282+
device.set_nerf_network(
4283+
std::make_shared<NerfNetwork<network_precision_t>>(
4284+
dims.n_pos,
4285+
n_dir_dims,
4286+
n_extra_dims,
4287+
dims.n_pos + 1, // The offset of 1 comes from the dt member variable of NerfCoordinate. HACKY
4288+
encoding_config,
4289+
dir_encoding_config,
4290+
network_config,
4291+
rgb_network_config
4292+
)
4293+
);
42734294
}
42744295

42754296
m_network = m_nerf_network = primary_device().nerf_network();

0 commit comments

Comments
 (0)