lasa01 / Plumber

A Blender addon for importing Source 1 engine maps, models, materials and textures. This addon makes it possible to import full CS:GO, TF2, CS:S or other Source 1 game maps into Blender.
MIT License
395 stars 29 forks source link

Incorrect UVs for detail textures #185

Open quantumdude836 opened 4 months ago

quantumdude836 commented 4 months ago

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):

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.