Forum rules - please read before posting.

How to Render GUI on a Separate Camera?

For speech bubbles I'm using a custom World Space Canvas UI. No issues there. The problem is that I'm also using a tilt-shift/depth of field effect to make the world seem like a miniature set; it is applied to MainCamera and this causes the World Space GUI to be blurred along with the scenery. So all the dialog text is blurry. I'd like for it to be sharp and crisp, no matter where it is in the game world.

A typical solution to this would be to render the GUI on a separate/second camera, thus having two cameras running at the same time. But I can't seem to figure out a way for Adventure Creator to do this.

Comments

  • AC won't control which layer the UI is on, so you could try setting it to it's own layer and creating a new camera to only render that layer.  Then parent that camera to AC's MainCamera so that they match up ( you may have to write a custom script that also copies the MainCamera's FOV, however).
  • edited December 2016
    Hi Chris!

    I have same problem here - my main camera have many effects, but I don't want to use some effects for background text and dialogues. How to do this? I agree, that it is good solution to add another camera which will be rendering different layers (with and without effects), but this method is working for objects and particles. So how can I find a way to exclude all dialogues or text or GUI from one camera with effects and set it to another camera without effects, maybe there is another trick?

    Thanks!
  • What effect is affecting your Menu, and is this an Adventure Creator-sourced Menu or a Unity UI one?  Generally, camera effects shouldn't your Menus.  It may be that the effect itself needs modifying.
  • edited December 2016
    I will try to describe my problem in details.

    I am using Unity UI. The main problem is in script called CTAA from Livenda. CTAA is actually an advanced temporal anti-aliasing. Here is the link so you can get an idea:

    http://www.livenda.com/

    Before using CTAA I was using many other scripts for my main camera and everything worked fine, but adding CTAA script into main camera gives a weird flickering and shake effect for all image and for all AC text in play mode. I decided to do a test to understand why image and AC text are flickering. So, I have turned off all scripts from my main camera except CTAA and this weird effect disappeared except for AC text. Next, I decided to do another test to see what script is making a conflict with CTAA and by disabling each individually script I found that the problem of image flickering appears when 2 scripts are "on" - CTAA and See Through System (basically this script which allows you to see objects behind the walls), but individually they work fine. So, the problem of flickering of image is in conflict of 2 scripts - of CTAA and See Through System for sure!

    BUT, another problem is that you see the same flickering for AC text. It is better to show you what is happening in video demonstration. Here is the link for video where you can see that effect. It will be better to download this video since quality from dropbox is not goof.

    https://www.dropbox.com/s/tl3rcp71h0c2rp1/CTAA Problems.avi?dl=0

    I wrote letter to Livenda support and have attached this video and described this situation in details and here is what they answered:

    Thanks for the Video, you are showing two separate issues, one for the GUI and the other with the See Through System. The GUI is flickering since there are no motion vectors being generated for it (which is required for re-projection), we have a fix method for this in the next coming update CTAA V2.6.

    In the mean while the simplest method to fix is to render the GUI from a separate camera and set it's depth order higher then the game camera and it's Clear Mask to Depth Only (can also try 'Don't Clear' method ) and set it's background color to black. This way the GUI will be rendered from a separate camera where there is no CTAA.  

    The See Through System am not too sure about, we have to take a look, there are a million ways to do things and everyone has their own method, especially with a system like ST where alpha masking is used to render objects behind using the depth map...

    So, I clearly understand that this problem is not about AC, but only in CTAA! They have described a method hot to fix this by putting CTAA on second camera. I hope that they can fix this problem with See Though System in near future but I also want to fix this problem for AC text. I don't want to loose apportunity to use CTAA in my game while waiting for CTAA update. That is why I want to try this trick with second camera. but I don't understand how to do this for AC text.

    Sorry, I am still learning Unity and AC while doing my game, so maybe all this are nube questions. I hope I've descriped everything in detail and maybe you have a solution for this? Chris, please help.

    Thanks!

  • As you're using Unity UI for your AC Menus, AC is simply taking care of when they are shown, and what happens when you click on them - not the rendering of them.  This means that the issue is actually between Unity UI and CTAA, not AC and CTAA.

    I would recommend waiting for their fix if you can - any workaround is going to be temporary, as you'll have to change it back once their update is out.

    However, AC won't change the Layer of your Unity UI prefab, so you can change that safely without AC affecting it.  You can then add another Camera to your in-scene MainCamera GameObject as a child, and set it to only render your new, separate layer that only your Unity UI prefabs are on.
  • Chris, huuuge thank you for your reply!
    I will try to play with this idea once again, but yep, it's better to wait their fix. 
    Thank you man!
  • I have the same issue as @pilamin. My speech bubbles are receiving bloom from the Main Camera's post processing effect. I tried parenting a new camera to ACs Main Camera with a specific layer as suggested, but the camera's size remains unaffected by the AC gamecamera specifications. 
    Have I set it up correctly or do I need a custom script?

    image


  • It's not set up correctly.  You want the regular MainCamera to be the parent, and then have your "UI" camera be a child.  This child should not have the MainCamera script or tag - just put in a new "UI" layer to match your UI elements.

    As a child object, it'll take the same position/rotation as your MainCamera, but the orthographic size won't change automatically - you'll need a script, i.e.:

    void Update ()
    {
      uiCamera.orthographicSize = mainCamera.orthographicSize;
    }

    Where "uiCamera" and "mainCamera" are two Camera variables exposed in your Inspector.
  • I set the camera up correctly now, but I'm having trouble with the script. I didn't understand this - Where "uiCamera" and "mainCamera" are two Camera variables exposed in your Inspector.

    Also, I'm not sure how to declare those two names in the script (as I don't have scripting knowledge) Thanks! :smile:
  • Try this:

    Add it to a C# script named CopyCameraSize and add it to the UI Camera.  Assign UI Camera and the Main Camera into the two fields in its Inspector, and the Orthographic Size fields will then match.
  • Thanks! Unfortunately the UI element fails to show up. Here's a video showing the issue (The UI element is the arrow from the speech bubble) Did a lot of tinkering but couldn't figure out the issue:

    https://youtu.be/Z7FjD_qSCL0
  • Change your UI Camera's Clear Flags field to Depth Only.
  • Works, thank you so much!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.