Jump to content
Klems

CS:GO phong on world surfaces

Recommended Posts

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

 

photo-31466.jpg?_r=1424536183

 

"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]"
}

2015-05-03_00001.jpg

"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]"

}

2015-05-03_00003.jpg

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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:

$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.
Edited by MrTwoVideoCards

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...