Author Topic: GUI cameras and Image Effects  (Read 16737 times)

SeanP

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
GUI cameras and Image Effects
« on: April 23, 2012, 12:40:03 PM »
I noticed that while using ui cameras, I am not getting any of my image effects on the main camera, it seems I have to make the main camera the highest depth, currently my main cam is -1, 3D NGUI cam dept 0 and 2D NGUI Cam depth 1, is there any solution for this?

SeanP

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: GUI cameras and Image Effects
« Reply #1 on: April 23, 2012, 01:04:41 PM »
Through testing I've found that it seems to just be the 3D cam that is causing the issue,
its setup like this.
http://i.imgur.com/ssSXm.png


our main camera is set up like this.
http://i.imgur.com/IT20U.png

any help would be awesome.


Edit:
I figured it out, if I just add my image effects to the 3D Camera it applies to the camera below.
« Last Edit: April 23, 2012, 01:09:36 PM by SeanP »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: GUI cameras and Image Effects
« Reply #2 on: April 23, 2012, 01:50:08 PM »
Yeah the last camera needs to be the one with the effects as it will apply them to everything leading up to it.

Btw... near/far ratio of 1:400,000 is massive and will result in some serious depth fighting issues. You might want to fix that.

What I did in the space game starter kit is to have a "distant objects" camera which is used to draw planets, and the normal game camera is used to draw the game items. I first draw the planets with the distant camera, then game objects with the game camera. The distant camera travels at a much reduced speed as well, and always stays relative to the player.

nzen

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 30
    • View Profile
Re: GUI cameras and Image Effects
« Reply #3 on: August 27, 2012, 04:35:17 AM »
So what's the setup for this with regards to an FPS game? I can't get SSAO working.

I have the default FPS camera and UI Root (3D)

- Player
-- Main Camera (Depth 0)

- UI Root (3D)
-- Camera (Depth 2)
--- ...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: GUI cameras and Image Effects
« Reply #4 on: August 27, 2012, 08:22:53 AM »
SSAO requires a depth buffer, so it will only function on whatever camera actually fills it, such as your game camera. Anything drawn before or after it (such as your UI camera) won't write to the depth buffer and thus won't work.

nzen

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 30
    • View Profile
Re: GUI cameras and Image Effects
« Reply #5 on: August 27, 2012, 08:39:06 AM »
Are you saying it's impossible to have if you use NGUI? I can get it if the depth is higher, but no ngui...

I even tried a seperate camera just for drawing the SSAO but I don't think I'm doing it right.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: GUI cameras and Image Effects
« Reply #6 on: August 27, 2012, 12:22:25 PM »
Sure it's possible. Just put the SSAO effect on your game camera. Your UI camera shouldn't have anything on it.

nzen

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 30
    • View Profile
Re: GUI cameras and Image Effects
« Reply #7 on: August 27, 2012, 01:50:39 PM »
It was always on the game camera. The GUI "Camera" is drawing just the GUI_Layer and has no image effects

The Main Camera isn't drawing the GUI_Layer. It has SSAO/Vignette/HDR/etc components. None of them work.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: GUI cameras and Image Effects
« Reply #8 on: August 27, 2012, 02:18:12 PM »
Then image effects are not supported on your target platform.

Image effects have nothing to do with NGUI and work fine as long as they are on the correct camera. I use them in Windward myself (fog of war and grayscale, for example).

nzen

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 30
    • View Profile
Re: GUI cameras and Image Effects
« Reply #9 on: August 27, 2012, 02:24:07 PM »
My target platform is Windows.

Note: NGUI > Create a New UI > GUI_Layer/Advanced 3D makes the effects disappear, Simple 2D doesn't.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: GUI cameras and Image Effects
« Reply #10 on: August 27, 2012, 02:45:38 PM »
Works fine here. Are you sure you're not forgetting to choose a UI layer prior to creating your 3D UI? If both your game camera and your 3D UI camera use the default layer, you may run into issues.

nzen

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 30
    • View Profile
Re: GUI cameras and Image Effects
« Reply #11 on: August 27, 2012, 03:39:09 PM »
Here's a video of it: http://youtu.be/WJu3Bx6X1oE

I forgot to record the mouse movement.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: GUI cameras and Image Effects
« Reply #12 on: August 27, 2012, 06:21:06 PM »
Well, don't know what to tell you. It works fine when I do it here, as evident by my picture. I follow the same steps, and my SSAO works fine. The only thing different is my depth precision is a lot higher. Yours is 0.02:1000, which is 1:50,000. I recommend keeping that below 1:300. Other than that I'm at a loss as to what you're doing different.

P.S. Forward or deferred rendering mode? I use forward here.

nzen

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 30
    • View Profile
Re: GUI cameras and Image Effects
« Reply #13 on: August 27, 2012, 06:40:48 PM »
Ahh yes it was because I was in deferred mode. It works in forward. I have the paid version and from searching I hear it's supposed to work in deferred too?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: GUI cameras and Image Effects
« Reply #14 on: August 27, 2012, 07:07:35 PM »
Yup, and it does. Force the GUI camera to use forward rendering.