Editing Models
4 4

26 posts in this topic

Recommended Posts

Hello.

 

So, I am wondering if anyone has figured out how to add 3-d shapes to the models or how to change/edit current ones?

 

I've only messed around with it a bit, but I believe you have to edit the pack files and I haven't messed around  with those too much. It seems like the developers gave us some tools to get started, like the object files with all the vertices and faces of the models. The furthest I got was removing parts of a weapon, and that wasn't very cool.

 

I found a thread probably 6 months ago with screenshots of a guy editing some weapon meshes in Blender. I don't remember where I saw it, but does anyone know how he got the models in a format that works with blender?

 

I think it would be badass to get some new shapes in the game like guns, hats, and backpacks.

 

I've edited the textures, but I haven't figured out how to set two different textures for the same model i.e. using the shotgun model for an AR-15 but with a different texture without changing the texture of the shotgun.

 

Kinda late here, hope that makes sense.

Share this post


Link to post
Share on other sites

Short and friendly answer: It sounds like a good idea, but it requires a long time of work and thinking, anyway, do you have any pictures of what you already did?

 

Long but not rude answer: I sometimes stay in between the fence when we talk about 2D and 3D. As my OCDish and perfectionist mind, I like the idea of sticking with only one kind of model, sprites and graphics. In my mind if one item has a 3D sprite, then every other item should have the same 3D sprites in my opinion. I am not saying that would be a bad idea, actually, if the game had 3D sprites, many items and resources could have a most interesting way of use and look. But as the devs said (but in another words), everything is a good idea, but the plans are different right now.

Share this post


Link to post
Share on other sites

The original format for the models are DirectX (.x) files. A quick look at the specifications indicates they're not too far from this in their current state, but there are some differences. Right now, TIS uses a tool that converts the models from X into the format the game uses. (Though I'm not too sure why there needs to be a difference).

The tools themselves haven't been released yet, but they're planned to be at some point in the future. Without that (and without decompling game code) there's probably no way to add new/different 3D models/textures without just altering the current ones.

2D sprites have a similar problem: they're hard-coded into the game, but different textures can be added with texturepacks and mods.
 

Share this post


Link to post
Share on other sites

Short and friendly answer: It sounds like a good idea, but it requires a long time of work and thinking, anyway, do you have any pictures of what you already did?

 

Long but not rude answer: I sometimes stay in between the fence when we talk about 2D and 3D. As my OCDish and perfectionist mind, I like the idea of sticking with only one kind of model, sprites and graphics. In my mind if one item has a 3D sprite, then every other item should have the same 3D sprites in my opinion. I am not saying that would be a bad idea, actually, if the game had 3D sprites, many items and resources could have a most interesting way of use and look. But as the devs said (but in another words), everything is a good idea, but the plans are different right now.

Textures are not difficult to edit.

thegang-1.png

But if you edit a texture on one model, it's the same for all the models, currently I don't know how to not do that... if that makes sense. And it seems like currently there is not a way to not do that.

 

As for the 2-D 3-D thing, I don't care either way. I was actually kind of bummed when they released the 3-D models, but I'm fine either way. If there was a way (simple, preferably) to edit / change them, I would love to mess around with it, but I am no programmer and can't figure it out. I found a lot of crap from the early releases of PZ where people were able to edit the actual sprites and add their own stuff.

 

I didn't get any screenshots of the bits of the models that I removed because I didn't think it was that impressive. It's pretty simple actually, just have to mess around with the files in the 'models' folder (I think that's the one, I'm on a different computer and can't look at the directory). The problem with those files is that there is no way currently (or simply) to make new models for mods.

The original format for the models are DirectX (.x) files. A quick look at the specifications indicates they're not too far from this in their current state, but there are some differences. Right now, TIS uses a tool that converts the models from X into the format the game uses. (Though I'm not too sure why there needs to be a difference).

The tools themselves haven't been released yet, but they're planned to be at some point in the future. Without that (and without decompling game code) there's probably no way to add new/different 3D models/textures without just altering the current ones.

2D sprites have a similar problem: they're hard-coded into the game, but different textures can be added with texturepacks and mods.

 

You sound like a wizard genius. I am not a genius. I seem to remember finding some software that could open(?) the pack files and display the .pngs(?). But that's as far as I got. I know it can be done and can be implemented in-game, but I'm on a much lower level.

Share this post


Link to post
Share on other sites

That's http://theindiestone.com/forums/index.php/topic/3511-pz-unpacker/page-2 this one (same thread with the never-released 3D model reader). Though, I think you can now access the contents of texturepacks through Tiled, as well: http://theindiestone.com/forums/index.php/topic/8790-custom-texture-packs-and-tile-definitions/

Bit of a learning curve, all of this. :D

Share this post


Link to post
Share on other sites

 

Short and friendly answer: It sounds like a good idea, but it requires a long time of work and thinking, anyway, do you have any pictures of what you already did?

 

Long but not rude answer: I sometimes stay in between the fence when we talk about 2D and 3D. As my OCDish and perfectionist mind, I like the idea of sticking with only one kind of model, sprites and graphics. In my mind if one item has a 3D sprite, then every other item should have the same 3D sprites in my opinion. I am not saying that would be a bad idea, actually, if the game had 3D sprites, many items and resources could have a most interesting way of use and look. But as the devs said (but in another words), everything is a good idea, but the plans are different right now.

Textures are not difficult to edit.

thegang-1.png

But if you edit a texture on one model, it's the same for all the models, currently I don't know how to not do that... if that makes sense. And it seems like currently there is not a way to not do that.

 

As for the 2-D 3-D thing, I don't care either way. I was actually kind of bummed when they released the 3-D models, but I'm fine either way. If there was a way (simple, preferably) to edit / change them, I would love to mess around with it, but I am no programmer and can't figure it out. I found a lot of crap from the early releases of PZ where people were able to edit the actual sprites and add their own stuff.

 

I didn't get any screenshots of the bits of the models that I removed because I didn't think it was that impressive. It's pretty simple actually, just have to mess around with the files in the 'models' folder (I think that's the one, I'm on a different computer and can't look at the directory). The problem with those files is that there is no way currently (or simply) to make new models for mods.

The original format for the models are DirectX (.x) files. A quick look at the specifications indicates they're not too far from this in their current state, but there are some differences. Right now, TIS uses a tool that converts the models from X into the format the game uses. (Though I'm not too sure why there needs to be a difference).

The tools themselves haven't been released yet, but they're planned to be at some point in the future. Without that (and without decompling game code) there's probably no way to add new/different 3D models/textures without just altering the current ones.

2D sprites have a similar problem: they're hard-coded into the game, but different textures can be added with texturepacks and mods.

 

You sound like a wizard genius. I am not a genius. I seem to remember finding some software that could open(?) the pack files and display the .pngs(?). But that's as far as I got. I know it can be done and can be implemented in-game, but I'm on a much lower level.

 

 

Wow, that's pretty cool actually. Do you modify the character skin or do you modify clothes and then use them? If you modify the character skin, then it would also be cool to do that with some clothes, and add accessories for example. Can you also mess around with depth and somehow do a backpack? Or it stays "printed/stuck" on the character skin like a plain thing?

Share this post


Link to post
Share on other sites

I was just thinking about whether or not it would be possible to do it to articles of clothing, but no, those are all done to the character model, so they are all essentially naked.

 

I'll mess around with it a bit and see what comes up.

Share this post


Link to post
Share on other sites

For example in models/weapons_fireaxe there is kinda scheme after vertex buffer

0.00128000, 0.05666700, 0.017397000.07668400, 0.12324600, 1.458663000.00739500, 0.89212200

I think the first or second line is coordinates of positon of vertex 

The other one is normal vector

The third one is texture coordinates.

If I'm right its easy to create program which converts these txt files to for example .obj files which I believe can be opened by almost every 3d editting software

Share this post


Link to post
Share on other sites

I'm going to have a crack at what Omegapl mentioned.
It'd be really nice to see some new models in the game, for guns, animals, etc.

One thing for starting off would probably look at how these model files are loaded into the game.

First things first though, gotta get me some energy and candy.

Share this post


Link to post
Share on other sites

I managed to create a program which loads up whole txt file Now what I have to do is to save it in diffrent format. 

The problem is I dont know what for example "Tangent" mean. I was using from time to time opengl so I know what normals are but these other things I have no idea.

 

 

Also I think it will be hard to add new models to the game (if even possible ) .

But you will be able to modify existing models unless they are hardcoded somewhere in game and these txt files are just sitting there doing nothing.

Share this post


Link to post
Share on other sites

I managed to create a program which loads up whole txt file Now what I have to do is to save it in diffrent format. 

The problem is I dont know what for example "Tangent" mean. I was using from time to time opengl so I know what normals are but these other things I have no idea.

 

 

Also I think it will be hard to add new models to the game (if even possible ) .

But you will be able to modify existing models unless they are hardcoded somewhere in game and these txt files are just sitting there doing nothing.

Is there any way you can post your work?

Be it Github, Dropbox, etc.

Share this post


Link to post
Share on other sites

 

I managed to create a program which loads up whole txt file Now what I have to do is to save it in diffrent format. 

The problem is I dont know what for example "Tangent" mean. I was using from time to time opengl so I know what normals are but these other things I have no idea.

 

 

Also I think it will be hard to add new models to the game (if even possible ) .

But you will be able to modify existing models unless they are hardcoded somewhere in game and these txt files are just sitting there doing nothing.

Is there any way you can post your work?

Be it Github, Dropbox, etc.

 

Right now its pointless it only loads and organize data which is stored in txt file but I will do so when I add ability to save in other format. This is the easier part of the program. As I said I dont know what some terms mean but I hope I'll find answer on the internet :)

Share this post


Link to post
Share on other sites

I looked through the Java decompiled code and found a class called ModelLoader.class located in projectzomboid/zombie/core/skinnedmodel/model

The function "load" has a case switch, and it looks like case 5 cycles through each vertice and loads in the following information (currently the following is only for verticies without tangents):

v x y zvn x y zvt x yExample:# Vertex Buffer:-0.05332200, -0.00887400, 0.000000000.00000000, 0.00000000, 1.000000000.79623500, 0.96012600

And face being just
f x y z

Share this post


Link to post
Share on other sites

Here we go our first output ! http://speedy.sh/NdTPB/test.obj guess what is it :P

It's 2:30 AM here so Im gonna get some sleep now :D

tomorrow (today) I'll fix few things and I hope I will upload the program.

Looking nice!

I typed up a python script to convert pzmesh.txt to .obj and vise versa, but my laptop just crashed and it seems like I lost some of my code. Not much harm, just a little annoying.

Feel like technology is slowly becoming sentient...

Anyhoot, I'll be posting my python code once I rewrite some of the code, and possible see how to load these models into the game. Perhaps need to edit a file, but the Java code to call models into existence seems to be in projectzomboid/zombie/core/skinnedmodel/ModelManager.class function loadStaticModel

It takes in "pzmesh", "texture" ("weapons_woodplank", "Objects_WoodPlank") and outputs a model constructor, which is the class core/skinnedmodel/model/Model.class

I believe I can't post any code publicly.

Wonder if there's a Lua loader for meshes...

Share this post


Link to post
Share on other sites

If the object files are some simplified equivalent of the .obj format, then I already have a browser-based custom model editor/viewer I had written for a different project.

Although, if as has been mentioned before, the models are a simplified .x format, well that's completely different to .obj format (it contains the same data, plus some extra, but structured differently).

 

In saying that, there seems no real point to playing around with the files if all you can do is replace existing ones, rather than add additional models. I'd imagine if there's no tools released before 1.0, then some other game developer or hobby programmer will whip up some tools (as far as I know, several 'real' programmers playing Zomboid are waiting for stable/finalised releases before they bother with any modding or tool development)

Share this post


Link to post
Share on other sites

They seem like a simplified version of a .obj file

See my post early in this thread.

 

From there, we can just load the .obj file into Blender and edit the mesh, then export it back out as a .obj and convert it to the PZ mesh format.

Share this post


Link to post
Share on other sites

From the developers themselves: It's x.

Though there are similarities -- I've wrote a loader for obj once a few years back. *Shrug*

Not saying you can't convert them, of course.

Share this post


Link to post
Share on other sites

I've been swamped with so much work these past 2 weeks.

However, I have gotten back into writing some code.

Wrote a simple Python parser, and have gotten to the point of converting the PZ Mesh data to .OBJ format.

I will be working on converting OBJ to PZ Mesh and handling more advanced meshes along with creating material files for loading textures.

Afterwards, I'll be making a Blender 3D import/export code, that way we can have a cross-system process for creating/editing PZ Models with free tools.

Since most of my hours now are spent on free time, I'm going to dedicate a night to getting this code cleaned up and pushed out, then the Blender code written.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
4 4