You must be logged in to post messages.
Please login or register

EE Scenario Design & Modding
Moderated by Soty

Hop to:    
loginhomeregisterhelprules
Bottom
Topic Subject: cemconv: The CEM Conversion Tool
posted 02-24-18 00:34 AM EDT (US)   
Hello EE Heaven!

I am proud to announce the initial release of cemconv, a command line tool for converting CEM models to and from the standard model file formats like OBJ.

Currently, cemconv can convert between CEM and the OBJ format. The OBJ format is a very simple text format that is human readable and editable.

However, cemconv only supports a few features of the CEM format currently. For example, multiple materials (player color), frame animation, and tag points (particle effects) are not supported yet. These will be implemented in the future.

How to use cemconv
cemconv, as a command line application, is more difficult than a GUI to use. Therefore, here is a step by step guide.

On Windows, open Command Prompt and navigate to the directory where cemconv.exe is. Then, you can use cemconv with cemconv.exe.

On Linux and Mac, it is a similar process, but using the terminal instead, and without the .exe extension. Make sure to give cemconv execute (chmod +x) permission.

Converting from CEM to OBJ
1. Obtain a CEM file. Usually, SSA Extract will do the trick.
Note: The amb_rock.cem file in Empire Earth/Data/Models is NOT a real CEM file. It is not even close to the correct format, and is likely related to hiding information, like CD keys.
2. Use the following command:
Windows cemconv.exe -i <CEM FILE NAME> -g cem -f obj <OUTPUT FILE NAME>
Linux/Mac ./cemconv -i <CEM FILE NAME> -g cem -f obj <OUTPUT FILE NAME>
3. The OBJ file at <OUTPUT FILE NAME> is now ready for viewing and editing, in an application like Blender.

Converting from OBJ to CEM
1. Obtain an OBJ file, from editing, or downloading.
2. Use the following command:
Windows cemconv.exe -i <OBJ FILE NAME> -g obj -f cem <OUTPUT FILE NAME>
Linux/Mac ./cemconv -i <CEM FILE NAME> -g obj -f cem <OUTPUT FILE NAME>
3. To view the model in Empire Earth, move the CEM file to Empire Earth/Data/Models and rename it to a preexisting model name. Alternatively, instead of renaming it, you can also use Forlin's DB editor to edit dbgraphics.dat.

If you have any issues with cemconv, please either reply or file an issue in the cemconv repository. Most notably, cemconv.exe has not been tested on Windows, only compiled for Windows. There is no reason it shouldn't work, but it is not tested.

Releases:
https://github.com/coderbot16/cemconv/releases

Windows users will want to install the cemconv-v0.1.0-x86_64-pc-windows-msvc.zip release, Mac users will want the cemconv-v0.1.0-x86_64-apple-darwin.tar.gz release, while Linux users will want the cemconv-v0.1.0-x86_64-unknown-linux-musl.tar.gz release.

Replies:
posted 02-26-18 02:37 AM EDT (US)     1 / 24  
This looks very promising. I will check it out on the weekend
posted 02-28-18 08:15 AM EDT (US)     2 / 24  
I've tried to test it on Windows, it does something but I can't find any .obj file...
posted 03-03-18 09:59 AM EDT (US)     3 / 24  
Philla007:

There are several possible issues that may be occurring.
* cemconv will not create a file's parent directories if they don't exist
* File names must be in quotes if they contain spaces ( a limitation of the command line )
* For example, the path C:\Program Files\EE\Data\ must be input as "C:\Program Files\EE\Data\"
* No output file was given, in which case cemconv will print the output to the console

If none of those help, paste the command that you're using into a reply and I will try to see if I spot anything wrong. If there's an error message in the console, please paste that as well.

[This message has been edited by coderbot16 (edited 03-03-2018 @ 10:00 AM).]

posted 03-03-18 11:44 AM EDT (US)     4 / 24  
This is what I did in command prompt:

C:\Users\Phillip>C:\Users\Phillip\Desktop\cemconv.exe -i C:\Users\Phillip\Desktop\air_a10_10.cem -g cem -f obj

