TrenchBroom / TrenchBroom

Cross-Platform Level Editor
kristianduske.com/trenchbroom
GNU General Public License v3.0
1.99k stars 233 forks source link

Texture UVs getting messed up with random textures/faces in OBJ export #2851

Closed TheRektafire closed 4 years ago

TheRektafire commented 4 years ago

System Information

TrenchBroom 2019.6 Release Windows 10 Home 64 bit

Expected Behavior

textures should be rotated or offset correctly

Steps to Reproduce

export an obj

issue Info

Often when exporting to OBJ some textures will haves messed up UVs, ie they will be flipped or offset incorrectly, it seems like it only effects specific textures but I can't quite be sure. Here is a screenshot showing a side by side comparison of a map i'm trying to make for a goldeneye 64 community project both in the editor and in blender as an example

image

As you can see the offsets and rotations of the handrails on the stairs are completely screwed up but the wall and door frame and floor on the other side of the room don't seem to be effected. I've had it occur with other textures in the GE texture pack i'm using along with other texture sets as well and it is pretty annoying, here is an example OBJ as well

tb_f'ed uv example.txt

And the mtl file tb_f'ed uv example.mtl.txt

edit: also the map having the issues is in valve format if that matters at all, here it is

tower_g.map.txt

ericwa commented 4 years ago

Hey, can you attach the map too? It might be specific to valve or standard 220 texture format. Thanks

TheRektafire commented 4 years ago

tower_g.map.txt

ericwa commented 4 years ago

Having trouble seeing the problem.. I loaded your map with the gametype edited to Quake 1, and khreathor's protype wad, and get this: (different texture in blender, but it shows the UV's are fine):

Capture

This face on the side of the railing looks like it's rotated 45 degrees in your screenshot, but I'm not seeing that in TB. face

Checking the railing brush, the texture is definitely not rotated, so I'm not sure why it looks that way in your TB screenshot.

{
( -992 64 416 ) ( -992 56 416 ) ( -992 56 384 ) skip/skip [ 0 -1 0 -0 ] [ 0 0 -1 -0 ] -0 1 1
( -608 56 416 ) ( -608 56 384 ) ( -992 56 384 ) alltextures/932620W2 [ 1 0 0 14 ] [ 0 0 -1 0 ] -0 0.7 1
( -992 56 384 ) ( -608 56 384 ) ( -624 64 384 ) skip/skip [ -1 0 0 -0 ] [ 0 -1 0 -0 ] -0 1 1
( -624 64 416 ) ( -608 56 416 ) ( -992 56 416 ) skip/skip [ 1 0 0 -0 ] [ 0 -1 0 -0 ] -0 1 1
( -624 64 384 ) ( -624 64 416 ) ( -992 64 416 ) skip/skip [ -1 0 0 -0 ] [ 0 0 -1 -0 ] -0 1 1
( -624 64 384 ) ( -608 56 384 ) ( -608 56 416 ) skip/skip [ 1 2.22045e-16 0 -0 ] [ 0 0 -1 -0 ] -0 1 1
}
TheRektafire commented 4 years ago

Actually that face is rotated 270 degrees as you can see here image

Maybe this is an issue specifically effecting generic or at least external textures vs wads?

ericwa commented 4 years ago

Seems like the V coordinates need to be flipped.

Reduced test case:

TheRektafire commented 4 years ago

image It's fixed now :D Thanks