UnitConverter obj->bfxm

A forum for the discussion and development of programs to assist working on or playing with the Vegastrike engine and data sets.
Post Reply
pyramid
Expert Mercenary
Expert Mercenary
Posts: 988
Joined: Thu Jun 15, 2006 1:02 am
Location: Somewhere in the vastness of space
Contact:

Post by pyramid »

jackS
Minister of Information
Minister of Information
Posts: 1895
Joined: Fri Jan 31, 2003 9:40 pm
Location: The land of tenure (and diaper changes)

Post by jackS »

Informational:

If you look at the Clydesdale, you'll see that each of the 3 component meshes has their own LODs. They should do their LODing independently (but I haven't checked that recently)

Animation support currently requires specifying every frame in the animation completely :-P
The wormhole model is the only "animated" model I'm familiar with

There was, last I checked, an "accessory" subtype of subunits that uses a neutered AI, but I'm not sure that's what people were looking for.
pyramid
Expert Mercenary
Expert Mercenary
Posts: 988
Joined: Thu Jun 15, 2006 1:02 am
Location: Somewhere in the vastness of space
Contact:

Post by pyramid »

I haven't come to test or integrate LOD meshing into the UnitConverter, but did improve the tool and uploaded version 0.07. The features now are limited to:
* convert model meshes
* convert shield meshes
* compress main textures
* compress faction textures
* remembers master textures
* obj/mtl error checking and validation
* create an mtl file

Hopefully without errors.
pyramid
Expert Mercenary
Expert Mercenary
Posts: 988
Joined: Thu Jun 15, 2006 1:02 am
Location: Somewhere in the vastness of space
Contact:

Post by pyramid »

Version 0.09 of the Unit Converter is now available in trunk/modtools/UnitConverter/.

Rudimentary functionality capable of supporting basic model and texture conversion operations is in place. With the tool you can now:
* assign textures to models
* convert model meshes
* convert shield meshes
* compress default master textures to dds
* compress faction master textures
* change techniques
* change blend mode
* create new mtl file or default mtl file if none exists
* select factions from an option dropdown
* view on-screen instructions for each workflow module
* copy the converted files to the units data dir for the model. If the dir doesn't exist, it will be created.

The tool is cross-platform. You will require python 2.5.x to run it.
Tkinter offers only limited functionality and in many cases some workarounds are required. The app remembers some of the settings after reinstantiation and has limited error checking and validation. It will also back-up mtl/bfxm/xmesh files before writing them again. If you have a good idea on how the workflow can be further improved, please post here. As this is my first python and my first tkinter app, the internal organization is a bit messy. My apologies for eventual difficulties in understanding the code.

Though I have not yet tested this version on Win, I do not expect too many profound bugs. In any case, please report errors in this thread.

Further workings will go towards the following features:
* check textures for POT dimensions
* check textures for image types accepted by nvcompress
* could have a unit.csv entry creator (stats, hud imae, shield mesh, turrets, ...)
* could import and display model using OpenGL
* integrate LoD and submesh processing

I'm open for any further feature suggestions you'd like to see implemented.

For LoD and submeshes I'd require a reference model. Clydesdale was mentioned in several places as being the subunit reference. Might check that out............ OK. It has LoDed subunits but no LoD specific textures. Might just create them myself.

And here some questions:
1) Does the technique A entry in the mtl file specify for A the name of the technique file from the data/techniques folder without th extension, e.g. "highend", or "cel"?
2) How are the techniques reflected in the xmesh files?
3) What doe the entries in blend mode actually mean? Whan is ONE, ZERO, SRCALPHA, INVSRCALPHA? And why a tuple? Is it (RGB, A)?
4) How do I setup the CineMut family for testin with the motorbike? Do I just copy the shader and technique files and change the default shader in vegastrike.config or must I do anything else?
5) Is CineMut ready for submission to svn?
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Post by chuck_starchaser »

pyramid wrote:And here some questions:
1) Does the technique A entry in the mtl file specify for A the name of the technique file from the data/techniques folder without th extension, e.g. "highend", or "cel"?
Something like that. We need a naming convention, like <texturepackingname> would be specified in the bfxm file,
but at runtime it would fleshed out to something like
"<texturepackingname>_<GPUbrand>_<qualityversion>.technique".
2) How are the techniques reflected in the xmesh files?
What characterizes a "technique" the most is actually the texture packing format. So, if an xmesh file specifies "Cinemut", it actually specifies that dielectric constant is in the blue channel of the second texture. There could be other shaders in the future, called something other than "CineMut", that make use of the same texture packing.
3) What doe the entries in blend mode actually mean? Whan is ONE, ZERO, SRCALPHA, INVSRCALPHA? And why a tuple? Is it (RGB, A)?
"ONE ZERO" is used for solids. "ONE INVSRCALPHA" is used for transparencies. "SRCALPHA INVSRCALPHA" is actually more standard for transparencies, but it is easy to multiply the result by SRCALPHA in the shader, so we use "ONE INVSRCALPHA" instead. With current shaders, the same shader can use both. With CineMut, there will be separate shaders for solids and transparencies: CineMut Opaque and CineMut FireGlass. So, when I export obj, I export all the opaque stuff to one mesh for use by CineMut Opaque, and then another, smaller mesh with windows and emissive polygons for use with CineMut FireGlass.
4) How do I setup the CineMut family for testin with the motorbike? Do I just copy the shader and technique files and change the default shader in vegastrike.config or must I do anything else?
5) Is CineMut ready for submission to svn?
You need Klauss' branch with techniques. I'm not sure how ready it is: Two things I know are yet to be done are cube-maps (they are working but we're lacking the code to read combined cube map textures), and the GI still needs further tweaking. Plus, the use of detail textures need finalizing, and I wanted to support dual-shininess materials. Give it another month or so. I'm not sure when will Klauss get a new videocard.

EDIT:
I was thinking, the unit converter should save settings to a ".ucw" file (for Unit Converter Workspace), as the process of conversion, for a given model, can easily take a couple of weeks of fixing up meshes, adding LOD's and whatnot, and it would be a killer to have to set everything up again every day.
Last edited by chuck_starchaser on Thu Aug 28, 2008 2:44 am, edited 1 time in total.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Post by klauss »

pyramid wrote: * could import and display model using OpenGL
You could launch VS for that.
All you have to do is do the conversion and save it where it belongs, then add a dummy units.csv entry (you can copy the llama for instance), adapting mesh and unit folders of course, edit missions/modelview.mission so that the unit type is the one just added to units.csv, and launch "vegastrike modelview.mission".
pyramid wrote:1) Does the technique A entry in the mtl file specify for A the name of the technique file from the data/techniques folder without th extension, e.g. "highend", or "cel"?
Exactly
pyramid wrote:2) How are the techniques reflected in the xmesh files?
Next to the textures, add the attribute technique="<technique>"
pyramid wrote:3) What doe the entries in blend mode actually mean? Whan is ONE, ZERO, SRCALPHA, INVSRCALPHA? And why a tuple? Is it (RGB, A)?
They're factors for the formula:

Code: Select all

final color = source_factor * source pixel + dest_factor * dest_pixel
So, ONE ZERO means

Code: Select all

final color = 1 * source pixel + 0 * dest_pixel = source_pixel
And SRCALPHA INVSRCALPHA means

Code: Select all

final color = source alpha * source pixel + (1-source alpha) * dest_pixel
This last one does the usual alpha blending effect.
pyramid wrote:4) How do I setup the CineMut family for testin with the motorbike? Do I just copy the shader and technique files and change the default shader in vegastrike.config or must I do anything else?
No need to (in facto you should not) change the default shader. Rather, assign the cinemut technique to the bike.
pyramid wrote:5) Is CineMut ready for submission to svn?
That's chuck's question to answer, But I'd say yes. Proper cubemaps and whatnot are refinements that can wait right?
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Post by chuck_starchaser »

