I tried making my own model in 3dsmax and putting it in the skeletalanimation project instead of the robot mesh. It works, but I'm only able to get Software skinning.
this line: if (p->hasVertexProgram())
is failing.
What does it mean to not have a vertex program? did I do something wrong in MAX?
Can't get hardware skinning working
-
DigitalGhost
- Halfling
- Posts: 62
- Joined: Mon Feb 07, 2005 9:47 pm
- sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
- Contact:
Hardware skinning has to be implemented in a vertex program. See http://www.ogre3d.org/docs/manual/manual_20.html#SEC76 , the section labelled "Skeletal Animation in Vertex Programs". We provide 2 example vertex programs for skinning.
-
DigitalGhost
- Halfling
- Posts: 62
- Joined: Mon Feb 07, 2005 9:47 pm
Hey, thanks for answering so fast.
I got the vertex thing loaded by putting it in the material file, but now I get this weird glitch. Basically, one of the legs of the model is messed up from the knee down. It looks like it's trying to draw a polygon from the top of the knee to some point at infinity. Do you have any idea what could be causing this?
Here is a screenshot of what I'm talking about:

I got the vertex thing loaded by putting it in the material file, but now I get this weird glitch. Basically, one of the legs of the model is messed up from the knee down. It looks like it's trying to draw a polygon from the top of the knee to some point at infinity. Do you have any idea what could be causing this?
Here is a screenshot of what I'm talking about:

-
DigitalGhost
- Halfling
- Posts: 62
- Joined: Mon Feb 07, 2005 9:47 pm
Problem fixed
The problem was that the example vertex program only supported 24 bones. It's since been fixed.
-
thorgrim
- Gnoblar
- Posts: 17
- Joined: Thu Oct 16, 2003 9:37 pm
Fix
Hi,
The fix was for the 4 weight bones skinning, but the one that come with ogre is using a profile of vs_1_1 which limit the number of bones (24).
However, I have changed the shader to provide a bigger array using a profile of vs_2_0.
I have several models being full H-Anim compliant (78 bones) and hardware skinning work perfectly.
Here is the sknippet is case you need it:
The fix was for the 4 weight bones skinning, but the one that come with ogre is using a profile of vs_1_1 which limit the number of bones (24).
However, I have changed the shader to provide a bigger array using a profile of vs_2_0.
I have several models being full H-Anim compliant (78 bones) and hardware skinning work perfectly.
Here is the sknippet is case you need it:
Code: Select all
// Basic hardware skinning using four indexed weights per vertex
vertex_program vhd/HardwareSkinningFourWeightsFullHANIM cg
{
source vhd_Basic.cg
entry_point hardwareSkinningFourWeightsFullHANIM_vp
profiles vs_2_0 arbvp1
includes_skeletal_animation true
}
/*
Four-weight-per-vertex hardware skinning, 2 lights
The trouble with vertex programs is they're not general purpose, but
fixed function hardware skinning is very poorly supported
*/
void hardwareSkinningFourWeightsFullHANIM_vp(
float4 position : POSITION,
float3 normal : NORMAL,
float2 uv : TEXCOORD0,
float4 blendIdx : BLENDINDICES,
float4 blendWgt : BLENDWEIGHT,
out float4 oPosition : POSITION,
out float2 oUv : TEXCOORD0,
out float4 colour : COLOR,
// Support up to 78 bones of float3x4
uniform float3x4 worldMatrix3x4Array[78],
uniform float4x4 viewProjectionMatrix,
uniform float3 lightPos[2],
uniform float4 lightDiffuseColour[2],
uniform float4 ambient)
{
// transform by indexed matrix
float4 blendPos = float4(0,0,0,0);
int i;
for (i = 0; i < 4; ++i)
{
blendPos += float4(mul(worldMatrix3x4Array[blendIdx[i]], position).xyz, 1.0) * blendWgt[i];
}
// view / projection
oPosition = mul(viewProjectionMatrix, blendPos);
// transform normal
float3 norm = float3(0,0,0);
for (i = 0; i < 4; ++i)
{
norm += mul((float3x3)worldMatrix3x4Array[blendIdx[i]], normal) *
blendWgt[i];
}
norm = normalize(norm);
float3 lightDir0 = normalize(lightPos[0] - blendPos);
float3 lightDir1 = normalize(lightPos[1] - blendPos);
oUv = uv;
colour = ambient +
(saturate(dot(lightDir0, norm)) * lightDiffuseColour[0]) +
(saturate(dot(lightDir1, norm)) * lightDiffuseColour[1]);
oUv = uv;
}
-
DigitalGhost
- Halfling
- Posts: 62
- Joined: Mon Feb 07, 2005 9:47 pm
Re: Fix
When I try your vertex skinning program, I get this error:thorgrim wrote:Hi,
The fix was for the 4 weight bones skinning, but the one that come with ogre is using a profile of vs_1_1 which limit the number of bones (24).
However, I have changed the shader to provide a bigger array using a profile of vs_2_0.
I have several models being full H-Anim compliant (78 bones) and hardware skinning work perfectly.
Here is the sknippet is case you need it:
(0): error C3001: no program defined