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 lvictorino · Sep 03, 2014 at 05:37 PM · camerashaderrenderingeffectpostprocess

Post processing effect on depth only camera.

Hi,

I want to apply a post processing effect to a Camera with a culling mask set as Depth only.

My configuration is :

  • Camera 1: renders the game, depth set to 0, culling mask set to SolidColor

  • Camera 2: renders the UI, depth set to 1, culling mask sef to Depth Only

I'd like to apply a simple "Grayscale mode" shader (renders everything in grayscale) to the content of Camera 2 because I want this effect applied only to the UI.

But as the Camera 2 is rendered after the Camera 1, the post-processing effect is also applied to Camera 1' content.

How could I do something as simple as this?

Thanks in advance for your help.

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 AlwaysSunny · Sep 03, 2014 at 10:42 PM 1
Share

You'll need to code yourself a shader into which you'll submit the UI camera's render texture. The UI cam should render with a background color. The shader should draw the UI's RT to the screen, presumably using additive or alpha blending, and NOT draw the UI cam's background color. If you can depth-test your UI elements, that opens other avenues. The script to accomplish this should probably follow the ImageEffect design pattern, and reside on the main camera. It should manually render the UI camera during its OnPostRender(), then Blit() the result to the screen through your custom shader.

1 Reply

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

Answer by MakeCodeNow · Sep 04, 2014 at 04:20 AM

You have two options:

1) Have a custom UI shader that can blend between color and grayscale, using a float or bool shader param. Set this param based on your UI state.

2) Render the UI to a unique Render Target, clearing color and depth and writing destination alpha. After color and scene are rendered, blit the UI texture on top of the scene texture.

Comment
Add comment · Show 2 · 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 lvictorino · Sep 09, 2014 at 12:54 PM 0
Share

Thanks for your answer. Is it common to have several full screen post processing effects?

avatar image MakeCodeNow · Sep 09, 2014 at 04:16 PM 0
Share

On PC and console, yes. Not so much on mobile.

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

24 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

Related Questions

effect on clipping plane 1 Answer

(Non-Euclidean) Overlapping Textures with Multiple Cameras Problem 0 Answers

Is particular object visible 1 Answer

Using a camera replacement shader but keeping the underlying (original) colors? -4 Answers

Access Unity Projector Buffer 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