Fix skinning glitches possible in (some) cards

This commit is contained in:
Benau 2017-10-22 01:59:33 +08:00
parent aa080db501
commit 7252a38da1
6 changed files with 31 additions and 19 deletions

@ -74,10 +74,13 @@ void main(void)
{
for (int i = 0; i < 4; i++)
{
if (Weight[i] < 0.01)
{
break;
}
// Logically we should break if the weight is (almost) zero
// given the fact that it's sorted from high to low,
// but GT240 will cause glitches
//if (Weight[i] < 0.01)
//{
// break;
//}
mat4 joint_matrix = mat4(
texelFetch(skinning_tex, (Joint[i] + skinning_offset) * 4),
texelFetch(skinning_tex, (Joint[i] + skinning_offset) * 4 + 1),

@ -53,10 +53,13 @@ void main(void)
{
for (int i = 0; i < 4; i++)
{
if (Weight[i] < 0.01)
{
break;
}
// Logically we should break if the weight is (almost) zero
// given the fact that it's sorted from high to low,
// but GT240 will cause glitches
//if (Weight[i] < 0.01)
//{
// break;
//}
mat4 joint_matrix = mat4(
texelFetch(skinning_tex, (Joint[i] + skinning_offset) * 4),
texelFetch(skinning_tex, (Joint[i] + skinning_offset) * 4 + 1),

@ -71,10 +71,13 @@ void main(void)
{
for (int i = 0; i < 4; i++)
{
if (Weight[i] < 0.01)
{
break;
}
// Logically we should break if the weight is (almost) zero
// given the fact that it's sorted from high to low,
// but GT240 will cause glitches
//if (Weight[i] < 0.01)
//{
// break;
//}
#ifdef GL_ES
mat4 joint_matrix = mat4(
texelFetch(skinning_tex, ivec2(0, skinning_offset + Joint[i]), 0),

@ -38,11 +38,14 @@ void main(void)
{
for (int i = 0; i < 4; i++)
{
if (Weight[i] < 0.01)
{
break;
}
ifdef GL_ES
// Logically we should break if the weight is (almost) zero
// given the fact that it's sorted from high to low,
// but GT240 will cause glitches
//if (Weight[i] < 0.01)
//{
// break;
//}
#ifdef GL_ES
mat4 joint_matrix = mat4(
texelFetch(skinning_tex, ivec2(0, skinning_offset + Joint[i]), 0),
texelFetch(skinning_tex, ivec2(1, skinning_offset + Joint[i]), 0),

@ -1502,7 +1502,7 @@ void CSkinnedMesh::convertForSkinning()
for (u32 j = 0; j < 4; j++)
{
JointInfluence influence;
influence.joint_idx = -100000;
influence.joint_idx = 0;
influence.weight = 0.0f;
this_influence.push_back(influence);
}

@ -261,7 +261,7 @@ void DrawCalls::handleSTKCommon(scene::ISceneNode *Node,
{
skinning_offset = getSkinningOffset();
if (skinning_offset + am->getTotalJoints() >
stk_config->m_max_skinning_bones)
(int)stk_config->m_max_skinning_bones)
{
Log::error("DrawCalls", "Don't have enough space to render skinned"
" mesh %s! Max joints can hold: %d",