Author Topic: [Fog of War] Make fog not overlay in clear areas  (Read 8319 times)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: [Fog of War] Make fog not overlay in clear areas
« Reply #15 on: December 22, 2013, 07:45:00 PM »
Move the Boom effect to your game camera as well.

Anselm

  • Guest
Re: [Fog of War] Make fog not overlay in clear areas
« Reply #16 on: December 23, 2013, 10:58:39 AM »
Due to the way Unity handles cameras if I move the bloom effect to the camera on the left it won't draw the effect.

I suppose this could explain the fog not drawing either. Due to Unity's silly way of handling camera rendering.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: [Fog of War] Make fog not overlay in clear areas
« Reply #17 on: December 23, 2013, 02:07:54 PM »
Handles cameras? What do you mean? Lower depth cameras are drawn first, which in your case is your main camera. UI camera can be last, drawn after all the post processing effects. It should work just fine.

Anselm

  • Guest
Re: [Fog of War] Make fog not overlay in clear areas
« Reply #18 on: December 23, 2013, 05:40:05 PM »
The way Unity has it's camera system set up post processing effects on cameras with a lower depth do not draw at all. You have to have the post processing effect on the highest depth camera in order for the effect to render properly, according to the Unity forums

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: [Fog of War] Make fog not overlay in clear areas
« Reply #19 on: December 24, 2013, 01:56:09 PM »
That's not true. Windward (http://www.tasharen.com/windward/) has the game camera with the FoW, and the UI camera is drawn afterwards.

P.S. Both your cameras are on the "Default" layer, which is wrong. The 3D UI camera should be on the 3D UI layer.

Anselm

  • Guest
Re: [Fog of War] Make fog not overlay in clear areas
« Reply #20 on: December 27, 2013, 12:18:34 PM »
I'll set up the cameras to be on the correct layers.

And that's very odd, in my projects whenever I have two cameras camera effects only work when you put them on the last drawn camera. I even looked at the Unity forums and they said this was a problem with the way Unity handles cameras. I'll try switching the layers on my cameras and see if that fixes it

Anselm

  • Guest
Re: [Fog of War] Make fog not overlay in clear areas
« Reply #21 on: December 27, 2013, 12:31:19 PM »
Nope, still doesn't fix it. I moved everything off the 3DGUI camera and changed it's layer, and the fog still only draws when the 3DGUI camera is turned off.

What settings did you have on the two cameras in Windward?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: [Fog of War] Make fog not overlay in clear areas
« Reply #22 on: December 27, 2013, 04:29:52 PM »
Main Camera (depth 0, Skybox clear flags, perspective projection)
- Grayscale effect
- FOWEffect

UICamera (depth 1, depth only clear flags, orthographic projection)
- UICamera script

Anselm

  • Guest
Re: [Fog of War] Make fog not overlay in clear areas
« Reply #23 on: December 27, 2013, 06:17:43 PM »
Interesting, it seems that the problem is caused by the 3DGUI camera being perspective. When I switch it to orthographic the fog draws fine.