D3D Shader Skinhack
I noticed while playing WarZ that chams sucked ass, huge ass. So I dug through my old sources and found that there is in fact something we can do about it. In Battlefield 1942, the Zbuffer wasnt used properly for the player models, and it caused chams to be annoying in that game. Someone posted a shader fix for it that worked. I worked it into D3D9 and in WarZ it seems to do the trick!
Before:

After:

Bonus cool stuff can be done too!


Just hook SetVertexShaderConstantF
Still a little buggy, the other depth buffers hold some valuable information I haven't found yet, was able to get a proper cham on their left legs... not the whole body yet, so just a skin hack for now.
Credits:
Everett
Sobeit for the SetModelColor() function.
Before:

After:

Bonus cool stuff can be done too!


Just hook SetVertexShaderConstantF
Code:
//DECLARE THE STRUCT
typedef float vec_t;
typedef vec_t vec3_t[3];
typedef vec_t vec4_t[4];
typedef struct vshader_s
{
vec4_t zcrap;
vec4_t zcrap1;
float depth_1;
float depth_2;
float depth_3;
float depth_4;
vec4_t zcrap3;
vec4_t zcrap4;
vec4_t zcrap5;
vec4_t zcrap6;
vec4_t zcrap7;
float a_r;
float a_g;
float a_b;
float a_a;
}
vshader_t;
vshader_t m_verTex;
//inside your SetVertexShaderConstantF()hook---
vshader_t *pv = (vshader_t*)pConstantData;
m_verTex = *pv;
//inside your DrawIndexedPrimitve()hook---
if(m_Stride==32)
{
m_verTex.depth_4 = 1.0f;
pDevice->SetVertexShaderConstantF(2,(CONST float *)&m_verTex,1);
SetModelColor(pDevice,7,0.3,0.3,0.3,7,0.3,0.3,0.3);
}
Still a little buggy, the other depth buffers hold some valuable information I haven't found yet, was able to get a proper cham on their left legs... not the whole body yet, so just a skin hack for now.
Credits:
Everett
Sobeit for the SetModelColor() function.
