I did this tutorial for my own learning purposes as well, if you find it useless, simply ignore it.
Truthfully, I don't call "Chameleons" anything like "Chams".
I call this feature False Buffer.
Most people take for granted things like chams and just copy paste these things not caring why they work, just knowing they do.
Today I'm going to explain how to create False Buffer, as well as explaining why I call it that.
Basic "Chams".
Code:
if (FalseBuffer&& PlayerStride){
DeVMunficent->SetRenderState(D3DRS_ZENABLE,false);
DeVMunficent->SetTexture( 0, texColor);
DeVMunficent->DrawIndexedPrimitive(Arguments);
DeVMunficent->SetTexture( 0, texColor);
DeVMunficent->SetRenderState(D3DRS_ZENABLE, true);{
Now, you've probably seen this all over the place on the forums because its extremely easy to find and basic.
"Why does this code work?"
Not getting to into detail.. but here we go.
The main reason we get the False Buffer Effect, is because of the following code.
Code:
DeVMunficent->SetRenderState(D3DRS_ZENABLE,false);
DeVMunficent->DrawIndexedPrimitive(Arguments);
DeVMunficent->SetRenderState(D3DRS_ZENABLE, true);
If you look closely at the code, you'll spot out the following.
Code:
D3DRS_ZENABLE,false
Z stands for the "Z Buffer" also known as the "W Buffer".
If you think from a geometric standpoint the Z axis is like the 3D axis.
As you can see in the code above, we are setting the Z Buffer to "false".
This will tell DirectX that we are not sorting the Z Distance on the specified stride.
This in return, simply pulls forward our stride, creating what is known as a "WallHack".(Another irrelevant term).
Adding the color is where you get the "Chameleon" effect.
Code:
DeVMunficent->SetTexture( 0, texColor);