arabago96 commited on
Commit
d32e384
·
1 Parent(s): 664d4f8

Restore gamma 2.2 configuration

Browse files
trellis/utils/postprocessing_utils.py CHANGED
@@ -340,7 +340,7 @@ def bake_texture(
340
  # 🔧 Apply gamma correction (Linear → sRGB)
341
  # Fixes "dark model" issue by converting from linear color space to sRGB
342
  texture_linear = texture.reshape(texture_size, texture_size, 3).cpu().numpy()
343
- texture_srgb = np.power(np.clip(texture_linear, 0, 1), 1.0/2.2) # Gamma 2.2 correction
344
  texture = np.clip(texture_srgb * 255, 0, 255).astype(np.uint8)
345
 
346
  # inpaint
@@ -394,7 +394,7 @@ def bake_texture(
394
  # 🔧 Apply gamma correction (Linear → sRGB)
395
  # Fixes "dark model" issue by converting from linear color space to sRGB
396
  texture_linear = texture[0].flip(0).detach().cpu().numpy()
397
- texture_srgb = np.power(np.clip(texture_linear, 0, 1), 1.0/2.2) # Gamma 2.2 correction
398
  texture = np.clip(texture_srgb * 255, 0, 255).astype(np.uint8)
399
  mask = 1 - utils3d.torch.rasterize_triangle_faces(
400
  rastctx, (uvs * 2 - 1)[None], faces, texture_size, texture_size
 
340
  # 🔧 Apply gamma correction (Linear → sRGB)
341
  # Fixes "dark model" issue by converting from linear color space to sRGB
342
  texture_linear = texture.reshape(texture_size, texture_size, 3).cpu().numpy()
343
+ texture_srgb = np.power(np.clip(texture_linear, 0, 1), 1.0/2.3) # Gamma 2.3 (slightly less bright than 2.2)
344
  texture = np.clip(texture_srgb * 255, 0, 255).astype(np.uint8)
345
 
346
  # inpaint
 
394
  # 🔧 Apply gamma correction (Linear → sRGB)
395
  # Fixes "dark model" issue by converting from linear color space to sRGB
396
  texture_linear = texture[0].flip(0).detach().cpu().numpy()
397
+ texture_srgb = np.power(np.clip(texture_linear, 0, 1), 1.0/2.3) # Gamma 2.3 (slightly less bright than 2.2)
398
  texture = np.clip(texture_srgb * 255, 0, 255).astype(np.uint8)
399
  mask = 1 - utils3d.torch.rasterize_triangle_faces(
400
  rastctx, (uvs * 2 - 1)[None], faces, texture_size, texture_size
trellis/utils/render_utils.py CHANGED
@@ -75,7 +75,7 @@ def render_frames(sample, extrinsics, intrinsics, options={}, colors_overwrite=N
75
  if 'depth' not in rets: rets['depth'] = []
76
  # Apply gamma correction to video frames (Linear → sRGB)
77
  color_linear = res['color'].detach().cpu().numpy().transpose(1, 2, 0)
78
- color_srgb = np.power(np.clip(color_linear, 0, 1), 1.0/2.2) # Standard gamma 2.2
79
  rets['color'].append(np.clip(color_srgb * 255, 0, 255).astype(np.uint8))
80
  if 'percent_depth' in res:
81
  rets['depth'].append(res['percent_depth'].detach().cpu().numpy())
 
75
  if 'depth' not in rets: rets['depth'] = []
76
  # Apply gamma correction to video frames (Linear → sRGB)
77
  color_linear = res['color'].detach().cpu().numpy().transpose(1, 2, 0)
78
+ color_srgb = np.power(np.clip(color_linear, 0, 1), 1.0/2.3) # Gamma 2.3 (slightly less bright)
79
  rets['color'].append(np.clip(color_srgb * 255, 0, 255).astype(np.uint8))
80
  if 'percent_depth' in res:
81
  rets['depth'].append(res['percent_depth'].detach().cpu().numpy())