HOME | DD

XnaFreak — Valve SMD to XPS converter - with textures and RGs

#3d #converter #download #file #script #smd #xps #xnalara #meshascii #application #valve
Published: 2018-08-02 12:37:36 +0000 UTC; Views: 13645; Favourites: 81; Downloads: 780
Redirect to original
Description

Valve SMD to XPS converter take SFM (Source Filmmaker) Models, and convert them to XPS so they can be used with XPS.


Already obsolete and canceled 


NEW smd2xps XpsImportExportScript to load .smd files in XPS
(Valve SMD to XPS mesh.ascii converter)

Currently latest (NEW) version v2.0


So I ask to test the new final smd2xps.exe tool version 2.0 DL   www.sendspace.com/file/uq8vn7

New in v2.0:

- Support for "BoneDict.txt" inside the tool folder, for renaming the Valve bone names to XPS bone names. You can extend this list. New "unknown" bones will be added to the Bone Dictonary by smd2xps itself.
- smd2xps fix now the "pure white" XPS issue. thx at silkroad820420  for detect it comments.deviantart.com/1/7620…
- Radio button to create Normal maps for XPS (using blue channel range from 127 to 255) or for Blender (using blue channel range from 0 to 255 )






HOW to use?
-> comments.deviantart.com/1/7574… <-





Outdated:

SSPD077  has requested to create a script for importing some other 3D format models to XPS .
Now, we have a Valve SMD importer for XPS.

Many thanks to for his patience and support.
Done
The script import SMD Mesh and textures and Armature/Bones.
The material informations are parsed from the Valve .vmt files (Color and Normal maps)
Transparency detection and support

How to use?
Unzip it  as "XpsImportExportScript.cs" in XNALara_XPS\scripts by overwriting the existing script. 
Run it with "Commands->Run Import/Export script ..."
Select your .smd file(s)

TODO
- To convert the .vtf files (images) to .png
- To extract the specular maps from the normal map alpha channel

Update


   private static bool FLIP_UV = false;
   private static bool ROTATE_X = true;
   private static bool SCALE = true;


Related content
Comments: 70

silkroad820420 [2018-09-14 08:12:58 +0000 UTC]

thank you so much!

👍: 0 ⏩: 1

XnaFreak In reply to silkroad820420 [2018-09-14 08:33:07 +0000 UTC]

n.p.

👍: 0 ⏩: 0

HarleySin [2018-08-18 18:52:10 +0000 UTC]

Wow you really did it
Need to test it too. I am curious how it will work.

Feel free to ask me next time to test it. I always make time to help friends.

👍: 0 ⏩: 1

XnaFreak In reply to HarleySin [2018-08-20 10:59:47 +0000 UTC]

Already obsolete and canceled

So I ask you to test the new smd2xps.exe tool


How to use?
1) unzip the smd2xps tools in any folder
2) copy all model data files in a new model data folder. All .smd (geometry), all .vmt (Valve Material Type) and all .vtf  (Valve Texture Files)
3) Run smd2xps.exe ; press the "load smd" button and select any of the .smd files. All of the smd files will be parsed and merged to one .mesh.ascii model.
4) Wait until the "Exit" vutton is activated and press it.

What does the tool?
1) convert the smd files to .mesh.ascii
2) scale the model from Valve inch to XPS meter and change the rotation
3) extract and convert all textures as png
4) Set the matching Render Group Numbers and parameters
5) Extract the specular maps from the normal map alpha channel
6) Convert the Valve Normal map blue channel to the XPS  syntax
7) Change the Valve cullmode cw (clock wise) to the XPS backface cullmode ccw (counter clock wise)
8) Merge all model parts to one single model
9) ...
...

TODO
Implements Half Lambert  lighting, developer.valvesoftware.com/wi…
Implements Phong Fresnel shader
Vertex transparency
Renaming bone names from source engine to XNALara reference  www.tombraiderforums.com/showp…
...
...

👍: 0 ⏩: 3

XnaFreak In reply to XnaFreak [2018-08-28 09:09:56 +0000 UTC]

