Changable Clothes

Everything related to 3D programming
User avatar
Comtois
Addict
Addict
Posts: 1431
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: Changable Clothes

Post by Comtois »

I do not understand your problem. clothes is a texture ? just change the material.
Please correct my english
http://purebasic.developpez.com/
Thorium
Addict
Addict
Posts: 1305
Joined: Sat Aug 15, 2009 6:59 pm

Re: Changable Clothes

Post by Thorium »

In a lot of games different clothes are accomplished by just switching textures.

You only need a more complex approach if you want to change clothes that realy need a different geometry. Like adding a hat or a waving coat.
Sweatshirt or t-shirts do not need a different geometry, except you have a ultra high detailed geometry.
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

Re: Changable Clothes

Post by applePi »

there is an example here http://www.blitzforum.de/forum/viewtopic.php?t=35397
all the code are listed after the second picture in the page
which describe how to make a clothes in blitz3d, the syntax seems not too far from purebasic, if you look at it see if you can translate it to purebasic will be great. since blitz3d are limited in its performance and vision
i may do it someday.
PMV
Enthusiast
Enthusiast
Posts: 727
Joined: Sat Feb 24, 2007 3:15 pm
Location: Germany

Re: Changable Clothes

Post by PMV »

The easiest way to accomplish that is by using shaders. And i
don't think there is another way as of the needed performance
and work, you can do alone. You can do very pretty clothes
with that, the only thing is ... they can't fly in the air when wind
is blowing. :lol:

Just look closer to high end games ... especially where you can
have different closings, too The most is done by shaders and
textures ...
To have different effects for each cloth, you should change the
base model instead of plopping another one on top of that.

MFG PMV
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 755
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: Changable Clothes

Post by Samuel »

Most gaming studios have there own system for creating meshes and animations in code. So, they can add new clothing or armor onto their meshes without many issues.
They just rebuild the data right there in the code. They also usually remove the vertices and faces that are now hidden. In order to improve rendering speed.

If one doesn't have the capabilities to create ones own meshes in code. For example using an already built model.
Then you would probably have to create a file for each model. With every combination of clothing, but that would give you a lot of mesh files. :(
This is why many games have there characters wearing the same getup throughout the story.

I believe there is a way with OGRE to share skeleton animations with seperate entities.
I think it's something like shareSkeletonInstanceWith (Entity *entity).
It's in OGRE's entity class reference.
http://www.ogre3d.org/docs/api/html/cla ... ntity.html
If I understood it correctly you can assign your model skeleton to a seperate clothing mesh.

I don't think Purebasic has this implemented yet and I have no clue if it ever will.
So, it may not be of any help.
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 755
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: Changable Clothes

Post by Samuel »

Alexi wrote: 1. Save this Skeleton separately for the Cloth and synchronize with the Player. (causes a lot of memory)
As you said this would be a bad way to go and I'd avoid it if at all possible.
Alexi wrote: 2. Directly insert the Cloth as Submesh in CAD Software. So it can use the same Skeleton, but can we remove/add/hide them at runtime? For example 8 basic meshes for clothes are included, just one of them (or separately 2) is visible. The invisibled Polygons should not be rendered or affect the performance.
From what I've read it is possible to hide SubMeshes with OGRE, but I don't think it's implemented in Purebasic yet.
Alexi wrote: 3. Merge the Mesh into the Player at runtime. This would be the best solution, if possible. The question is, does it connect with the skeleton. The AddSubMesh() seems to work just on a mesh created internally, so the second question is, does SetMeshData() insert the joint weighting information?
SetMeshData() only works with coordinates, normals, tangents, uvs, and color. At least according to Purebasic's help files.

In OGRE's submesh class reference I found addBoneAssignment.
Which allows one to assign a vertex to a bone with a given weight.
http://www.ogre3d.org/docs/api/html/cla ... bMesh.html

If and when purebasic supports skeletal bone creation I would assume this would also be available.
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Changable Clothes

Post by Bananenfreak »

Just look at this:

http://www.youtube.com/watch?v=JMK6g9-zdnI

This are all armors from (or of?!) Gothic 3. The Thing is, that there are only a few different meshes, rest is done with Materials (Textures) or a few new armorplates,... . So you can have various armors with only a few meshes (One for armor itself and 2-3 for a few variations).
So, I believe they change meshes when the changed armor is different; For this, we Need shareSkeletonInstanceWith (Entity *entity).

I think Skyrim uses variant parts of leg, arm, breast and head armormeshes and mix them to one armor:
http://www.youtube.com/watch?v=B-WuJpZp9Sc
Image
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Changable Clothes

Post by Bananenfreak »

To take up this Topic again, I have a question.
I thought long time about it, but I don´t come to a end. Perhaps somebody here got a great idea...
In my game, there is the possibility to wear different clothes; they could "overlap", too (An armor and a Shirt).
The next Feature is you can change your armorpieces (armarmor(left and right; I don´t know, perhaps this is useless), gloves (left and right), armor for chest, helmet and hats, Pants, shoes (also left and right? I don´t think so)).
What is a good way for realise it? A ground mesh (My character) and now I lay my armorpieces over it (bound them to bones)? So I don´t have to give my armorpieces any animations...
In my mind, there is only one Problem: The renderbatches. For every amorpiece one renderbatch and I have so many small things to render in a big world... Every Batch Counts...

Any ideas how to realise a big "clothsimulation" with small batchamount?

EDIT: I don´t want only textures as clothes, perhaps for things like Shirts.
Image
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 755
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: Changable Clothes

Post by Samuel »

Bananenfreak wrote: What is a good way for realise it? A ground mesh (My character) and now I lay my armorpieces over it (bound them to bones)?
This would probably be your best bet. If you have a lot of armor options.
Bananenfreak wrote: In my mind, there is only one Problem: The renderbatches. For every amorpiece one renderbatch and I have so many small things to render in a big world... Every Batch Counts...
In my opinion I wouldn't worry about the character batches unless this is a mmo game your talking about.
Its more important to have your world combined into as few meshes as possible.
Like combining trees, rocks, and buildings all into one mesh. Of course this is assuming they won't pass the vertex/face limit.

If the batch count for your character is really important. Then you'll have to make the armors a part of the mesh directly.
It sounded like you have a lot of armor options though. So, you probably won't want to do this.

To recap I wouldn't worry about your character batches unless you have many characters being rendered.
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Changable Clothes

Post by Bananenfreak »

First, this will be a single Player game. Later, if I have enough free-time, I want to add a multiplayer (If I´m able to do that :D). But I´m really sure not a MMO :D
Image
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 755
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: Changable Clothes

Post by Samuel »

Alexi wrote:Is it possible to exclude polygons by a material script from being processed for animations and rendering?
As far as I know this is not possible with scripts or shaders.

As for the CPU issue. Hopefully, I'll have that toon hardware shader working for you soon. I got the basics done, but I just haven't had the time to finish it.
Sometime in the next few days I'll try to tackle the rest of it. If I don't finish it by this Monday I'll send you what I have and then maybe you can finish the last little bits.
Post Reply