STEAM GROUP
Blender Source Tools BleST
STEAM GROUP
Blender Source Tools BleST
272
IN-GAME
1,804
ONLINE
Founded
November 8, 2013
All Discussions > Help > Topic Details
T.A.G. Oct 28, 2020 @ 3:14pm
Exporting a TF2 map/model as an .obj with textures from Blender.
I have almost no clue what I'm doing so I'd appretiate if someone pointed me in the right direction. I used this https://github.com/lasa01/io_import_vmf/ to import a TF2 map into blender.
The result I need is to get an obj file to use it elswhere. No matter what I do, when I am trying to export an obj file from this blender project, I get the obj file itself, the mtl file with useless text where the material path should be, and no materials at all. Ideally what I want to achieve is an obj file, mtl with absolute or relative texture paths and a number of png images, those being the textures. Is there any easy way I can achieve this, or shold I give up on this idea?
Last edited by T.A.G.; Oct 28, 2020 @ 3:49pm
Originally posted by Pte Jack:
BleST does not have anything to do with textures in Blender.

BleST only gets material information from the model it imports, that's it.

If you want a model textured in Blender after importing with BleST, you have to convert the VTFs to an image format that Blender can use (ie Png) and manually set up the nodetrees for the material to use the converted textures. BleST does not load or export textures.

This add-on you've found is using code from multiple add-ons and programs and this is a quick idea of what I think is going on (pure speculation, I really don't know unless I analyze the script.)

1) the io_import_vmf add-on is importing the brushes and texture information from the map decompiled using BSPSource. It is also gathering Model/Prop data contained in the map from the VMF.
2) then it's calling Crowbar to extract those models from the VPKs and sticking them into the map cache folder where it also uses Crowbar to decompile them there.
3) once decompiled it calls BleST to import them and using VMF data places them where they need to be. It also gathers more VMT info from the models through BleST.
4) it then calls Crowbar to extract the VTFs
5) and uses IO_Source to convert the textures from VTF to PNG format and goes about texturing the map in Blender.

These temporary PNGs are not being saved and they are not being packed into the blend file. They are immediately replaced as new textures are called, converted and used. (this is the bug to this add on that I see right now). Blender retains information about the previously used textures as long as the blend file is open. However, because these texture references are internal and not saved or packed, they are lost as soon as the file is closed.
< >
Showing 1-15 of 24 comments
Pte Jack Oct 28, 2020 @ 3:27pm 
Have you submitted a bug report to the Add-on authors or asked for their assistance via the GitHub?
T.A.G. Oct 28, 2020 @ 3:31pm 
No, I took a gamble and asked here because I thought that his add-on probably uses Blender Source Tools (since it's required for the add-on to work) to handle materials. Hoped maybe someone already had a similar issue here.
Pte Jack Oct 28, 2020 @ 3:36pm 
I've just downloaded it to have a look at it. I didn't know it existed until you posted this.
T.A.G. Oct 28, 2020 @ 3:37pm 
Update: I have just attempted to use exclusively Blender Source Tools to make an .obj out of a random .mdl and I got no materials yet again. So in fact I did send my question to the right place it seems.
Pte Jack Oct 28, 2020 @ 4:47pm 
I'm looking at this right now and have a map importing, and you would not use BleST to export an OBJ.
T.A.G. Oct 28, 2020 @ 4:52pm 
I can't get materials to be exported along with the obj for a model that was imported into blender using BleST. I once imported some random 3d model from the internet into blender and exported obj with materials without issues, but I can't get it to work for models imported with BleST, or that other add-on for maps.
T.A.G. Oct 28, 2020 @ 4:53pm 
I'm trying to export through File - Export - Wavefront (.obj) (I can see how my previous comment can be misread, what I meant is I imported a random TF2 model with BleST and tried to export it nto .obj)
Last edited by T.A.G.; Oct 28, 2020 @ 4:55pm
Pte Jack Oct 28, 2020 @ 5:40pm 
I think the add on you mentioned in your opening is using code from IO-Source (a different Add-on) to import VTFs as PNGs to what I thought was packed images in the Blend File. However when I try to send packed images back to folders, the function is not doing this. So I'm trying to find the temporary location that the PNG are being saved in to texture the map (no luck so far).

That said, When you export a OBJ (with materials) the export function exports a Model (the Obj) and a Material reference (the mtl file). It does not export or create textures.

Exert from the .mtl file
----
newmtl brush/beach/decal/b_o_d_19_marker
Ns 9.000004
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.100000 0.100000 0.100000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_Kd textures\\brush_beach_decal_b_o_d_19_marker.png
map_d textures\\brush_beach_decal_b_o_d_19_marker.png

newmtl brush/beach/decal/b_o_d_a_marker
Ns 9.000004
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.100000 0.100000 0.100000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_Kd textures\\brush_beach_decal_b_o_d_a_marker.png
map_d textures\\brush_beach_decal_b_o_d_a_marker.png
----
These are the materials the model uses and the call to the textures (path/image.png) that the material commands are controls

If these are not physical files (and like I say, I'm haven't found them anywhere) then to get them you're going to have to convert the VTFs to the path and image format that the mtl file is calling.
T.A.G. Oct 28, 2020 @ 5:47pm 
Well, me being a noob, I can't comprehend how it is possible that the texture doesn't exist anywhere yet blender displays it perfectly fine. I assume BleST lets Blender read VTF files but not export them or something? Manually converting them is obviously not an option since I'm working with a whole map which has tons of materials.
Pte Jack Oct 28, 2020 @ 5:56pm 
BleST does not read VTF file. The map add on uses BleST to import the prop models into the map. this is something you are going to have to go back to the IO_import_VMF add-on author about, it has absolutely nothing to do with BleST. BleST is doing its job perfectly from what I can see.

In fact, if you save your blend file, close it then reopen it, the map will come in Purple, meaning it can't find the textures it needs to paint the mesh objects.
Last edited by Pte Jack; Oct 28, 2020 @ 5:59pm
T.A.G. Oct 28, 2020 @ 5:59pm 
So what's the explanation for me not being able to export textures for a single model either?
The author of this thread has indicated that this post answers the original topic.
Pte Jack Oct 28, 2020 @ 6:35pm 
BleST does not have anything to do with textures in Blender.

BleST only gets material information from the model it imports, that's it.

If you want a model textured in Blender after importing with BleST, you have to convert the VTFs to an image format that Blender can use (ie Png) and manually set up the nodetrees for the material to use the converted textures. BleST does not load or export textures.

This add-on you've found is using code from multiple add-ons and programs and this is a quick idea of what I think is going on (pure speculation, I really don't know unless I analyze the script.)