Then command prompt did this:

v -0.026008952 0.09390329 -0.6944989
vn -0.5803704 0.6827887 -0.44381273
vt 0.0004995167 0.91407585
v 0.020534579 0.09390328 -0.6944989
.
.
.
f 160/160/160 163/163/163 166/166/166
# name: player color, texture: 0, texture_name: air_a10_10T
f 167/167/167 168/168/168 169/169/169
f 170/170/170 171/171/171 172/172/172
f 173/173/173 174/174/174 175/175/175
f 176/176/176 175/175/175 174/174/174
f 177/177/177 178/178/178 179/179/179
f 180/180/180 181/181/181 182/182/182
f 183/183/183 184/184/184 185/185/185
f 186/186/186 185/185/185 184/184/184

Then I tried to add output 3 times (even with quotes) and it showed me this error:

C:\Users\Phillip>C:\Users\Phillip\Desktop\cemconv.exe -i C:\Users\Phillip\Desktop\air_a10_10.cem -g cem -f obj C:\Users\Phillip\Desktop\
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 3, message: "The system cannot find the path specified." } }', src\libcore\result.rs:916:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

C:\Users\Phillip>C:\Users\Phillip\Desktop\cemconv.exe -i "C:\Users\Phillip\Desktop\air_a10_10.cem" -g cem -f obj "C:\Users\Phillip\Desktop"
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 5, message: "Access is denied." } }', src\libcore\result.rs:916:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

C:\Users\Phillip>"C:\Users\Phillip\Desktop\cemconv.exe" -i "C:\Users\Phillip\Desktop\air_a10_10.cem" -g cem -f obj "C:\Users\Phillip\Desktop"
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 5, message: "Access is denied." } }', src\libcore\result.rs:916:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

[This message has been edited by Philla007 (edited 03-03-2018 @ 11:52 AM).]

posted 03-03-18 01:34 PM EDT (US)     5 / 24  
The issue is that your paths point to your Desktop folder, but you need to attach a name for the individual file. The access denied error is caused by cemconv trying to open Desktop as if it is a file, but it is a directory instead.

For example, try:
"C:\Users\Phillip\Desktop\cemconv.exe" -i "C:\Users\Phillip\Desktop\air_a10_10.cem" -g cem -f obj "C:\Users\Phillip\Desktop\air_a10_10.obj"
posted 03-04-18 08:11 AM EDT (US)     6 / 24  
Still nothing, I've tried to do it in other directory and it showed me this error:

C:\Users\Phillip>"C:\Users\Phillip\New folder\cemconv.exe" -i "C:\Users\Phillip\New folder\air_a10_10.cem" -g cem -f obj "C:\Users\Phillip\New folder\air_a10_10.obj"
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 2, message: "The system cannot find the file specified." } }', src\libcore\result.rs:916:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
posted 03-04-18 10:16 AM EDT (US)     7 / 24  
That's a bug in the way that cemconv handles file opening. As a workaround, you need to create the empty file on the desktop with New Document, and then use the cemconv command. I'll push an update later today to fix it.

EDIT: Update released as version 0.1.1, replacing the nasty panic error messages with more user friendly ones as well as fixing the above issue.

[This message has been edited by coderbot16 (edited 03-04-2018 @ 10:57 AM).]

posted 03-04-18 03:42 PM EDT (US)     8 / 24  
Thank you very much coderbot16, this update solved my problems.
Now I can get to business with modeling but first I need to figure how file works...
posted 03-04-18 04:29 PM EDT (US)     9 / 24  
For editing the exported OBJ files, I'd recommend using Blender (https://www.blender.org/) if you aren't using it already. Blender has native support for the OBJ format and allows you to view and edit the OBJs directly, before re-exporting them back into the CEM format.
posted 03-05-18 03:45 PM EDT (US)     10 / 24  
Of course, that's the program I use.
By the way, did you used a model from internet for those palms on your photo or you did it yourself and can you tell me how to make texture for them? I wanna practice myself so I can make new models...
posted 03-05-18 07:37 PM EDT (US)     11 / 24  
The palm trees are from OpenGameArt: https://opengameart.org/content/palm-tree-v2. In the screenshot, I placed the converted palm tree model as Empire Earth/Data/Models/amb_rocks3.cem. I also copied the asphalt texture & renamed it, resulting in Empire Earth/Data/Models/amb_rocks10T.sst. However, more is possible using Forlin's DB editor (to edit dbgraphics.dat) and an SST importer/exporter, such as the one in EE Studio. In this case, the Rocks 3 object is replaced with the asphalt palm trees.

