Author Topic: Fog of War - Using Texture instead of Color  (Read 1947 times)

PetitChu

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Fog of War - Using Texture instead of Color
« on: April 14, 2015, 12:11:29 PM »
Hi, i have search on your forum for a way to make your FoW plugin working with a texture instead of Color, but i didn't see a solution or solution are really incomplete/ i don't understand it. So what is the way to use Texture instead of Color, like the Cloud texture in Civ V ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,151
  • Toronto, Canada
    • View Profile
Re: Fog of War - Using Texture instead of Color
« Reply #1 on: April 16, 2015, 08:11:42 AM »
That should be simple enough. In the FOW shader it outputs the color by lerping it on line 88 -- from original to unexplored to explored.

In your case instead of passing _Unexplored and _Explored, you would be passing sampled texture values instead. Something like
  1. half4 tex0 = tex2D(_SomeCloudTexture, pos.xz);

PetitChu

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Fog of War - Using Texture instead of Color
« Reply #2 on: April 17, 2015, 02:23:31 PM »
Thank you for the Answer Aren. I know your should be very busy right now with Windward coming out soon, so a huge thank you to taking the time to answer me. It's almost working now !! I means, what you tell me works but I have some tweak to make. I know it isn't your job to tell me that, but in case you can answer me, I will ask ! So my texture are now displayed by the Shader, but it's almost transparent because I have a lot of White in the Texture and it seem to render white as an alpha channel or something (i'm very bad in Shader, I never learn about that :S and now my Boss ask me to make this ! ). I suppose i have to find where in the Shader it tell white is alpha, but I donèt know what the code for this should look. So if you have any idea (and the time for answer me) it will be very Great. Again, thank you for the first answer, it help me alot !

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,151
  • Toronto, Canada
    • View Profile
Re: Fog of War - Using Texture instead of Color
« Reply #3 on: April 18, 2015, 01:32:00 PM »
Unfortunately shader coding is outside the scope of this kit's support. You will need to figure it out yourself.