1. Forums
  2. Discord
  3. About Mapcore
  4. Patreon Supporters
  • Login
  • Register
  • Search
This Thread
  • Everywhere
  • This Thread
  • This Forum
  • Articles
  • Pages
  • Forum
  • More Options
  1. Mapcore
  2. Discussions
  3. Level Design

CS:GO phong on world surfaces

  • Klems
  • April 29, 2015 at 1:44 AM
  • TheGuma
    • May 1, 2015 at 2:23 PM
    • #41

    I'll probably use Phong on 90% of my new maps textures. I'll see how far I can push the old fart Source engine on my old fart computer while maintaining good framerate. As far as I'm concerned Phong is less performance intensive because it only gathers information from a light source rather than a cubemap, which both takes size and acts as an image inside computer memory (no matter what format).However, having two shaders on a texture confuses Source thus why there may be some problems with blend/cubemap stuff combined with Phong. I suggest sticking with only one (either envmap or Phong). Bumpmap shouldn't be a problem though.

  • jackophant
    • May 1, 2015 at 2:37 PM
    • #42

    This stuff all looks very nice... but


    Quote

    [Blocked Image: http://i0.kym-cdn.com/photos/images/original/000/234/765/b7e.jpg]

  • Mamorex
    • May 1, 2015 at 5:05 PM
    • #43

    Edit: Phong shading dev textures - http://csgo.gamebanana.com/textures/4174My old animated puddles with Phong shading - http://csgo.gamebanana.com/textures/3968 EddieLTU

    Quote

    just a warning, phong and blend textures along with blendmodulade don't like eachother


    They works fine for me.

    Bonus: [Blocked Image: http://oi58.tinypic.com/2edcx2w.jpg]

    Code
    "LightmappedGeneric"
     
    {
     
    "$basetexture" "folder/texture"
     
    "$phong" "1"
    "$phongexponent" "40"
    "$phongamount" "[5 5 5 1.0]"
     
    "$offset" "1"
     
    "Proxies"
     
    { //begin of "Proxies"
     
    "EntityRandom"
    {
    "scale" "3"
    "resultVar" "$offset"
    }
    "Sine"
    {
    "sineperiod" 1
    "timeoffset" "$offset"
    "resultVar" "$phongamount[2]"
    }
    "Sine"
    {
    "sineperiod" 2
    "timeoffset" "$offset"
    "resultVar" "$phongamount[0]"
    }
    "Sine"
    {
    "sineperiod" 3
    "timeoffset" "$offset"
    "resultVar" "$phongamount[1]"
    }
     
    } //end of "Proxies"
     
    }
    Display More
  • Single
    • May 2, 2015 at 9:32 AM
    • #44

    I have experimented with $envmapanisotropy, $envmapanisotropyscale, and $envmaplightscale a bit. I set up a .vmt, and applied it to the floor of this room. 'phong_bump' is a blank normal map, with a blank alpha channel.

    Code
    LightmappedGeneric
    {
    	$color "[1 1 1]"
    	$bumpmap "modelsneutronphong_bump"
    	$normalmapalphaenvmapmask 1
    
    
    	$envmap env_cubemap
    	$envmaptint "[1 1 1]"
    	$envmapanisotropy 	<variable>
    	$envmapanisotropyscale 	<variable>
    	$envmaplightscale       <variable>
    	
    
    
    	$reflectivity "[0.4 0.3 0.2]"
    
    
    	%keywords neutron
    }
    Display More

    [Blocked Image: http://i.imgur.com/X9EcXU8.jpg]

    What we are basically seeing is the env_cubemap pasted onto the flat-white floor texture.

    In the next set of images, $envmaplightscale has been set to 1, simply because I forgot to turn it off.

    $envmapanisotropy seems to have boolean input, '0' for off, '1' for on. The magnitude of the effect is determined by $envmapanisotropyscale, which is a float from '0' (which gives the same effect as $envmapanisotropy 0) upwards. Screenshots of the effect:

    Code
    $envmapanisotropy       1
    $envmapanisotropyscale 	0.8
    $envmaplightscale       1


    [Blocked Image: http://i.imgur.com/d2NiIOR.jpg]

    What we see is that the 'top' of the cubemap is pushed away, lengthening the 'sides' of the cubemap.

    Code
    $envmapanisotropy       1
    $envmapanisotropyscale 	1.5
    $envmaplightscale       1

    [Blocked Image: http://i.imgur.com/s2XlxRi.jpg]

    When $envmapanisotropyscale goes greater than 1, it begins to use some of the 'bottom' face of the cubemap in its projections, leading to some interesting effects:

    Code
    $envmapanisotropy       1
    $envmapanisotropyscale 	3.0
    $envmaplightscale       1

    [Blocked Image: http://i.imgur.com/0MNTU2t.jpg]

    Potential uses for $envmapanisotropyscale >1 could be creating fisheye mirrors?

    I quite like the effect of $envmapanisotropyscale (for values between 0 and 1), it puts more of the walls and horizon into the cubemap reflections, which looks quite nice.

    $envmaplightscale is very interesting, imo. The input is a float, from 0 (no effect) upwards. This setting multiplies the intensity of the cubemap reflections by the lightmap, meaning dark areas do not reflect as strongly as bright ones.

    Code
    $envmaplightscale       0.5

    [Blocked Image: http://i.imgur.com/KEDFfcr.jpg]

    A bit of a subtle effect, note the reduced reflections near the walls.

    Code
    $envmaplightscale       1.0

    [Blocked Image: http://i.imgur.com/kzZ9h0r.jpg]

    What seems to be a strict multiplication of the two; I should increase my $envmaptint to compensate if I want to leave it like this.

    Code
    $envmaplightscale       2.5

    [Blocked Image: http://i.imgur.com/g96MoNe.jpg]

    When the $envmaplightscale goes ABOVE 1, we see interesting effects. It hasn't quite inverted the lightmap, but it is still brighter than when $envmaplightmapscale 1. I'm not entirely sure what this means at this stage.

    When you tweak all the settings...

    Code
    $envmaptint             "[1.6 1.6 1.6]"
        $envmapcontrast          1
        $envmapsaturation        0.4
        $envmapanisotropy        1.0
        $envmapanisotropyscale   0.2
        $envmaplightscale        0.5

    You can get some nice results.

    [Blocked Image: http://i.imgur.com/d7y2JqL.jpg]

    It's not quite as nice as $phong, but goes alright.


    What still needs to be explored:

    • Negative values of $envmaplightscale and $envmapanisotropyscale.
    • What really happens for very postive values of $envmaplightscale.
  • Vaya
    • May 2, 2015 at 10:14 AM
    • #45

    I would like to see the first 2 examples in game. First floor with a simple tiled normal (large tiles) would look awesome imo

  • Single
    • May 3, 2015 at 10:33 AM
    • #46
    Quote from Vaya

    I would like to see the first 2 examples in game. First floor with a simple tiled normal (large tiles) would look awesome imo


    [Blocked Image: http://static.mapcore.org/uploads/profile/photo-31466.jpg?_r=1424536183]


    Code
    "LightmappedGeneric"
    {
    	"$basetexture" "de_mirage/tile/tile_ver4_diffuse"
    	"$bumpmap" "de_mirage/tile/tile_ver4_normal"
    	"$surfaceprop" "tile"
    
    
    	$normalmapalphaenvmapmask 1
    	$envmap env_cubemap
    	$envmaptint "[1.0 1.0 1.0]"
    	$envmapsaturation 0.4
    	$envmapcontrast 0.5
    	$envmapanisotropy 1
    	$envmapanisotropyscale 1.0
    	$envmaplightscale 0.7
    
    
    	$phong 1
         	$phongexponent 40
    	$phongMaskContrastBrightness "[0 5]"
            $phongAmount "[4.1 4.2 4.0 1.0]"
    }
    Display More

    [Blocked Image: http://levitegg.com/images/other/2015-05-03_00001.jpg]

    Code
    "LightmappedGeneric"
    {
    	"$baseTexture" "concrete/hr_c/hr_sidewalk_b"
    	"$surfaceprop"  	"concrete"
    	"$bumpmap" 	"concrete/hr_c/hr_sidewalk_b_ssbump"
    	$ssbump 1
    	$ssbumpmathfix 1
    
    
    
    
    	$normalmapalphaenvmapmask 1
    	$envmap env_cubemap
    	$envmaptint "[7.0 7.0 7.0]"
    	$envmapsaturation 0.6
    	$envmapcontrast 0.2
    	$envmapanisotropy 1
    	$envmapanisotropyscale 1
    	$envmaplightscale 0.6
    
    
    	$phong 1
         	$phongexponent 40
    	$phongMaskContrastBrightness "[0 5]"
            $phongAmount "[4.1 4.2 4.0 1.0]"
    
    
    }
    Display More

    [Blocked Image: http://levitegg.com/images/other/2015-05-03_00003.jpg]

    Probably not the best scenes to use, but I guess it shows what it was meant to.

  • Vaya
    • May 3, 2015 at 12:28 PM
    • #47

    looks awesome never the less. I think phong suits open areas better but it still works well in both scenes. Going to play about it with myself soon and see if I can work it into my current map.

  • TheGuma
    • May 3, 2015 at 6:49 PM
    • #48

    If you think that's impressive, you've seen nothing...

    [Blocked Image: http://images.akamai.steamusercontent.com/ugc/34118850568913905/0B15F6F97EA052E18051421451BA14FABF5F80DC/]


    Here's how it looks like with some different settings + Displacements


    [Blocked Image: http://images.akamai.steamusercontent.com/ugc/34118850568944063/05B442B78C2C337809B847C1ADFE6C6AC2E8D130/]

  • Pampers
    • May 4, 2015 at 12:23 AM
    • #49

    Year 2007 called and wanted their phong shading and text editor shader tweaks back

  • Steppenwolf
    • May 5, 2015 at 1:31 PM
    • #50

    That's handy. Now everything can look like it's covered in a thin layer of wax.

  • will2k
    • May 6, 2015 at 9:11 PM
    • #51
    Quote from Pampers

    Year 2007 called and wanted their phong shading and text editor shader tweaks back

    With Valve, the call went straight to voice mail

  • The Horse Strangler
    • July 15, 2015 at 1:55 PM
    • #52

    Whatup pimps, lots of confusion in this thread, so I wanted to hop in and maybe clarify a few things on how phong works and what it actually does.

    First off, phong is a specular shading method that emulates specular highlights on a surface, essentially defining the roughness of the surface itself. Phong is one of many specular reflection methods, there are others out there like Blinn/Cook–Torrance/Beckmann etc. Source already has a vmt setting called specular though, so that makes it super confusing. Phong wasn't added into the source engine until somewhere around 06/07 I believe, and valve never felt the need to change it (physically based wasn't even a thing at all back then.). In the current gen it's very important to not confuse specular with environment mapping. Environment mapping are the familiar cubemaps we sprinkle thruout our maps, whereas the various specular and envmap settings define the contrast, intensity and color of that cubemap reflection.

    Phong is a real-time intinterpolation of a surface's normal and a light vector (which direction the light is pointing). These two combined create a specular reflection. That being said this is why only the cascadded sun ent works for phong right now. it's a realtime light shadowmap that has readable realtime vectors. Apparently these vectors are exposed to models as well, it would be nice to see point and spotlights effecting brush surfaces, but I doubt it.


    Here's a explanation of how the phong settings work:

    Code
    $phong 1 // Enables Phong
    $phongexponent 40 //Controls the size of the specular highlight. Smoother surfaces should use higher values (glass/marble/ceramic) while rough surfaces should use lower values (dirt/wood/cardboard) 
    $phongMaskContrastBrightness "[0 5]" //This is specific to the valve implementation of the shader. This takes the existing phong map and powers it, higher values cause whitespots to become much more intense, while causing darker areas of the mask to get even darker. (think of like multiplying layers ontop one another in photoshop)
    $phongAmount "[4.1 4.2 4.0 1.0]"  //This is a weird one, but I assume it controls the specular intensity on each vectore, being xyz. The 4th float must be the alpha of all of those channels combined, and thus should act as a overall intensity slider. Tuning these values could allow you to create some really interesting Fresnel on various surfaces (specular sheen on finely woven clothes and satin)
    $phongfresnelranges "[0.02 0.02 0.02]"  // This is the actual fresnel ranges, except it's not really designed for accurate specular representation. Besides, brush work won't even be as complicated as model geometry (tons of dips and convexities) so I would advise keeping this at default. It generally ends up creating a rimlight like effect via specular, which is not ideal for csgo's realistic style
    $phongBoost "30"  // Straight up multiplies phong

    I've added these as comments so it should be safe to drop that template up there and paste it into a vmt without it spitting out an error. Anyways I hope that clears some of it up. A quick note on some surfaces, Metals should generally have a medium sized exponent with the envmapsaturation set to 0.5 to create a tinted specular reflection that's somewhat dark and lacks color. Rough surfaces like wood and concrete should probably use a lower phong exp value (maybe 15?). Obviously none of this is tied to any physically based system, but it is possible to achieve some of those results. Just keep playing with specular and evnmapping respectively.

  • jackophant
    • July 15, 2015 at 2:42 PM
    • #53

    as this is vmt related, would this same process work for setting phong on csgo weapon skins? Even per channel?

    I'm thinking along the lines of the official slaughter/dark water skins valve have, as I can't recall anything else using this type of effect?

    Or am I getting ahead of myself here, tricking myself into thinking I've understood this?

  • The Horse Strangler
    • July 16, 2015 at 11:40 AM
    • #54

    Yeah, it should work the same.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!

Register Yourself Login
Discord

The Mapcore Discord is our lively IRC channel of the 2000s reborn. Chat about level design, gaming, and more.

Latest Posts

  1. Why is data science needed

    shilpa
    July 17, 2026 at 12:39 PM
  2. Any of the old guard still around? D:

    Warby
    July 12, 2026 at 8:23 PM
  3. About our archived forums

    Thrik
    June 30, 2026 at 2:12 PM
  4. Mapcore Discord

    mason_fan123
    June 24, 2026 at 8:52 PM
  5. [CS2] Valley

    Serialmapper
    June 22, 2026 at 11:56 AM
  6. Free Music / SFX Resource - Over 2500 Tracks

    Eric Matyas
    June 18, 2026 at 12:32 PM
  7. Pango [WIP]

    Elowen
    June 11, 2026 at 10:13 AM
  8. [CS2] Dvina

    Jeremy Rivera
    June 11, 2026 at 10:03 AM
  9. Bridges 2.0 by NEXSIDE, MAP SHOWCASE. ( Steam Workshop )

    MrTrane18
    June 1, 2026 at 7:46 PM
  10. Classic Maps Reborn For CS2

    SillySpaceCat
    May 31, 2026 at 10:33 PM

Users Viewing This Thread

  • 3 Guests
  1. Privacy Policy
  2. Contact
Powered by WoltLab Suite™