Shaders for Source in Practice

Hey, you! We are one of the oldest mod sites on the Interwebs. Sign up and maximize your browsing experience.

  • Subscribe: Get notified of new submissions like this.
  • Say Thanks: Show your appreciation by sending Noodum points.
  • Post: Give Noodum your thoughts on this Tutorial.
  • Vote: Help Noodum win the Monthly Awards.
  • Rate: Give this Tutorial a rating out of 10.
  • Flag: Alert moderators and warn members of a problem with this Tutorial.
  • Watch: Get notified when this Tutorial is updated.
Mascot

Resistance is futile...

Become a Bananite

Already a Bananite? Login

INTRODUCTION

Welcome to the Shaders for Source in Practice guide! This tutorial has been made for the GameBanana "A Bananite's guide to..." tutorial contest, and as such, publification anywhere outside of Gamebanana is not permitted. Me and 4Echo have spent a good amount of time researching all the tiny bits of information there is to find about Source shaders, and we are happy to compile it all into a single tutorial and give the information to everyone. We hope that the guide is not hard to follow! PLEASE read the tutorial first before watching the video at the bottom, as it‘ll make much more sense. You'll do that, right? We have taken a different approach to a tutorial, where we don't just teach you how to make good shaders - that doesn't work out most of the time, since your mindset becomes locked to the specific type of shaders done in a tutorial, so instead, we teach you how to, first of all, pick the right mindset and what should you keep in mind when making shaders, be it the target game, the amount of reflectivity you‘re going for, etc. The tutorial is mainly focused on artists who are trying to put their asset in a Source game and just cannot get the shaders to look right, however it should still be plenty of help for someone who‘s simply trying to redo a shader set for an existing asset. The programs used in this tutorial are going to be mainly VTFEdit and Photoshop. If you don‘t have VTFedit you can grab it from here - it‘s completely free! If you don‘t have Photoshop, GIMP is a good substitute for that. So, let‘s start!

PART ONE – UNDERSTANDING

When making a set of shaders, it isn‘t enough to just open up the TGA texture sheets and export them as VTF. That is going to cause a lot of problems – the main one being that the textures are not Source-ready. Source functions using masks, whereas standard rendering programs, such as Xoliul Shader in 3ds Max or Marmoset Toolbag use diffuse, specular and gloss maps (you get the idea). The primary difference between the two is that masks are usually monochrome and are used to mask out a specific effect (phong, envmap or rimlight), whereas texture sheets can be colored and control the appearance of all the effects in general. Sure, you can use the same mask to mask off multiple effects at once, but it‘s always better to create separate masks for each effect given how little control over those effects you have in the VMT file. The program you‘re using to preview your textures in real-time while texturing also plays a big part. Marmoset Toolbag is a poor choice primarily because it‘s a PBR shader, basically, whereas Source isn‘t. Xoliul Shader or 3Point Shader in 3DS Max is a much better choice – it‘ll represent the final product much more closely than Marmoset Toolbag would. Changes to the texture are also probably gonna have to be made – the most common problem is that the textures appear blurred out when imported. Either you have to sharpen them, or you have to disable mipmaps when importing – about that in the video tutorial (check below). So, if you want to import textures properly into the Source engine, you have to understand how it works. Source can blur them, compress them to hell, screw them up if your shader setup is incorrect – most of that can be prevented by double-checking your VTF import settings. Compression settings are also important. For the diffuse and exponent, something like DXT5 is fine - the compression errors won't be too evident. As for the normal map, you definitely want to leave it uncompressed - normal map compression artefacts look really bad in Source. Sure, the hefty filesize may put you off, but it's well worth it. If, for some reason, filesize is a huge concern - don't save your textures as DXT1, as it dumps any information in the alpha channel of the texture you're importing - this'll result in the masks for the effects disappearing, and the quality will take a huge toll.

PART TWO – PLANNING

