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

Fixed large uv wrapping #249

Merged
merged 6 commits into from
Feb 14, 2024
Merged

Conversation

Lilaa3
Copy link
Collaborator

@Lilaa3 Lilaa3 commented Sep 7, 2023

Arthur suggested this a solution, he said he could test it later today. Until then this will remain a draft pr.

Copy link
Contributor

@Dragorn421 Dragorn421 left a comment

Choose a reason for hiding this comment

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

Does fast64 use the max shift of two textures for exporting? (Can you link to code) (why is this even a per texture setting in fast64)

@Lilaa3
Copy link
Collaborator Author

Lilaa3 commented Sep 8, 2023

This is the code that wraps uv´s back into valid bounds

@Lilaa3
Copy link
Collaborator Author

Lilaa3 commented Sep 8, 2023

Arthur tested this and confirmed it works as intended btw. Should be ready for one more review and then being merged

@Lilaa3 Lilaa3 marked this pull request as ready for review September 8, 2023 11:38
Arthur suggested this a solution.
@Lilaa3
Copy link
Collaborator Author

Lilaa3 commented Sep 8, 2023

All known issues should be fixed now

fast64_internal/f3d/f3d_writer.py Outdated Show resolved Hide resolved
return (SShift * sMirrorScale, TShift * tMirrorScale)


def getUVInterval(f3dMat) -> tuple[int, int]:
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this behaves as expected if e.g. tex0 has shift=0 mirror=True and tex1 has shift=1 mirror=False

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

When shift is 0, SShift will be 1, because 2^0 is 1. What´s wrong here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The result of your case should be 2.

2 if f3dMat.tex0.T.mirror or f3dMat.tex1.T.mirror else 1,
]
# To prevent wrong UVs when wrapping UVs into valid bounds,
# we need to account for the highest texture shift and if mirroring is active.
Copy link
Contributor

Choose a reason for hiding this comment

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

To reiterate on my previous comments why "highest"? There must be a piece of code elsewhere on exporting that handles this similarly? Where

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There isn´t because this is doing something else, we don´t need to account for texture resolutions and what not, so there is no function which does this behavior specifically.

@jesusyoshi54
Copy link
Collaborator

I have some comments on style but the actual code makes sense and if it is tested then I don't feel the need for any functionality changes

@FazanaJ
Copy link

FazanaJ commented Sep 23, 2023

Screenshot 1
Screenshot 1
Noticable cutoff from the second texture when using shifting

Copy link
Contributor

@Yanis42 Yanis42 left a comment

Choose a reason for hiding this comment

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

code is ok to me but I still need to get feedback from mario people and I need to see if anything breaks on oot (since this is F3D stuff)

I'll approve once both sides are tested and ok

@Lilaa3 Lilaa3 closed this Jan 18, 2024
@Lilaa3 Lilaa3 reopened this Jan 18, 2024
@Lilaa3
Copy link
Collaborator Author

Lilaa3 commented Jan 18, 2024

Oops closed on accident, what I was going to say is that fazana had incorrect mask values, the pr should be working correctly.

getSTUVRepeats couldn´t auto type hint, getUVInverval can.
Use 1.0 instead of 1
@Lilaa3
Copy link
Collaborator Author

Lilaa3 commented Jan 18, 2024

code is ok to me but I still need to get feedback from mario people and I need to see if anything breaks on oot (since this is F3D stuff)

I'll approve once both sides are tested and ok

Could you test then please? This shouldn´t affect oot differently at all.

Copy link
Collaborator

@jesusyoshi54 jesusyoshi54 left a comment

Choose a reason for hiding this comment

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

works on my machine

fast64_internal/f3d/f3d_writer.py Outdated Show resolved Hide resolved
fast64_internal/f3d/f3d_writer.py Outdated Show resolved Hide resolved
@Dragorn421 Dragorn421 added bug Something isn't working f3d Has to do with the "f3d" code common to all games labels Jan 27, 2024
@Dragorn421 Dragorn421 merged commit 4f621f4 into Fast-64:main Feb 14, 2024
1 check passed
@Lilaa3 Lilaa3 deleted the fixed-large-uv-wrapping branch August 24, 2024 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working f3d Has to do with the "f3d" code common to all games
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants