Author Topic: Tasharen Fog of War  (Read 115087 times)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Tasharen Fog of War
« Reply #75 on: March 30, 2014, 08:01:57 AM »
@capitalj: Calling FOWSystem.CreateGrid() will re-create your FoW height map.

@zmeinaz: The same FOWSystem.CreateGrid() will need to be modified to perform raycasts using Vector3.forward instead of Vector3.up.

zmeinaz

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: Tasharen Fog of War
« Reply #76 on: March 30, 2014, 08:16:35 PM »
I'm still not quite getting the desired behavior. I have a 2D tile map on the xy plane. I want the tiles to have the fog of war. I think I need to somehow map the xz plane of the fow texture to the xy plane of my tile map. From what I have seen so far, the x-axis updates correctly, but the y axis is always 0.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Tasharen Fog of War
« Reply #77 on: March 31, 2014, 07:07:24 AM »
You will also want to modify the revealer logic (RevealUsingRadius, RevealUsingLOS) -- they use a 3D position.

zmeinaz

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: Tasharen Fog of War
« Reply #78 on: March 31, 2014, 08:29:57 PM »
Thanks, I ended up having to re-orient the FOWSystem to the xy plane. Works great!

capitalj

  • Jr. Member
  • **
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 88
    • View Profile
Re: Tasharen Fog of War
« Reply #79 on: April 01, 2014, 01:54:25 AM »
Hey, 2 questions about FOW:

1) Is it possible to have only 1 texture? I don't really need an explored and unexplored color. I would like to have everything either be  hidden or visible.

2) the FOW currently projects onto the skybox if viewed from a ground level instead of overhead view: http://cl.ly/image/0e2z31360d22

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Tasharen Fog of War
« Reply #80 on: April 01, 2014, 11:15:23 AM »
1. FOW always uses two textures, but not for explored / unexplored color, but for blending. The smooth transitions that occur when you are uncovering the map are done in the shader by blending between two textures. When one texture is at alpha of 100%, the second one can be used for writing the next batch of updated FOW data.

2. When using the Image Effect based approach the skybox is a part of the scene so yes it will be covered by the fog. If you want selective fog of war, you need to use custom shaders on objects as shown in the second example.

capitalj

  • Jr. Member
  • **
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 88
    • View Profile
Re: Tasharen Fog of War
« Reply #81 on: April 01, 2014, 01:45:00 PM »
Ah ok, I'll try out the shader based approach then.

So for the explored/unexplored areas, is there a way to disable that feature? So that areas that are hidden (whether previously explored or not) are always at the same darkness?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Tasharen Fog of War
« Reply #82 on: April 02, 2014, 06:54:30 PM »
Sure, set the explored/unexplored colors accordingly. For example if both are pure black then you will not be able to uncover anything. Only what's immediately visible will be seen. If you set the explored color to pure white, then you will premanently uncover parts of the world as you travel through it.

hummada23

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 45
    • View Profile
Re: Tasharen Fog of War
« Reply #83 on: April 06, 2014, 01:30:28 AM »
Hi,

Maybe I'm doing something wrong, but something I've noticed with this asset is that it doesn't black out the top of things that block the revealer's height (like the tops of mountains), as can be seen in the example included with it. Is there something I can do to change this?   

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Tasharen Fog of War
« Reply #84 on: April 06, 2014, 03:12:11 AM »
That's how it was written, yes. The top is visible -- you can see the top of the mountain -- so the fog of war node underneath gets marked as "visible". It's either that or it would be "not visible" -- meaning you would never see the top of the mountain as it would be shrouded by a permanent fog layer even if you've uncovered everything around it.

hummada23

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 45
    • View Profile
Re: Tasharen Fog of War
« Reply #85 on: April 06, 2014, 07:49:31 AM »
OK great, thanks.

capitalj

  • Jr. Member
  • **
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 88
    • View Profile
Re: Tasharen Fog of War
« Reply #86 on: April 06, 2014, 10:06:57 PM »
You can try setting the Raycast Radius to 0, I'm not sure if that will help in your situation but I remember doing something like that and it hid the backs of mountains.

konsnos

  • Newbie
  • *
  • Thank You
  • -Given: 8
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: Tasharen Fog of War
« Reply #87 on: April 10, 2014, 08:19:42 AM »
Hello, I have a question.

Is the height of FOW adjustable? I want to restrict the visible area into layers. Bottom won't seen anything on higher layers whatever the height difference, but higher layers will see lower.

Thanks in advance for the response.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Tasharen Fog of War
« Reply #88 on: April 10, 2014, 08:22:04 AM »
FoW is based on a 2D heightmap. The heightmap is created by performing raycasts into the world, determining the height at each pixel (and pixels are pretty big). Once this heightmap is created, it gets reused and won't be re-calculated unless you tell it to. Revealers that navigate the 2D heightmap have their own height, so when a "raycast" is performed, it's done in the 2D space by basically comparing the heights from point A to point B to see if something blocks the "line of sight".

konsnos

  • Newbie
  • *
  • Thank You
  • -Given: 8
  • -Receive: 0
  • Posts: 26
    • View Profile
Re: Tasharen Fog of War
« Reply #89 on: April 10, 2014, 01:06:13 PM »
FoW is based on a 2D heightmap. The heightmap is created by performing raycasts into the world, determining the height at each pixel (and pixels are pretty big). Once this heightmap is created, it gets reused and won't be re-calculated unless you tell it to. Revealers that navigate the 2D heightmap have their own height, so when a "raycast" is performed, it's done in the 2D space by basically comparing the heights from point A to point B to see if something blocks the "line of sight".
So basically if A can see to B, then B can also see at A? No exceptions?