|
I've read at this forum some questions similar to mine, but no one seems to have the answer for what I'm looking for. I'm working with customizable characters, and what I'm looking for is basically to apply different textures to a single mesh, overlaping them hierarchically (not only replacing one texture with another one), like shown on the image. Does anyone have any clue about how to do that? Many thanks
(comments are locked)
|
|
If the model is a single mesh, with a single material you can just 'add' materials to its mesh in the inspector. If you look at a model in the inspector with a mesh render component assigned you'll notice you can add further materials by setting the size value. Normally this is for use with mulit sub-meshes, but you can assign as many materials as you like. Any materials > number of meshes will be applied over the top of the material assigned to the last sub-mesh (if you have a single mesh then its just applied over the top of it). Frankly its rather odd behaviour as although it works for single meshes, its no use for multi sub-mesh models as only the last sub-mesh will have the additional materials applied to it. Its a bit hard to explain, but if you give it a go, it should become obvious. I asked a question about this behaviour myself, but never really got a good answer as to why it works as it does or if its even intentional. If you have multiple sub-meshes then its unlikely to be of use, in which case writing a shader is your best. Although I guess you could always write some code to composite a sequence of textures into a final version, avoiding the need for a shader and reducing draw calls. Many thanks! It seems to be exactly what I was looking for. I'll try that here. Thanks for replying!
Jul 23 '10 at 02:14 PM
Dorothysb
Yay! It worked! Many many thanks! I just have a concern about that. I'll try to make myself clear, because I'm quite a newbie on unity (actually, I'm a character artist with not much experience with engines ). My question is: How does unity handle all this maps applied on a single material? I mean, does Unity "converts" all the different textures in a single one into the engine to optimizing the file size?
Jul 23 '10 at 03:11 PM
Dorothysb
Well you're not adding maps, but adding materials, so there is no additional memory overhead. However there is likely to be gpu processing overhead as each material will (I believe) need another render pass per additional material you add to the list. Effectively what you are doing here is (as I understand it) telling Unity to render the mesh with the first material, then render again with the next material in the list and so on.
Jul 23 '10 at 05:19 PM
Noisecrime
There is no texture compositing or optimisation going on, though that should not be a problem. You need all the textures in memory regardless which method you choose.
Jul 23 '10 at 05:19 PM
Noisecrime
Omg, just saw this now and it is so helpful!!! Thanks Noisecrime
Oct 13 '11 at 01:15 AM
Pilot
(comments are locked)
|
|
You can achieve that with multi sub-object materials. Note: This is done in the design phase of your mesh and isn't done inside of Unity. This involves breaking the character's body apart by poly face and assigning a specific material ID to each separate section. From there each part can have a separate texture applied to it. See Tutorial linked above. Keep in mind that the more materials you have the more GL draw calls your character requires. Hope that helps. == Yes, but I the character I'm using as a reference for that it's not breaked in so many pieaces. The forearm for example, it's made in one single piece. It really seems that there's a texture overlapping...
Jul 21 '10 at 01:56 PM
Dorothysb
This could be done with the method I mentioned above but with some clever texture mapping techniques.
Jul 21 '10 at 02:17 PM
equalsequals
You could also go so far as to write a shader that linear interpolates multiple textures together based on masks.
Jul 21 '10 at 02:19 PM
equalsequals
Thanks, I'll make some tests here! Cheers
Jul 21 '10 at 02:21 PM
Dorothysb
(comments are locked)
|