BUG fix with version 1.5  thx  TSelman61 for reporting it
Vertex transparency with version 1.4 thx HarleySin  for reporting it
Renaming some bones with version 1.3

First seen model, ported with my smd2xps tool: 

Mature Content


smd2xps tool test WIP   using "transparency" dedection with version 1.4
Without "transparency" dedection (v1.3) 

👍: 0 ⏩: 0

XnaFreak In reply to XnaFreak [2018-08-22 12:13:17 +0000 UTC]

Renaming bone names from source engine to XNALara reference started with the new version 1.3

👍: 0 ⏩: 0

HarleySin In reply to XnaFreak [2018-08-20 22:16:24 +0000 UTC]

Setting the matching render group really saves time. Instead of renaming each mesh in Blender.

You already work on the next gen?!
Ok i tried it with 2 models.

--------------------------------------------

1st:sfmlab.com/item/3062/ (Shrek model)
+
I decided to pick a simple model first.
With crowbar i converted the downloaded mdl file to smd. Can that cause any issues?
My settings create vta files and qci files. It seemed not to distract it.

I proceeded as you wrote and after loading by drag and drop the generic_item.mesh file Shrek loaded properly into xps.
Beside the scaling. He was super huge which tells me STEP 2 didnt work properly.

The Shrek model only has one mesh/smd file. It was renamed like this in the material editor:
5_Material--30_0.2_0_0

---> I would call it a success.


2nd:sfmlab.com/item/2673/ (Auriel nsfw model)
Again i converted the mdl file to smd with crowbar.
Proceeded as you wrote and loaded all files in one folder.

This model has 23 smd files.
I deleted the vta and qci files in this case because my first on this model generated a generic_item.mesh file that would load something invisible into Xps
with just a root ground. So it did on my 2nd try without the vta and qci files.

But the materials were displayed properly and renamed in the material editor. Ready and applied with the textures.
Transparency was not checked.

Shall i provide you the generic_item.mesh file?
-------------------------------------------------

Your tool looks very promising.
I will try more models^^

👍: 0 ⏩: 1

XnaFreak In reply to HarleySin [2018-08-21 05:34:49 +0000 UTC]

thx for testing. Very appreciated.

1st: 

 Crowbar should not cause any issues.
I know that  Crowbar produce a SMD file, which does not comply with the Valve SMD specification for the SMD header:

// Created by Crowbar 0.56
version 1
nodes

Comment lines ("// Created by Crowbar 0.56") are not allowed in SMD! My tool has no trouble to read and parse it.

 I am sure, STEP 2 (scale down with factor 0.0254) works fine. Perhaps IS Shrek "super huge"; perhaps Crowbar scale it wrong; perhaps the MDL file is wrong.

2nd:

vta and qc files should not cause any issues. Strange. Perhaps, to find the qc file, you have changed the "file ordering" in your "Windows Explorer" (ex from "by name" to "by type"), and this produce the wrong .mesh.ascii. I will check this.

Transparency will be checked, if the matching .vmt contains the translucent true shader parameter.
$translucent 1
Also the wrong vmt
"$translucent" 1
should works. Perhaps, the model us another Transparency parameter? To implement alpha , based on  vertex color transparency, is on the TODO list (two minutes to implement it )

----

Yes, please  provide the files. 
For 1th (Shrek), please provide the smd and the generic_item.mesh.ascii file
For 2nd (Auriel) both generic_item.mesh.ascii files (or even better the whole test folder with vta and qc files)

👍: 0 ⏩: 1

HarleySin In reply to XnaFreak [2018-08-21 12:59:33 +0000 UTC]

I guess that the files are weird/wrong and not your tool either. I loaded the Crowbar converted smd/qc files of the Auriel model
into Blender and there were meshes missing.

But as i converted them with Noesis to mesh.ascii they got displayed properly in Blender.
I pm you the files later today

👍: 0 ⏩: 0

TSelman61 In reply to ??? [2018-08-04 21:51:22 +0000 UTC]

Wow, looks really nice.  But I think there's a problem. I'm probably an idiot.

I copied your "XpsImportExportScript_org.cs" file to the "...XNALara_XPS\scripts" folder. But since I had 2 from the same file, I replaced it with the previous one.(overwriting)
But nothing changed. But he's still running the Witcher script.  