Yes, you heard that right. You need to plan your texture. Like I said in the previous part, you can‘t expect to make a PBR texture, put it in Source and expect it to look exactly the same – that just won‘t happen. Making your textures while having the exact method of implementation in mind will help you a lot. There really isn‘t much to this part – that‘s literally all you have to do and it‘ll make your life a lot easier. When making a PBR texture, you‘re gonna have to do a lot of tweaks for the texture to look even a bit good. Not that you‘d make an asset specifically for Source anyway, it‘s 2015 already, but there are still some morons that do (including me), so just get on with reading it, will you? Here‘s an example of bad planning (thanks, Epicfury!): ![bad example](http://files.gamebanana.com/img/ss/wips/55d14f10b18ae.jpg "bad example") The normal map isn‘t inverted, the wood and metal have absolutely no difference in shading whatsoever, the metal has no detail in the phong... once again, all of those things will be covered in the video tutorial down below. Of course, people think they can copy/paste the VMT settings from one skin to another and call it a day, but then, this happens: ![bad example 2](http://files.gamebanana.com/img/ss/skins/52aa37d0629b0.jpg "bad example 2") You might not see the problem here, but in contrast with the hands, everything is very apparent indeed. I‘d also complain about the hands reflecting way too much light given the fact that they‘re HANDS, but that‘s not the main focus of this picture. You can see the hands reflecting a ton of light, but the gun seems to be reflecting nothing. This usually happens when copypasting shaders from one skin to another – you get nonexisting reflection or stuff like that. Issues like this most of the time come from missing knowledge about shader parameters and how they interact with the textures, but ONCE AGAIN, that‘ll be covered in the video tutorial.

PART THREE – PERFORMING

So I‘ve brainwashed you a lot so far, you probably have a headache at this point and thinking: „Why do I need to know all of this?“ Well, here‘s where everything you‘ve read come together. Assuming you paid any attention to the text above, you‘ve made your textures for an asset with Source in mind. Now you need to import the textures and make a shader set. Importing the textures is pretty technical and doesn‘t require any special knowledge – you just import them depending on what type of texture it is, pretty much. However, everything you‘ve read, everything you‘ve thought about, all of the things you did to the texture come to play in the shader itself. You‘re going to use the VertexLitGeneric type most of the time, since it supports the most shader instructions. All of the weapon skins use VertexLitGeneric. You might want to use some other shader type, such as UnlitGeneric for parts that don‘t reflect anything or are supposed to be transparent altogether, for example, the lens of an Eotech sight. You could also try your luck with the Reflect type if you want to make something super reflective, for example, a mirror, or perhaps a lens of a scope. For most things, VertexLitGeneric will work, but for some scenarios, some other shader types do the job simply better. Structuring the shader document is also a good idea. Making the entire shader set chaotic makes it very hard to read and make corrections. Group your shader instructions based on what effect do they control (basically, don‘t have phong controlling instructions under $envmap, it makes it really hard to read and modify).

PART FOUR – THE VIDEO TUTORIAL

Congratulations! You‘ve made it through the text tutorial. The video tutorial starts here, explaining a lot of the technical stuff when it comes to Source shading – what import settings should you use, what shader instructions do what, etc. Huge thanks to my mate 4Echo who I‘ve done this tutorial with – he made this tutorial video. You can download the files from the tutorial [here](http://files.gamebanana.com/bitpit/4cuckold.7z ""). (please don't mind the filename)

ADDITIONAL REFERENCES

VMT Parameter Reference - a great read indeed. View this tutorial as an extension of that one. It provides information about pretty much every shader instruction there is, what it does, and in which Source version it is available.

THE END

This is it for the tutorial! We hope you‘ve enjoyed it, and now know how to make shaders for Source way better. See you next time!
---------------------------------------------------------------
Noodum and 4Echo, 2015

Posts

  • 1y
    Preggo Waffles avatar
    Refraction Studios Flag Affiliation: Refraction Studios
    Member Joined 4y
    1,236 points Ranked 3770th
    12 medals 2 rare
    • Returned 1000 times Medal icon
    • 10 submissions featured Medal icon
    • One month a member Medal icon
    • 6 months a member Medal icon
    • 1 year a member Medal icon
    • Became a Studio Leader Medal icon
    Preggo Waffles Refraction Studios Flag
    Refraction Studios
    Sooo....does anyone have a link to 3point or xoliul? Main page download doesnt work.

    Top Quality Shitposter
  • 2y
    4Echo avatar
    4Echo avatar Denied.
    Destiny Flag Affiliation: Destiny
    Moderator Joined 6y
    40,475 points Ranked 100th
    38 medals 1 legendary 7 rare
    • Returned 5000 times Medal icon
    • 3rd Place - Movie Replicas Modeling Contest Medal icon
    • 3rd Place - The
    • 25 posts awarded Exemplary Feedback Medal icon
    • Returned 1000 times Medal icon
    • 10 submissions featured Medal icon
    4Echo avatar
    4Echo
    Destiny Flag
    Destiny
    Source Shaders Expert
    Posted by Names

    4Echo seems like a nice and funny guy in the video.


    Had a really tough cold so my voice was more raspy than it actually is. Ended up sounding like Bill Clinton mixed with Kylo Ren.
    • Interesting x 1
    • Funny x 1
    Only Perfection is Acceptable
  • 2y
    spacepirate avatar
    Refraction Studios Flag Affiliation: Refraction Studios
    Member Joined 4y
    2,141 points Ranked 2180th
    17 medals 3 rare
    • 3rd Place - Size Matters Skinning Contest Medal icon
    • Returned 1000 times Medal icon
    • 10 submissions featured Medal icon
    • Became a Studio Leader Medal icon
    • One month a member Medal icon
    • 6 months a member Medal icon
    spacepirate Refraction Studios Flag
    Refraction Studios
    4Echo seems like a nice and funny guy in the video.

  • 2y
    Rafael De Jongh avatar
    Rafael De Jongh avatar Offline
    Apocalyptic Flag Affiliation: Apocalyptic
    Super Moderator Joined 9y
    44,703 points Ranked 90th
    73 medals 8 legendary 19 rare
    • 1st Place - Winter Textures Contest Medal icon
    • 1st Place - GameBanana Around the Globe Contest Medal icon
    • 1st Place - Sci-Fi Skinning Contest Medal icon
    • 1st Place - Winter Warfare Medal icon
    • 1st Place - Movie Replicas Modeling Contest Medal icon
    • Submitted 100 WiPs Medal icon
    Rafael De Jongh avatar
    Rafael De Jongh
    Apocalyptic Flag
    Apocalyptic
    Skinning/Modelling Expert
    Fancy Pancy.
    2D/3D Artist avatar
    Mantra
    2D/3D Artist
  • 2y
    Epicusfuria avatar
    Epicusfuria avatar doing work
    Member Joined 3y
    284 points Ranked 13592nd
    21 medals 4 rare
    • Thanked 50 submitters Medal icon
    • Returned 1000 times Medal icon
    • 10 submissions featured Medal icon
    • Received thanks 50 times Medal icon
    • Submitted 10 Skins Medal icon
    • One month a member Medal icon
    > **Posted by 4Echo**
    >
    > > **Posted by Epicfury**
    > >
    > > The image you used was a WIP. I released the skin with flipped normals. Say it's from the wip page or something.
    >
    > Those shaders are still pretty horrible, even in the final release.

    Well shit.
    Digital Fabricator avatar
    Mantra
    Digital Fabricator
  • 2y
    4Echo avatar
    4Echo avatar Denied.
    Destiny Flag Affiliation: Destiny
    Moderator Joined 6y
    40,475 points Ranked 100th
    38 medals 1 legendary 7 rare
    • Returned 5000 times Medal icon
    • 3rd Place - Movie Replicas Modeling Contest Medal icon
    • 3rd Place - The
    • 25 posts awarded Exemplary Feedback Medal icon
    • Returned 1000 times Medal icon
    • 10 submissions featured Medal icon
    4Echo avatar
    4Echo
    Destiny Flag
    Destiny
    Source Shaders Expert
    > **Posted by Epicfury**
    >
    > The image you used was a WIP. I released the skin with flipped normals. Say it's from the wip page or something.

    Those shaders are still pretty horrible, even in the final release.
    Only Perfection is Acceptable
  • 2y
    Epicusfuria avatar
    Epicusfuria avatar doing work
    Member Joined 3y
    284 points Ranked 13592nd
    21 medals 4 rare
    • Thanked 50 submitters Medal icon
    • Returned 1000 times Medal icon
    • 10 submissions featured Medal icon
    • Received thanks 50 times Medal icon
    • Submitted 10 Skins Medal icon
    • One month a member Medal icon
    > The normal map isn‘t inverted, the wood and metal have absolutely no difference in shading whatsoever, the metal has no detail in the phong... once again

    The image you used was a WIP. I released the skin with flipped normals. Say it's from the wip page or something.
    Digital Fabricator avatar
    Mantra
    Digital Fabricator
  • 2y
    schiff. avatar
    schiff. avatar away
    Purgatory dev. team Flag Affiliation: Purgatory dev. team
    Member Joined 8y
    19,405 points Ranked 223rd
    40 medals 4 legendary 8 rare
    • Submitted 100 Skins Medal icon
    • 30 submissions featured Medal icon
    • Reached 100 subscribers Medal icon
    • Returned 5000 times Medal icon
    • Submitted 50 WiPs Medal icon
    • 6 years a member Medal icon
    schiff. avatar
    schiff.
    Purgatory dev. team Flag
    Purgatory dev. team
    BIIIIG THANKS FOR THIS

    10/10

    one man army. avatar
    Mantra
    one man army.

Share

Shareable Image:
Share banner
HTML embed code:
BB embed code:
Markdown embed code:

More embeddable images

Bookmark and Share

Credits

Main
4Echo avatar Destiny Flag
Destiny
4Echo avatar Offline
Destiny Flag Affiliation: Destiny
Moderator Joined 6y
40,475 points Ranked 100th
38 medals 1 legendary 7 rare
  • Returned 5000 times Medal icon
  • 3rd Place - Movie Replicas Modeling Contest Medal icon
  • 3rd Place - The
  • 25 posts awarded Exemplary Feedback Medal icon
  • Returned 1000 times Medal icon
  • 10 submissions featured Medal icon
Video part of the tutorial
Noodum
Noodum Offline
Member Joined 2y
2,466 points Ranked 1893rd
21 medals 1 legendary 3 rare
  • 1st Place - A Bananite's Guide to... Contest Medal icon
  • 4th Place - The
  • Returned 1000 times Medal icon
  • 10 submissions featured Medal icon
  • 1 post awarded Exemplary Feedback Medal icon
  • One month a member Medal icon
Wall of text

Submitter

Noodum avatar
Noodum Offline
Member Joined 2y
2,466 points Ranked 1893rd
21 medals 1 legendary 3 rare
  • 1st Place - A Bananite's Guide to... Contest Medal icon
  • 4th Place - The
  • Returned 1000 times Medal icon
  • 10 submissions featured Medal icon
  • 1 post awarded Exemplary Feedback Medal icon
  • One month a member Medal icon

Noodum
Creator
  • Paypal Donate
Send a Private Message to the submitter

Details

Difficulty Level
Intermediate Difficulty

Stats

Posts
8
Views
4,982
Date Added
2y
Date Modified
2y

Scores

91 bScore
10 Rating

5 voters

WiPs by Submitter

bcp.crwdcntrl.net tracking pixel