Commit Β·
0d083ca
1
Parent(s): 4095016
update
Browse files
models/DiMeR/models/DiMeR.py
CHANGED
|
@@ -83,6 +83,7 @@ class DiMeR(nn.Module):
|
|
| 83 |
samples_per_ray=rendering_samples_per_ray,
|
| 84 |
use_deformation_weight=use_deformation_weight,
|
| 85 |
)
|
|
|
|
| 86 |
@spaces.GPU
|
| 87 |
def init_flexicubes_geometry(self, device, fovy=50.0):
|
| 88 |
camera = PerspectiveCamera(fovy=fovy, device=device)
|
|
|
|
| 83 |
samples_per_ray=rendering_samples_per_ray,
|
| 84 |
use_deformation_weight=use_deformation_weight,
|
| 85 |
)
|
| 86 |
+
|
| 87 |
@spaces.GPU
|
| 88 |
def init_flexicubes_geometry(self, device, fovy=50.0):
|
| 89 |
camera = PerspectiveCamera(fovy=fovy, device=device)
|
models/DiMeR/models/geometry/render/neural_render.py
CHANGED
|
@@ -7,6 +7,7 @@
|
|
| 7 |
# license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited.
|
| 8 |
|
| 9 |
import torch
|
|
|
|
| 10 |
import torch.nn.functional as F
|
| 11 |
import nvdiffrast.torch as dr
|
| 12 |
from . import Renderer
|
|
@@ -146,6 +147,7 @@ class NeuralRender(Renderer):
|
|
| 146 |
# - Single light
|
| 147 |
# - Single material
|
| 148 |
# ==============================================================================================
|
|
|
|
| 149 |
def render_layer(
|
| 150 |
self,
|
| 151 |
rast,
|
|
@@ -189,6 +191,7 @@ class NeuralRender(Renderer):
|
|
| 189 |
|
| 190 |
return gb_pos, gb_normal
|
| 191 |
|
|
|
|
| 192 |
def render_mesh(
|
| 193 |
self,
|
| 194 |
mesh_v_pos_bxnx3,
|
|
@@ -245,6 +248,7 @@ class NeuralRender(Renderer):
|
|
| 245 |
# normal = torch.lerp(torch.zeros_like(normal), (normal + 1.0) / 2.0, hard_mask.float()) # black background
|
| 246 |
return ori_mesh_feature, antialias_mask, hard_mask, rast, v_pos_clip, mask_pyramid, depth, normal, gb_normal
|
| 247 |
|
|
|
|
| 248 |
def render_mesh_light(
|
| 249 |
self,
|
| 250 |
mesh_v_pos_bxnx3,
|
|
|
|
| 7 |
# license agreement from NVIDIA CORPORATION & AFFILIATES is strictly prohibited.
|
| 8 |
|
| 9 |
import torch
|
| 10 |
+
import spaces
|
| 11 |
import torch.nn.functional as F
|
| 12 |
import nvdiffrast.torch as dr
|
| 13 |
from . import Renderer
|
|
|
|
| 147 |
# - Single light
|
| 148 |
# - Single material
|
| 149 |
# ==============================================================================================
|
| 150 |
+
@spaces.GPU
|
| 151 |
def render_layer(
|
| 152 |
self,
|
| 153 |
rast,
|
|
|
|
| 191 |
|
| 192 |
return gb_pos, gb_normal
|
| 193 |
|
| 194 |
+
@spaces.GPU
|
| 195 |
def render_mesh(
|
| 196 |
self,
|
| 197 |
mesh_v_pos_bxnx3,
|
|
|
|
| 248 |
# normal = torch.lerp(torch.zeros_like(normal), (normal + 1.0) / 2.0, hard_mask.float()) # black background
|
| 249 |
return ori_mesh_feature, antialias_mask, hard_mask, rast, v_pos_clip, mask_pyramid, depth, normal, gb_normal
|
| 250 |
|
| 251 |
+
@spaces.GPU
|
| 252 |
def render_mesh_light(
|
| 253 |
self,
|
| 254 |
mesh_v_pos_bxnx3,
|