Phong

Started by Shinobiwan, March 11, 2011, 03:18:39 PM

Previous topic - Next topic

Shinobiwan

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

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

#2
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.

Shinobiwan

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

#4
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.

wallworm

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

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

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!

SMF spam blocked by CleanTalk