1) the io_import_vmf add-on is importing the brushes and texture information from the map decompiled using BSPSource. It is also gathering Model/Prop data contained in the map from the VMF.
2) then it's calling Crowbar to extract those models from the VPKs and sticking them into the map cache folder where it also uses Crowbar to decompile them there.
3) once decompiled it calls BleST to import them and using VMF data places them where they need to be. It also gathers more VMT info from the models through BleST.
4) it then calls Crowbar to extract the VTFs
5) and uses IO_Source to convert the textures from VTF to PNG format and goes about texturing the map in Blender.

These temporary PNGs are not being saved and they are not being packed into the blend file. They are immediately replaced as new textures are called, converted and used. (this is the bug to this add on that I see right now). Blender retains information about the previously used textures as long as the blend file is open. However, because these texture references are internal and not saved or packed, they are lost as soon as the file is closed.
Last edited by Pte Jack; Oct 28, 2020 @ 6:54pm
T.A.G. Oct 28, 2020 @ 6:53pm 
Your explanation is a bit too complex for me to understand, so could you answer this instead please. At this point I think I might be misunderstanding the difference between materials and textures or something. Forget about the map add-on. Let's say I make a new blender file and import medic.mdl. He gets imported not as just a white object, but fully colored with appropriate materials. And when I select Shading I can see there is something resembling "nodetrees" you mentioned. So what's going on, is that not something that can actually be exported as a PNG along with OBJ?
Pte Jack Oct 28, 2020 @ 6:55pm 
Wait a minute... Maybe there's been an addition to BleST i'm not aware of. Let me check something out.
Pte Jack Oct 28, 2020 @ 7:32pm 
Keeping this simple.
.
VTM (Material, is a plain text file containing calls to the textures and how to display them in a Valve Source game engine.)

VTF (Texture, is a proprietary Image file format used to texture a Valve model. Blender can not use VTF texture files, these files have to be converted into a compatible image format before they can be used in Blender.)

And No, as I said, BleST does not import textures. It never has and there's nothing new in the documentation to indicate that it imports textures now.

When you import a model using BleST, it reads materials information (VMT names and what mesh uses what material) from the model when it it imported and that Material information is added to the mesh objects imported. BleST does not set up Shader NodeTrees from the materials.

The mesh will import using the Blender default texture for mesh (greyish white) and if you click the Material or Render view mode buttons in the 3D Viewer, the mesh will not texture on a model imported using BleST.

You have to manually turn on Use Nodes in the materials tab, convert the required VTFs to compatible image format, manually add Image texture nodes to the nodetrees then point them to the converted images and then plug them into the input nodes of BSDF shader being used.

If you are getting textured models in Blender on import then you're using a different add-on to bring in the SMD/DMX or QC files you're importing. It's Not BleST.

I suspect you're looking at a model that was imported by the add-on you first mentioned when you tried to import a map. Through the process it uses (and I tried to outline above) has used the code for IO_Source and that code has textured the model.

Last edited by Pte Jack; Oct 28, 2020 @ 7:33pm
< >
Showing 1-15 of 24 comments
Per page: 1530 50

All Discussions > Help > Topic Details
Date Posted: Oct 28, 2020 @ 3:14pm
Posts: 24