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
2
Question by Therian13 · Mar 23, 2015 at 06:36 AM · unity 5cameralayersimage-effectsmultiple cameras

Unity 5 image effects for multiple cameras

Hello Everyone,

First, I apologize that this may seem like a repeat of other questions, but none of their solutions seems to work for me.

My issue is that I currently have 2 cameras in my game, one is the player's main camera, and the other is the layer camera that draws the player's arms.

My game uses edge detection image effects, but it will only work for one camera at a time. in this case, the layer camera, since it has a higher depth. So the hands get the edge detection, but the rest of the scene does not.

I used to have a script called Copy to Camera RT, and it worked great while I had Unity 4.6, but once I upgraded to Unity 5, it no longer works.

Would anyone know a way to fix this error?
Any help would be greatly appreciated. Thank you.

Comment
Add comment · Show 3
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 SaraCecilia · Mar 23, 2015 at 04:22 PM 0
Share

Hey, can you post the relevant parts of your script? And whatever error messages you are receiving.

avatar image Therian13 · Mar 23, 2015 at 06:45 PM 0
Share

there are no errors. Its just one camera is over-writing the image effects for the other camera. The scripts are the built in image effects for unity.

the copy to screen one is :

 using System.Collections;
 using UnityEngine;
 
 // fixes the deferred lighting missing final copy&resolve, so the next camera gets the correctly final processed image in the temp screen RT as input
 // NOTE: The script must be the last in the image effect chain, so order it in the inspector!
 [ExecuteInEdit$$anonymous$$ode]
 public class CopyToScreenRT : $$anonymous$$onoBehaviour
 {
     private RenderTexture activeRT; // hold the org. screen RT
 
     private void OnPreRender()
     {
         if (camera.actualRenderingPath == RenderingPath.DeferredLighting) {
             activeRT = RenderTexture.active;
         }
         else {
             activeRT = null;
         }
     }
 
     private void OnRenderImage(RenderTexture src, RenderTexture dest)
     {
         if (camera.actualRenderingPath == RenderingPath.DeferredLighting && activeRT) {
             if (src.format == activeRT.format) {
                 Graphics.Blit(src, activeRT);
             }
             else {
                 Debug.LogWarning("Cant resolve texture, because of different formats!");
             }
         }
 
         // script must be last anyway, so we don't need a final copy?
         Graphics.Blit(src, dest); // just in case we are not last!
     }
 }
avatar image Therian13 · Mar 26, 2015 at 11:10 PM 0
Share

Still an ongoing issue.. Has anyone found a work around for this by chance?

1 Reply

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

Answer by Therian13 · Mar 27, 2015 at 01:09 AM

I got it to work finally.

I had to make my main camera's rendering path as Legacy Deffered, and the layer camera as Legacy Vertex Lit, and THEN I had to change the Quality Settings / Anti Aliasing to at least X2 Multi Sampling.

Why this worked, I'm not particularly sure. but the good news is, that it doesn't need any scripts to work anymore. so I guess there is that. :D

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 _invalidusername · Sep 04, 2015 at 08:58 PM 0
Share

Changing the anti aliasing in quality settings did the trick for me, thank you

avatar image TeohRIK · Apr 25, 2016 at 08:29 AM 0
Share

I really appreciate your answer, it stuck me for 1 day and finally I get this work :D

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

23 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

Related Questions

What are the performance issue of using multiple camera in layers (Mobile) 0 Answers

Weird FPS Camera 0 Answers

Applying Image Post-Processing Effects to Right Eye 1 Answer

how do i make first person character rotate left and right along with camera? 0 Answers

Capture camera output 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