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

Improve Texture class #5

Open
G2Pavon opened this issue Jan 15, 2024 · 1 comment
Open

Improve Texture class #5

G2Pavon opened this issue Jan 15, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@G2Pavon
Copy link
Owner

G2Pavon commented Jan 15, 2024

@G2Pavon G2Pavon added the enhancement New feature or request label Jan 15, 2024
@G2Pavon
Copy link
Owner Author

G2Pavon commented Jan 18, 2024

Texture lock explained by Captain P:

One way to look at texture projection is that you have a texture plane, and you're projecting vertices onto that plane to get UV coordinates. Here is how I apply 'texture fit' when transforming a brush: https://github.com/pwitvoet/mess/blob/master/MESS/Macros/MappingExtensions.cs#L61
I first project a vertex onto the texture plane to get the original UV coordinates (not normalized, so texture size doesn't matter), then I transform the vertices and rotate/scale the UV axis, and then I project the same (now transformed) vertex again onto the now rotated and scaled texture plane to get new UV coordinates. I then use the difference between the old and new UV coordinates to update the UV offset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant