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 texture mode on load_obj #1886

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pytorch3d/datasets/shapenet_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def __init__(self) -> None:
self.model_dir = "model.obj"
self.load_textures = True
self.texture_resolution = 4
self.texture_wrap = "clamp"

def __len__(self) -> int:
"""
Expand Down Expand Up @@ -90,6 +91,7 @@ def _load_mesh(self, model_path) -> Tuple:
create_texture_atlas=self.load_textures,
load_textures=self.load_textures,
texture_atlas_size=self.texture_resolution,
texture_wrap = self.texture_wrap
)
if self.load_textures:
textures = aux.texture_atlas
Expand Down
4 changes: 2 additions & 2 deletions pytorch3d/io/obj_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ def load_obj(
map is created per face.
texture_wrap: string, one of ["repeat", "clamp"]. This applies when computing
the texture atlas.
If `texture_mode="repeat"`, for uv values outside the range [0, 1] the integer part
If `texture_wrap="repeat"`, for uv values outside the range [0, 1] the integer part
is ignored and a repeating pattern is formed.
If `texture_mode="clamp"` the values are clamped to the range [0, 1].
If `texture_wrap="clamp"` the values are clamped to the range [0, 1].
If None, then there is no transformation of the texture values.
device: Device (as str or torch.device) on which to return the new tensors.
path_manager: optionally a PathManager object to interpret paths.
Expand Down