Skip to content

Commit 215dfd3

Browse files
committed
use better realization for lod rendering
1 parent 90145d5 commit 215dfd3

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

render_large_lod.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def load_gaussians(lp, iteration=30_000, load_vq=False, device='cuda'):
3838
scene = LargeScene(lp, gaussians, load_iteration=iteration, load_vq=load_vq, shuffle=False)
3939
return gaussians, scene
4040

41-
def render_set(model_path, name, iteration, views, model, max_sh_degree, pipeline, background):
41+
def render_set(lp, model_path, name, iteration, views, model, max_sh_degree, pipeline, background):
4242
avg_render_time = 0
4343
max_render_time = 0
4444
avg_memory = 0
@@ -88,21 +88,22 @@ def render_set(model_path, name, iteration, views, model, max_sh_degree, pipelin
8888
def render_sets(dataset : ModelParams, iteration : int, pipeline : PipelineParams, load_vq : bool, skip_train : bool, skip_test : bool, custom_test : bool):
8989

9090
with torch.no_grad():
91+
if dataset.aabb is None:
92+
import numpy as np
93+
dataset.aabb = np.load(os.path.join(dataset.source_path, "data_partitions", f"{dataset.partition_name}_aabb.npy")).tolist()
94+
print(f"Use default AABB of {[round(x, 2) for x in dataset.aabb]}")
95+
9196
if custom_test:
9297
dataset.source_path = custom_test
9398
filename = os.path.basename(dataset.source_path)
9499

95100
lod_gs_list = []
96101
org_model_path = dataset.model_path
97102
for i in range(len(dataset.lod_configs)):
98-
lp.model_path = dataset.lod_configs[i]
99-
lod_gs, scene = load_gaussians(lp, iteration, load_vq)
100-
print(f"Init LoD {len(dataset.lod_configs)-i} with {lod_gs.get_xyz.shape[0]} points from {lp.model_path}")
101-
if lp.aabb is None:
102-
lp.aabb = get_default_aabb(lp, scene.getTrainCameras(), lod_gs.get_xyz, scale=1.0)
103-
aabb_list = [round(x, 2) for x in lp.aabb.data.cpu().numpy().tolist()]
104-
print(f"Use default AABB of {aabb_list}")
105-
lod_gs = BlockedGaussian(lod_gs, lp, compute_cov3D_python=pp.compute_cov3D_python)
103+
dataset.model_path = dataset.lod_configs[i]
104+
lod_gs, scene = load_gaussians(dataset, iteration, load_vq)
105+
print(f"Init LoD {len(dataset.lod_configs)-i} with {lod_gs.get_xyz.shape[0]} points from {dataset.model_path}")
106+
lod_gs = BlockedGaussian(lod_gs, dataset, compute_cov3D_python=pp.compute_cov3D_python)
106107
lod_gs_list.append(lod_gs)
107108
dataset.model_path = org_model_path
108109

@@ -115,7 +116,7 @@ def render_sets(dataset : ModelParams, iteration : int, pipeline : PipelineParam
115116

116117
if custom_test:
117118
views = train_cams + test_cams
118-
render_set(dataset.model_path, filename, loaded_iter, views, lod_gs_list, max_sh_degree, pipeline, background)
119+
render_set(dataset, dataset.model_path, filename, loaded_iter, views, lod_gs_list, max_sh_degree, pipeline, background)
119120
print("Skip both train and test, render all views")
120121
else:
121122
if not skip_train:

0 commit comments

Comments
 (0)