Jump to content

Batch material creator


cocopino
 Share

Recommended Posts

Hi,

 

After getting pretty fed up with jerking around with material files all the time I decided to write this little program to batch convert images to DDS files and creating accompanying mat files along with them. Just posting it here in case others find it useful too. You can add more shader options by creating extra files in the templates folder.

 

I'm not sure I'm allowed to distribute makedds.exe so I didn't. You'll need to look it up in your LeadwerksSDK/Tools folder.

 

Vista/Windows 7: Placing the program in folder "Program Files" might cause problems if not run as Administrator.

 

I've also included a little program to batch rename filenames, which helps me achieve the mandatory "models_buildings_medieval_house1.gmf" naming convention by using regular expressions.

 

BE VERY CAUTIOUS WITH RENAMER.EXE!

 

Using it on important files (e.g. your system32 folder) might lead to you having to re-install Windows and/or having a less than pleasant day.

Automat.zip

desktop: Quad core Q6600 + 4GB + ATI HD4890 + XP

laptop: Dual core T6400 + 4 GB + NVidia 9600M GT + Vista 32

Link to comment
Share on other sites

thank you I will give it a try

 

Leadwerks material system is sooooo annoying. For me I export from sculptris, import the 3dcoat, import to blender, export to directory, convert using obj2gmf,create material file, name everything properly, copy to final SDK directory...test. Model shows up all white! I mess up at the blender part. Ok, export to directory again, convert again, triple check material file name, copy to final SDK directory again...test. Pray.

 

I really hope Josh does something to make it less aannnnnnooooying.

Core I5 2.67 / 16GB RAM / GTX 670

Zbrush/ Blender / Photoshop CS6 / Renoise / Genetica / Leadwerks 3

Link to comment
Share on other sites

you're missing it - the reason I even have to take it to blender is because of the way the material system works, instead of being able to make materials interactively inside of the editor as is the case with every other game engine editor I've ever used (blender, visual3d, blade3d, cryengine2) you have to open up a seperate material editor, and also make sure you get the name correct, but where does the name come from? You have to name it the same thing that the (usually) diffuse texture is associated with each surface's UV ( I guess I said that right) - but the programs I used, namely 3dcoat don't comply with that rule very well - and so becasue of that I have to reassociate the diffuse with teh UV map inside of blender. In other words the extra step exists becasue of the way Leadwerks material system works

 

and even if you take that part out of the equation it is still extremely awkward relative to say visual3d.net where if I want to test out a quick model I can just drag and drop it into a folder, it was the same with Blade3d too. Oftentime with leadwerks I just will not even test the way a model looks because it's just so awkward and annoying when u misname a mat file and then have to figure out what you did wrong.

 

Right now I have a some white models in my editor just because I'm avoiding the whole material file hassle right now. One day I might give them a material for leadwerks.

 

It's just not an organic feeling. Especially if you compare it to blender game engine.

Core I5 2.67 / 16GB RAM / GTX 670

Zbrush/ Blender / Photoshop CS6 / Renoise / Genetica / Leadwerks 3

Link to comment
Share on other sites

Well I fail to see how Josh is going to resolve an issue that is inherent to a modeling app's way of naming materials... not to mention its usually different in all the apps out there. This program that cocopino has done helps in that aspect to some degree. What would be ideal is a common interface for all of the existing converters, that allows you to pick the converter, set whatever options needed, convert the model to gmf, detect how many surface materials are in the gmf, and then create the material file based on the selections of different templates (like cocopino's app does). But again, this is something that could be done by the community and Josh shouldn't have to waste his time doing it. Cocopino's app seems like it would be a perfect starting point for an app like this to be produced. He just needs to add the converter interface that just uses the existing converters, set options with it, and then scan the created gmf's for number of surfaces and get each material name, then create a mat file.

 

If Josh was using a standard file format then this probably wouldn't be an issue... but then again it might also limit people's choices for modeling apps. Using his own format and providing several different options for converters, gives people choices.

 

In any case, cocopino's apps here do a great job... it really does help. You add the interface for a converter and you'll have a fantastic super app.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

In any case, cocopino's apps here do a great job... it really does help. You add the interface for a converter and you'll have a fantastic super app.

Nice to hear it's being useful.

 

It's very easy to call the different *2gmf.exe programs according to filename extension, I didn't because I didn't see use for it. When in need of a converter, almost always I need to scale the object as well. And, when scaling the object I've already opened the model in UUnwrap and need to save it anyway.

 

Should the *2gmf.exe programs get a command line scaling option, I'll surely add this and rewrite the app so it will create and run a batchfile doing all the converting while we ourselves can do something useful.

desktop: Quad core Q6600 + 4GB + ATI HD4890 + XP

laptop: Dual core T6400 + 4 GB + NVidia 9600M GT + Vista 32

Link to comment
Share on other sites

yep, i essentially use uu3d as well but when i use 3dws then i use the 3dw2gmf converter which has a scale parameter. I had thought some of the other converters had some options as well, like remove vertex color, scaling... but dont hold me to that... its been a long time... I have a small gui interface for 3dws that just runs the converter in the background in silent mode, but it only allows me to select one model and then automatically copies the resulting gmf to a folder of my choice... i was just thinking yours could easily be setup to do something like this as well.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

dae2fbx.exe /?

Autodesk ImportExport 2010
modified to a command utility by RStralberg, Rimfrost Software, 2009

Usage: ImportExportCmd sourcefile targetfile outputformat

Output formats:
0 = fbx - FBX binary (*.fbx)
1 = fbx - FBX ascii (*.fbx)
2 = fbx - FBX encrypted (*.fbx)
3 = dxf - Autocad DXF (*.dxf)
4 = 3ds - 3D Studio 3DS (*.3ds)
5 = obj - Alias OBJ (*.obj)
6 = dae - Collada DAE (*.dae)

 

fbx2gmf.exe /?

fbx2gmf [-s] [-merge] filename.gmf

-s              silent conversion (optional)
-merge          merge meshes (optional)
filename.gmf    input filename (required)

 

obj2gmf.exe doesn't have any options.

 

So it seems that none of these support scaling, which makes them useless to me (I've never used any of the command line converters because of this reason)

desktop: Quad core Q6600 + 4GB + ATI HD4890 + XP

laptop: Dual core T6400 + 4 GB + NVidia 9600M GT + Vista 32

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...