Then I deleted the "XpsImportExportScript.cs" file.
I copied the "XpsImportExportScript_org.cs" file and the rename is "XpsImportExportScript.cs".

And run this time.  But UV maps are horizontally flipped.  Should we fix them manually?
I tested it on v11.8.  

👍: 0 ⏩: 1

XnaFreak In reply to TSelman61 [2018-08-05 07:58:23 +0000 UTC]

Finally, someone has tested it.

My failure Too times

First issue
I forgot to rename the script to XpsImportExportScrip.cs.  

1) Right woud be: Unzip it  as "XpsImportExportScript.cs" in XNALara_XPS\scripts by overwriting the existing "XpsImportExportScrip.cs" script.
2) deleting the "XpsImportExportScript.cs" file is also  enough.
My findings are, XPS uses the "XpsImportExportScript_org.cs" file if either the file "XpsImportExportScrip.cs" is missing, or this "XpsImportExportScript.cs" has any syntax error.



Right, UV maps are horizontally flipped (I have implement this, because the .tga texture images of your Aiden model was flipped.)

2nd issue

You can edit this quickly with Notepad (text editor)
Change Line 16 (Ctrl+G 16) from
private static bool FLIP_UV = true;
to
private static bool FLIP_UV = false;

EDIT:
Upload is updated now, with both fixes.

👍: 0 ⏩: 1

TSelman61 In reply to XnaFreak [2018-08-07 06:47:35 +0000 UTC]

These are small things that can be corrected.
It's not a problem anyway it's a great thing.

Okay, the problem is solved. But there are a few more problems. So I waited for your updates. (I think you've updated.) For this reason I wrote a little late reply.

Another issue is that "Texture maps" should be in PNG format.
But I think Script is interested in .dds files. Then I changed that.  
     (".dds" to ".png")  I think you should change one of them.

Another
   The imported model is oversized and in a horizontal position.
Last
  If me do not get it wrong, you say that  supports the  Normal Map. I guess I do not know how to do it. SMD2XNA Just Diffuse
  First I tried it with .wtf names.  SMD2XNA Normal 0  It did not work
  Then I noticed that. SMD2XNA Bump  Then I changed their names. SMD2XNA Normal 1  It did not work again, Is it because of not being "Specualr Map"?   


Thanks in advance.

👍: 0 ⏩: 2

XnaFreak In reply to TSelman61 [2018-08-07 11:57:13 +0000 UTC]

EDIT
script updated with rotate X -90° and scale 0.0254 (Valve inches to XPS meters)

textures
I  guess that the file aiden_coat_d.vmt was not found, and your .smd file was in the "models/player" folder


Just wondering.
You screen SMD2XNA Just Diffuse  shows  in the "Materialform":
mesh name
5_models/player/aidenpearce/aiden-coat-d
and in Control GUI:
model name
player

My Materialform (also XPS 11.8) show as mesh name
4_Aiden-coat-d
and as model name
SMD Format

The path "models/player/aidenpearce/" in your screen is wondrous.

my aiden_coat_d.vmt file contains
"$basetexture" "models/player/aidenpearce/Aiden_coat_d"
"$bumpmap" "models/player/aidenpearce/Aiden_coat_n"

My folder tree is:

Aiden Pearce  +
              + SMD Format
                           - aiden_pearce_AidenPearce.smd
                           + Texture
                                     - aiden_coat_d.tga
                                     - aiden_coat_n.tga
              + MDL
                           + Materials
                                      - aiden_coat_d.vmt


Also, because the .smd is in "SMD Format", the model name is "SMD Format"
        the .vmt is searched in or downstream the folder(s)"SMD Format" and  inside or downstream  the "..\SMD Format" folder(s)
        the image files (just the basenames, like "aiden_coat_d" and "aiden_coat_n", without extension like ".tga" or ".dds" or ".png" and without the path from the .vmt archive like "models/player/aidenpearce") are ONLY  searched in or below the folder "SMD Format" (model name).

I assume, your folder tree is:

models/player/aiden_pearce_AidenPearce.smd

Your "aiden_coat_d.vmt" is perhaps in

models/player/aidenpearce/aiden_coat_d.vmt

but your textures are not in

models/player/aiden_coat_d.xxx
models/player/aiden_coat_n.xxx


???


confused? me too (How to survive 35 degree celsius heat in my home? )

1) Make a new folder below "XNALara_XPS\data\" like
    "XNALara_XPS\data\Aiden Pearce"
