Search Unity

  1. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  2. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Participate with students all over the world and build projects to teach people. Join now!
    Dismiss Notice
  5. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Supersample Rendering using Cinemachine

Discussion in 'Cinemachine' started by DavidAvenue, Oct 2, 2018.

  1. DavidAvenue

    DavidAvenue

    Joined:
    Dec 27, 2016
    Posts:
    5
    Hey,

    We have were having this issue and went on to use this supersampling script and it worked fine with the Unity's default camera, but haven't been able to make it work when using cinemachine, would you please tell me if there's some way in cinemachine to achieve this? or what I might need to change to make it work.

    Thanks.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,820
    You can make that script work with the Cinemachine camera.
    Just follow the instructions. Make a new Camera that will be your final camera. Deactivate the Camera component on your old main camera, the one with the brain (leave the brain active). Attach the script to the new camera, as directed, and link the brain's deactivated camera to the script. No reason why it shouldn't work.
     
  3. DavidAvenue

    DavidAvenue

    Joined:
    Dec 27, 2016
    Posts:
    5
    Hey, thanks for your input but still couldn't get it to work. I guess should start by saying I have the MainCamera (with Camera component, Cinemachine Brain, and tagged as MainCamera), and a CM vcam (with Cinemachine Virtual Camera component) -- all which is just a 2D Camera.

    I tried but was getting these:
    - Can't add component 'Camera' to MainCamera because such a component is already added to the game object!
    - NullReferenceException: Object reference not set to an instance of an object SupersamplingCamera.Start().
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,820
    It's not clear what you tried. Given your description of your setup, I see no reason why the supersampling script you posted wouldn't work if you followed the instructions correctly.

    Maybe you could be a little more specific about what exactly you tried to do?
     
  5. DavidAvenue

    DavidAvenue

    Joined:
    Dec 27, 2016
    Posts:
    5
    Hi, these are the steps I did:
    1. I created a scene and added a Cinemachine 2D Camera.
    2. Added the SupersamplingCamera script Main Camera.

    This results in:
    Can't add component 'Camera' to Main Camera because such a component is already added to the game object!

    Any suggestions would be greatly appreciated.
     
    Last edited: Oct 23, 2018
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,820
    Looks to me as though you're not following the instructions given with the script you linked to, namely:

    1) deactivate your main camera
    2) create a new camera and set culling mask to none and clear flags to solid color
    3) attach this script [...]
    4) link your main camera to the script
    You're supposed to end up with 2 Unity cameras:
    1. The Main Camera, with the CM brain, and the Unity Camera component deactivated
    2. A second camera, with the supersampling script, and the Main Camera linked in the "cam" field
     
  7. DavidAvenue

    DavidAvenue

    Joined:
    Dec 27, 2016
    Posts:
    5
    Thank you very much.

    I'd like to add that for it to work I had to remove the "using UnityStandardAssets.ImageEffects" and was able to set the Clear Flags to Depth only because otherwise it woudln't show anything on the Game view while in Edit Mode.
     
    Gregoryl likes this.