Skip to content

Conversation

@nandometzger
Copy link

@nandometzger nandometzger commented Dec 18, 2025

  • Fixed TypeError in load_ply by converting numpy array to tensor before calling sRGB2linearRGB
  • Fixed dark rendering issue by ensuring sRGB conversion is applied when input/output is sRGB (even if internal state is linear)

My testing file uses sRGB
I attach it here so you can reproduce the problem
loki1

Error message for the original code:

>>>sharp render -i output -o renderings


2025-12-18 13:38:15,124 | INFO | Rendering output/loki.ply
Traceback (most recent call last):
  File "/scratch3/metzgern/random/ml-sharp/.venv/bin/sharp", line 8, in <module>
    sys.exit(main_cli())
             ^^^^^^^^^^
  File "/scratch3/metzgern/random/ml-sharp/.venv/lib/python3.11/site-packages/click/core.py", line 1462, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch3/metzgern/random/ml-sharp/.venv/lib/python3.11/site-packages/click/core.py", line 1383, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/scratch3/metzgern/random/ml-sharp/.venv/lib/python3.11/site-packages/click/core.py", line 1850, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch3/metzgern/random/ml-sharp/.venv/lib/python3.11/site-packages/click/core.py", line 1246, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch3/metzgern/random/ml-sharp/.venv/lib/python3.11/site-packages/click/core.py", line 814, in invoke
    return callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch3/metzgern/random/ml-sharp/src/sharp/cli/render.py", line 61, in render_cli
    gaussians, metadata = load_ply(scene_path)
                          ^^^^^^^^^^^^^^^^^^^^
  File "/scratch3/metzgern/random/ml-sharp/src/sharp/utils/gaussians.py", line 326, in load_ply
    colors = cs_utils.sRGB2linearRGB(colors)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch3/metzgern/random/ml-sharp/src/sharp/utils/color_space.py", line 52, in sRGB2linearRGB
    return robust_where(
           ^^^^^^^^^^^^^
  File "/scratch3/metzgern/random/ml-sharp/src/sharp/utils/robust.py", line 40, in robust_where
    input_2 = torch.where(~condition, input_2, branch_false_safe_value)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: where() received an invalid combination of arguments - got (numpy.ndarray, numpy.ndarray, float), but expected one of:
 * (Tensor condition)
 * (Tensor condition, Tensor input, Tensor other, *, Tensor out = None)
 * (Tensor condition, Number self, Tensor other)
      didn't match because some of the arguments have invalid types: (numpy.ndarray, numpy.ndarray, float)
 * (Tensor condition, Tensor input, Number other)
      didn't match because some of the arguments have invalid types: (numpy.ndarray, numpy.ndarray, float)
 * (Tensor condition, Number self, Number other)
      didn't match because some of the arguments have invalid types: (numpy.ndarray, numpy.ndarray, float)

- Fixed TypeError in load_ply by converting numpy array to tensor before calling sRGB2linearRGB
- Fixed dark rendering issue by ensuring sRGB conversion is applied when input/output is sRGB (even if internal state is linear)
@nandometzger nandometzger marked this pull request as ready for review December 18, 2025 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant