Any way here it is I take credits for finding and posting.
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
n 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.
or 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]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
What format will we save this.. and how will we make it a .dll?
I thought it would be that simple once, but you have to understand this is a VERY generic overview of chams. It is not specific to CA or any game. It does not tell you how models are drawn and how to specify which models are drawn. I think a lot of that deals with getting structures out or memory, but I wouldn't know for sure. However the basic concept is there. So what he's saying is learn more about some of these functions on your own, and what you need to use them, then you can apply this technique. It looked like one of his examples were for OpenGL too, so you see it was very generic, but meant to convey a concept. C&P'in does not a hack make. ;l
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."