Achieving TF2 model shading for custom models?

Discussion in 'Mapping Questions & Discussion' started by JoshuaC, May 28, 2009.

  1. JoshuaC

    JoshuaC L7: Fancy Member

    Messages:
    446
    Positive Ratings:
    145
    I didn't see a modeling section, so if this is in the wrong area could a mod please move this to the correct one? Thanks!

    I'm getting into modeling my own props, and I'm wondering how exactly would I go about achieving the shading the player models have. I've searched the valve wiki but have found nothing on the subject.
     
  2. psihomir

    psihomir L4: Comfortable Member

    Messages:
    192
    Positive Ratings:
    32
    If all else fails, I'd contact the author of this model and ask him how he made it.
     
  3. Zeewier

    Zeewier L9: Fashionable Member

    Messages:
    619
    Positive Ratings:
    130
    shading is "hidden" inside the vmf files. I think you know the progress on finding those since you got some material reskins in watchtower.

    It's probably the phong shading and the rim lightning ;)
     
  4. JoshuaC

    JoshuaC L7: Fancy Member

    Messages:
    446
    Positive Ratings:
    145
    I only changed the rock texture to fit the alpine theme in watchtower.

    What I'm looking for isn't achieved by phong or rim lighting. What I'm looking for is the lighting shading on the models. It's unique to the TF2 models somehow and I'm not sure how to do it.
     
  5. Zeewier

    Zeewier L9: Fashionable Member

    Messages:
    619
    Positive Ratings:
    130
    Last edited: May 28, 2009
  6. Altaco

    Altaco L7: Fancy Member

    Messages:
    485
    Positive Ratings:
    121
    Here's the relevant part of the vmt for the heavy weapons guy, everything that has to do with shading:
    ---------------------------------------------

    "$basetexture" "models\player\medic\medic_red"
    "$bumpmap" "models\player\medic\medic_normal"
    "$detail" "effects/tiledfire/fireLayeredSlowTiled512.vtf"
    "$detailscale" "5"
    "$detailblendfactor" 0.01
    "$detailblendmode" 6

    "$yellow" "0"
    "$one" "1"

    "$phong" "1"
    "$phongexponent" "20"
    "$phongboost" ".3"
    "$lightwarptexture" "models/player/pyro/pyro_lightwarp"
    "$phongfresnelranges" "[.3 1 8]"
    "$halflambert" "0"

    // Rim lighting parameters
    "$rimlight" "1" // To enable rim lighting (requires phong)
    "$rimlightexponent" "4" // Exponent for phong component of rim lighting
    "$rimlightboost" "2" // Boost for ambient cube component of rim lighting
    ---------------------------------------------


    This also looks like it could be helpful (skip to page 4):
    http://www.valvesoftware.com/publications/2007/NPAR07_IllustrativeRenderingInTeamFortress2.pdf

    Based on that, it looks like what you want is (d) on that page, that is, using warped diffuse and ambient cube shading. I believe this is a part of the phong lighting. That $lightwarptexture looks like it's what you probably want, opening that up it looks exactly like figure 7 in that pdf file. So it's a combination of the phong shading, half lambertian, and lightwarp settings that create the nice shading they've made. Rimlights are nice too :3.
     
    • Thanks Thanks x 1
  7. JoshuaC

    JoshuaC L7: Fancy Member

    Messages:
    446
    Positive Ratings:
    145
    I don't believe you know what you're talking about. vmf's are map files.

    Hmm, I messed around with similar settings for my model but never tried the lightwarp stuff. I'll give it a try.
     
  8. (s2a) yahodahan

    (s2a) yahodahan L3: Member

    Messages:
    144
    Positive Ratings:
    18
    I could be wrong, but I believe a lot of the work will be done in 3DSMax/etc, via "render to texture". Using things like ambient occlusion, soft almost-toon-shading, etc, you could render out a very nice base texture (without strong directional, of course).

    From there, I would move on to the vmt...at which point I would have no idea how to proceed :D

    good luck!
     
  9. JoshuaC

    JoshuaC L7: Fancy Member

    Messages:
    446
    Positive Ratings:
    145
    I've already got down how to bake ambient occlusion onto a texture map in XSI.

    [​IMG]
    (The white lines are due to a crappy unwrap on my part)

    Now that I'm poking around in the files it definitely seems that the lightwarp is the key to the shading. I'll whip up a fast model to try it.
     
  10. (s2a) yahodahan

    (s2a) yahodahan L3: Member

    Messages:
    144
    Positive Ratings:
    18
    i'll be following closely :) def something I have wondered about in the past.

    To be true, I kinda gave up custom models in Hammer once I realized you couldn't lightmap them, as you can Hammer BSP. boo.

    more good luck to ya!
     
  11. YM

    aa YM LVL100 YM

    Messages:
    7,099
    Positive Ratings:
    5,739
    Don't use XSI the user agreement states you can't make profit from anything made in it.
     
  12. JoshuaC

    JoshuaC L7: Fancy Member

    Messages:
    446
    Positive Ratings:
    145
    Uh.. what exactly am I supposed to use? Is there some sort of special code inside the model that says "MADE IN XSI"?
     
  13. JoshuaC

    JoshuaC L7: Fancy Member

    Messages:
    446
    Positive Ratings:
    145
    And lightwarp was the answer. Thanks!

    [​IMG]