Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Leuthil · Sep 23, 2014 at 01:35 PM · shadershaderscolormaskcolormask

Shader help - 2d black and white polygons where black shows one background image and white shows another

I'm really stuck on this and I've tried numerous things which haven't been working very well. I am new to shader programming so I don't really have a clue what to do. I tried looking into the DepthMask shader but it didn't accomplish what I needed. Basically I have a game like this that is black and white and I am trying to make the black show an image and the white to show another image like these examples:

Example 1 (the subtle textures on each colour is different)

Example 2 (a clear example of the kind of thing I would do except for both colours)

I have tried setting the polygons to textures manually but the problem is that the textures don't line up obviously so it doesn't look like a mask over a big entire image.

My ideal solution would be a post-process effect that just finds either black or white pixels and replaces it with the appropriate pixel of each one of the two textures (the one for the black and the one for the white). I don't have Unity Pro though so that may not even be possible (if it is even possible with Unity Pro??).

Comment
Add comment · Show 1
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 Leuthil · Sep 23, 2014 at 02:50 PM 0
Share

I found in the Unity manual something that is getting closer to what I need. At the Surface Shader Examples page if you scroll down to "Detail Texture in Screen Space" it seems to provide a functionality close to what I need.

I guess I'll try fooling around with that and see what I can do. Would anyone be able to explain the shader code there a bit to me? I understand UV mappings but I don't know where the 8,6 comes from (unless it's just an arbitrary number).

0 Replies

· Add your reply
  • Sort: 

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

26 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Creating a line between different colors? 0 Answers

How to increase the brightness of the Texture Mask Shader? 0 Answers

is it possible to make 2d real time coloring with masks (paint app) 1 Answer

Alpha-based Color Mask 2 Answers

Implement texture masking into simple existing shader 1 Answer


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