[Important Feature Request] Export SkinSwaps into multiple Atlases

Discuss issues pertaining to the Creature Animation Editor here.
sonic2002
Posts: 20
Joined: Sun May 05, 2019 7:51 pm

Re: [Important Feature Request] Export SkinSwaps into multiple Atlases

Post by sonic2002 » Sat Aug 10, 2019 5:26 pm

You probably work with hundred of developers or game studios.
I CAN'T BELIEVE nobody has encountered this problem.
Without these feature, all Creature becomes useless in tha game engine because of this serious memory problem!

Most of Game studios economy is selling weapons and skins. A LOT of them.

If you can't load them separetely, it means either to create games with few skins, so they are packed together with the character... OR


Provide a code To SWAP a placeholder texture at Runtime !!!

I can't believe nobody has told you this. How they are selling their games?
Create a separate Project file for each weapon? That would be INSANE...

In the Docs you state "
Skin Swapping ( Costume and Item swapping )
A more efficient way of allowing character costume and weapon/item changes is to use the Skin Swap functionality"

Well, thats not efficient at all, for the problem I presented to you, the memory problem of loading the whole assett.

Imagine we want to use the same Set of weapons to be used for different characters.

The right Way would be to load in memory the Character that has a Placeholder , the load ONLY the weapon I need at runtime, not ALL OF THEM.

With the current Skinswap I am forced to create a different atlas for each character even if they share the same weapons!! A very waste of memory!

chong
Posts: 1022
Joined: Thu Feb 19, 2015 2:21 am

Re: [Important Feature Request] Export SkinSwaps into multiple Atlases

Post by chong » Sat Aug 10, 2019 5:47 pm

Hello,

Actually quite a few game studios using Creature in production modify the runtimes to accomplish exactly what you mentioned for their own gameplay/engines.

Each mesh region is saved out with standard points, indices and uvs ( the standard mesh representation of any rendering engine ). From there any game dev can employ the standard graphics routines to manipulate and map whichever texture you want ( based on your engine ) to get the job done.

This is again why we provide the full source ( they are now even under the liberal apache license ) for Game devs out there. A lot of such functionality is quite specific to your gameplay and engine code. A lot of these studios have no issues modifying and customizing the code base for their production use, we suggest you do the same.

Thanks

sonic2002
Posts: 20
Joined: Sun May 05, 2019 7:51 pm

Re: [Important Feature Request] Export SkinSwaps into multiple Atlases

Post by sonic2002 » Sat Aug 10, 2019 6:05 pm

Even if they can generate an Image from UV indexes ( and I have no Idea how), that doesn't have anything to do with the problem of the memory.

You code colors, new motors and things, but this is a number ONE issue! Spine can separate the files in memory!! We switched to Creature because creating the animation is simpler like advertised, but then using it in the real production is not! When you work with the artists, they draw the textures of the weapons, And developers are supposed to simply just load them at runtime! I do know how to generate all these info from a psd file! That complicates much the things..

I read other people in the forum asking for the same feature years ago like: viewtopic.php?f=1&t=193

I said I can make a donation, could you please implement this method that is a PRIME feature instead of making new motors that would be useless if they need to load into memory giant atlases? Please,Please Help!!

Thank you in advance :roll: :|

Could you SHARE the code you use to convert a PNG image into points, indexes and UV then!
Most of Dev would like to have a simple Creature SDK with a simple method to SwapIN a texture into a Region.

chong
Posts: 1022
Joined: Thu Feb 19, 2015 2:21 am

Re: [Important Feature Request] Export SkinSwaps into multiple Atlases

Post by chong » Sat Aug 10, 2019 6:31 pm

Hello,

Actually the information I provided is what you need to accomplish your goals.

1. Each mesh has points, indices and uvs. You only need to map the uvs over to your own custom texture image ( loaded elsewhere ). This is precisely how other gamedevs do it via dynamically swapping out UVs for their own custom texture.

2. You could alternatively also just create different images for different parts and "attach" them to the various bones. That way you are independent of the mesh/uv scheme and you can swap out whatever item you want manually. Just size the image to the same bounding box dimensions of the region mesh.

These operations are all gameplay/game engine specific; it is expected for game devs to have standard/basic knowledge of implementing/modifying shaders + uvs to do this sort of thing. Again, most production houses have already implemented this feature themselves internally with no issues, this is custom to each and every gameplay/engine code base so everybody's implementation will be different.

Thanks

sonic2002
Posts: 20
Joined: Sun May 05, 2019 7:51 pm

Re: [Important Feature Request] Export SkinSwaps into multiple Atlases

Post by sonic2002 » Sun Aug 11, 2019 5:03 pm

Regarding the First Option:

That is not as intuitive as you describe.. It Tried this.
In order to do that we need to create two submeshes, one with a material containg the charcter body atlas, and another submesh with a material holding the weapon atlas! Is a bit hard to me to manage this, I believe this little line of code should be implemented just now.

SwapInTextureInMesh( string HatPlaceholder, Texture2d BlueHatTexture);
DONE.



No more hussle.It's a vary basic feature all the animation tools have.
Actually if you don't plan to help us We will forced to go with the BRAND NEW Fully integrated UNITY animation sistem, which yes, at the moment will not let you save as much time as Creature that has dynamic motors, BUT IS fully integrated.
The time I save with Creature I Must waste it into integrating these basic feature, so in the end..
The unity tool has a simple SpriteSKin component where any bdy part can be swapped with any texture at run time. No meshes, no vertex and UVS, submaterial and hard stuff. Easy and clean.

Regarding the second Option:

I do not understand how is different from the first option. Ma ybe you didn't understand the problem.
We are in Creature PACK.
We need to swap a simple weapon into a (damn XD!!) placeholder. That's it. We are getting crazy for doing these, because we expected a simple call to be there. The weapon must come from another Atlas, from Resources folder, From another Asset Bundle that contains all weapons. Not the one of the character body.

As I said PUT ALL SKINS AND WEAPONS together and Use the SkinSwap is a bloat of memory, is a suicide.

We actually are very in love with Creature and also because of your kindness, but you need to understand that if we don't receive any help in implementaing a basic feature like this that should be in a tutorial, we are forced to switch to another solution in order to release our game.

We will throw away ALL OUR TIME we spent on damn animations on all the characters of our game.
8 Months of work thrown in the bin.
Because the lack of a method.

I need to know, what solution do you propose. Could you code this for us or copy a snippet, from these "studios" that you said have already succeded in these? Can you help the whole community or not ?

Thank you very much.

chong
Posts: 1022
Joined: Thu Feb 19, 2015 2:21 am

Re: [Important Feature Request] Export SkinSwaps into multiple Atlases

Post by chong » Sun Aug 11, 2019 5:18 pm

Hello,

CreaturePack does not have bones so you will not be able to do attachments using bones. You have to use the fully-featured Creature runtime to be able to attach your own images as slots.
This is clearly documented in the CreaturePack Github docs:
https://github.com/kestrelm/Creature_Un ... eaturePack
CreaturePack however does support SkinSwapping since that is completely mesh based. But it does not support all the features of the full Creature plugin since it is tailored specifically for fast mesh deformations. When you are developing the game, you should have looked at the features sets from both the Creature and CreaturePack plugins to decide which one to pick. You can even mix and match them for different characters/scenarios.

The reason why you seem to think it is easier in other systems is because they do not support full mesh deformation which is why swapping in those systems is much easier to handle. In a full mesh deformation system like Creature, you will need to be aware of UVs + points in order to accomplish what you want.

I cannot release any code from other studios because they are obviously proprietary; I can however describe what I think their algorithm is ( which I already did in the previous post ) and you can grab some ideas from them for implementation.

You need to understand a couple of things:

1. In CreaturePack, everything has been baked down/compressed to an optimal file format ( which is what CreaturePack is ). It is tuned for size + performance but it lacks the full features of the original JSON/Flatbuffers format. Again, this is documented on the Github plugins site.

2. If you want to swap items, you need to understand you cannot just swap an arbitrary mesh into the character and expect it work. Remember, this is a full on skinned mesh with inverse bind matrices, skin weights etc. The method you described ( a simple call ) isn't going to work as you described. Which is why the best option ( and correct option ) is UV swapping to another part of the texture. If not, you need to do what I described which is attach another non deforming image onto the bone transform for swapping.

To be honest, the above point 2) is something most gamedevs with proper game engine/gameplay experience do have if they want to go beyond what is provided in the API set of Creature. The same idea is applied if you want to swap out say a gun mesh in a FBX character in 3D. If you do not care about mesh deformation, you will essentially just attach your static mesh under the transform of the bone you care about and let it get carried along for the ride. This is the same concept and will allow you to save memory from large texture atlases. As for the implementation, this will be specific to your game and you as a gamedev will need to figure that out since every person's game is quite different.

3. Going beyond 1 texture atlas has issues in itself. Firstly, that means you will need to bind a different texture for each region mesh if it addresses a different texture; this has big performance issues. Secondly, you could also say give each mesh point multiple UV coordinates but that means you will need to write a special Unity shader to accomplish what you want. Plus, because you now have less uv sets to play with per point, another game dev with different requirements from yours will not be able to run a different fancier shader that uses multiple uvs per point for advanced lighting effects for example. So when you say give you the code to do it, take note that everyone's use case is quite different. Hence, these things are all gameplay specific methods that the gamedev needs to take up and customize/implement.

