Author Topic: Fog of War -- Getting Terrain Trees and Grass Under the Fog  (Read 4251 times)

Velo

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 13
    • View Profile
Fog of War -- Getting Terrain Trees and Grass Under the Fog
« on: April 16, 2014, 01:11:39 PM »
Hello,

So far I've managed to get a couple of shaders (not provided with the package) to work with the fog of war system by modifying the shaders themselves with lines of code provided in your shader examples.  However, I'm having trouble getting trees and grass used in Unity's built-in terrain script to work with the fog of war correctly.

I have a separate tree prefab in which I've modified the shader for the tree, and it works with the fog of war system exactly how I want (which is good).  However, as soon as I use this exact same tree prefab with Unity's terrain system (i.e. the ones you can "paint" onto the terrain), the tree's cease to work with the fog of war for some reason.

Is there any way you could help me with what lines of code need to be in either the terrain shader or the tree shader in order for the tree to be covered by the fog of war when it's placed using the terrain painting system?

Thank you.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Fog of War -- Getting Terrain Trees and Grass Under the Fog
« Reply #1 on: April 17, 2014, 02:04:52 PM »
I honestly don't know anything about how Unity does objects painted on the terrain.

Velo

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 13
    • View Profile
Re: Fog of War -- Getting Terrain Trees and Grass Under the Fog
« Reply #2 on: April 17, 2014, 02:11:49 PM »
Ouch.  Okay. 

Well, I'm considering buying the pro version of Unity, and so then I'd be able to use the "image effect (post-processing)" version of this asset.  But do you know if doing it that way would the fog of war cover the trees and grass used with Unity's terrain system?


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Fog of War -- Getting Terrain Trees and Grass Under the Fog
« Reply #3 on: April 17, 2014, 02:17:26 PM »
Yes, it will.

Velo

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 13
    • View Profile
Re: Fog of War -- Getting Terrain Trees and Grass Under the Fog
« Reply #4 on: April 17, 2014, 02:22:56 PM »
Awesome.  Thank you.

The fog of war effect looks great btw, and being able to hide the renderers with your provided script is amazing.  Just wanted to say thank you for making this asset  :D