klauss wrote:
pyramid wrote:5) Is CineMut ready for submission to svn?
That's chuck's question to answer, But I'd say yes. Proper cubemaps and whatnot are refinements that can wait right?
Sure; I'm game; it's working fairly well, all things considering. In any case, there are no models yet that use it, so it hurts nothing that there are still issues to resolve.
Don't miss my previous post, it ended up in the previous page.
Klauss, yours is the latest version of CineMut, and I don't have it, so if you could give it to Pyramid. Last thing you did, that I know of, was to use that shininess trick for specular occlusion of envmap, remember? Then you started working on having separate prtn+prtp.
pyramid
Expert Mercenary
Expert Mercenary
Posts: 988
Joined: Thu Jun 15, 2006 1:02 am
Location: Somewhere in the vastness of space
Contact:

Post by pyramid »

Here's a new revision of the UnitConverter as attachment. *EDIT: obsolete version deleted. Get the latest version from svn.
I have no access to svn from this place and I'll be leaving for the weekend without being able to commit.

It now saves the workspace which can consist of several subunits. Indidvidual texture and shader settings for each subunit will be remembered. There is yet no operation of joining subunits into one bfxm. I won't be able to implement this still today.

Enjoy!
Last edited by pyramid on Wed Sep 10, 2008 11:38 am, edited 3 times in total.
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Post by loki1950 »

Just got the source for nvcompress it's at 2.0.3 does it still need safemode's patch which was for 0.9.4 :wink:

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Post by chuck_starchaser »

Pyramid; for CineMut we'll need different names to the textures; I would suggest just numbers (tex0, tex1, etc.). Reason being, all textures have mixtures of channels for different purposes. Even diffuse is no longer diffuse, but rather albedo (sum of diffuse and specular). See this post:
http://vegastrike.sourceforge.net/forum ... 8ad#101695
pyramid
Expert Mercenary
Expert Mercenary
Posts: 988
Joined: Thu Jun 15, 2006 1:02 am
Location: Somewhere in the vastness of space
Contact:

Post by pyramid »

loki1950 wrote:Just got the source for nvcompress it's at 2.0.3 does it still need safemode's patch which was for 0.9.4 :wink:
I was testing version 2.0.x together with safemode after it was released. You don't need to apply the patch anymore. IIRC, it was documented accordingly on the wiki general art requirements page.
chuck_starchaser wrote:Pyramid; for CineMut we'll need different names to the textures; I would suggest just numbers (tex0, tex1, etc.).
I'm well aware of that fact as I've been watching very closely the development on cinemut. Thought just to release the toll with the neutral naming (tex0-4) after cinemut has been tested and released to svn (including cubemap support). But I might as well do it right now and put the old names in parentheses, e.g. "Texture 0 (diffuse)" so that people still working with today's shaders can prepare ans test the units in vs.
pyramid
Expert Mercenary
Expert Mercenary
Posts: 988
Joined: Thu Jun 15, 2006 1:02 am
Location: Somewhere in the vastness of space
Contact:

Post by pyramid »

I am currently completing the UnitConverter launcher for test viewing the reworked models. Linux and Win versions are ready. I am though wondering what is the directory and execution command to launch the application on Mac.

For example under WIndows I have to change to execute the command vegastrike from the .../vegastrike/data/bin directory. I am wondering if the directory is .../vegastrike/VegaStrike.app or just .../vegastrike :?: and if the command to start the application is VegaStrike.app or just vegastrike :?:

The corresponding wiki page does not clarify how running vegastrike manually works on mac.
Phlogios
Confed Special Operative
Confed Special Operative
Posts: 298
Joined: Sun Jul 30, 2006 1:38 pm
Location: Sweden
Contact:

Post by Phlogios »

../VegaStrike.app/Contents/MacOS/vegastrike

The .app file is actually a directory, and the binary is inside the MacOS folder in Contents.
"Enjoy the Choice" - A very wise man from Ottawa.
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Post by chuck_starchaser »

