h2xdev / godotvmf Goto Github PK
View Code? Open in Web Editor NEWA VMF importer for Godot Engine
License: MIT License
A VMF importer for Godot Engine
License: MIT License
Material importer ignores VMT properties other than $basetexture and VTF data other than the single image that is the base texture.
The biggest issue is the lack of mip texture export. Even with VTFs where mip textures are included, the importer ignores them.
It would be great if the most used properties changed Godot material properties such as $translucent turning transparency from disabled to alpha.
Hello, I am a developer working on a game in the Godot Game Engine and it was truly strange to me that your project was announced literally just a day before I got started on making the project I intended on making now, gotta say, that's pretty handy. On the other side of things though, I am a Linux user and have been trying to acquire the most native files that I can get to get started, so far I have gotten BSPSrc, VPKEdit, VTFCmd with Wine but as to where I can find another copy of mdl2obj I am somewhat completely stumped.
It's not as if I don't trust you or anything, but I'm personally wondering where mdl2obj.exe comes from, how it works, etc. I plan for players of my game to be able to create levels in VMF files and load them at runtime, but them requiring all of these tools and having to set all of it up is somewhat of a pain, luckily for some tools like VTFCmd, I know where certain links are and I know what licenses certain softwares use, like BSPSrc is public domain, which is great! But mdl2obj?
Where did you get that, exactly, did you make it? Is it related to https://github.com/fzwoch/mdl2obj ?
What license is it, can I compile a native version of it for Linux? Can I look at it's source code? I am very keen on learning the ins and outs of the source engine and as far as I have searched, I cannot seem to find it.
If you have any information, please let me know :)
I have come from the reddit post and I mentioned on using linux, I have spent a few days on trying to get the hammer++ to work on linux and I finally got it working, now I have tested your plugin and it seems to work so far with basic geometry squares and rectangles (havent tested complex geometry yet) and it seems to work for that, but the textures dont seem to load in, though I am missing one third party dependency since it is an exe file I am not sure how it will work on the linux side.
I'm sorry for the long hold, I had trouble with college that I had to deal with first. Good job on improving the plugin by the way, I'm immensely happy with how nicely it's coming along.
Here's a list of issues and enhancement proposals for the model and material import:
Use VPhysics
, nothing for Not solid
or a bounding box for Use bounding box
.props_combine/stasisvortex.mdl
is missing transparency.items/ammocrate_smg1.mdl
and props_c17/tv_monitor01.mdl
have weird artifacts.props_combine/combine_booth_short01a.mdl
glass on the front is only visible from the inside, on the sides is only visible from the outside.props_c17/paper01.mdl
is invisible from the bottom.metal/metalfence007a
is not backface culled but it should be.Another thing, it's probably a dumb question but I want to know if it's even possible to somehow have shaders from the materials translated to compute shaders that can be used in Godot with any sort of accuracy, if at all.
Here are the errors I am getting:
Here is what my config looks like:
{
"entitiesFolder": "res://examples/entities",
"gameInfoPath": "C:/Program Files (x86)/Steam/steamapps/common/Team Fortress 2",
"instancesFolder": "res://examples/instances",
"materialsFolder": "res://examples/materials",
"mdl2obj": "res://mdl2obj.exe",
"modelsFolder": "res://examples/models",
"nodeConfig": {
"defaultTextureSize": 512,
"fallbackMaterial": null,
"generateCollision": true,
"generateCollisionForModel": true,
"ignoreTextures": [
"TOOLS/TOOLSNODRAW"
],
"importModels": false,
"importScale": 0.025,
"overrideModels": true,
"textureImportMode": 1
},
"vtflib": "C:/Program Files/Nem's Tools/VTFEdit"
}
I am using Godot 4.2.1 stable.
The map I tried importing is this.
I'm somewhat of an experienced developer, so I thought about fixing stuff myself, but I'm not too confident in knowing how GodotVMF works yet and I don't feel like making commits to the project if my use case is going to be extremely specific, so I thought I'd let you know about these kinds of things, because for the past few days, I've been trying to get a custom map, particularly a surf map, to load for testing by using GodotVMF.
Before update 1.2.0 (Displacement) I was able to get the map to load correctly, although the models were missing their textures and everything else was too because I hadn't extracted the vpk. A full map and no textures is completely fine because I can just substitute the missing textures with my own materials, but as of right now, importing the map doesn't seem to work.
First, though, I need to talk about my setup, here is my config:
{
"entitiesFolder": "res://assets/entities",
"gameInfoPath": "/home/lachrymogenic/Development/Godot Engine/VMFTest/mesa/",
"instancesFolder": "res://assets/materials",
"materialsFolder": "res://assets/materials",
"mdl2obj": "/home/lachrymogenic/Development/Godot Engine/VMFTest/mdl2obj",
"modelsFolder": "res://assets/models",
"nodeConfig": {
"defaultTextureSize": 512,
"fallbackMaterial": null,
"generateCollision": true,
"generateCollisionForModel": true,
"ignoreTextures": [
"TOOLS/TOOLSNODRAW"
],
"importModels": true,
"importScale": 0.025,
"overrideModels": true,
"textureImportMode": 1
},
"vtflib": "/home/lachrymogenic/Development/Valve Dev Utilities/VTFCmd/vtfcmd.sh"
}
just incase you're wondering, yes, I put vtflib in a completely different location and yes it is a shell file but it does indeed work, it runs wine and passes all the arguments to the wine executable.
Attempting to study how the code works, I set my gameinfo folder to the folder that BSPSrc produces when you extract a map with the "Extract embedded files" option on. I moved this folder to the project folder. On the old version, it works and imports in custom materials from that map. I also had to change the code because materials and other stuff wouldn't load in general because for some reason the code tries to apply .to_lower()
to the path files, for what reason is somewhat unknown. Simply encasing code like
var vtf = (config.gameInfoPath + '/materials/' + baseTexture + '.vtf')\
.replace('//', '/') \
.to_lower()
with
var vtf = (config.gameInfoPath) + ('/materials/' + baseTexture + '.vtf')\
.replace('//', '/') \
.to_lower()
is what allows me to use my gameinfo path, which includes uppercase letters. I've often had to restart and reload the project multiple times in order to get it working correctly.
Everything was fine in the old version except for an issue where I cannot load custom model materials. But as of right now, my output is spamming this: `Vertex amount (8) must be a multiple of the amount of vertices required by the render primitive (3)' and I'm not sure why though I can only conclude that the Displacement feature is unfinished and other commits have broken functionality of the importer, such as the merging of "develop" into the main branch. This is what it looked like before and after
(I had to redo the before image and models take too much time to load and materials are being a pain rn so I didn't load them in, just pretend that they're there and some textures on the wall are actually there in this image etc.)
With all this being said, I'm not sure if there is anything else that I can provide to help diagnose the issue, maybe I'm the issue, because in trying to revert back to the old version, I have managed to screw myself over and now absolutely NO entities are rendering... except they are now for some reason?
I reverted to the version I was using 3 days ago and moved some parts of my config from res://assets (my own folder) to res://examples and renamed the name of the map to use all lower case, turn off import models in the config and loaded up a completely different map and I've managed to get entities to import again
Very weird, I'm going to attempt to study more about how this code works and then modify it to work with my use case, get it to load model materials, but I still thought I should let you know and also that there may be things you might want to tweak, like using all lower case stuff for file paths is a pretty bad idea when most people have capitals in their file paths, I don't know if Windows disregards it or something but Linux for sure doesn't like that.
To be honest, I should have studied it first instead of blindly trying to load in decompiled BSPSrc maps and expecting it to just run perfectly, but if I do manage to learn enough about your project that I'm able to fix some things, I still might be apprehensive to commit due to the potential possibility that whatever works for you breaks for me and vice versa, though I am really keen on using and potentially helping with this project.
.to_lower()
is there sometimes.I don't expect others to do all the work for my issues but what I'm worried about is that the devs of this project have real working model support and displacement support that just works for them but not for me and by optimizing it to work for me, it won't work for them. This might be related to the fact that I am using decompiled maps instead of maps made with Hammer++
Currently the code for mdl2obj is shipped as a Windows executable mdl2obj.exe.
I suppose it makes sense to not ask users on Windows to go install Node.js. For better support of Linux and macOS I would advocate to ship the raw Javascript and ask those users to simply install Node.
I would be happy to create a Pull Request with those changes if you think that is good enough of a solution.
As a side note the mdl2obj repo seems to be missing the source-mdl source code that is required to make it work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.