Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added orthographic projection #349

Merged
merged 3 commits into from
Aug 21, 2024

Conversation

VladislavZavadskyy
Copy link
Contributor

Should be useful :)

Copy link
Collaborator

@liruilong940607 liruilong940607 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very useful!! It seems like a handful of users are looking for this support from #349! Left a few minor comments.

width: int,
height: int,
) -> Tuple[Tensor, Tensor]:
"""PyTorch implementation of prespective projection for 3D Gaussians.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: "perspective projection"

@@ -77,12 +77,13 @@ def quat_scale_to_covar_preci(
return covars if compute_covar else None, precis if compute_preci else None


def persp_proj(
def proj(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the sake of backward compatibility, I think we should keep the function persp_proj and have another ortho_proj. The rest of the code does not need to change (i.e., these two APIs could share the underlying implementation)

Another solution which is also fine with me, is to have this proj function and keep the original persp_proj but raise deprecated warning inside of it. This would also avoid sudden interrupt to the users.

@@ -174,6 +180,8 @@ def test_projection(test_data, fused: bool, calc_compensations: bool):
quats = test_data["quats"]
scales = test_data["scales"]
means = test_data["means"]
ortho = test_data.get("ortho", False)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can set ortho as an argument of this function and decorate this function with pytest to specify this argument to be with options True and False. This way pytest would test over all choices. See examples here:

@pytest.mark.parametrize("packed", [True, False])
def test_rasterization(
per_view_color: bool, sh_degree: Optional[int], render_mode: str, packed: bool

@liruilong940607
Copy link
Collaborator

Test is failing because of format. Could you run

pip install black==22.3.0
black . gsplat/ tests/ examples/ profiling/

Copy link
Collaborator

@liruilong940607 liruilong940607 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@liruilong940607 liruilong940607 merged commit 5ec2670 into nerfstudio-project:main Aug 21, 2024
2 checks passed
@VladislavZavadskyy
Copy link
Contributor Author

Pleasure doing business with you :)

@VladislavZavadskyy VladislavZavadskyy deleted the ortho branch August 21, 2024 19:03
LearnedVector added a commit to LearnedVector/gsplat that referenced this pull request Aug 21, 2024
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.

2 participants