Pyramid, try this version of cinemut:
http://wcjunction.com/temp_images/toad/ ... _opaque.fp
I think it's the last version I gave to Klauss; he still has the latest; but this one seems to work, at least for me.
(Don't ask me how, but the one I thought was my latest copy turned out to be a very old version; and the bike was indeed invisible; and that problem had something to do with cloaking.)
pyramid
Expert Mercenary
Expert Mercenary
Posts: 988
Joined: Thu Jun 15, 2006 1:02 am
Location: Somewhere in the vastness of space
Contact:

Post by pyramid »

UnitConverter version 0.20 is in svn.

In addition to previous versions and bug fixes, you can now:
* Compress the hud image
* Add shield mesh to the model workspace
* Edit basic unit information (type, combat role, shield, cockpit, description, scale)
* See the native mesh dimensions (length, width, height, all without scale adjustment)
* Test the unit in VS, optionally with alternate faction textures

As always, feature requests and bug reports are welcome here.

@Phologios,
Thanks for the suggestion for starting VS on Mac. I h ope it works out.

@Chuck,
Good to see th eshader update. I'll test it (hopefully) soon.
Fendorin
Elite Venturer
Elite Venturer
Posts: 725
Joined: Mon Feb 26, 2007 6:01 pm
Location: France, Paris

Post by Fendorin »

@Pyramid

it's means your tools can made the unit cvs too?? ( placing turret, cockpit, thruster light, docking point/size) easier with graphic thing?

did you try to work on station like the shaper's flower i made or the civilian-asteroid-shipyard?

?????
pyramid
Expert Mercenary
Expert Mercenary
Posts: 988
Joined: Thu Jun 15, 2006 1:02 am
Location: Somewhere in the vastness of space
Contact:

Post by pyramid »

Actually, the tool changes the units.csv entry for existing units or creates a new entry for new units. I haven't yet worked with installations but they should be working. At the moment, the unit parameters that you can change are very limited. Haven't come around to making the turret placement available neither any of the other more advanced options, but will put this up on my task list and gradually include those items.

A graphical interface indeed would be a nice solution though I haven't got a clue how I'd go about that. Need to start digging into python openGL programming for that.
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Post by chuck_starchaser »

One way to go about it would be to require a separate .obj containing meshes with special names for thrusters and weapon positions, and have code that reads their positions and orientations. That way, we could do it all in Blender. What I can't think of, atm, is what kinds of shapes they would be such that the code could extract not only position but the forward and up vectors from them, as well. This could actually be the same obj that has the shield.
Neskiairti
Confed Special Operative
Confed Special Operative
Posts: 334
Joined: Thu Jan 11, 2007 4:10 am

Post by Neskiairti »

pyramid.. there is fairly easy python GUI implimentation out there.. such as things like PythonCard
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Post by chuck_starchaser »

CineMut update:
http://wcjunction.com/temp_images/cinem ... _opaque.fp
Features kick-ass level specular self-occlusion.
Sharper shadows coming soon.
One known issue: No specular spotlights off paint; can's seem to figure out why.
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Post by chuck_starchaser »

Updated cinemut_opaque.fp again, same link above.
Latest screenshot at the cinemut thread.
Did you try it, Pyramid?
pyramid
Expert Mercenary
Expert Mercenary
Posts: 988
Joined: Thu Jun 15, 2006 1:02 am
Location: Somewhere in the vastness of space
Contact:

Post by pyramid »

chuck_starchaser wrote:Did you try it, Pyramid?
Not yet. Was busy integrating the units WIP, making the UnitConverter, and organizing the models task list. Still got a few ships to go but will have a look maybe tonight. The images of the bike in the cinemut thread look amazing from the shading capabilities point of view.

*EDIT*
It works but the bike is all red and blue and green. Must be missing some updated textures or it's due to the DXT compression. I'll check that now.
Luckily with the UnitConverter the testing is fairly quick.

*EDIT2*
Nope, with uncompressed textures it looks all the same. Maybe the techniques file?
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Post by chuck_starchaser »

Damn!
No, when the bike looks green and red and whatever it means the shader failed to compile.
(When it does, it picks another shader, and so the specularity, dielectric blend and constant are interpreted as red, green and blue.)
Could you check what it says about it in stderr?
pyramid
Expert Mercenary
Expert Mercenary
Posts: 988
Joined: Thu Jun 15, 2006 1:02 am
Location: Somewhere in the vastness of space
Contact:

Post by pyramid »

No std output whatsoever related to shader. Usually if something goes wrong it should come right after the OpenGL Extensions listing. Strange thing, there is no cinemut_opaque.vp.
Post Reply