git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10807 75d07b2b-3a1a-0410-a2c5-0572b91ccdcaexperimental
parent
915638a370
commit
f0aff05d41
@ -0,0 +1,18 @@ |
|||||||
|
ShaderNodeDefinitions{ |
||||||
|
ShaderNodeDefinition AlphaDiscard { |
||||||
|
Type: Fragment |
||||||
|
Shader GLSL100: Common/MatDefs/ShaderNodes/Basic/alphaDiscard.frag |
||||||
|
Documentation{ |
||||||
|
Discards the current pixel if its alpha channel value is below the given threshold |
||||||
|
@input alpha the alpha value |
||||||
|
@input threshold the discard threshold |
||||||
|
} |
||||||
|
Input { |
||||||
|
float alpha |
||||||
|
float threshold |
||||||
|
} |
||||||
|
Output { |
||||||
|
None |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,3 @@ |
|||||||
|
void main(){ |
||||||
|
if( alpha <= threshold )discard; |
||||||
|
} |
@ -0,0 +1,61 @@ |
|||||||
|
ShaderNodesDefinitions { |
||||||
|
ShaderNodeDefinition BasicGPUSkinning{ |
||||||
|
Type: Vertex |
||||||
|
Shader GLSL100: Common/MatDefs/ShaderNodes/HardwareSkinning/basicGpuSkinning.vert |
||||||
|
Documentation { |
||||||
|
This Node is responsible for computing vertex positions transformation |
||||||
|
of the vertex due to skinning in model space |
||||||
|
Note that the input position and the output are both in model Space so the output |
||||||
|
of this node will need to be translated to projection space. |
||||||
|
This shader node doesn't take Normals and Tangent into account for full support use FullGPUSkinning |
||||||
|
IMPORTANT NOTE : for this node to work properly, you must declare a Int NumberOfBones material parameter to which the number of bones will be passed. |
||||||
|
@input modelPosition the vertex position in model space (usually assigned with Attr.inPosition or Global.position) |
||||||
|
@input boneMatrices an array of matrice holding the transforms of the bones assigned to this vertex. Its size is defined by the NumberOfBones material parameter |
||||||
|
@input boneWeight a vec4 holding the bone weights applied to this vertex (4 weights max). |
||||||
|
@input boneIndex a vec4 holding the bone indices assignes to this vertex (4 bones max). |
||||||
|
@output modModelPosition transformed position of the vertex in model space. |
||||||
|
} |
||||||
|
Input{ |
||||||
|
vec4 modelPosition |
||||||
|
mat4 boneMatrices[NumberOfBones] |
||||||
|
vec4 boneWeight |
||||||
|
vec4 boneIndex |
||||||
|
} |
||||||
|
Output{ |
||||||
|
vec4 modModelPosition |
||||||
|
} |
||||||
|
} |
||||||
|
ShaderNodeDefinition FullGPUSkinning{ |
||||||
|
Type: Vertex |
||||||
|
Shader GLSL100: Common/MatDefs/ShaderNodes/HardwareSkinning/fullGpuSkinning.vert |
||||||
|
Documentation { |
||||||
|
This Node is responsible for computing vertex positions, normals and tangents transformation |
||||||
|
of the vertex due to skinning in model space |
||||||
|
Note that the input position and the output are both in model Space so the output |
||||||
|
of this node will need to be translated to projection space. |
||||||
|
IMPORTANT NOTE : for this node to work properly, you must declare a Int NumberOfBones material parameter to which the number of bones will be passed. |
||||||
|
@input modelPosition the vertex position in model space (usually assigned with Attr.inPosition or Global.position) |
||||||
|
@input modelNormal the vertex normal in model space (usually assigned with Attr.inNormal) |
||||||
|
@input modelTangent the vertex tangent in model space (usually assigned with Attr.inTangent) |
||||||
|
@input boneMatrices an array of matrice holding the transforms of the bones assigned to this vertex. Its size is defined by the NumberOfBones material parameter |
||||||
|
@input boneWeight a vec4 holding the bone weights applied to this vertex (4 weights max). |
||||||
|
@input boneIndex a vec4 holding the bone indices assignes to this vertex (4 bones max). |
||||||
|
@output modModelPosition transformed position of the vertex in model space. |
||||||
|
@output modModelNormal transformed normal of the vertex in model space. |
||||||
|
@output modModelTangent transformed tangent of the vertex in model space. |
||||||
|
} |
||||||
|
Input{ |
||||||
|
vec4 modelPosition |
||||||
|
vec3 modelNormal |
||||||
|
vec3 modelTangent |
||||||
|
mat4 boneMatrices[NumberOfBones] |
||||||
|
vec4 boneWeight |
||||||
|
vec4 boneIndex |
||||||
|
} |
||||||
|
Output{ |
||||||
|
vec4 modModelPosition |
||||||
|
vec3 modModelNormal |
||||||
|
vec3 modModelTangent |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
|
||||||
|
void main(){ |
||||||
|
modModelPosition = (mat4(0.0) + |
||||||
|
boneMatrices[int(boneIndex.x)] * boneWeight.x + |
||||||
|
boneMatrices[int(boneIndex.y)] * boneWeight.y + |
||||||
|
boneMatrices[int(boneIndex.z)] * boneWeight.z + |
||||||
|
boneMatrices[int(boneIndex.w)] * boneWeight.w) * vec4(modelPosition.xyz,1.0); |
||||||
|
} |
@ -0,0 +1,12 @@ |
|||||||
|
|
||||||
|
void main(){ |
||||||
|
modModelPosition = (mat4(0.0) + |
||||||
|
boneMatrices[int(boneIndex.x)] * boneWeight.x + |
||||||
|
boneMatrices[int(boneIndex.y)] * boneWeight.y + |
||||||
|
boneMatrices[int(boneIndex.z)] * boneWeight.z + |
||||||
|
boneMatrices[int(boneIndex.w)] * boneWeight.w) * modelPosition; |
||||||
|
|
||||||
|
mat3 rotMat = mat3(mat[0].xyz, mat[1].xyz, mat[2].xyz); |
||||||
|
modModelTangent = rotMat * modelTangent; |
||||||
|
modModelNormal = rotMat * modelNormal; |
||||||
|
} |
Loading…
Reference in new issue