Jump to content
Klems

CS:GO phong on world surfaces

Recommended Posts

Added support for Phong on world materials. See Train for examples of such materials.

http://www.reddit.com/r/GlobalOffensive/comments/347uvq/counterstrike_global_offensive_update_for_42815/

 

Just wanted to let you guys know.

 

EDIT: here's the VMT from the modified texture in Train.

"LightmappedGeneric"
{
	"$basetexture" "metal/hr_metal/metal_grated_d"
	"$bumpmap"  "metal/hr_metal/metal_grated_d_normals"
	"$surfaceprop" "Metal"
	

			    "$phong" "1"
                "$phongexponent" "105.0"
                "$phongMaskContrastBrightness" "[.5 8]"
                "$phongAmount" "[4 4 4 1.0]"

		"$normalmapalphaenvmapmask" "1"
	


	//"$envmap" "env_cubemap"
	//"$envmaptint" 		"[.3 .3 .3]"	
	"$detail" 				"detaildetailconcrete001a"
	"$detailscale" 			"[4 4 4]"
	"$detailblendfactor" 	"1"

}

I have no idea what "phongAmount" or "phongMaskContrastBrightness" stands for. Hopefully we'll get some doc soon.

Edited by Klems

Share this post


Link to post
Share on other sites

That's so great !!!

 

So at first i tried to use their texture in a very simple test map with 1 light.

It didn't work : screenshot

 

Then i tried to add a sun light, just like in de_train :

It worked : screenshot 1, screenshot 2 :)

 

Then i tried with a custom texture of my friend Wenceslas :

it's pretty nice : screenshot 1, screenshot 2

I noticed that the alpha mask that was in the normalmap was used for the phong, the marble reflected more than the wood which is pretty nice.

 

After that, i tried to use it on a displacement :

Yeah it works ! screenshot

 

Then i tried to add the world reflections with cubemaps and it works great as well for me

screenshot

So i don't know what's not working with you LATTEH, can you explain me a bit more ?

 

And finaly the most crazy test : displacement with a texture with transparency, phong, normalmap and specular

With $translucent : http://i.imgur.com/5AjUwVz.jpg

With $alphatest : http://i.imgur.com/KxEMVks.jpg(even better since you have the shadows and the edges are sharper, more defined than with $translucent)

 

 

I'll try the other parameters tomorow, i have to go to bed it's late here ^^

Thank you valve guys

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

add -nop4 before -tools -console

and in console, type "toolload vmt"

Share this post


Link to post
Share on other sites

 

How did you get CSGO's tools mode working? I thought it has been broken since release

 

3 years after release, they are still broken :nag::D

 

But as nico said, you can load all the tools with "toolload" and unload them with "toolunload" (toolload vmt for material editor, toolload pet for particle editor and so on)

 

Thanks everyone who took the time to test this nice feature and post results, much appreciated :)

Share this post


Link to post
Share on other sites

How does phong exactly work and could you give a Noob explanation :)

https://developer.valvesoftware.com/wiki/Phong_materials

https://en.wikipedia.org/wiki/Phong_reflection_model

To put it simply, envmap reflect world, while phong reflect lights. You don't need cubemaps to use phong, so there's no artifacts related to cubemap resolution. The reflection is pixel perfect. I know world is essentialy light and lights are actually rendered in cubemaps, but I think you get the point.

 

There's a bit more to it, phong shading is per-pixel lighting, goureaud is per-vertex, and flat is per-triangle.

I'm not sure how source handle models lighting. I guess phong is used if you put $phong in the VMT, otherwise goureaud is set by default. World surfaces are not lit per-pixel, or even per-vertex, because they use lightmaps. Only the reflections matters here.

Edited by Klems

Share this post


Link to post
Share on other sites

 

How does phong exactly work and could you give a Noob explanation :)

https://developer.valvesoftware.com/wiki/Phong_materials

https://en.wikipedia.org/wiki/Phong_reflection_model

To put it simply, envmap reflect world, while phong reflect lights. You don't need cubemaps to use phong, so there's no artifacts related to cubemap resolution. The reflection is pixel perfect. I know world is essentialy light and lights are actually rendered in cubemaps, but I think you get the point.

 

There's a bit more to it, phong shading is per-pixel lighting. Goureaud shading is per-vertex and is used on prop_static.

I'm not sure how source handle dynamic models.

 

 I know world is essentialy light and lights are actually rendered in cubemaps

 

Correct me if I'm wrong, but I think the world lights are rendered in lightmaps?

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