2) Copy the .smd files, the textures (what is your image format?) and the .vmt file in this new folder. Like
    "XNALara_XPS\data\Aiden Pearce\aiden_pearce_mask.smd"
    "XNALara_XPS\data\Aiden Pearce\aiden_mask_d.vmt"
    "XNALara_XPS\data\Aiden Pearce\Aiden_mask_d.png"
    "XNALara_XPS\data\Aiden Pearce\Aiden_mask_n.png"
3) Rund the importer script

👍: 0 ⏩: 0

XnaFreak In reply to TSelman61 [2018-08-07 09:32:23 +0000 UTC]

Yes, it is planned to update the script.

I will later translate your comments (later).
What is going in my mind right now?
 Right, the right scale is 0.026 (??) and "root ground" xX -90°   I'm just not sure if this is always the case, or only with the 2 models I get by  you.

Right, the script supports normal maps (if the images are unpacked, .vtf is in the TODO list).
material_name.dds is just a "fallback" (default) if the matching texture (described in the available .vmt file) is not found in your hard disk folder. The script let (currently) in this issue, XPS creating the maps.

Ex:  aiden_pant_d.vmt
"$bumpmap" "models/player/aidenpearce/Aiden_pant_n"
will assign
aiden_pant_n.tga
or
aiden_pant_n.dds
or
aiden_pant_n.png
or wathever the file extension on your hard drive is. XSP supported texture (and image) formats: PFM (Portable float map), DDS, BMP, JPG, TGA, PNG, PPM, DIB, HDR

default value
aiden_pant_d.dds
Render Group Number 5_ (RG 7_ if "$translucent" 1)

👍: 0 ⏩: 1

TSelman61 In reply to XnaFreak [2018-08-08 15:02:42 +0000 UTC]

Great Job. You've made updates.  It works really well.

Now I will work on the normal map. I try different permutations.  I do not have much time, so I don't want to prolong the word.

You can try it on more models.(For  "Right, the right scale is 0.026 (??) and "root ground" xX -90° ..." )

 sfmlab.com/
Source Filmmaker steamcommunity.com/app/1840
Garry's Mod   steamcommunity.com/app/4000
    you can find it from many places.

Get rid of the problems in your head with more models.  In my free time I will try different models.

👍: 0 ⏩: 1

XnaFreak In reply to TSelman61 [2018-08-08 15:25:44 +0000 UTC]

thx

right, script is updated and contains

   private static bool FLIP_UV = false;
   private static bool ROTATE_X = true;
   private static bool SCALE = true;


About normal map, I have answered here sta.sh/01ntclk0xpii

thx for the hint "more models", I like to continue my tutorial about "The backface culling Myth" and to update the SMD script, rather than try it on more models > CIP
Like “The Banana Principle”... , and even more like the Perpetual beta (also called 'banana principle') > "Deliver it early and immature. It will mature on its own by the users (your) work (review)."

BTW: The right scale was 0.0254 ("inch to meter"  Valve use values in inch, XPS use the unit meter).  I'm probably an idiot.

👍: 0 ⏩: 0

necroalx In reply to ??? [2018-08-02 12:47:48 +0000 UTC]

Nice! looking forward to trying this.

👍: 0 ⏩: 1

XnaFreak In reply to necroalx [2018-08-02 12:49:55 +0000 UTC]

You are a porter?
I am very interested in your experiences with it.

👍: 0 ⏩: 1

necroalx In reply to XnaFreak [2018-08-02 13:23:11 +0000 UTC]

I mostly only used to mod game models for ps2 games and some old pc games back in the day, mostly texture mods. I've only started getting into posing and modding models very recently. I'll let you know how it works for me then

👍: 0 ⏩: 0