EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Tools (https://www.eqemulator.org/forums/forumdisplay.php?f=593)
-   -   EQG Weapon Model Importer v0.1 (https://www.eqemulator.org/forums/showthread.php?t=38287)

Zaela_S 05-12-2014 09:02 AM

EQG Weapon Model Importer v0.1
 
A tool for importing (and exporting) weapon models into .eqg files, using any ID numbers you like.

Link

Forewarning 1: Currently, this tool only supports plain, non-animated geometry. It may support adding and working with particle animations in future versions -- a kindly forum-goer has already offered to share some particle know-how with me, so hopefully I'll be able to make some headway with that before long.

Forewarning 2: I know basically nothing about Blender and 3D modelling in general, so don't bother asking me anything about that! I've used Blender all of two times, both just to make sure this tool worked. Tutorials are not too hard to find -- I used this extremely basic one to find my way around enough to make the dumb example you'll see below.

Apparently posts are limited to 6 images, so I'm gonna have to split this up a bit...

Importing

1. First things first, you'll want to make your model and its texture in Blender (or another 3D modelling program, maybe).

http://i.imgur.com/yxGsW8p.png

2. Having that, you'll want to export it as a .ply file. This is the closest independent format to what the client expects, so we're going with it, at least for now.

http://i.imgur.com/6MRb3LB.png

3. Base export settings will not do! The client uses "left-handed" 3D coordinates internally, which basically means the coordinates you need are the ones that make the least sense. In particular, if your model is properly upright (as mine is) you'll want to export with positive X as the UP direction. Don't question it. Figuring out the Forward direction will be up to you.

Also, you should uncheck "Vertex Colors" and make sure everything else is checked.

http://i.imgur.com/sFn6tkJ.png

4. Now it's time to fire up EQG Weapon Model Importer. It's not gonna win any UI design awards, but it has all the info we need for now. You can import your weapon model into one of the existing weapon model .eqgs (filtering for "equip" is a good idea), or you can make a new .eqg file of your own by right-clicking in the first column and selecting "New EQG Archive". I'm gonna do the second one for this example.

http://i.imgur.com/8ykMFrS.png

5. Either way, select your desired destination .eqg file from the first column, and then right-click in the second column to bring up your options. We're gonna want to "Import Model from .ply". Doing so will let you search for the .ply file you exported from Blender (or whatever). You'll also be prompted for the ID number you'll want your weapon model to have -- I picked 3333 since the 3000 range is nice and open. A .mod file will be made from the .ply's geometry data; its name will be in the format "it#####.mod".

http://i.imgur.com/Ox1xWs2.png

[Continued in the next post...]

Zaela_S 05-12-2014 09:03 AM

6. A material will also be made for us, named "Custom" (the name doesn't matter). When we select that, we will be able to edit this material's opacity setting(?) (currently a string with an unknown range of possible values), and its properties. Properties control the material's texture as well as things like shininess. Our model will just be a pure black blob if we don't at least include the "e_TextureDiffuse0" (main texture) property, so we click the "Add Property" button and select that from the list.

http://i.imgur.com/tJUBgb4.png

7. Having done that, we'll be able to select our new property from the property list and set its value. In this case, it's the name of the texture to look for in the same .eqg file.

EQG Weapon Model Importer currently only works with .mod files; to import new images, you'll probably want to use EQGExport.

Furthermore, it's worth noting that although pretty much everything in the .eqg files use .dds or perhaps .bmp for their textures, .png textures will work just as well. It makes sense that the client would use a generalized image loader. This is good, because not many programs support writing .dds files, and .bmp files are huge. Sticking with .png is both convenient and worthwhile, so we might as well do that.

In any case, type in the name of the image file and then hit Enter or press the "Commit Change" button to save your changes.

http://i.imgur.com/ruGPr0P.png

8. If you're putting your model into one of the main weapon model .eqg's, this won't matter, but if you made your own .eqg file like I did, you'll want to make sure the client actually loads it by adding it to the /Resources/GlobalLoad.txt file in your EQ folder.

http://i.imgur.com/qwS0uPU.png

9. Now you're set! You might want to make an item using your new model's ID, but if you have a server you can use the #wc command in, that'll be enough for a quick test.

http://i.imgur.com/eGO8EWn.png

And, hopefully, that's it!

http://i.imgur.com/B3qck7K.png

[Continued in the next post...]

Zaela_S 05-12-2014 09:04 AM

Exporting

EQG Weapon Model Importer can also export existing weapon model data to the .ply format. This may be useful if you want to use an existing model as the basis for a new one, or just to muck with something you're familiar with.

1. In EQG Weapon Model Importer, select your desired .mod file and right-click to bring up the "Export Selected Model to .ply" option. It'll ask you for the folder you want to export to. The exported file will have the same name, just with .ply instead of .mod.

http://i.imgur.com/pV8alrk.png

2. Then, go into Blender (or whatever), and find the option to import from .ply...

http://i.imgur.com/cazLRT2.png

3. Note that, in Blender at least, we aren't given the option to specify which way is up when importing. So the models will generally be on their sides. Rotating the Y axis by 270 degrees in Blender will get it back upright.

http://i.imgur.com/PZVxwGy.png



Annndddd... that's it. The program is not thoroughly tested so there could be bugs etc. Also there are probably Material Property types that I missed (I didn't look very hard) as well as the mysterious Opacity options, so if anyone feels like figuring out all of those I'll be sure to include them. Also, some pre-existing weapon models have multiple Materials to allow e.g. different shininess values for different parts of the model, but currently this tool supports only one material for new models. Materials are applied on a triangle-by-triangle basis... I'm not sure of any good, non-tedious way of selecting particular triangles (especially since I'm not likely to produce anything like a complicated 3D interface). Here's hoping particles are a bit easier...

Zaela_S 05-12-2014 09:52 AM

Few points I forgot to make:

* Weapon attachment points (where they go in your hand) are assumed to be at 0,0,0 on the model.
* Be mindful of units. Models use the same units as /loc -- the tube in the above example is 2 units long.
* The client expects non-.bmp images to be upside down (flipped, not rotated). It just does!

vsab 05-12-2014 10:55 AM

That looks simply awesome! What language/toolset do you write these apps in?

knowom 05-12-2014 08:14 PM

This is awesome work Zaela_S I've been learning a bit about how blender works last few months casually just for the fun of it. I'm still not great with it, but I know understand a lot more about it now than I did not to long ago. It's a fun program to learn and play around with you can do really amazing stuff with it if your good enough at it.

Anyway this site here is called BlendSwap.
http://www.blendswap.com/blends

It has tons and tons of freely distributed 3D models people have submitted. It should be possible to load them up in blender and export them over into EQG files!

You can obviously design your own 3D models as well to export, but this is a big break through tool in this area of EQemu development in my eyes.

This is like a fairly modular 3Diminsional stairway labyrinth design I made in it back in February for the hell of it.

https://pbs.twimg.com/media/Bg2-otpCEAAqXx8.png:large

Anyway this is exciting news the possibility of a abundance of copyright free player made content being possible is awesome to think about this opens up the doors a lot to true player made customization.

Here's a example of a texture made from scratch in GIMP as well. It kind of reminds me of lava and steam vapor.
https://pbs.twimg.com/media/BgEo-rECQAAVX9b.jpg:large

Zaela_S 05-12-2014 11:11 PM

Quote:

Originally Posted by vsab (Post 230436)
What language/toolset do you write these apps in?

Mostly Lua, with some C++ to handle low level stuff like reading and writing the binary files. I use a non-mainstream GUI library called IUP. It's made by the designers of Lua so it makes good use of the features of the language, more so than typical bindings. The documentation can be a bit confusing (it's translated from portuguese) and it takes a bit to get used to, but it's pretty simple and quick to work with once you get the hang of it. Well, provided you're comfortable with Lua.

I might put the project up on github if there's any desire for that. Most of the code already comes with the program though in the form of the Lua scripts.


Also, I answered my own question of how to handle multiple materials: start with the model to import split into separate pieces and files, then combine them in the importer; each separate piece would get its own material entry. Shouldn't be too hard to put together for a future version.

Zaela_S 05-16-2014 03:10 PM

http://i.imgur.com/PKFHC7O.png

Work on particles begins...

Weldarr 05-16-2014 04:35 PM

Soon as I have the ActorEmmitters more decoded I'll send it your way Zaela, that will open up the door for the custom particles ;)

- Vaion

Akkadius 05-16-2014 04:57 PM

Quote:

Originally Posted by Weldarr (Post 230538)
Soon as I have the ActorEmmitters more decoded I'll send it your way Zaela, that will open up the door for the custom particles ;)

- Vaion

Vaion, feel free to document on the new Wiki. It is super easy to use. Send me a PM if you want an account :)

Cassieze 05-19-2014 10:47 PM

When I try to add
a property i get the following error
Code:

.\gui/display.lua:56: attempt to index local 'set' (a nil value)
stack traceback:
        .\gui/display.lua:56: in function 'UpdateDisplay'
        .\gui/display.lua:143: in function 'SaveNewProperty'
        .\gui/property.lua:44: in function <.\gui/property.lua:13>
        (tail call): ?
        [C]: in function 'MainLoop'
        gui/main.lua:74: in main chunk

I'm trying to put them into Dodequip.... I did go in game to see that the number is working - got a black model.

Using underfoot

Any thoughts?

Zaela_S 05-19-2014 11:00 PM

Ah, I forgot about properties when I changed how some things were arranged.

Re-download, should be fixed.

Cassieze 05-19-2014 11:33 PM

This worked thank you

Zaela_S 05-22-2014 10:06 PM

Cliche as hell example of the kind of thing an uncreative total newb (me -- my first model more complicated than an auto-generated cylinder) can slap together in a couple hours (most of it grappling with Blender's UI and skimming tutorials) with a little effort.

http://i.imgur.com/WfgQwfi.png http://i.imgur.com/zOCVrIN.png
http://i.imgur.com/gsp5opf.png http://i.imgur.com/3AJpMDE.png
http://i.imgur.com/IV5gEA2.png

Getting started is not as hard as it might seem! Although, making the texture and normal map (the e_TextureNormal0 property) decent is probably harder than making a workable static model... (The sharp edge of the blade looked more distinct before I put that noisy metal texture on, for one thing.)

Better than a cardboard tube, at least. Feel free to post your own~

(Oh, and for reference: with the blade facing the positive Y axis in Blender, I had to export with negative Z as the forward direction to make it face the right way in game).

knowom 05-23-2014 03:39 AM

Cloud Strife's Buster Sword...in all it's EQ glory! ;) Looks pretty decent for just a few hours work. Sword looks a little to heavy for you though Zaela!

http://cdn2.screenjunkies.com/wp-con...man-meme-1.png


All times are GMT -4. The time now is 12:43 PM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.