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

Incorrect UVs for detail textures #185

Open
quantumdude836 opened this issue May 17, 2024 · 1 comment
Open

Incorrect UVs for detail textures #185

quantumdude836 opened this issue May 17, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@quantumdude836
Copy link

Describe the bug
Detail textures are misaligned in Blender, even if they're aligned in Hammer

To Reproduce
Steps to reproduce the behavior:

  1. Import any VMF with materials that have detail textures (such as "gm_construct/grass" from Garry's Mod)
  2. Switch to material preview
  3. See misaligned detail texture

Expected behavior
Detail textures should be aligned as they are in Hammer

Related files
gm_uvdemo.zip

Logs

Read prefs: "C:\Users\Andrew\AppData\Roaming\Blender Foundation\Blender\4.1\config\userpref.blend"
[Plumber] [INFO] opening file system of game `Garry's Mod`...
[Plumber] [WARN] opening filesystem: directory `D:\Steam\steamapps\common\GarrysMod\garrysmod/download` not found
[Plumber] [INFO] file system opened in 0.05 s
[Plumber] [INFO] importing vmf `C:\Users\Andrew\AppData\Local\Temp\plumber-uv\gm_uvdemo.vmf`...
[Plumber] [INFO] vmf imported in 0.19 s

Screenshots
Original map in Hammer:
hammer
Imported map in Blender:
blender

Details (please complete the following information):

  • OS: Windows 10 22H2
  • Blender Version: 4.1
  • Addon Version: 1.0.1
  • Did you download a release or build the addon yourself: downloaded release
  • Related Game: any (Garry's Mod used for example)

Additional context
After skimming through the code I believe the issue is in plumber-core, specifically where UVs are "normalized" by adjusting the UV coords by a whole number. For the base texture, this is fine, but detail textures use scaled coords, which means that UVs used by detail textures are adjusted by a non-whole number.

@quantumdude836 quantumdude836 added the bug Something isn't working label May 17, 2024
@lasa01
Copy link
Owner

lasa01 commented Oct 23, 2024

Good find, the normalization does break uvs of textures with scaled coords. Not sure what the best way to fix this would be. The UV normalization could be removed, but this would result in quite ugly UVs being imported (uv coordinates in the hundreds, far away from the origin).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants