Giter VIP home page Giter VIP logo

vmf2obj's Introduction

VMF2OBJ

Convert source-engine VMF files from any game into OBJ files with materials (including brushes, displacements, entities, and models)

Watch a demonstration video:

Youtube demonstration

How to run

Download the latest version from the Releases page, then double click on the .jar file to open it.

The VMF2OBJ GUI

Then, simply fill out which VMF file you'd like to convert, and the VPK files (and custom folders) that house the models, materials, etc for the map.

An example

There is also a Command Line Interface:

java -jar ./VMF2OBJ.jar [VMF_FILE] [args...]

usage: vmf2obj [VMF_FILE] [args...]
 -h,--help                  Show this message
 -o,--output <arg>          Name of the output files. Defaults to the name
                            of the VMF file
 -q,--quiet                 Suppress warnings
 -r,--resourcePaths <arg>   Semi-colon separated list of VPK files and
                            folders for external custom content (such as
                            materials or models)
 -t,--tools                 Ignore tool brushes

Example:

java -jar .\vmf2obj.jar .\input.vmf -o .\output -r "D:\SteamLibrary\steamapps\common\Half-Life 2\hl2\hl2_misc_dir.vpk;D:\SteamLibrary\steamapps\common\Half-Life 2\hl2\hl2_textures_dir.vpk;C:\path\to\custom\content\;C:\path\to\more\custom\content\" -t

To use external resources that are not in a VPK file, simply add the path to the folder that contains the "models"/"materials" folders.

custom-content/        <----- Select this folder
├── materials/         <----- DON'T select this folder
│   └── models/
│       └── props/
│           ├── clock.vmt
│           └── clock.vtf
└── models/            <----- DON'T select this folder
    └── props/
        ├── clock.dx80.vtx
        ├── clock.dx90.vtx
        ├── clock.mdl
        ├── clock.phy
        ├── clock.sw.vtx
        └── clock.vvd

Building

To build the app from source, simply run:

mvn package

The compiled .jar file will be placed in the target directory.

Packaged Dependencies

This project packages the following software and uses them during the conversion process. This project would not be possible without them.

Support

  • Brushes
  • Displacements
  • Materials
    • Textures
    • Bump Maps
    • Transparency
  • Brush Entities
  • prop_* Entities
    • Geometry
    • Geometry Normals
    • Materials

Unsupported Features

These are features that I don't have any plans to implement, either because I don't know how to, or the feature is too inconsistant, or would require extreme reworks to the current implementation. Of course, if you have an idea on how to implement any of these please feel free to submit a PR or issue discussing the idea.

  • prop_* skins
    • Textures are defined per triangle in a model's decompiled SMD, but skins are defined in it's QC file. I don't know of a good way to line up skins with multiple textures to a single model. I would theoretically be possible to implement single-material skins, but the results may end up being inconsistent and produce unexpected results.
  • Displacement blend materials
    • All the data needed for a blend material is included in the displacement object, but in order to implement it into an obj object either a separate texture must be generated with the blend built in, or a per-vertex material must be applied and blended between. The downsides of the first option is that it requires a lot of processing before hand (and Java's compatibility with Targa files is kinda potato at best), and the resulting texture is not editable. The downside of the second option is that the each vertex has to be either entirely one texture or entirely the other, and the linear blend will always go between the two. This will make for very strange looking textures when comparing it to the hammer counterpart, and it would require a complete rework of how the application handles textures. The perfect-world solution is to use a format that supports this kind of thing out of the box, but then you loose compatibility pretty quickly.
  • infodecal
    • infodecal entities don't store any data about where the decal is displayed, meaning it is projected from it's origin to the brush and clipped/sized accordingly. I personally don't know enough about how this process is done, and I don't feel comfortable trying to brute force it. I looked around for the source code associated with it, but I could not find anything to reverse engineer. I know it's a pretty important feature, but I don't know how to make it work correctly.
  • info_overlay
    • info_overlay is basically nextgen infodecal. Instead of just projecting to one side, an info_overlay can be projected to multiple faces, including different orientations and brushes so that the decal can "wrap" around. Again, I honestly don't really know how to approach this without brute forcing every face to create a separate object with it's own UV wrapping. And that doesn't even include the fact that info_overlays can be distorted before being placed.

Other Notes

Depending on where you import the converted result to, you might run into a problem where all the geometry looks very dark. This is due to the Source engine using additional normal data that might cause side effects in other software. In Blender, this can be solved with this quick script. Simply select all the objects, and run this script in a new text editor. See this for more information.

vmf2obj's People

Contributors

dylancyclone avatar porkmuncher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vmf2obj's Issues

Wont open

Heya, i might be just stupid, but how do i actually run this java extension?
Double clicking on it does nothing, do i need some kind of program to run it other than java?
lots of love

Incorrect conversion of some displacements

Hi, I am faced with the problem of incorrect conversion of some displacements. Moreover, the problem is not with all at once, but with some specific
image
image
Is there any way to fix this?

P.S. You can check this problem yourself by converting decompiled ar_lunacy

Fatal error: java.nio.file.NoSuchFileException

When I try to convert a gmod map, for whatever reason on the 4th step it freezes on 6% because it can't find arcade.smd

Processing entities... 6% [> ] 263/4247 (0:00:02 / 0:00:30) 131.5/sSEVERE: Fatal error: java.nio.file.NoSuchFileException: C:\Users\Owner\AppData\Local\Temp\vmf2objtemp\models\arcade.smd
upon looking in the temp folder, arcade.smd is inside models/gta iv/ however, when i copy and paste it out of the folder, I get a different error:

Processing entities... 6% [> ] 263/4247 (0:00:02 / 0:00:30) 131.5/sWARNING: Failed to find modelName
SEVERE: Fatal error: java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 0

Comparison method violates its general contract (Side.completeSide)

Command - java -jar .\VMF2OBJ.jar .\de_dust2.vmf .\output "F:\SteamLibrary\steamapps\common\Counter-Strike Source\cstrike\cstrike_pak_dir.vpk;F:\SteamLibrary\steamapps\common\Counter-Strike Source\hl2\hl2_misc_dir.vpk;F:\SteamLibrary\steamapps\common\Counter-Strike Source\hl2\hl2_sound_misc_dir.vpk;F:\SteamLibrary\steamapps\common\Counter-Strike Source\hl2\hl2_sound_vo_english_dir.vpk;F:\SteamLibrary\steamapps\common\Counter-Strike Source\hl2\hl2_textures_dir.vpk"

Exception in thread "main" java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeHi(Unknown Source)
at java.util.TimSort.mergeAt(Unknown Source)
at java.util.TimSort.mergeForceCollapse(Unknown Source)
at java.util.TimSort.sort(Unknown Source)
at java.util.Arrays.sort(Unknown Source)
at java.util.ArrayList.sort(Unknown Source)
at java.util.Collections.sort(Unknown Source)
at com.lathrum.VMF2OBJ.dataStructure.map.Side.completeSide(Side.java:71)
at com.lathrum.VMF2OBJ.dataStructure.map.VMF.parseSolids(VMF.java:311)
at com.lathrum.VMF2OBJ.App.main(App.java:502)

File not found

I got the following error while trying to convert a de_Dust2 CSGO map.

Processing entities... 16% [=> ] 603/3751 (0:00:01 / 0:00:05) 603.0/sSEVERE: Fatal error: java.nio.file.NoSuchFileException: C:\Users\Devo\AppData\Local\Temp\vmf2objtemp\models\props\autocombine\de_dust2\dust_window_frame_.smd

The tool did create a folder called autocombine, while the VMF uses the path autocombine2.
dust_window_frame_.smd is also a weird name, there shouldn't be any file called like that since there is a missing word after the frame_.

Missing Material

I can't find any documentation on this so I opened an issue. Basically I added a custom texture to Hammer by putting vmf and vtf files in materials/custom of tf2. It works just fine in Hammer. But once I try to run this program, it says Missing Material. I tried adding those textures by the folder, by making a vpk, and by a folder of the raw png files. How do I add these custom textures?
image

i don't understand

Python: Traceback (most recent call last):
File "C:\Users\freeb\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\io_import_vmf_init_.py", line 748, in execute
importer.load(self.filepath, context, self.map_data_path)
File "C:\Users\freeb\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\io_import_vmf\import_vmf.py", line 140, in load
vmf = vmfpy.VMF(open(file_path, encoding="utf-8"), self.vmf_fs)
File "C:\Users\freeb\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\io_import_vmf\deps\vmfpy_init
.py", line 721, in init
self.editorversion: Optional[int] = self.parse_int_str("editorversion", versioninfo)
File "C:\Users\freeb\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\io_import_vmf\deps\vmfpy_init
.py", line 77, in _parse_int_str
value = self.parse_str(name, vdict)
File "C:\Users\freeb\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\io_import_vmf\deps\vmfpy_init
.py", line 66, in _parse_str
raise VMFParseException(f"{full_name} doesn't exist", self._context)
vmfpy.VMFParseException: VMF parsing failed: editorversion doesn't exist

location: :-1

Collapse Vertex Normals

Similar to #1, If there are duplicate vertex normals, they can be combined/collapsed into one so that the data is not repeated. The struggle with this is making sure any faces that use the collapsed vertex normal are redirected to the one that was kept.

Sort faces by texture

If a brush used multiple materials, it is possible for the .obj file to switch back and forth between the materials multiple times. For optimization, it would be nice to sort the faces so that only one usemtl needs to be used per material per object.

For example:

usemtl tools/toolsnodraw
f 1/1 2/2 3/3 4/4 
usemtl tools/toolstrigger
f 5/5 6/6 7/7 8/8 
usemtl tools/toolsnodraw
f 9/9 10/10 11/11 12/12

could be optimized to:

usemtl tools/toolsnodraw
f 1/1 2/2 3/3 4/4 
f 9/9 10/10 11/11 12/12
usemtl tools/toolstrigger
f 5/5 6/6 7/7 8/8 

Decompiled Portal 2 Maps always show this error.

I honestly do not know why this issue is happening as I have put all correct VPK's and every time I convert a portal 2 map, this error shows up

To help, the map, I am trying to convert is "sp_a1_wakeup.vmf"
below this is what the Log says.


Starting VMF2OBJ conversion v2.0.3
[1/5] Reading VPK file(s) and custom content...
[2/5] Reading geometry...
SEVERE: Fatal error: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Expected ':' at line 1 column 1838408 path $.entities[87].connections.

Exception in thread "main" java.lang.NullPointerException

Running the command java -jar VMF2OBJ.jar gladoschamber.vmf output "D:\Steam\steamapps\common\Portal 2\portal2\pak01_dir.vpk" -t outputs the following:

Exception: java.lang.NullPointerException
[1/5] Reading VPK file(s)...
Exception in thread "main" java.lang.NullPointerException
        at java.io.File.<init>(Unknown Source)
        at com.lathrum.VMF2OBJ.App.main(App.java:389)

Texture UVs appear to be flipped

Not sure exactly what's going on. All I know is I made a test map to demonstrate this: I set these sloped textures as you can see, then exported it to obj, then when I open in blender they are flipped.
image
image
this also appears to happen in windows 10 object viewer so I don't think it's Blender

Collapse *almost* duplicate vertices

Similar to #1 and #2, but with a margin of error. The program already merges vertices if they are exact duplicates of each other, but for more complicated geometry there could be rounding errors that make the vertices technically slightly different, but effectively the same. It would be a good optimization and improvement if the extra vertices were merged together. The struggle with this is making sure any faces that use the collapsed vertex texture are redirected to the one that was kept.

Unterminated object at line 1 column 24570 path $.solids[0].sides[0].null

Hi I'm trying to convert a tf2 map that I made into obj but I keep getting this error.
Starting VMF2OBJ conversion v2.0.0-rc.3 [1/5] Reading VPK file(s) and custom content... [2/5] Reading geometry... SEVERE: Fatal error: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object at line 1 column 24570 path $.solids[0].sides[0].null

VMF2OBJ version is 2.0.0-rc.3
Here is the vmf
mvm_swirl_event_rc1.zip
There are some custom models used in this map however I dont think this is the problem.

VMF2OBJ returning empty OBJ

Trying to convert some old Gmod maps to OBJ - Stripped out all ents, just brushes left. No fatal errors returned - The OBJ I'm getting is only empty verts?

image

Is this a common problem? Apologies if I'm missing something obvious

edit; fixed by stripping the original VMF of all its textures - not an ideal solution but I didn't need them in this instance

Several errors while converting decompiled maps from Portal 2

Not sure what happened here. I've decompiled all the maps from portal 2 using bspsrc and have had moderate success however things keep cropping up and one in particular is really annoying due to it failing to give me any output at all.
These errors include:

SEVERE: Fatal error: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated array at line 1 column 2564665 path $.entities[414].ACH.A3_DOORS"[6]

When i'm converting sp_a3_transition01.bsp as well as several errors in other maps like

Failed to parse Material: nature/water_bottomless_pit_01
Missing Material: concrete/concrete_bts_ceiling001a_noportal
Failed to parse Material: plastic/plasticwall001b
Prop has no model? prop_testchamber_door
Failed to parse Material: circle_shield_main

It's more likely to be my fault than the tools however i'm not really sure how to solve any of these. If anyone else has encountered these and fixed them please let me know how.

DISPLACEMENT MAPS ROTATED INCORRECTLY

after exporting a map for some reason every displacement is rotated some amount

im currently trying to convert gm_fork into an obj (everything is fine except the displacement maps)

log will be in a comment because it is looong
(sorry for massive log)
images:
image
image

Recycle prop data

Right now the application goes through the process of decompiling, converting, and processing every prop regardless of if it has already been converted. If the application were to temporarily store the prop data and reuse it every time the prop was reused in the map, the application could be sped up probably by a good amount

NullPointerExpexction at processing entities

I am trying to convert a map to obj, but it seems to throw an exception. I have tried to not include entities but it seems will remove all map entities

Map I am trying to convert: https://steamcommunity.com/sharedfiles/filedetails/?id=1908300524 (A danger zone map combines multiple CSGO maps)

Command line: java -Xmx 16GB -jar vmf2obj.jar .\dz_csgoworld_v2_2d.vmf .\export "C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive\csgo\pak01_dir.vpk" -e "[INSERT PATH HERE]\dz_csgoworld_v2_d"

Cleanup needed

Now that the thing is confirmed to work, we ought to clean it up a bit. Ex: We have a gson that we imported but the only time it's ever used is in code that's commented out.

I also suggest we change all the public static final variables at the top to private variables and create some getters/setters for them since having them open like that causes security issues

Severe fatal error

When im trying to convert a custom map that i made into obj i get this error

SEVERE: Fatal error: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object at line 1 column 1626 path $.solids[0].sides[0].null

Im using hl2_textures_dir, hl2_pak_dir and hl2_misc_dir vpks.

Any help pls?

Trouble using custom materials/models

I am confused on how you import custom materials and models without VPK. As it seems its possible based on your writing in the description. Yet i cannot figure it out. Am I missing something key?

How do I check which pak files are used and other configuration issues.

Is there a way to have your tool get the values from the configuration files of hammer? I really want to convert a "model" I made with hammer but cannot seem to get this to work. I don't know which pak files I used and while I made sure to update the paths for the hl2 pak files, that did not work. There's a LOT of .pak files in the Counter-Strike directory.

Any and all help would be greatly appreciated. Fyx#5710 on discord

Missing Materials on Gmod Map

I tried to convert a map that I made for gmod using the default materials but the program was unable to find a ton of the materials
Upon looking further I found the materials but they aren't packaged into a vpk and adding it as a folder doesn't work either, it still can't find it
I know that nobody is updating this program or helping people with issues anymore, but any help would be appreciated
Thanks!

Here's the log in case it helps:

Starting VMF2OBJ conversion v2.0.0
[1/5] Reading VPK file(s) and custom content...
[2/5] Reading geometry...
[3/5] Writing brushes...

Missing Material: concrete/concretefloor008a

Missing Material: plaster/plasterwall044b

Missing Material: props/carpetfloor004a

Missing Material: plaster/plasterwall044b

Missing Material: props/carpetfloor004a

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: props/carpetfloor004a

Missing Material: glass/glasswindow001b

Missing Material: glass/glasswindow001b

Missing Material: glass/glasswindow001b

Missing Material: tile/tilefloor003a

Missing Material: concrete/concretefloor016a

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: glass/glasswindow001b

Missing Material: brick/brickwall052b

Missing Material: brick/brickwall052b

Missing Material: brick/brickwall052b

Missing Material: brick/brickwall052b

Missing Material: glass/glasswindow001b

Missing Material: brick/brickwall052b

Missing Material: glass/glasswindow001b

Missing Material: brick/brickwall052b

Missing Material: glass/glasswindow001b

Missing Material: brick/brickwall052b

Missing Material: glass/glasswindow001b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: glass/glasswindow001b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: props/carpetfloor004a

Missing Material: props/carpetfloor004a

Missing Material: props/carpetfloor004a

Missing Material: props/carpetfloor004a

Missing Material: props/carpetfloor004a

Missing Material: props/carpetfloor004a

Missing Material: props/carpetfloor004a

Missing Material: props/carpetfloor004a

Missing Material: props/carpetfloor004a

Missing Material: props/carpetfloor004a

Missing Material: props/carpetfloor004a

Missing Material: props/carpetfloor004a

Missing Material: props/carpetfloor004a

Missing Material: props/carpetfloor004a

Missing Material: props/carpetfloor004a

Missing Material: props/carpetfloor004a

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: brick/brickwall052b

Missing Material: brick/brickwall052b

Missing Material: brick/brickwall052b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: glass/glasswindow001b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: props/carpetfloor004a

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: concrete/concretefloor016a

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Missing Material: brick/brickwall052b

Missing Material: plaster/plasterwall044b

Writing Brushes... 100% [===================] 216/216 (0:00:03 / 0:00:00) 72.0/s
[4/5] Processing entities...

Processing entities... 100% [======================] 2/2 (0:00:00 / 0:00:00) ?/s
[5/5] Cleaning up...
Conversion complete! Output can be found at: C:\Users\Cassie Cat\Downloads

Could not find QC file for model (Map from Portal 1)

Hello,
I try to convert the 'testchmb_a_00_d.vmf' file from Portal 1.
I'm on v2.0 on macOS.
Here's a capture of the home tool
Capture d’écran 2023-08-16 à 23 17 30
I placed 'models' folder at the same folder of the jar.
It the same for material.

I attached the full log : log.txt

I spend one hour one that. Any solution ? Caused by macOS ?
Note : I used the Windows version of Portal from Steam (download from CrossOver and saved to my desktop). I extracted the .vmf from the /portal/maps/testchmb_a_00_d.bsp with 'bspsrc'

How do we make the jar file?

To the users or developers out there, how were you able to make the Jar file?

I followed the tutorial below but I'm missing something:

 - Start Command Prompt.

 - Navigate to the folder that holds your class files:

    C:\>cd \mywork

 - Set path to include JDK’s bin.  For example:

    C:\mywork> path c:\Program Files\Java\jdk1.7.0_25\bin;%path%

 - Compile your class(es):

    C:\mywork> javac *.java

 - Create a manifest file

   manifest.txt with, for example, this content:

        Manifest-Version: 1.0
        Created-By: 1.8.0_171 (Oracle Corporation) #your jdk version
        Main-Class: mainPackage.MainClass

 - Create the jar file:

    C:\mywork> jar cvfm Craps.jar manifest.txt *.class

(tutorial link)

However I can't get past the create-classes step:

When I type:

javac .\src\main\java\com\lathrum\VMF2OBJ\*.java

I get 100 errors:

image

Thank you for your time.

Displacement orientation problems

Sometimes, the orientation of displacements is incorrect. I'm having trouble tracking down the source of the issue, but it seems to occur more often in decompiled maps compared to "raw" vmf maps built in hammer. See an example here: https://youtu.be/3CgoCSRIGqI?t=90

According to the VDC, there is an attribute of displacements called startposition that is supposed to indicate the bottom left corner of the displacement, but unless I'm missing something, this value doesn't seem to be spitting out useful information. (and bottom-left corner relative to what? )
https://developer.valvesoftware.com/wiki/Valve_Map_Format#Dispinfo

The annoying part is that the overall dimensions of the converted displacement are correct, it's just the order in which the vertices are loaded that is incorrect. This isn't a problem for square displacements since the converted result can easily be mirrored into position, but rectangular displacements are a little more difficult to fix quickly.

Collapse Vertex Textures

If there are duplicate vertex textures, they can be combined/collapsed into one so that the data is not repeated. The struggle with this is making sure any faces that use the collapsed vertex texture are redirected to the one that was kept.

Error while decompiled maps from Portal 2

The map is Chapter 6 Beyond the Seal, .bsp file is sp_a3_03
The errors that appear in the progress

[info] Unequal amount of areaporal entities and areaportal brushes. Falling back to 'Manual' method
[info] No occluders to reallocate...
[warning] EntitySource: funct_areaportal entity links to a non existing areaportal, skipping...

And error that appear in Errors & Warnings

[warning] EntitySource: funct_areaportal entity links to a non existing areaportal, skipping...

-e argument prevents program from running

If I try to add an external content path (tried both a folder containing materials/models/etc. and the materials folder itself) the program simply displays the help menu without any errors.

Linux support

Attempting to run this on Linux produces some errors and a never-ending progress bar.

If I include external paths it fails to convert VTF files and dies:

Starting VMF2OBJ conversion v1.1.3
[1/5] Reading VPK file(s)...
[2/5] Reading geometry...
[3/5] Writing brushes...
Writing Brushes...   0% [>                         ]    1/1151 (0:00:00 / 0:00:00) ?/sFailed to extract material: sunabouzu/th_wall02
java.io.IOException: Cannot run program "/tmp/vmf2objtemp/VTFCmd.exe": error=13, Permission denied
Failed to extract bump material: sunabouzu/th_walln
java.io.IOException: Cannot run program "/tmp/vmf2objtemp/VTFCmd.exe": error=13, Permission denied
Missing Material: metal/metalwall061f
Missing Material: tools/toolsnodraw
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 0
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
	at java.base/java.util.Objects.checkIndex(Objects.java:359)
	at java.base/java.util.ArrayList.get(ArrayList.java:427)
	at com.lathrum.VMF2OBJ.App.main(App.java:750)
Writing Brushes...   0% [>                         ]    2/1151 (0:00:56 / 8:56:34) 0/s^C

If I don't include external paths and just include the Garry's Mod VPK file, it gets through the brushes stage and dies on the entities stage

[...]
Missing Material: tools/toolsnodraw
Missing Material: tools/toolsnodraw
Missing Material: sunabouzu/bathroom_sign01
Missing Material: sunabouzu/sound_dampen
Missing Material: tools/toolsnodraw
Writing Brushes... 100% [======================] 1151/1151 (0:00:10 / 0:00:00) 115.1/s
[4/5] Processing entities...
Processing entities...   0% [>                     ]    1/1075 (0:00:00 / 0:00:00) ?/sException in thread "main" java.io.IOException: Cannot run program "/tmp/vmf2objtemp/CrowbarCommandLineDecomp.exe": error=13, Permission denied
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
	at java.base/java.lang.Runtime.exec(Runtime.java:594)
	at java.base/java.lang.Runtime.exec(Runtime.java:453)
	at com.lathrum.VMF2OBJ.App.main(App.java:978)
Caused by: java.io.IOException: error=13, Permission denied
	at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
	at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:314)
	at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:244)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110)
	... 4 more
Processing entities...   0% [>                     ]    1/1075 (0:00:31 / 9:15:13) 0/s^C

VPK Support of third-party games

Currently there doesn't seem to be any support for using VPKs that belong to third party source games, like Dark Messiah and Vampire: The Masquerade. Using those VPK's gives an
SEVERE: Error while loading vpk file: Invalid signature
error.

Any chance that support for these would be added in down the line?

converting problem

hi
when im trying to convert my vmf to obj this error showing to me

Starting VMF2OBJ conversion v2.0.0
[1/5] Reading VPK file(s) and custom content...
[2/5] Reading geometry...
SEVERE: Fatal error: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object at line 1 column 4260 path $.solids[0].sides[0].null

sorry for my bad english

Fatal Error on the reading geometry step

"SEVERE: Fatal error: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object at line 1 column 42084 path $.solids[0].sides[0].null"

Got an error after reading geometry.

Starting VMF2OBJ conversion v1.1.3
[1/5] Reading VPK file(s)...
[2/5] Reading geometry...
Exception in thread "main" com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object at line 1 column 2641 path $.solids[0].sides[0].null
at com.google.gson.Gson.fromJson(Gson.java:942)
at com.google.gson.Gson.fromJson(Gson.java:892)
at com.google.gson.Gson.fromJson(Gson.java:841)
at com.google.gson.Gson.fromJson(Gson.java:813)
at com.lathrum.VMF2OBJ.dataStructure.map.VMF.parseVMF(VMF.java:243)
at com.lathrum.VMF2OBJ.App.main(App.java:510)
Caused by: com.google.gson.stream.MalformedJsonException: Unterminated object at line 1 column 2641 path $.solids[0].sides[0].null
at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1568)
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:491)
at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:414)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:216)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:72)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:72)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
at com.google.gson.Gson.fromJson(Gson.java:927)
... 5 more

Rotation Of Map Not Being Right + Displacement Orientation Not Right

Main Info

I exported a custom map of mine, It manages to come out on its side (On its Y-Axis). The Models and Materials came out okay though. I exported an HL2 Background Map to see the same thing was happening. I wouldn't really consider this an issue because I can flip it manually, But a different issue arises. "Displacement Rotation/Orientation Not Right". The displacements become jumbled when it comes to how it rotated on its Z-Axis. They were exported almost perfectly, With the main problem being the rotation. The whole structure of the map was built around the displacements and the way it curved to make a walkable path when everything was aligned correctly. May also be the displacements not actually exporting right in general.

Displacements and some misc map info need some work when it comes to how they export. I know you've still been trying to tackle these weird issues so I hope you can maybe use this info.

Extra Debug Info

  • My Displacements were really complex. (This probably meant there was alot of displaced geometry, And alot of chances to trip up)
  • Used Portal 1's Hammer (.Exe From The Bin) To create the Source VMF Used for the OBJ. (Doubt Portal 1's Hammer works differently enough from all the others to really cause a problem on its own. Each game has its quirks though, So IDK)
  • Used 1 Custom Model (It worked on the OBJ File, The rotation of this model, Which was a train/tram remake from HL2, Was rotated around the displacements. It was rotated right too, Just that the displacements weren't)
  • Used VMF2OBJ-2.0.0-rc.1 (I know you're testing this one out, Have no idea if the changes from the version previous are the problem here)
  • The map had all of the displacements put into the preferred position (Can't recall if I did any changes to rotation in hammer though. Might be rotation editing in Hammer doesn't get translated into the OBJ?)
  • Log appeared successful (No errors, No missing assets. The UI Said everything exported alright)
  • Map Name: "c1_hp1cutscene" (I know some special characters can wack things, Just wanted to show the name just in case)
  • What it looks like when first loaded in Blender (This is the right camera position too, Turned grid off but this is the right view)
    Exmp1
  • What it looks like when flipped to right rotation (You should be able to go to point A- To point B without any obstruction, Along with the hills stopping you from falling off)
    Exmp2
  • What it looks like in Hammer properly (The angle showed here makes one cutoff to the fence look like it could have a wall but it actually doesn't in the editor)
    Exmp3

End Message (Thing-)

This isn't the worst issue, All things considered, I'm hella impressed it worked good as it did. I'll be honest and say I'm pretty dumb, If I'm just spitting out blank info- Please point me in the right direction. All of these can be tweaked manually at least. In the meantime, I'll optimize the displacements in Hammer and or Blender to hopefully get the map I want ready for some animation work. I'm really weirded out by this, But I can hope you can maybe optimize the program.

I'm also willing to give more info, And or debug some things if ya want

Missing faces, misaligned terrain, flipped normals

Hi, I've been trying to convert de_dust2 from CS:GO and have run into a few issues. (Converted using -t)

  • Small sections of walls are missing throughout the map, it looks like some faces weren't exported
  • The floor (terrain) has a large number of missing/misaligned sections, it appears to affect sloped area the worst

image

  • In the exported mesh the map (floor & some walls) seem to have inverted normals, the props all have correct normals

image

Dark areas show backfaces in the mesh

Thanks for this great tool!

SEVERE: Fatal error: java.lang.ArrayIndexOutOfBoundsException: -1

I am trying to convert a Garry's Mod map but I keep getting this fatal error.

The map is RP City Life by Meech.

Here's the log:

SEVERE: Failed to extract tools, do you have permissions?
SEVERE: java.io.FileNotFoundException: D:\Documents\Git\VMF2OBJ\target\VMF2OBJ-2.0.0-jar-with-dependencies.jar (The system cannot find the path specified)
Starting VMF2OBJ conversion v2.0.1
[1/5] Reading VPK file(s) and custom content...
[2/5] Reading geometry...
[3/5] Writing brushes...
Writing Brushes...   0% [>                   ]    1/8475 (0:00:00 / 0:00:25) ?/sSEVERE: Failed to extract material: de_train/train_cementwear_01
SEVERE: java.lang.NullPointerException
SEVERE: Fatal error: java.lang.ArrayIndexOutOfBoundsException: -1
Writing Brushes...   0% [>                 ]    2/8475 (0:00:01 / 1:11:23) 2.0/s

Here is what my files look like:
image

Here is what my settings look like:
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.