Note: cemconv currently passes texture coordinates straight from OBJ to CEM, without modification. When testing a new texture, it was applied incorrectly. Perhaps EE uses a different coordinate system than OBJ (Direct3D vs OpenGL texture coordinates).

[This message has been edited by coderbot16 (edited 03-05-2018 @ 07:38 PM).]

posted 03-06-18 01:10 PM EDT (US)     12 / 24  
Thanks for that!
I have another question for you, do you maybe know anything about animations for models and how they work? Are they combined together with model or they are seperated?
posted 03-07-18 06:27 PM EDT (US)     13 / 24  
Animations are stored with the model, but cemconv does not support them yet as OBJ does not support animation of any form on its own. I need to find a format that supports animations in a similar way to EE (keyframe based).

[This message has been edited by coderbot16 (edited 03-07-2018 @ 06:27 PM).]

posted 03-08-18 01:18 PM EDT (US)     14 / 24  
Alright then, thank you for replying!
posted 03-12-18 02:37 AM EDT (US)     15 / 24  
What I believe it is not hidden but it uses different modules in cem library


https://docs.rs/cem/0.1.0/cem/

v1V1 model format. Found rarely in Empire Earth 1, but not the native format of any released game.
v2V2 model format. Primarily found in Empire Earth 1.
v5V5 model format. Primarily found in Empires: Dawn of the Modern World.

_____________________________________
If You Need Help in Hexing or you have something to share
Contact me realforce212@gmail.com
______________
posted 04-04-18 10:00 AM EDT (US)     16 / 24  
Hi coderbot16

Wow! Really great work!
I am a 3d-Model-Artist and a big fan of Empire Earth.
Already converted my own A-10.

Just a quick test..

Maybe FBX would be a good format?
https://docs.rs/cem/0.1.0/cem/
I saw your documentations about cem is it complete?

I am asking because with those informations i could programm my own converter.
Or better my own import\exporter for Blender?
I am not a programmer... but if i now it would be possible i could try it.
And tell me if there is anything i could help you with the converter.
not sure what... but you never know

greetings
posted 04-18-18 08:27 PM EDT (US)     17 / 24  
@simisoad:

I apologize for the late response, but I've lost most of my interest in EE. Lately my projects have been focusing more on Minecraft development in the like of projects like Sircmpwn's TrueCraft. I do play modded MC regularly, and Minecraft projects are more practical as the audience following them is absolutely massive.

I do still work on EE sometimes, and this project was the result: I had already done some work with reverse engineering, and on a week-long programming sprint I devoted almost all programming time to the project.

But, after seeing the initial response (or lack thereof), I felt as if the time was wasted. If the most sought after tool in all of EE generated almost no response, what would?

However, I checked back today, and was delighted at the response to the project. While I still lack an inherent interest myself in developing it, the fact that others are interested is certainly motivating.

In pure technical aspects, the cem library is partially complete. It can read V1 model files, but I have not investigated them because there are less than 15 in existence. V5 support is woefully incomplete and is all but useless at the moment. V2, on the other hand, is almost perfectly supported aside from minor details.

With the source of cem and the V2<->OBJ converters, the general ins and outs of the format are easy to discern. There are some unresolved issues, like the texture coordinate system, but these are minor details.

FBX certainly seems like a good format, but the issue is that there are no high level Rust libraries for it yet. This means that I would have to reimplement an FBX reader/writer as well, which is no small task.

You're certainly welcome to use the source to make your own converter, and I feel that someone genuinely interested in EE would be much better fit than me. If you have any questions or clarifications, feel free to ask, or even better, file an issue on GitHub, which I check far more often.
posted 05-27-18 08:06 AM EDT (US)     18 / 24  
Dear Coderbot,

I do believe that the response could have been a little better, but with EE almost dead, only the die hard fans and modders like myself would be responsive enough for this.

But I tell you, we were delighted, thrilled, and more than happy with what you have achieved! If you can devote a little bit of your time, may I ask you to visit us https://empireearthreborn.slack.com. Or maybe send me an email in gmail (randolph.velosi)? I have a proposition you may be interested.

My Profile in Empire Earth || Latest Submissions Two Flags: Battle for Africa ||Jun 2023
My Profile in Age of Kings || Latest Submission Shadows of Betrayal || August 2012
AOK Designer of the Year 2012
Core Team Member & Site Co-Administrator,Empire Creations
posted 11-16-18 03:03 PM EDT (US)     19 / 24  
I just updated cemconv with some new features. It now has support for converting CEM to COLLADA (COLLADA to CEM is not yet supported unfortunately). This means that animations now work, and soon submodels will work too. Also, this release fixes a long standing bug with texture coordinate handling.
posted 12-16-18 01:40 PM EDT (US)     20 / 24  
I'm hoping Empire Earth Reborn can accommodate my future needs and I have checked out their page. If you haven't, then https://empireearthreborn.slack.com/app .

I don't know if any of you guys have played Empires: Dawn of the Modern World (2003 - same Engine), and must have played Age of Empires at least once. Well those Games have Unique Units and Buildings for different Civilisations.

Empire Earth is fantastic! But my problem with the game was that every Civilisation was pretty much the same, with different Bonuses. The Expansion - the Art of Conquest - very slightly accommodated this fact by giving some different Civilisations Unique Units and Buildings.

I dream of many Civilisations like: Germany, Poland, Italy, France, etc - all with their own Units, Buildings. For different Epochs in Human History.

Perhaps, the adding of new Epochs like the Vietnam War period - with those awesome USA Helicopters - or the Six Day War with Israel fighting the Arab countries.

There are some very talented people out there. I dream of making a large collection of Units and Buildings - even if Scenario Editor only, but then can Add them to Player's Tree Techs. Or, perhaps, new Civilisations where the NEW Units and Buildings are available.

Extra Scenery Buildings and Structures can be made for Campaigns too. Like Town Streets with Shops, Homes, Apartment Blocks. Have a Battle going on down the Street.

The User - Atlasfield - is Fantastic are making Unit Textures. Perhaps, the new Units can be placed in the game with the different Textures.

I also once heard that we are LIMITED with how many new things we can add into the game - I am not sure if Empires: Dawn of the Modern World - has the same restrictions, or not. Perhaps, that is the next hurdle.

EDIT: Also to Note. If we want MORE in a certain Epoch, there is always the Possibility of swapping around Files before Launching Empire Earth. ALL Unit Slots could be taken for WW2 for example. If a Player wants to ONLY play in WW2 Epoch, then could temporary put the new WW2 Files into the Directory. Then when finished, take them out.

[This message has been edited by bradley877 (edited 12-16-2018 @ 01:41 PM).]

posted 11-08-20 11:08 AM EDT (US)     21 / 24  
This is great, thank you!

EE forever
posted 11-08-20 12:51 PM EDT (US)     22 / 24  
Ashrzr, this program has been discontinued. Take a look at my post: http://ee.heavengames.com/cgi-bin/forums/display.cgi?action=ct&f=3,38434,,10

We developed a far better tool, I believe you will be suprised when you will see xD
posted 11-12-20 11:57 AM EDT (US)     23 / 24  
should i sticky and lock this thread?
posted 11-13-20 04:19 PM EDT (US)     24 / 24  
Yeah, if you want of course
Empire Earth Heaven » Forums » EE Scenario Design & Modding » cemconv: The CEM Conversion Tool
Top
You must be logged in to post messages.
Please login or register
Hop to:    
Empire Earth Heaven | HeavenGames