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
  • Klems
    • April 29, 2015 at 1:44 AM
    • #1
    Quote

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

    http://www.reddit.com/r/GlobalOffens…date_for_42815/


    Just wanted to let you guys know.


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

    Code
    "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"
    
    
    }
    Display More

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

  • DrywallDreams
    • April 29, 2015 at 1:56 AM
    • #2

    Hell yeah, that's great!

  • LATTEH
    • April 29, 2015 at 2:33 AM
    • #3

    This is something I've been wanting for a long time!

    Edit: aww you can't use world reflections (env map) with phong.

  • leplubodeslapin
    • April 29, 2015 at 3:52 AM
    • #4

    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

  • nicoreda
    • April 29, 2015 at 1:23 PM
    • #5

    New test:

    1 bumpmap

    http://images.akamai.steamusercontent.com/ugc/7141620562…AE1BE7E947A309/

    2 Bumpmap

    http://images.akamai.steamusercontent.com/ugc/7141620562…9618099EA632BD/

    2 Bumpmap Lowered the second scale

    http://images.akamai.steamusercontent.com/ugc/7141620562…9EE1B8AE98537D/


    $envmapanisotropy 1

    scale 0

    http://images.akamai.steamusercontent.com/ugc/7141620562…7A44D5BE13F5C5/


    scale 1

    http://images.akamai.steamusercontent.com/ugc/7141620562…8C0A8DE69608EF/

  • EddieLTU
    • April 29, 2015 at 2:00 PM
    • #6

    did some tests

    [Blocked Image: http://images.akamai.steamusercontent.com/ugc/36370312383810608/AAE65556D22F6315E99CFDB92B1E3CBF96196CF0/]

    [Blocked Image: http://images.akamai.steamusercontent.com/ugc/36370312383810992/32636AE7A69A2A97DB51BE1E0585DC6019A3B25F/]


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

  • Vaya
    • April 29, 2015 at 2:45 PM
    • #7

    That looks amazing!

  • EddieLTU
    • April 29, 2015 at 3:46 PM
    • #8

    did a test with a dust 2 tile texture

    [Blocked Image: http://images.akamai.steamusercontent.com/ugc/36370312384096266/313BDC5DEDBF6DC2806D62DF0318159220173087/]

  • Skybex
    • April 29, 2015 at 4:05 PM
    • #9
    Quote from nicoreda

    $envmapanisotropy 1

    scale 0

    http://images.akamai.steamusercontent.com/ugc/7141620562…7A44D5BE13F5C5/


    scale 1

    http://images.akamai.steamusercontent.com/ugc/7141620562…8C0A8DE69608EF/

    Display More


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

  • TheGuma
    • April 29, 2015 at 4:06 PM
    • #10

    Been messing around as well

    [Blocked Image: http://images.akamai.steamusercontent.com/ugc/34118512570466612/04FA71DE78BA311C2BA71F645FB2F522CCFCF8B8/]

    Could do it a bit more subtle, just showing off what a single brush an a texture can do.

  • nicoreda
    • April 29, 2015 at 4:15 PM
    • #11
    Quote from Skybex

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

    add -nop4 before -tools -console

    and in console, type "toolload vmt"

  • will2k
    • April 29, 2015 at 5:20 PM
    • #12
    Quote from Skybex

    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


    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

  • Muffin
    • April 29, 2015 at 6:14 PM
    • #13

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

  • Klems
    • April 29, 2015 at 6:26 PM
    • #14
    Quote from Muffin

    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.

  • TheGuma
    • April 29, 2015 at 6:32 PM
    • #15
    Quote from Klems

    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.

    Display More

    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?

  • Klems
    • April 29, 2015 at 6:53 PM
    • #16
    Quote from TheGuma

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

    Of course! They just happen to be rendered in cubemaps as well.

    At least, that's how I think it is. When you build cubemaps you can see some glows where lights should be, and you can actually see lights in some reflections in-game. It wasn't like that in previous version of the engine by the way.

  • leplubodeslapin
    • April 29, 2015 at 7:02 PM
    • #17

    Yes, what you can do by the way to see the glows, is lowering your screen resolution (for example 1280x720) and choose a cubemap resolution in your map that is too high (256 x 256 for example should be too much). It won't be able to build the cubemaps and there will be an error message in the console. But still, the glows will then be visible ingame.


    It's a bit useless but yea, whatever. I'd like to be able to change the scale of this glow in order to make big blurred reflections with cubemaps but i don't think you can do that.

  • TheGuma
    • April 29, 2015 at 7:10 PM
    • #18

    So lets sum this up, Phong looks BETTER on large surfaces in my opinion.

    It looks smoother, shinier. But what about performance? Is this method more performance efficient than cubemap reflections? Should I use it sparingly?


    I'm very curious, as this could radically increase my map's graphical fidelity.

  • Muffin
    • April 29, 2015 at 7:18 PM
    • #19
    Quote from TheGuma

    So lets sum this up, Phong looks BETTER on large surfaces in my opinion.

    It looks smoother, shinier. But what about performance? Is this method more performance efficient than cubemap reflections? Should I use it sparingly?

    I'm very curious, as this could radically increase my map's graphical fidelity.

    I'm actually expecting 3kliskphilip to do an analysis on phong

  • TheGuma
    • April 29, 2015 at 7:33 PM
    • #20

    It's quite weird, we were talking about this in the chat 2 weeks before this update came out.

    We were looking for ways to make a texture reflect light on a world brush rather than a model.


    Two weeks later, Valve out of nowhere


    Do we have an undercover Valve employee here?

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™