Skip to content

Commit

Permalink
fix tangent.w (used as sign value to calculate binormal for normal-ma…
Browse files Browse the repository at this point in the history
…pping)
  • Loading branch information
Constantine Rudenko committed Aug 7, 2019
1 parent a71c810 commit 5be2702
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 129 deletions.
4 changes: 2 additions & 2 deletions Code/DQ skinning/DualQuaternionSkinner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ passing data to the vertex and fragment shaders is done through RenderTextures
layout is as such:
rtSkinnedData_1 float4 vertex.xyz, normal.x
rtSkinnedData_2 float4 normal.yz, tangent.xy
rtSkinnedData_3 float tangent.z
rtSkinnedData_3 float2 tangent.zw
*/
RenderTexture rtSkinnedData_1;
RenderTexture rtSkinnedData_2;
Expand Down Expand Up @@ -270,7 +270,7 @@ void SetMesh(Mesh mesh)
this.rtSkinnedData_2.Create();
this.shaderDQBlend.SetTexture(this.kernelHandleComputeBoneDQ, "skinned_data_2", this.rtSkinnedData_2);

this.rtSkinnedData_3 = new RenderTexture(textureWidth, textureHeight, 0, RenderTextureFormat.RFloat);
this.rtSkinnedData_3 = new RenderTexture(textureWidth, textureHeight, 0, RenderTextureFormat.RGFloat);
this.rtSkinnedData_3.filterMode = FilterMode.Point;
this.rtSkinnedData_3.enableRandomWrite = true;
this.rtSkinnedData_3.Create();
Expand Down
4 changes: 2 additions & 2 deletions Code/DQ skinning/Shaders/Compute/DQBlend.compute
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RWStructuredBuffer<vertex_info> vertex_infos;
uint textureWidth;
RWTexture2D<float4> skinned_data_1;
RWTexture2D<float4> skinned_data_2;
RWTexture2D<float> skinned_data_3;
RWTexture2D<float2> skinned_data_3;



Expand Down Expand Up @@ -84,5 +84,5 @@ void CSMain (uint3 id : SV_DispatchThreadID)

skinned_data_1[pos] = float4(vertinfo.position.xyz, vertinfo.normal.x);
skinned_data_2[pos] = float4(vertinfo.normal.yz, vertinfo.tangent.xy);
skinned_data_3[pos] = vertinfo.tangent.z;
skinned_data_3[pos] = vertinfo.tangent.zw;
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Shader "MadCake/Material/Standard hacked for DQ skinning"

#ifdef _TANGENT_TO_WORLD
v.tangent.xy = data_2.zw;
v.tangent.z = data_3.x;
v.tangent.zw = data_3.xy;
#endif
}
}
Expand Down Expand Up @@ -292,7 +292,7 @@ Shader "MadCake/Material/Standard hacked for DQ skinning"

#ifdef _TANGENT_TO_WORLD
v.tangent.xy = data_2.zw;
v.tangent.z = data_3.x;
v.tangent.zw = data_3.xy;
#endif
}
}
Expand Down Expand Up @@ -395,7 +395,7 @@ Shader "MadCake/Material/Standard hacked for DQ skinning"

#if defined(UNITY_STANDARD_USE_SHADOW_UVS) && defined(_PARALLAXMAP)
v.tangent.xy = data_2.zw;
v.tangent.z = data_3.x;
v.tangent.zw = data_3.xy;
#endif
}
}
Expand Down Expand Up @@ -528,7 +528,7 @@ Shader "MadCake/Material/Standard hacked for DQ skinning"

#ifdef _TANGENT_TO_WORLD
v.tangent.xy = data_2.zw;
v.tangent.z = data_3.x;
v.tangent.zw = data_3.xy;
#endif
}
}
Expand Down Expand Up @@ -634,7 +634,7 @@ Shader "MadCake/Material/Standard hacked for DQ skinning"

#ifdef _TANGENT_TO_WORLD
v.tangent.xy = data_2.zw;
v.tangent.z = data_3.x;
v.tangent.zw = data_3.xy;
#endif
}
}
Expand Down Expand Up @@ -757,7 +757,7 @@ Shader "MadCake/Material/Standard hacked for DQ skinning"

#ifdef _TANGENT_TO_WORLD
v.tangent.xy = data_2.zw;
v.tangent.z = data_3.x;
v.tangent.zw = data_3.xy;
#endif
}
}
Expand Down Expand Up @@ -886,7 +886,7 @@ Shader "MadCake/Material/Standard hacked for DQ skinning"

#if defined(UNITY_STANDARD_USE_SHADOW_UVS) && defined(_PARALLAXMAP)
v.tangent.xy = data_2.zw;
v.tangent.z = data_3.x;
v.tangent.zw = data_3.xy;
#endif
}
}
Expand Down Expand Up @@ -962,4 +962,4 @@ Shader "MadCake/Material/Standard hacked for DQ skinning"

FallBack "VertexLit"
CustomEditor "StandardShaderGUI"
}
}
117 changes: 0 additions & 117 deletions Code/DQ skinning/Shaders/Material/MinimalSkinning.shader

This file was deleted.

0 comments on commit 5be2702

Please sign in to comment.