Author Topic: Tasharen Fog of War change axis to 2D x-y  (Read 4258 times)

BuddyBoy

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Tasharen Fog of War change axis to 2D x-y
« on: April 14, 2014, 09:57:50 AM »
Sorry for the duplicate post, I have been search for answers for 2 days and I see this question popping up on a few forums so I thought it would be a good idea to post a
new thread so we can all see the answer here.


I am working on a 2D game in Unity 4.3 and I want to use this but the x/y axis is not supported.

Please can you explain each file to modify and what to change to use the 4.3 2D x-y. I saw somebody else asked this but I was a little lost.

I assume the cs files as well as the shader, but please outline the changes.

Thanks.

Buddy

BuddyBoy

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Tasharen Fog of War change axis to 2D x-y
« Reply #1 on: April 15, 2014, 12:49:34 AM »
Hi Aren. Please help, been three days now with no answers. I have purchased all of your plugins/ games - some I don't even use but I wanted to show my support of your business - I have also never pestered you for support and figured it out myself.

If you could advise on the above, it would be most appreciated.

BuddyBoy

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Tasharen Fog of War change axis to 2D x-y
« Reply #2 on: April 15, 2014, 05:03:39 AM »
I need the FOG to use the image effect - to XY setup.


  • I have modified (with awesome help elsewhere) the FOWSystem.cs to orientate to the XY.
  • I need to get the FOV.Shader to reflect the xy now - I have no clue how to do this...
  • Revealer -not sure what to change here.
« Last Edit: April 15, 2014, 05:25:34 AM by BuddyBoy »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,149
  • Toronto, Canada
    • View Profile
Re: Tasharen Fog of War change axis to 2D x-y
« Reply #3 on: April 15, 2014, 10:42:45 AM »
Alright, well first look at FOWImageEffect. It also uses XZ there (line 80). You will want to change this to XY.

In the FOW.shader you will want to change .xz to .xy on line 52.

If you already made all the changes to FOWSystem then I think this should be it.

BuddyBoy

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Tasharen Fog of War change axis to 2D x-y
« Reply #4 on: April 15, 2014, 12:04:59 PM »
Done! Thanks :)
FOWImageEffect was the key,thanks !

hurleybird

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Tasharen Fog of War change axis to 2D x-y
« Reply #5 on: June 21, 2014, 06:51:27 PM »
In the FOW.shader you will want to change .xz to .xy on line 52.

I'm also trying to get fog of war to work for an XY 2D game. These instructions don't seem valid any longer. In the current version line 52 reads as "pos.xyz = pos.xyz * 2.0 - 1.0;" and changing to .xy doesn't work. 

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,149
  • Toronto, Canada
    • View Profile
Re: Tasharen Fog of War change axis to 2D x-y
« Reply #6 on: June 22, 2014, 09:16:13 PM »
Line 84, hurleybird:
  1. float2 uv = pos.xz * _Params.z + _Params.xy;
Note the ".xz". If you search the shader for ".xz" you will only find this one reference.

fkufgs

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Tasharen Fog of War change axis to 2D x-y
« Reply #7 on: November 26, 2014, 09:57:15 PM »
Hi,

been trying to achieve this myself for a while but to no avail.

Could you share these scripts please n thank you.  :P

Thnx

Cheers,

fkufgs

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Tasharen Fog of War change axis to 2D x-y
« Reply #8 on: November 28, 2014, 02:28:18 PM »
Any one have this done and would like to share scripts??? Aren???

Thnx,

Cheers

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,149
  • Toronto, Canada
    • View Profile
Re: Tasharen Fog of War change axis to 2D x-y
« Reply #9 on: November 30, 2014, 06:05:45 AM »
I've never done it myself. I merely guided others to how to do it. I don't have a script to share.

fkufgs

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Tasharen Fog of War change axis to 2D x-y
« Reply #10 on: November 30, 2014, 11:10:47 AM »
Hi Aren, do you mind telling me what functions to change in the system.cs script, i did the shader and other script.

thnx,

Cheers

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,149
  • Toronto, Canada
    • View Profile
Re: Tasharen Fog of War change axis to 2D x-y
« Reply #11 on: December 02, 2014, 12:44:35 PM »
Basically search for ".z" and replace it with ".y".

JayExbl

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Re: Tasharen Fog of War change axis to 2D x-y
« Reply #12 on: July 28, 2015, 05:32:38 AM »
I tried several times to get this working but I'm afraid I've had no luck.

I changed float y = t.position.z - mFog.worldSize * 0.5f;
to float y = t.position.y - mFog.worldSize * 0.5f;

Also changed .z's to .y's in FOWsystem.

At this stage it still doesn't work for me, so I also changed this:

mSize = new Vector3(worldSize, heightRange.y - heightRange.x, worldSize);
to:
mSize = new Vector3(worldSize, worldSize, heightRange.y - heightRange.x);

Still not working.

Not sure if there's anything else I need to do in regards to co-ordinates in my scene, but I think its all based on world co-ords?

If I can get the fog to reveal, generally what I'll see is a big line getting revealed on the Y axis, which should be a radius.

If anyone's got this working in the latest version I'd love to hear from you (or the developer!).
Thanks,
Jay