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 mcmcmc · Mar 20, 2013 at 09:35 PM · shadersprojectors

Merging colors of 2+ Projectors

Hello,

I am creating a game where the player is able to throw paint upon objects in the game world to reveal it. Initially the game world is mostly white, so they throw their colored paint to reveal walls, objects, etc.

Right now I create a projector to apply paint to surfaces, and these projectors are of red/blue/yellow color paint splats. However when two or more projectors hit any given area, the colors are not merging as I would expect them to.

My desired effect is to have the colors merge to their correct color when the projectors intersect, so red + yellow = orange, yellow + blue = green, etc. The current observed effects are:

  • red + blue = black

  • red + yellow = red

  • yellow + blue = black

  • all three together = black

alt text

I am currently using the Projector/Multiply shader on my material being projected. I know I have to use shaders to apply these rules, however I have no idea where to start, as I don't have much training or knowledge in shaders.

Could somebody please give me some references where I could learn to get my desired effect, or help me find a shader which already does this?

Thanks for your time.

splatter.png (122.1 kB)
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 hoy_smallfry · Mar 20, 2013 at 09:59 PM 0
Share

Using Projector/$$anonymous$$ultiply is your problem. Take these colors for instance:

Red (1, 0, 0, 1)

Blue (0, 0, 1, 1)

If you are multiplying, the equation is:

Red Blue = ( Red.r Blue.r, Red.g Blue.g, Red.b Blue.b, Red.a Blue.a ) = ( 1 0, 0 0, 0 1, 1 * 1 ) = (0, 0, 0, 1) = Black

Same with yellow and red:

Red (1, 0, 0, 1)

Yellow(1, 1, 0, 1)

Red Yellow = ( Red.r Yellow.r, Red.g Yellow.g, Red.b Yellow.b, Red.a Yellow.a ) = ( 1 1, 0 1, 0 0, 1 * 1 ) = (1, 0, 0, 1) = Red

Ins$$anonymous$$d of a multiply, you should use an additive equation, so that way: you get the corresponding values:

Red + Blue = ( Red.r + Blue.r, Red.g + Blue.g, Red.b + Blue.b, Red.a + Blue.a ) = ( 1 + 0, 0 + 0, 0 + 1, 1 + 1 ) = (1, 0, 1, 1) = $$anonymous$$agenta

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Freaking-Pingo · Mar 20, 2013 at 09:55 PM

Personally I don't have much experience with shaders either, but I think this can be achieved in a shader.

What you probably are looking for is blending colors. Perhaps in your current shader you are using additive color, which mean you have to go into that shader and change it to blending colors.

ShaderLab syntax: Blending

This is the best shot I can give you, but I may be wrong.

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

12 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

Related Questions

Terrain Trees Ignore Projector 0 Answers

Question regarding the blob shadow projector shader 0 Answers

Weird Lines When Using Projector Unity 2020.3 0 Answers

Grid Projector only for up-facing normals 1 Answer

Low intensity of projector in dark enviornments 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