Jump to content

How to properly apply Phong to my textures? (Source Engine)


Recommended Posts

Posted (edited)

Hello everybody!

Lately I've been making a desert map; to fulfill my idea I did some sand and canyon textures. To increase their realism and detail I tried to adding phong to simulate those glowing grains present in the sands. So I made a specular map for the grains and put in the alpha channel of my Bumpmap and added the Phong parameters to the VMT file. But whenever I try the whole texture gets shiny:

 

Without Phong

20170213211711_1.thumb.jpg.84cad70db54c45509dd25624f99d4472.jpg

 

With Phong

20170213211749_1.thumb.jpg.27772f08e28327b4bb8c9a8dc8fd4fb4.jpg

 

Specular Map

sand_specular.thumb.jpg.96752b7ab9a17df14cff0ad47c62ef99.jpg

 

As you can see, the whole texture is affected by phong and not just grains. How can I fix this? I believe that I confused myself in the VMT parameters but I'm not sure: 

"WorldVertexTransition"
{
    "$baseTexture" "tunisia/tun_sand_01"
      "$bumpmap"     "tunisia/tun_sand_01_normal"
    "$surfaceprop" "sand"
    
    "$baseTexture2" "tunisia/tun_sand_02"
      "$bumpmap2"     "tunisia/tun_sand_02_normal"
    "$surfaceprop2" "sand"
            
    
    "$blendmodulatetexture" "nature/blend_texture_01"
    "$blendmasktransform" "center .5 .5 scale 1 1 rotate 0 translate 0 0"

    "$normalalphaenvmask" "1"
    "$envmap" "env_cubemap"
    "$phong" "1"
    "$phongExponentTexture" "252"
}

 

 

Thank you in advice!

Edited by Edude
Posted

I'm going to test this right now. Thank you for your reply. I also would like to ask, is there any quality loss when converting TGA images to VTF and vice versa?

Posted (edited)
1 minute ago, Edude said:

I'm going to test this right now. Thank you for your reply. I also would like to ask, is there any quality loss when converting TGA images to VTF and vice versa?

DXT formats are lossy, yes. The reduced file size is definitely worth it though. A lossy compression can't be uncompressed to its former state.

Edited by grapen
Posted (edited)

Hum I got it. I check here and my bumpmaps were in DXT. Now that I put them on BGR888 they have improved a lot. Thanks!

Edited by Edude
Posted
18 hours ago, tomm said:

try to put your alpha in your base texture and add this parameter in your vmt

hope this helps

I did some more testing following your instructions but nothing has changed. The textures remain entirely bright, ignoring the specular map.

 

Here's the VMT

Quote

"WorldVertexTransition"
{
     "$baseTexture" "tunisia/tun_sand_01"
     "$bumpmap"     "tunisia/tun_sand_01_normal"
     "$surfaceprop" "sand"
    
     "$baseTexture2" "tunisia/tun_sand_02"
     "$bumpmap2"     "tunisia/tun_sand_02_normal"
     "$surfaceprop2" "sand"
            
    
    "$blendmodulatetexture" "nature/blend_texture_01"
    "$blendmasktransform" "center .5 .5 scale 1 1 rotate 0 translate 0 0"

    "$envmap" "env_cubemap"
    "$phong" "1"
    "$BasemapAlphaPhongMask" "1"
    "$phongExponentTexture" "1"
}

 

Posted
8 hours ago, Edude said:

I did some more testing following your instructions but nothing has changed. The textures remain entirely bright, ignoring the specular map.

That's strange, maybe it doesn't work with blend materials even though it should. I've only tried this on a regular VertexLitGeneric.

Posted

Are you sure that the alpha is working correctly in the base textures ? It needs to be dxt5 or BGRA8888 (BGR888 doesn't have alpha)

You can view the channels in vtf edit.

 

Posted (edited)

I think $phong is only supported on VertexLitGeneric shader with HL2 ep2 engine.

https://developer.valvesoftware.com/wiki/$phong

You're currently trying to apply $phong to a WorldVertexTransition shader so that's why there's errors. Wiki says $phong would work for WorldVertexTransition on the CS:GO engine though.

You could replace the ground with a model and it would shade correctly then.

Edited by WD
  • 3 weeks later...
Posted
On 15/02/2017 at 5:17 AM, tomm said:

That's strange, maybe it doesn't work with blend materials even though it should. I've only tried this on a regular VertexLitGeneric.

I thought the same thing, but I tested it as lightmapped generic and did not get good result. 

Sorry for the late reply

On 15/02/2017 at 7:30 AM, spa said:

Are you sure that the alpha is working correctly in the base textures ? It needs to be dxt5 or BGRA8888 (BGR888 doesn't have alpha)

You can view the channels in vtf edit.

 

It's very strange because I tried both alpha in the base texture and alpha in the bumpmap. I also tried both formats DXT5 for the base texture and BRGA8888 for bump. Probably Day of Infamy (game I'm mapping) do not support $phong. 

On 15/02/2017 at 7:56 AM, WD said:

I think $phong is only supported on VertexLitGeneric shader with HL2 ep2 engine.

https://developer.valvesoftware.com/wiki/$phong

You're currently trying to apply $phong to a WorldVertexTransition shader so that's why there's errors. Wiki says $phong would work for WorldVertexTransition on the CS:GO engine though.

You could replace the ground with a model and it would shade correctly then.

Maybe I was mistaken a bit, I thought that Insurgency and Day of Infamy would be using the CSGO version of the source engine and with that $phong would works normally. 

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.

×
×
  • Create New...