4. The Creature runtimes are not only on Github, they are on a very liberal Apache Licensing scheme ( which means even game devs who don't own Creature are free to use them for any close sourced app ). This is very generous ( and you can compare with the other solutions out there ) and was done specially for game devs after numerous requests from various studios. A lot of them have teams working on customizing the runtimes for their specific needs. With the full source out, studios are free to ( and encouraged to ) go ahead and modify it/customize the plugins for their own requirements.

sonic2002
Posts: 20
Joined: Sun May 05, 2019 7:51 pm

Re: [Important Feature Request] Export SkinSwaps into multiple Atlases

Post by sonic2002 » Sun Aug 11, 2019 7:32 pm

Which is why the best option ( and correct option ) is UV swapping to another part of the texture.
"UV swapping to another part of the texture" DOING THIS MEANS:

EITHER------> MEANS that this texture is inside the same atlas of the charcter body and THIS IS NOT FEASIBLE AND SCALABLE BECAUSE of memory problems..

OR ------> (CORRECT ME IF I am wrong)

I understood that, in order to get a Weapon W from another atlas, I take its UV references, which are relative measures from 0 to 1 that refers to a texture assigned to a material! when you do :
active_mesh.uv = uvs;
And then you set Active Mesh as the main mesh, it is going to READ those UV coordinates refering them to the MATERIAL that is assigned to the Mesh!
A material holds only ONE atlas.

AND I SAID THAT ONE ATLAS CONTAING ALL IS NOT SCALABLE!!!
Thus I am forced to create A mesh with 2 materials, each with an atlas. One for the charcter body, the other for weapon.
The atlas of the weapon will be Unloaded from the memory when not used.

This is done Creating 2 submeshes and merging them.

AND THIS IS HARD AND LONG.

So do you have a faster solution? From what you write "the best option ( and correct option ) is UV swapping to another part of the texture. " looks very fast instead, but as I shown you, it's not...

PS. No, The New integrated 2d Animantion plugin Made by UNITY is simple and fast and provides mesh deformation! And is very easy to swap things and fully interated with mecanim with the Override and Layers feature (Creature is not).

chong
Posts: 1022
Joined: Thu Feb 19, 2015 2:21 am

Re: [Important Feature Request] Export SkinSwaps into multiple Atlases

Post by chong » Mon Aug 12, 2019 2:25 pm

Hello,

1) No that is not true, in any rendering engine you can have a vertex with more than one UV coordinate and you can also bind your rendering mesh to multiple textures ( you need to understand the rendering engine internals to do this ).
Thus, you can have multiple UV coordinates per vertex, with a second set of UVs referencing a completely different texture map. You will however need to implement the code to do this ( the shader needs to be aware of multiple UVs ) and you need to make sure your code works with the current rendering pass configured in the rendering engine. I believe the maximum number of texture sampler units per shader right now is 16 for most engines.

2) Another alternative for you is what some other studios do: You construct a submesh for each of the character's regions with the material referencing the character's texture atlas. This submesh has the same number of points, uvs etc. as the original region mesh. At runtime, you pose the character first ( by running 1 timestep of it ) but keep the original full character mesh invisible. You then copy over each of the character mesh's point, uvs etc. over to each submesh. The submeshes are the actual meshes you render, not the original character mesh which is invisible. Basically this is a clone of the Creature character but rendered as separate submeshes. If you want to now swap in a separate new item independent of the original Creature character, you can use a standard Unity render mesh object bound to another texture. You will then have to attach that separate mesh object to the submesh you want to swap out. The submesh is now made invisible ( because you want to swap that out ) but you will need to pick 3 points from it to form an attachment transform ( you need to compute the transformation matrix frame from those 3 points ). With the attachment transform computed, you can now proceed to put your new attachment in the correct location for rendering.
If you are using the full Creature Plugin instead of CreaturePack, then it's even easier. Just use the corresponding bone transform as an attachment transform for your newly swapped item.

Do take note however, that method 1) ( swapping UVs ) is still more optimal since you are batching everything into 1 render pass. For performance reasons, it is always much more optimal to reduce the number of drawcalls and render everything as one single pass. Of course if you aren't familiar with how rendering engines/shaders work, 2) is probably easier for you.

Cheers

furrfire
Posts: 55
Joined: Fri May 04, 2018 4:33 am

Re: [Important Feature Request] Export SkinSwaps into multiple Atlases

Post by furrfire » Thu Sep 05, 2019 9:10 am

This thread does have me curious about something.

Are we talking about skin swaps using too much memory?
Or the cpu performance?
Both?

I got this character with lots of skin swap parts. We spam it in unreal engine to stress test. Like hundreds of characters... I notice that the performance (frames per second) is the same whether 1 skin is active or if ALL of them are active. The memory in use doesn't seem to matter.
Are we doing something wrong here?

chong
Posts: 1022
Joined: Thu Feb 19, 2015 2:21 am

Re: [Important Feature Request] Export SkinSwaps into multiple Atlases

Post by chong » Thu Sep 05, 2019 9:20 am

Hello,

In general the skinSwaps are very efficient, and in UE4 in particular should be quite optimized as you mentioned in your tests.

Cheers

Post Reply