Spaces:
Running
on
L40S
Running
on
L40S
Upload ./svrm/ldm/models/svrm.py with huggingface_hub
Browse files- svrm/ldm/models/svrm.py +3 -4
svrm/ldm/models/svrm.py
CHANGED
|
@@ -209,12 +209,11 @@ class SVRMModel(torch.nn.Module):
|
|
| 209 |
vtx_colors = self.render.forward_points(cur_triplane, torch.tensor(vtx_refine).unsqueeze(0).to(**here))
|
| 210 |
vtx_colors = vtx_colors['rgb'].float().squeeze(0).cpu().numpy()
|
| 211 |
|
| 212 |
-
|
| 213 |
with open(obj_vertext_path, 'w') as fid:
|
| 214 |
verts = vtx_refine[:, [1,2,0]]
|
| 215 |
for pidx, pp in enumerate(verts):
|
| 216 |
color = vtx_colors[pidx]
|
| 217 |
-
color = [color[0]**color_ratio, color[1]**color_ratio, color[2]**color_ratio]
|
| 218 |
fid.write('v %f %f %f %f %f %f\n' % (pp[0], pp[1], pp[2], color[0], color[1], color[2]))
|
| 219 |
for i, f in enumerate(faces_refine):
|
| 220 |
f1 = f + 1
|
|
@@ -261,7 +260,7 @@ class SVRMModel(torch.nn.Module):
|
|
| 261 |
tex_map = tex_map.float().squeeze(0) # (0, 1)
|
| 262 |
tex_map = tex_map.view((texture_res, texture_res, 3))
|
| 263 |
img = uv_padding(tex_map, hole_mask)
|
| 264 |
-
img = ((img/255.0) **
|
| 265 |
img = img.clip(0, 255).astype(np.uint8)
|
| 266 |
|
| 267 |
verts = vtx_refine.cpu().numpy()[:, [1,2,0]]
|
|
@@ -271,7 +270,7 @@ class SVRMModel(torch.nn.Module):
|
|
| 271 |
fid.write('newmtl material_0\n')
|
| 272 |
fid.write("Ka 1.000 1.000 1.000\n")
|
| 273 |
fid.write("Kd 1.000 1.000 1.000\n")
|
| 274 |
-
fid.write("Ks 0.
|
| 275 |
fid.write("d 1.0\n")
|
| 276 |
fid.write("illum 2\n")
|
| 277 |
fid.write(f'map_Kd texture.png\n')
|
|
|
|
| 209 |
vtx_colors = self.render.forward_points(cur_triplane, torch.tensor(vtx_refine).unsqueeze(0).to(**here))
|
| 210 |
vtx_colors = vtx_colors['rgb'].float().squeeze(0).cpu().numpy()
|
| 211 |
|
| 212 |
+
|
| 213 |
with open(obj_vertext_path, 'w') as fid:
|
| 214 |
verts = vtx_refine[:, [1,2,0]]
|
| 215 |
for pidx, pp in enumerate(verts):
|
| 216 |
color = vtx_colors[pidx]
|
|
|
|
| 217 |
fid.write('v %f %f %f %f %f %f\n' % (pp[0], pp[1], pp[2], color[0], color[1], color[2]))
|
| 218 |
for i, f in enumerate(faces_refine):
|
| 219 |
f1 = f + 1
|
|
|
|
| 260 |
tex_map = tex_map.float().squeeze(0) # (0, 1)
|
| 261 |
tex_map = tex_map.view((texture_res, texture_res, 3))
|
| 262 |
img = uv_padding(tex_map, hole_mask)
|
| 263 |
+
img = ((img/255.0) ** 0.8) * 255 # increase brightness
|
| 264 |
img = img.clip(0, 255).astype(np.uint8)
|
| 265 |
|
| 266 |
verts = vtx_refine.cpu().numpy()[:, [1,2,0]]
|
|
|
|
| 270 |
fid.write('newmtl material_0\n')
|
| 271 |
fid.write("Ka 1.000 1.000 1.000\n")
|
| 272 |
fid.write("Kd 1.000 1.000 1.000\n")
|
| 273 |
+
fid.write("Ks 0.000 0.000 0.000\n")
|
| 274 |
fid.write("d 1.0\n")
|
| 275 |
fid.write("illum 2\n")
|
| 276 |
fid.write(f'map_Kd texture.png\n')
|