Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Zeroth · May 06, 2010 at 03:17 PM · textureimagemultiplelayer

Layering multiple 2d images on one texture

What I am trying to do is build a customizeable 2d mech game, where you select armor and parts, and the appearance of your avatar changes accordingly. This means, with a top-down view, I need to layer shoulders, head, legs when walking, etc.

How do I do this? I've looked at Texture2d, and found the SetPixels command, but that seems to be rather clumsy. The only way I can envisage this is to GetPixels from the smaller images, then SetPixels, but as I said, this is rather clumsy.

Is there a better, easier to use way?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by sean · May 06, 2010 at 09:19 PM

Hrm. So you've unwrapped entire mechs to textures and then split the model apart so you can have piecewise mechs where for some odd reason you want all the individual pieces to use the same texture file?

The answer from a proper pipeline standpoint is to allow each piece to use its own texture file- as long as you've loaded all the textures into Unity, it shouldn't actually chew up more VRAM to have multiple textures represented in multiple pieces of your mech. You may want to even split out and re-unwrap your mechs as separate pieces that can use separate texture files. This will make everything more modular and less headache-y.

If you really want to stick with compositing multiple parts of multiple textures into a single image, your best bet would be writing a shader that takes multiple textures and a grayscale mask image delineating which pieces of the final uv space to fill from which source image.

If even that would be a stretch, you may be able to somehow composite multiple Decal shaders, each with a texture that is transparent save for the part of the map you need, but I'm not sure offhand if Unity lets you stack render passes like that.

If you want to get REALLY pathological... I suppose you could (on a Pro license) stack up multiple simple full-viewport-sized planes each with an unlit transparent material and a component texture similar to the previous idea, render that to texture via a script, and plug the render result in as your final model texture.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Zeroth · May 06, 2010 at 10:31 PM 0
Share

No, I haven't taken apart mech models. This is an old-school 2d style game. :P

avatar image
0

Answer by Chris Masterton · May 06, 2010 at 10:05 PM

You are building a top-down 2d mech game? You could avoid compositing them altogether and draw each piece at a different y height. Let the transparent sorting take care of the composite.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image sean · May 07, 2010 at 02:09 PM 0
Share

that, and make sure your camera is set to orthographic so you don't get scaling issues between pieces

avatar image
0

Answer by Sammual12 · Sep 03, 2010 at 08:55 PM

If I understand http://answers.unity3d.com/questions/16020/multiple-textures-layered-in-a-single-mesh correctly then you can just make each mech part a different Texture and add a Material for every part/texture.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Combining textures into one image. 1 Answer

Multiple textures on single object similar to terrain painter? 2 Answers

How can I resize an image and save it to disk ? 6 Answers

load all png files as resource but NOT from resource folder 2 Answers

32 bit color in texture file 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges