mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-11-22 15:02:54 +08:00
Fix for leg jankyness. Added PBBNCCTTX shader
This commit is contained in:
parent
639bebbc75
commit
918ed7fccf
@ -924,7 +924,7 @@ namespace CodeWalker.GameFiles
|
|||||||
var pbone = Parent;
|
var pbone = Parent;
|
||||||
while (pbone != null)
|
while (pbone != null)
|
||||||
{
|
{
|
||||||
pos = pbone.AnimRotation.Multiply(pos * pbone.AnimScale) + pbone.AnimTranslation;
|
pos = pbone.AnimRotation.Multiply(pos /** pbone.AnimScale*/) + pbone.AnimTranslation;
|
||||||
ori = pbone.AnimRotation * ori;
|
ori = pbone.AnimRotation * ori;
|
||||||
pbone = pbone.Parent;
|
pbone = pbone.Parent;
|
||||||
}
|
}
|
||||||
|
@ -537,27 +537,68 @@ namespace CodeWalker.Rendering
|
|||||||
bone.AnimRotation = q;
|
bone.AnimRotation = q;
|
||||||
break;
|
break;
|
||||||
case 2: //scale?
|
case 2: //scale?
|
||||||
|
v0 = aseq.EvaluateVector(f0);
|
||||||
|
v1 = aseq.EvaluateVector(f1);
|
||||||
|
v = interpolate ? (v0 * ialpha) + (v1 * falpha) : v0;
|
||||||
|
bone.AnimScale = v.XYZ();
|
||||||
break;
|
break;
|
||||||
case 5://vector3...
|
case 5://root motion vector
|
||||||
//v0 = aseq.EvaluateVector(f0);
|
if (bone.Tag != 0)
|
||||||
//v1 = aseq.EvaluateVector(f1);
|
{ }
|
||||||
//v = interpolate ? (v0 * ialpha) + (v1 * falpha) : v0;
|
//v0 = aseq.EvaluateVector(f0);
|
||||||
//bone.AnimScale = v.XYZ();
|
//v1 = aseq.EvaluateVector(f1);
|
||||||
|
//v = interpolate ? (v0 * ialpha) + (v1 * falpha) : v0;
|
||||||
|
//bone.AnimTranslation += v.XYZ();
|
||||||
break;
|
break;
|
||||||
case 6://quaternion...
|
case 6://quaternion... root rotation?
|
||||||
|
if (bone.Tag != 0)
|
||||||
|
{ }
|
||||||
|
//q0 = new Quaternion(aseq.EvaluateVector(f0));
|
||||||
|
//q1 = new Quaternion(aseq.EvaluateVector(f1));
|
||||||
|
//q = interpolate ? Quaternion.Slerp(q0, q1, falpha) : q0;
|
||||||
|
//bone.AnimRotation *= q;
|
||||||
break;
|
break;
|
||||||
|
case 7://vector3... (camera position?)
|
||||||
|
break;
|
||||||
|
case 8://quaternion... (camera rotation?)
|
||||||
|
break;
|
||||||
|
case 27:
|
||||||
|
case 50:
|
||||||
case 134://single float?
|
case 134://single float?
|
||||||
case 136:
|
case 136:
|
||||||
case 137:
|
case 137:
|
||||||
case 138:
|
case 138:
|
||||||
case 139:
|
case 139:
|
||||||
case 140:
|
case 140:
|
||||||
|
if (bone.Tag != 0)
|
||||||
|
{ }
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < bones.Count; i++)
|
||||||
|
{
|
||||||
|
var bone = bones[i];
|
||||||
|
var tag = bone.Tag;
|
||||||
|
switch (bone.Tag)
|
||||||
|
{
|
||||||
|
case 23639: tag = 58271; break; //RB_L_ThighRoll: SKEL_L_Thigh
|
||||||
|
case 6442: tag = 51826; break; //RB_R_ThighRoll: SKEL_R_Thigh
|
||||||
|
//case 61007: tag = 61163; break; //RB_L_ForeArmRoll: SKEL_L_Forearm //NOT GOOD
|
||||||
|
//case 5232: tag = 45509; break; //RB_L_ArmRoll: SKEL_L_UpperArm
|
||||||
|
}
|
||||||
|
if (tag != bone.Tag)
|
||||||
|
{
|
||||||
|
var obone = bone;
|
||||||
|
if (skel.BonesMap.TryGetValue(tag, out obone))
|
||||||
|
{
|
||||||
|
bone.AnimRotation = obone.AnimRotation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < bones.Count; i++)
|
for (int i = 0; i < bones.Count; i++)
|
||||||
{
|
{
|
||||||
var bone = bones[i];
|
var bone = bones[i];
|
||||||
|
@ -138,6 +138,7 @@ namespace CodeWalker.Rendering
|
|||||||
VertexShader basicvspbbncttt;
|
VertexShader basicvspbbncttt;
|
||||||
VertexShader basicvspbbncct;
|
VertexShader basicvspbbncct;
|
||||||
VertexShader basicvspbbncctx;
|
VertexShader basicvspbbncctx;
|
||||||
|
VertexShader basicvspbbnccttx;
|
||||||
VertexShader basicvspbbncttx;
|
VertexShader basicvspbbncttx;
|
||||||
VertexShader basicvsbox;
|
VertexShader basicvsbox;
|
||||||
VertexShader basicvssphere;
|
VertexShader basicvssphere;
|
||||||
@ -199,6 +200,7 @@ namespace CodeWalker.Rendering
|
|||||||
byte[] vspbbnctttbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCTTT.cso");
|
byte[] vspbbnctttbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCTTT.cso");
|
||||||
byte[] vspbbncctbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCCT.cso");
|
byte[] vspbbncctbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCCT.cso");
|
||||||
byte[] vspbbncctxbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCCTX.cso");
|
byte[] vspbbncctxbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCCTX.cso");
|
||||||
|
byte[] vspbbnccttxbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCCTTX.cso");
|
||||||
byte[] vspbbncttxbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCTTX.cso");
|
byte[] vspbbncttxbytes = File.ReadAllBytes("Shaders\\BasicVS_PBBNCTTX.cso");
|
||||||
|
|
||||||
byte[] vsboxbytes = File.ReadAllBytes("Shaders\\BasicVS_Box.cso");
|
byte[] vsboxbytes = File.ReadAllBytes("Shaders\\BasicVS_Box.cso");
|
||||||
@ -225,6 +227,7 @@ namespace CodeWalker.Rendering
|
|||||||
basicvspbbncttt = new VertexShader(device, vspbbnctttbytes);
|
basicvspbbncttt = new VertexShader(device, vspbbnctttbytes);
|
||||||
basicvspbbncct = new VertexShader(device, vspbbncctbytes);
|
basicvspbbncct = new VertexShader(device, vspbbncctbytes);
|
||||||
basicvspbbncctx = new VertexShader(device, vspbbncctxbytes);
|
basicvspbbncctx = new VertexShader(device, vspbbncctxbytes);
|
||||||
|
basicvspbbnccttx = new VertexShader(device, vspbbnccttxbytes);
|
||||||
basicvspbbncttx = new VertexShader(device, vspbbncttxbytes);
|
basicvspbbncttx = new VertexShader(device, vspbbncttxbytes);
|
||||||
basicvsbox = new VertexShader(device, vsboxbytes);
|
basicvsbox = new VertexShader(device, vsboxbytes);
|
||||||
basicvssphere = new VertexShader(device, vsspherebytes);
|
basicvssphere = new VertexShader(device, vsspherebytes);
|
||||||
@ -281,7 +284,7 @@ namespace CodeWalker.Rendering
|
|||||||
layouts.Add(VertexType.PBBNCCTX, new InputLayout(device, vspbbncctxbytes, VertexTypePBBNCCTX.GetLayout()));
|
layouts.Add(VertexType.PBBNCCTX, new InputLayout(device, vspbbncctxbytes, VertexTypePBBNCCTX.GetLayout()));
|
||||||
layouts.Add(VertexType.PBBNCTTX, new InputLayout(device, vspbbncttxbytes, VertexTypePBBNCTTX.GetLayout()));
|
layouts.Add(VertexType.PBBNCTTX, new InputLayout(device, vspbbncttxbytes, VertexTypePBBNCTTX.GetLayout()));
|
||||||
layouts.Add(VertexType.PBBNCTTTX, new InputLayout(device, vspbbncttxbytes, VertexTypePBBNCTTTX.GetLayout()));//TODO
|
layouts.Add(VertexType.PBBNCTTTX, new InputLayout(device, vspbbncttxbytes, VertexTypePBBNCTTTX.GetLayout()));//TODO
|
||||||
layouts.Add(VertexType.PBBNCCTTX, new InputLayout(device, vspbbncctxbytes, VertexTypePBBNCCTTX.GetLayout()));//TODO
|
layouts.Add(VertexType.PBBNCCTTX, new InputLayout(device, vspbbnccttxbytes, VertexTypePBBNCCTTX.GetLayout()));
|
||||||
//PBBCCT todo
|
//PBBCCT todo
|
||||||
//PBBNC todo
|
//PBBNC todo
|
||||||
|
|
||||||
@ -469,8 +472,8 @@ namespace CodeWalker.Rendering
|
|||||||
case VertexType.PBBNCTTX:
|
case VertexType.PBBNCTTX:
|
||||||
vs = basicvspbbncttx;
|
vs = basicvspbbncttx;
|
||||||
break;
|
break;
|
||||||
case VertexType.PBBNCCTTX://not used?
|
case VertexType.PBBNCCTTX:
|
||||||
vs = basicvspbbncctx;//TODO
|
vs = basicvspbbnccttx;
|
||||||
break;
|
break;
|
||||||
case VertexType.PBBNCTTTX:
|
case VertexType.PBBNCTTTX:
|
||||||
vs = basicvspbbncttx;//TODO
|
vs = basicvspbbncttx;//TODO
|
||||||
@ -1023,6 +1026,7 @@ namespace CodeWalker.Rendering
|
|||||||
basicvspbbncttt.Dispose();
|
basicvspbbncttt.Dispose();
|
||||||
basicvspbbncct.Dispose();
|
basicvspbbncct.Dispose();
|
||||||
basicvspbbncctx.Dispose();
|
basicvspbbncctx.Dispose();
|
||||||
|
basicvspbbnccttx.Dispose();
|
||||||
basicvspbbncttx.Dispose();
|
basicvspbbncttx.Dispose();
|
||||||
basicvsbox.Dispose();
|
basicvsbox.Dispose();
|
||||||
basicvssphere.Dispose();
|
basicvssphere.Dispose();
|
||||||
|
BIN
Shaders/BasicVS_PBBNCCTTX.cso
Normal file
BIN
Shaders/BasicVS_PBBNCCTTX.cso
Normal file
Binary file not shown.
75
Shaders/BasicVS_PBBNCCTTX.hlsl
Normal file
75
Shaders/BasicVS_PBBNCCTTX.hlsl
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
#include "BasicVS.hlsli"
|
||||||
|
|
||||||
|
struct VS_INPUT
|
||||||
|
{
|
||||||
|
float4 Position : POSITION;
|
||||||
|
float4 BlendWeights : BLENDWEIGHTS;
|
||||||
|
float4 BlendIndices : BLENDINDICES;
|
||||||
|
float3 Normal : NORMAL;
|
||||||
|
float4 Colour0 : COLOR0;
|
||||||
|
float4 Colour1 : COLOR1;
|
||||||
|
float2 Texcoord0 : TEXCOORD0;
|
||||||
|
float2 Texcoord1 : TEXCOORD1;
|
||||||
|
float4 Tangent : TANGENT;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
VS_OUTPUT main(VS_INPUT input, uint iid : SV_InstanceID)
|
||||||
|
{
|
||||||
|
VS_OUTPUT output;
|
||||||
|
float3x4 bone = BoneMatrix(input.BlendWeights, input.BlendIndices);
|
||||||
|
float3 bpos = BoneTransform(input.Position.xyz, bone);
|
||||||
|
float3 opos = ModelTransform(bpos, input.Colour0.xyz, input.Colour1.xyz, iid);
|
||||||
|
float4 cpos = ScreenTransform(opos);
|
||||||
|
float3 bnorm = BoneTransformNormal(input.Normal.xyz, bone);
|
||||||
|
float3 btang = BoneTransformNormal(input.Tangent.xyz, bone);
|
||||||
|
float3 onorm = NormalTransform(bnorm);
|
||||||
|
float3 otang = NormalTransform(btang);
|
||||||
|
|
||||||
|
float4 tnt = ColourTint(input.Colour0.b, input.Colour1.b, iid); //colour tinting if enabled
|
||||||
|
|
||||||
|
float4 lightspacepos;
|
||||||
|
float shadowdepth = ShadowmapSceneDepth(opos, lightspacepos);
|
||||||
|
output.LightShadow = lightspacepos;
|
||||||
|
output.Shadows = float4(shadowdepth, 0, 0, 0);
|
||||||
|
|
||||||
|
output.Position = cpos;
|
||||||
|
output.CamRelPos = opos;
|
||||||
|
output.Normal = onorm;
|
||||||
|
output.Texcoord0 = GlobalUVAnim(input.Texcoord0);
|
||||||
|
output.Texcoord1 = input.Texcoord1; // input.Texcoord;
|
||||||
|
output.Texcoord2 = 0.5; // input.Texcoord;
|
||||||
|
output.Colour0 = input.Colour0;
|
||||||
|
output.Colour1 = input.Colour1;
|
||||||
|
output.Tint = tnt;
|
||||||
|
output.Tangent = float4(otang, input.Tangent.w);
|
||||||
|
output.Bitangent = float4(cross(otang, onorm) * input.Tangent.w, 0);
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
WIND FOR CLOTHING
|
||||||
|
|
||||||
|
mul r1.xyz, v8.xxzx, umGlobalParams.xxyx //colour[1].XXZX
|
||||||
|
mul r1.xyz, r1.xyzx, umPedGlobalOverrideParams.xxyx
|
||||||
|
mul r0.w, v8.y, l(6.283185) //colour[1].Y
|
||||||
|
mul r2.xyz, umPedGlobalOverrideParams.zzwz, umGlobalParams.zzwz
|
||||||
|
mad r2.xyz, globalScalars2.xxxx, r2.xyzx, r0.wwww
|
||||||
|
sincos r2.xyz, null, r2.xyzx
|
||||||
|
mad r1.xyz, r2.xyzx, r1.xyzx, r4.xyzx //OUTPUT - r4 is base bone transform, r1,r2?
|
||||||
|
|
||||||
|
|
||||||
|
translation:
|
||||||
|
|
||||||
|
r1.xyz = umGlobalParams.xxy * umPedGlobalOverrideParams.xxy * vc[1].xxz;
|
||||||
|
r2.xyz = umGlobalParams.zzw * umPedGlobalOverrideParams.zzw * globalScalars2.xxx + (vc[1].y * 6.283185)
|
||||||
|
pos.xyz += r1 * cos(r2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
@ -160,6 +160,16 @@
|
|||||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
||||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||||
</FxCompile>
|
</FxCompile>
|
||||||
|
<FxCompile Include="BasicVS_PBBNCCTTX.hlsl">
|
||||||
|
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||||
|
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
|
||||||
|
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||||
|
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
|
||||||
|
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
||||||
|
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||||
|
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
|
||||||
|
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
|
||||||
|
</FxCompile>
|
||||||
<FxCompile Include="BasicVS_PBBNCCTX.hlsl">
|
<FxCompile Include="BasicVS_PBBNCCTX.hlsl">
|
||||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
|
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
|
||||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
|
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
|
||||||
|
@ -75,6 +75,7 @@
|
|||||||
<FxCompile Include="BasicVS_PBBNCCTX.hlsl" />
|
<FxCompile Include="BasicVS_PBBNCCTX.hlsl" />
|
||||||
<FxCompile Include="BasicVS_PBBNCTTX.hlsl" />
|
<FxCompile Include="BasicVS_PBBNCTTX.hlsl" />
|
||||||
<FxCompile Include="ShadowVS_Skin.hlsl" />
|
<FxCompile Include="ShadowVS_Skin.hlsl" />
|
||||||
|
<FxCompile Include="BasicVS_PBBNCCTTX.hlsl" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Quaternion.hlsli" />
|
<None Include="Quaternion.hlsli" />
|
||||||
|
Loading…
Reference in New Issue
Block a user