Dylancyclone / VMF2OBJ

Convert source-engine VMF files into OBJ files with materials (including brushes, displacements, entities, and models)
MIT License
113 stars 6 forks source link

Incorrect exporting of displacements #30

Open degradka opened 2 years ago

degradka commented 2 years ago

Hello, I'm using vmf2obj version 2.0.0-rc3, and here's my problem disps

Dylancyclone commented 2 years ago

Hi! What map are you trying to decompile?

degradka commented 2 years ago

What do you mean?

Dylancyclone commented 2 years ago

What map are you having problems with? This way I can try and reproduce the problem

degradka commented 2 years ago

gm_postsoviet_yard on Steam workshop (game Garry's Mod)

Dylancyclone commented 2 years ago

Ok I am see the problem on my computer, but I am thoroughly confused on what's causing it. For example, and I'll go into detail in case someone else sees the problem and can help out:

Take this displacement here in hammer: image It slopes upwards towards the wall, and downwards away from the wall.

That same displacement decompiled: image Appears to be flipped, it slopes down towards the wall and upwards away from it. Ok, makes sense, but that's not the issue. According to the VDC, the startposition property of a displayment is "The position of the bottom left corner in an actual x y z position." (https://developer.valvesoftware.com/wiki/Valve_Map_Format#Dispinfo) The start position of that displacement is [-467 -1582 44] image Which when putting the bottom-left corner of the displacement, puts it in the corner of the wall: image

But in order for the displacement to be rendered "correctly," it would have to be in the opposite corner. I'm honestly not sure what the issue is here. I'll slowly keep looking into it, but it's currently midterms week and I don't have a whole lot of extra time on my hands at the moment.

If anyone has any ideas, feel free to share!

degradka commented 2 years ago

Thank you for your answer! However, if you use v1.1.3 there's no problem anymore.

Dylancyclone commented 2 years ago

Hmm now that is interesting, since in that version it was failing to convert other displacements, as seen in #20 and #16. I fixed those issues by rewriting the way displacements were converted. I can't tell if there's any difference between this displacement and the ones from those other issues.

botchi09 commented 2 years ago

This is still happening in maps from Empires mod!

ghost commented 2 years ago

Any solution to this? Having the same problem with a Team Fortress 2 map, pl_badwater:

Screenshot 2022-09-25 055035

I am using the latest version, 2.0.0

Dylancyclone commented 2 years ago

Unfortunately, I'm still unable to figure out exactly what is going on here. I am able to find a fix that works for some maps (see the comments above), but I've also found some maps where the startposition property seems to be a completely random coordinate that is different from brush to brush. This can cause most but not all displacements to line up, and I can't figure out a reproducible way to find out why image If anyone knows or has any ideas, I am all ears