how do i make a ...

Dodo

Tank
Joined
Aug 30, 2004
Messages
2,140
Reaction score
0
i want to make a "Material Screen Overlay" like in Garry's mod v8.... how do i do that, or where can i find a tutorial ?
 
i want to ask garry !! :'( somebody answer my question PLEASE !

(and dont even try telling me you dont know)
 
It's pretty simple. Create a new HUD element, and then just make it draw a material on the screen - all of the blurring and stuff is handled by the material.

-Angry Lawyer
 
Open up the source materials GCF and you can see many examples of how to create some of those effects, like the fisheye, refraction and yuv shaders.

define your material something like this:

Code:
"yuv" //this is the shader to use
{
}
or
Code:
"hsv"
{
}

Here are some of them:

  • "bloom"
  • "camo"
  • "cloud"
  • "eyeball"
  • "eyes"
  • "lightmappedgeneric"
  • "lightmappedtwotexture"
  • "modulate"
  • "reflecttexture"
  • "refract"
  • "sprite"
  • "translucentlightmap"
  • "unlitgeneric"
  • "unlittwotexture"
  • "vertexlitgeneric"
  • "water"
  • "watersurfacebottom"
  • "wireframe"
  • "worldtwotextureblend"
  • "worldvertexalpha"
  • "worldvertextransition"
  • "yuv"

Check the SDK docs on materials, and the HUD/VGUI tutorials for creating new overlays or elements.
 
thanks.. :D

ill have to find out how to make the new hud materials.. are there any good tutorials on the web of making a new HUD element ?
 
Stick this in a new .cpp in your Client project.

Code:
#include "cbase.h"
#include "hudelement.h"
#include "hud_macros.h"
#include "iclientmode.h"
#include "view.h"

using namespace vgui;

#include <vgui_controls/Panel.h>
#include <vgui_controls/Frame.h>
#include <vgui/IScheme.h>
#include <vgui/ISurface.h>
#include <vgui/ILocalize.h>

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

//=============================================================================
// Dodo's magical screen filter thing - edited from Valve's code by Angry Lawyer
//=============================================================================
class CHudFilter : public CHudElement, public vgui::Panel
{
public:
	DECLARE_CLASS_SIMPLE( CHudFilter, vgui::Panel );

	CHudFilter( const char *name );

	virtual bool ShouldDraw();	
	virtual void Paint();
	virtual void VidInit();
	virtual void ApplySchemeSettings(vgui::IScheme *pScheme);

private:
	CHudTexture *m_pFilterTexture;

	Color	m_clrIcon;
};


DECLARE_HUDELEMENT( CHudFilter );


CHudFilter::CHudFiler( const char *pName ) :
	vgui::Panel( NULL, "hudfilter" ), CHudElement( pName )
{
	SetParent( g_pClientMode->GetViewport() );

	m_pVoiceIcon = NULL;

	SetHiddenBits( 0 );

	m_clrIcon = Color(255,255,255,255);
}

	
void CHudFilter::ApplySchemeSettings(vgui::IScheme *pScheme)
{
	BaseClass::ApplySchemeSettings( pScheme );

	SetBgColor( Color( 0, 0, 0, 0 ) );
}

void CHudFilter::VidInit( void )
{
	m_pFilterTexture = gHUD.GetIcon( "HudFilter" );
}

bool CHudFilter::ShouldDraw()
{
	return true;
}

void CHudFilter::Paint()
{
   if( !m_pFilterTexture )
		return;
	
	int x, y, w, h;
	GetBounds( x, y, w, h );

	m_pFilterTexture->DrawSelf( 0, 0, w, h, m_clrIcon );
}

That'll give you the basic code. Compile it.

In HudLayout.res, add this:

Code:
	HudFilter
	{
		"fieldName"		"HudFilter"
	"xpos" "0"
	"ypos" "0"
	"wide" "1024"
	"tall" "768"
	"visible" "1"
	"enabled" "1"
	}

After that, just create the texture, define it in mod_textures.txt, and play.

-Angry Lawyer
 
thank you sooo much :D angry laywer, if you need any concept art... PM me !
 
Back
Top