Author Topic: Phong  (Read 7426 times)

Shinobiwan

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
    • View Profile
Phong
« on: March 11, 2011, 03:18:39 pm »
Hey shawn, just wondering if there was a way you could incoporate phong into your tools somehow. Like making it easy for people to use on their models without  having to go through some very complicated steps. Prety much what youve done with everything else so far :)

Thanks again for this amazing tool!

Shin


wallworm

  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 101
  • Behind me?
    • View Profile
Re: Phong
« Reply #1 on: March 11, 2011, 05:22:37 pm »
Thanks for the idea. I'll have to learn more about the Source phong shader since I haven't used it yet. But I'll look into it.

wallworm

  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 101
  • Behind me?
    • View Profile
Re: Phong
« Reply #2 on: March 13, 2011, 04:58:57 pm »
So I started adding Phong to the texture exporter. Since this is my first delve into it... tell me what you think of this:

In Max, if the Material Shader is set to Phong and there is a bitmap in the Specular Level Map slot, the material will have Phong added and use the Specular Level bitmap as the $phongexponenttexture texture?

That is currently what I've got it doing.

I've thought of making it check to see if there is a bump/normal map that has an alpha channel...in order to be used also. Is that necessary or not?

Finally, what parameters in the 3ds Material for a phong material might control/translate the other parameters?:

$phongexponent
$phongboost 
$phongfresnelranges

In other words, what would make most sense? It's just way easier to translate from the material than build an extra utility to control those. It may be that those values will have to be tweaked in the VMT file after generated if I can't find a good controller in the Max material.
« Last Edit: March 13, 2011, 05:00:57 pm by wallworm »

Shinobiwan

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
    • View Profile
Re: Phong
« Reply #3 on: March 25, 2011, 12:54:47 pm »
This all sounds awesome, but i have to be honest in that ive never used phong before. I just kinda thought it might add even more functionality and atractiveness to your pluggin, using a shader thats all but neglected in the source engine.

Safemilk
  • Newbie
  • *
  • Posts: 2
  • Karma: 0
  • Acolyte
    • View Profile
Re: Phong
« Reply #4 on: September 23, 2014, 04:59:50 pm »
Hey just wanted to chime in with some explanation for the different parameters.

The biggest difference here is that the $phongexponenttexture actually should not be related to the Specular Level Bitmap, it's actually more analogous to a Gloss Map.

The specular intensity comes from the alpha of the normal map which is $normalmapalphaenvmapmask.
If there isn't a $bumpmap in the vmt you would use $envmapmask.

$phongexponent =In max this is most like the Glossiness Slider
$phongboost  = In Max this is most like the Specular Level Slider
$phongfresnelranges = This is doesn't relate as much to anything in max that easily. It's something you have to tweak in the VMT on your own.

Sorry if this is stuff you already know/figured out, just wanted to be thorough.
« Last Edit: September 23, 2014, 05:01:44 pm by Safemilk »

wallworm

  • Administrator
  • Hero Member
  • *****
  • Posts: 3675
  • Karma: 101
  • Behind me?
    • View Profile
Re: Phong
« Reply #5 on: September 23, 2014, 08:38:49 pm »
Thanks for joining and chiming in on this :)

It might be better for me to update the WW settings to use Glossiness. But at this very moment, the Specular Color map is used for $phongexponenttexture. This was one of those settings that was added in piecemeal over the years and at times the best choice wasn't always made initially. Changes can potentially affect current users and files. I'm not against the change, though. I'll consider changing it in an upcoming release.

Most of the Phong settings can be set if you add a WW Shader custom attribute to your material. The current WW Phong settings are described here. Adding a WW Shader setting is done via the WW > WW Materials menu and is detailed here.

I do have plans of an overhaul of the material system utilizing ShaderFX at some point that will have in-Max viewport representation of all material settings, including phong.

Joris Ceoen

  • Global Moderator
  • Full Member
  • *****
  • Posts: 233
  • Karma: 27
  • WallWorm Ambassador
    • View Profile
Re: Phong
« Reply #6 on: September 24, 2014, 03:45:16 am »
This sounds really cool. Phong is indeed a shader that seems to be completely unknown to many mapper (although, most weapon-artists know all about it.).

What I generally seem to experience of most people using it is that they think it's a "poor quality reflection shader" while this is completely wrong. In fact it's just a shader to represent diffuse reflection (reflection that only reflects light intensity rather than the environment) and therefore many mappers use specular reflection on anything they think should be reflected. There are definitly some stone and wood types that simply do not reflect the environment (not glossy enough) and only light, which is where the very effective and nice Phong shader enters.

It would be cool to see this function being added, although indeed, some of its functions are 'complicated' by which I mean sometimes it can take a long time before you actually get the right settings you need for the given situation in the level. I never minded doing this on my own aside from WW, but if it gets implemented, it's all the more a great addition to the tools :)

Safemilk
  • Newbie
  • *
  • Posts: 2
  • Karma: 0
  • Acolyte
    • View Profile
Re: Phong
« Reply #7 on: September 24, 2014, 12:12:03 pm »
Thanks for having me, wallworm and thanks for the tools!

Yeah I generally just write out the vmts by hand and I didn't even realize there was this functionality in WWMT.

The $phongexponenttexture mishap is one that still gets me, Source uses such different terms for everything that whenever I take a break from doing any Source related modding I come back and have to try and remember all the little nuances.

jorisceoen, I'm with you on that!