Fps Haxers
Please Login to view the forums. Thank you.


Game Enhancements. Free, Safe, Working and Trusted.
 
HomePortalFAQRegisterLog in
Welcome! Come join our Great Community. We are looking for Mods and Coders!
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Share | 
 

 chams (i take no credit)

Go down 
AuthorMessage
BumbleBee
Super Moderator
Super Moderator
avatar

Warning Bar :
Posts : 113
Join date : 2009-06-29
Age : 22
Location : Up Your Ass

PostSubject: chams (i take no credit)   Thu Jul 02, 2009 8:24 pm

Ok, in this tutorial i will be explaining the basic concept behind chams, how they work, why they work and how this can be done easily in other renderers, but i will be using D3D9 as an example.

The term "chams" is short for "chameleon colors", which basically (you guessed it) changes the color of the model being rendered, but not just simple changes it, that would be a skinhack, the trick to chams is that the model is rendered one way behind the wall, and one way in front of the wall.

This can be a change in colors, wireframe, or whatever effects you want behind/in front of the wall.

The factor that controls the visibility (or pseudo-visibility) is a value called the Z-Buffer


Quote:
In computer graphics, z-buffering is the management of image depth coordinates in three-dimensional (3-D) graphics, usually done in hardware, sometimes in software. It is one solution to the visibility problem, which is the problem of deciding which elements of a rendered scene are visible, and which are hidden. The painter's algorithm is another common solution which, though less efficient, can also handle non-opaque scene elements. Z-buffering is also known as depth buffering.

For this concept to work at all, one model has to be rendered behind the wall, this can be achieved by bringing your model to the top of the Z-Order, the Z-Order traditionally used to describe 2-Dimensional elements in this case describes the dilemma quite well

Our model is not on the top of the Z-Order, therefore, is not visible
what you see instead is a wall, the engine you use depends on how you do it exactly, but usually you can control the "flow" of the z-buffer for your current model in the model rendering function, once the z-buffer value is edited it is usually re-cached each frame, so you only need not apply the "hack" that frame to "stop" the chams

Once your model is on top, what you have is a simple wallhack, easy but it is not chams that is for certain.

You want to have two colors for the model, one behind and one in front
this can not be achieved without redrawing the model

in OpenGL the function to draw models is "glDrawElements", in d3d8/d3d9 the function is "DrawIndexedPrimitive" and in Source engine, the function is "DrawModelEx/DrawModelExecute"

to disable the "depth test" or bring your model to the top of the "z-order",
in OpenGL the function is "glDisable(GL_DEPTH_TEST)", in DirectX it is "g_pGlobalDevice->SetRenderState( D3DRS_ZENABLE, FALSE )" or "g_pGlobalDevice->SetRenderState( D3DRS_ZFUNC, D3DCMP_NEVER )",
i won't go into detail much about the Source engine because it involves a lot of explanation.

whatever the renderer is, the same idea still applies to all of them

To complete the chams, you need one model being drawn without a Z-buffer, and one drawn with one enabled.

this serves two purposes, you can edit the color of the model behind the wall and in front, and because you rendered the model in front of the wall after you rendered the "wallhacked" model, the model rendered after gets rendered over the wallhack model, and since it has a depth-test you will have effectively drawn one model of one color behind the wall, and another in front of the wall with a (hopefully) separate color.

now that the explanation is out of the way, here is the basic concept:


PHP Code:
int __cdecl Hooked_DrawModel( ... )
{
if( IsPlayer( ... ) )
{
//disable z-buffer checking
//color model blue

Original_DrawModel( ... );

//enable the z-buffer
//color model red
}

return Original_DrawModel( ... );
}

i have made chams for many games, but the same method still applies.

here is some other examples, in other renderers (which are not imaginary) which may help you.


PHP Code:
void new_glDrawElements( GLenum mode, GLsizei count, GLenum type, const GLvoid *indicies )
{
if( _ReturnAddress() == 0x123456 )
{
glDisable( GL_DEPTH_TEST );
glDisable( GL_TEXTURE_2D );
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, &green );
Original_glDrawElements( mode, count, type, indicies );
glEnable( GL_DEPTH_TEST );
glColorPointer( 4, GL_UNSIGNED_BYTE, 0, &blue );
}

Original_glDrawElements( mode, count, type, indicies );
}

PHP Code:
int __stdcall new_DrawIndexedPrimitive( IDirect3DDevice9 *pDevice, D3DPRIMITIVETYPE Type, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount )
{
if( UC_IS_MARINE || UC_IS_REDARMY )
{
g_pGlobalDevice->SetTexture( 0, NULL );
g_pGlobalDevice->SetPixelShader( g_pBackAllied );
g_pGlobalDevice->SetRenderState( D3DRS_ZENABLE, FALSE );
g_pGlobalDevice->SetRenderState( D3DRS_ZFUNC, D3DCMP_NEVER );

pDrawIndexedPrimitive( pDevice, Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount );

g_pGlobalDevice->SetRenderState( D3DRS_ZENABLE, dwOldZEnable );
g_pGlobalDevice->SetRenderState( D3DRS_ZFUNC, dwOldZFunc );
g_pGlobalDevice->SetPixelShader( g_pFrontAllied );
}

return pDrawIndexedPrimitive( pDevice, Type, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount );
}

i take no credits of this all credits go to S0beit for making this tut

i thought it would be usefull for this site if somepeople learn this so here it is

i dont take any credits
Back to top Go down
Leki
Administrator
Administrator
avatar

Warning Bar :
Posts : 197
Join date : 2009-06-29
Age : 24
Location : In your Mom's house. Duh!

PostSubject: Re: chams (i take no credit)   Thu Jul 02, 2009 8:33 pm

Nice
Back to top Go down
http://fpshaxers.forumotion.net
BumbleBee
Super Moderator
Super Moderator
avatar

Warning Bar :
Posts : 113
Join date : 2009-06-29
Age : 22
Location : Up Your Ass

PostSubject: Re: chams (i take no credit)   Thu Jul 02, 2009 8:36 pm

i know it is a nice tutorial but i dont understand any of it.
Back to top Go down
chuck_norris
Banned
Banned
avatar

Warning Bar :
Posts : 7
Join date : 2009-08-21
Age : 29
Location : auburn wa

PostSubject: Re: chams (i take no credit)   Fri Aug 21, 2009 11:07 pm

i understand it but i cant use c++ or anything like that i have not figured out hjow to use the programs if i did i wuold make my own hacks and not be here waiting for them lol
Back to top Go down
http://s1.webstarts.com/RMMS/index.html
minipa
Trainee Mod
Trainee Mod
avatar

Warning Bar :
Posts : 57
Join date : 2009-09-05
Age : 22
Location : Canada

PostSubject: Re: chams (i take no credit)   Tue Sep 08, 2009 9:24 pm

i dont understand either, i just inject chams with an injector lol
Back to top Go down
qoehd8
Moderator
Moderator
avatar

Posts : 86
Join date : 2009-08-23
Age : 28

PostSubject: Re: chams (i take no credit)   Wed Sep 09, 2009 5:38 am

BumbleBee wrote:
i know it is a nice tutorial but i dont understand any of it.
lol me too
Back to top Go down
Megaops
Forum Owner
Forum Owner
avatar

Warning Bar :
Posts : 270
Join date : 2009-07-01
Age : 21
Location : Sleeping in your house

PostSubject: Re: chams (i take no credit)   Sun Sep 13, 2009 5:35 pm

This explains what chams is, and how to make them..

_________________
Back to top Go down
http://fpshaxers.tk/
Sponsored content




PostSubject: Re: chams (i take no credit)   

Back to top Go down
 
chams (i take no credit)
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Fps Haxers :: Programming :: Programming-
Jump to: