Rawal Khirodkar commited on
Commit
7fe52e0
·
1 Parent(s): 5743b44

Pointmap: bump icosphere subdiv to 1 (smooth balls); cut max_points to 25K to balance GLB size

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -236,7 +236,7 @@ def _triangulate_grid(pointmap_hwc: np.ndarray, mask_hw: np.ndarray,
236
 
237
 
238
  def _make_glb(image_pil_texture: Image.Image, pointmap_hwc: np.ndarray,
239
- mask_hw: np.ndarray, max_points: int = 60_000) -> str:
240
  """Render the pointmap as a cloud of tiny coloured spheres (one per pixel).
241
 
242
  Avoids triangulation artifacts entirely — there's no surface mesh between
@@ -273,10 +273,10 @@ def _make_glb(image_pil_texture: Image.Image, pointmap_hwc: np.ndarray,
273
  extent = float(np.ptp(pts, axis=0).max()) if len(pts) else 1.0
274
  radius = max(extent / max(np.cbrt(len(pts)), 1.0) * 0.7, 1e-4)
275
 
276
- # Icosphere template (subdivisions=012 verts, 20 faces — light per instance).
277
- sphere = trimesh.creation.icosphere(subdivisions=0, radius=radius)
278
- sv = sphere.vertices.astype(np.float32) # (V=12, 3)
279
- sf = sphere.faces.astype(np.int64) # (F=20, 3)
280
  V, F = len(sv), len(sf)
281
  N = len(pts)
282
 
 
236
 
237
 
238
  def _make_glb(image_pil_texture: Image.Image, pointmap_hwc: np.ndarray,
239
+ mask_hw: np.ndarray, max_points: int = 25_000) -> str:
240
  """Render the pointmap as a cloud of tiny coloured spheres (one per pixel).
241
 
242
  Avoids triangulation artifacts entirely — there's no surface mesh between
 
273
  extent = float(np.ptp(pts, axis=0).max()) if len(pts) else 1.0
274
  radius = max(extent / max(np.cbrt(len(pts)), 1.0) * 0.7, 1e-4)
275
 
276
+ # Icosphere template (subdivisions=142 verts, 80 faces — smoother balls).
277
+ sphere = trimesh.creation.icosphere(subdivisions=1, radius=radius)
278
+ sv = sphere.vertices.astype(np.float32) # (V=42, 3)
279
+ sf = sphere.faces.astype(np.int64) # (F=80, 3)
280
  V, F = len(sv), len(sf)
281
  N = len(pts)
282