fix: Improve video realism by using Forest HDRI envmap (same as UNLOCKED)
Browse files
app.py
CHANGED
|
@@ -202,7 +202,7 @@ def image_to_3d(
|
|
| 202 |
|
| 203 |
# --- Render Video Preview (8 seconds at 15fps = 120 frames) ---
|
| 204 |
render_result = render_utils.render_video(mesh, num_frames=120, resolution=720, envmap=envmap, verbose=False)
|
| 205 |
-
video = render_result
|
| 206 |
|
| 207 |
download_video = os.path.join(user_dir, 'sample.mp4')
|
| 208 |
imageio.mimsave(download_video, video, fps=15, pixelformat='yuv420p')
|
|
@@ -417,10 +417,21 @@ if __name__ == "__main__":
|
|
| 417 |
pipeline.cuda()
|
| 418 |
|
| 419 |
# Load HDRI envmap for beautiful lighting
|
| 420 |
-
envmap
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 424 |
|
| 425 |
demo.launch()
|
| 426 |
|
|
|
|
| 202 |
|
| 203 |
# --- Render Video Preview (8 seconds at 15fps = 120 frames) ---
|
| 204 |
render_result = render_utils.render_video(mesh, num_frames=120, resolution=720, envmap=envmap, verbose=False)
|
| 205 |
+
video = render_result.get('shaded_forest', render_result.get('shaded'))
|
| 206 |
|
| 207 |
download_video = os.path.join(user_dir, 'sample.mp4')
|
| 208 |
imageio.mimsave(download_video, video, fps=15, pixelformat='yuv420p')
|
|
|
|
| 417 |
pipeline.cuda()
|
| 418 |
|
| 419 |
# Load HDRI envmap for beautiful lighting
|
| 420 |
+
# Load HDRI envmap for beautiful lighting
|
| 421 |
+
envmap = {
|
| 422 |
+
'forest': EnvMap(torch.tensor(
|
| 423 |
+
cv2.cvtColor(cv2.imread('assets/hdri/forest.exr', cv2.IMREAD_UNCHANGED), cv2.COLOR_BGR2RGB),
|
| 424 |
+
dtype=torch.float32, device='cuda'
|
| 425 |
+
)),
|
| 426 |
+
'sunset': EnvMap(torch.tensor(
|
| 427 |
+
cv2.cvtColor(cv2.imread('assets/hdri/sunset.exr', cv2.IMREAD_UNCHANGED), cv2.COLOR_BGR2RGB),
|
| 428 |
+
dtype=torch.float32, device='cuda'
|
| 429 |
+
)),
|
| 430 |
+
'courtyard': EnvMap(torch.tensor(
|
| 431 |
+
cv2.cvtColor(cv2.imread('assets/hdri/courtyard.exr', cv2.IMREAD_UNCHANGED), cv2.COLOR_BGR2RGB),
|
| 432 |
+
dtype=torch.float32, device='cuda'
|
| 433 |
+
)),
|
| 434 |
+
}
|
| 435 |
|
| 436 |
demo.launch()
|
| 437 |
|