Shadows, SSAO and CartoonEdge now works with HardWareSkinning
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10580 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
b93715f66b
commit
c4fc9b723f
@ -192,6 +192,7 @@ MaterialDef Phong Lighting {
|
||||
Defines {
|
||||
COLOR_MAP : ColorMap
|
||||
DISCARD_ALPHA : AlphaDiscardThreshold
|
||||
NUM_BONES : NumberOfBones
|
||||
}
|
||||
|
||||
ForcedRenderState {
|
||||
@ -218,12 +219,13 @@ MaterialDef Phong Lighting {
|
||||
HARDWARE_SHADOWS : HardwareShadows
|
||||
FILTER_MODE : FilterMode
|
||||
PCFEDGE : PCFEdge
|
||||
DISCARD_ALPHA : AlphaDiscardThreshold
|
||||
DISCARD_ALPHA : AlphaDiscardThreshold
|
||||
COLOR_MAP : ColorMap
|
||||
SHADOWMAP_SIZE : ShadowMapSize
|
||||
FADE : FadeInfo
|
||||
PSSM : Splits
|
||||
POINTLIGHT : LightViewProjectionMatrix5
|
||||
NUM_BONES : NumberOfBones
|
||||
}
|
||||
|
||||
ForcedRenderState {
|
||||
@ -246,12 +248,13 @@ MaterialDef Phong Lighting {
|
||||
HARDWARE_SHADOWS : HardwareShadows
|
||||
FILTER_MODE : FilterMode
|
||||
PCFEDGE : PCFEdge
|
||||
DISCARD_ALPHA : AlphaDiscardThreshold
|
||||
DISCARD_ALPHA : AlphaDiscardThreshold
|
||||
COLOR_MAP : ColorMap
|
||||
SHADOWMAP_SIZE : ShadowMapSize
|
||||
FADE : FadeInfo
|
||||
PSSM : Splits
|
||||
POINTLIGHT : LightViewProjectionMatrix5
|
||||
NUM_BONES : NumberOfBones
|
||||
}
|
||||
|
||||
ForcedRenderState {
|
||||
@ -274,10 +277,7 @@ MaterialDef Phong Lighting {
|
||||
|
||||
Defines {
|
||||
DIFFUSEMAP_ALPHA : DiffuseMap
|
||||
}
|
||||
|
||||
RenderState {
|
||||
|
||||
NUM_BONES : NumberOfBones
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,6 +15,35 @@ MaterialDef Unshaded {
|
||||
// For hardware skinning
|
||||
Int NumberOfBones
|
||||
Matrix4Array BoneMatrices
|
||||
|
||||
//Shadows
|
||||
Int FilterMode
|
||||
Boolean HardwareShadows
|
||||
|
||||
Texture2D ShadowMap0
|
||||
Texture2D ShadowMap1
|
||||
Texture2D ShadowMap2
|
||||
Texture2D ShadowMap3
|
||||
//pointLights
|
||||
Texture2D ShadowMap4
|
||||
Texture2D ShadowMap5
|
||||
|
||||
Float ShadowIntensity
|
||||
Vector4 Splits
|
||||
Vector2 FadeInfo
|
||||
|
||||
Matrix4 LightViewProjectionMatrix0
|
||||
Matrix4 LightViewProjectionMatrix1
|
||||
Matrix4 LightViewProjectionMatrix2
|
||||
Matrix4 LightViewProjectionMatrix3
|
||||
//pointLight
|
||||
Matrix4 LightViewProjectionMatrix4
|
||||
Matrix4 LightViewProjectionMatrix5
|
||||
Vector3 LightPos
|
||||
|
||||
Float PCFEdge
|
||||
|
||||
Float ShadowMapSize
|
||||
}
|
||||
|
||||
Technique {
|
||||
@ -38,21 +67,106 @@ MaterialDef Unshaded {
|
||||
Technique {
|
||||
}
|
||||
|
||||
Technique PreNormalPass {
|
||||
Technique PreNormalPass {
|
||||
|
||||
VertexShader GLSL100 : Common/MatDefs/SSAO/normal.vert
|
||||
FragmentShader GLSL100 : Common/MatDefs/SSAO/normal.frag
|
||||
VertexShader GLSL100 : Common/MatDefs/SSAO/normal.vert
|
||||
FragmentShader GLSL100 : Common/MatDefs/SSAO/normal.frag
|
||||
|
||||
WorldParameters {
|
||||
WorldViewProjectionMatrix
|
||||
WorldViewMatrix
|
||||
NormalMatrix
|
||||
}
|
||||
WorldParameters {
|
||||
WorldViewProjectionMatrix
|
||||
WorldViewMatrix
|
||||
NormalMatrix
|
||||
}
|
||||
|
||||
RenderState {
|
||||
}
|
||||
Defines {
|
||||
NUM_BONES : NumberOfBones
|
||||
}
|
||||
}
|
||||
|
||||
Technique PreShadow {
|
||||
|
||||
VertexShader GLSL100 : Common/MatDefs/Shadow/PreShadow.vert
|
||||
FragmentShader GLSL100 : Common/MatDefs/Shadow/PreShadow.frag
|
||||
|
||||
WorldParameters {
|
||||
WorldViewProjectionMatrix
|
||||
WorldViewMatrix
|
||||
}
|
||||
|
||||
Defines {
|
||||
COLOR_MAP : ColorMap
|
||||
DISCARD_ALPHA : AlphaDiscardThreshold
|
||||
NUM_BONES : NumberOfBones
|
||||
}
|
||||
|
||||
ForcedRenderState {
|
||||
FaceCull Off
|
||||
DepthTest On
|
||||
DepthWrite On
|
||||
PolyOffset 5 3
|
||||
ColorWrite Off
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Technique PostShadow15{
|
||||
VertexShader GLSL150: Common/MatDefs/Shadow/PostShadow.vert
|
||||
FragmentShader GLSL150: Common/MatDefs/Shadow/PostShadow15.frag
|
||||
|
||||
WorldParameters {
|
||||
WorldViewProjectionMatrix
|
||||
WorldMatrix
|
||||
}
|
||||
|
||||
Defines {
|
||||
HARDWARE_SHADOWS : HardwareShadows
|
||||
FILTER_MODE : FilterMode
|
||||
PCFEDGE : PCFEdge
|
||||
DISCARD_ALPHA : AlphaDiscardThreshold
|
||||
COLOR_MAP : ColorMap
|
||||
SHADOWMAP_SIZE : ShadowMapSize
|
||||
FADE : FadeInfo
|
||||
PSSM : Splits
|
||||
POINTLIGHT : LightViewProjectionMatrix5
|
||||
NUM_BONES : NumberOfBones
|
||||
}
|
||||
|
||||
ForcedRenderState {
|
||||
Blend Modulate
|
||||
DepthWrite Off
|
||||
PolyOffset -0.1 0
|
||||
}
|
||||
}
|
||||
|
||||
Technique PostShadow{
|
||||
VertexShader GLSL100: Common/MatDefs/Shadow/PostShadow.vert
|
||||
FragmentShader GLSL100: Common/MatDefs/Shadow/PostShadow.frag
|
||||
|
||||
WorldParameters {
|
||||
WorldViewProjectionMatrix
|
||||
WorldMatrix
|
||||
}
|
||||
|
||||
Defines {
|
||||
HARDWARE_SHADOWS : HardwareShadows
|
||||
FILTER_MODE : FilterMode
|
||||
PCFEDGE : PCFEdge
|
||||
DISCARD_ALPHA : AlphaDiscardThreshold
|
||||
COLOR_MAP : ColorMap
|
||||
SHADOWMAP_SIZE : ShadowMapSize
|
||||
FADE : FadeInfo
|
||||
PSSM : Splits
|
||||
POINTLIGHT : LightViewProjectionMatrix5
|
||||
NUM_BONES : NumberOfBones
|
||||
}
|
||||
|
||||
ForcedRenderState {
|
||||
Blend Modulate
|
||||
DepthWrite Off
|
||||
PolyOffset -0.1 0
|
||||
}
|
||||
}
|
||||
|
||||
Technique Glow {
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
#import "Common/ShaderLib/Skinning.glsllib"
|
||||
uniform mat4 m_LightViewProjectionMatrix0;
|
||||
uniform mat4 m_LightViewProjectionMatrix1;
|
||||
uniform mat4 m_LightViewProjectionMatrix2;
|
||||
@ -41,7 +42,12 @@ const mat4 biasMat = mat4(0.5, 0.0, 0.0, 0.0,
|
||||
|
||||
|
||||
void main(){
|
||||
gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition, 1.0);
|
||||
vec4 modelSpacePos = vec4(inPosition, 1.0);
|
||||
|
||||
#ifdef NUM_BONES
|
||||
Skinning_Compute(modelSpacePos);
|
||||
#endif
|
||||
gl_Position = g_WorldViewProjectionMatrix * modelSpacePos;
|
||||
|
||||
#ifndef POINTLIGHT
|
||||
#ifdef PSSM
|
||||
@ -50,7 +56,7 @@ void main(){
|
||||
vec4 worldPos=vec4(0.0);
|
||||
#endif
|
||||
// get the vertex in world space
|
||||
worldPos = g_WorldMatrix * vec4(inPosition, 1.0);
|
||||
worldPos = g_WorldMatrix * modelSpacePos;
|
||||
|
||||
#ifdef DISCARD_ALPHA
|
||||
texCoord = inTexCoord;
|
||||
|
@ -1,4 +1,5 @@
|
||||
attribute vec4 inPosition;
|
||||
#import "Common/ShaderLib/Skinning.glsllib"
|
||||
attribute vec3 inPosition;
|
||||
attribute vec2 inTexCoord;
|
||||
|
||||
uniform mat4 g_WorldViewProjectionMatrix;
|
||||
@ -7,6 +8,11 @@ uniform mat4 g_WorldViewMatrix;
|
||||
varying vec2 texCoord;
|
||||
|
||||
void main(){
|
||||
gl_Position = g_WorldViewProjectionMatrix * inPosition;
|
||||
vec4 modelSpacePos = vec4(inPosition, 1.0);
|
||||
|
||||
#ifdef NUM_BONES
|
||||
Skinning_Compute(modelSpacePos);
|
||||
#endif
|
||||
gl_Position = g_WorldViewProjectionMatrix * modelSpacePos;
|
||||
texCoord = inTexCoord;
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
#import "Common/ShaderLib/Skinning.glsllib"
|
||||
uniform mat4 g_WorldViewProjectionMatrix;
|
||||
uniform mat3 g_NormalMatrix;
|
||||
|
||||
@ -11,6 +12,11 @@ varying vec2 texCoord;
|
||||
void main(void)
|
||||
{
|
||||
texCoord=inTexCoord.xy;
|
||||
normal = normalize(g_NormalMatrix * inNormal);
|
||||
gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition,1.0);
|
||||
vec4 modelSpacePos = vec4(inPosition, 1.0);
|
||||
vec3 modelSpaceNormals = inNormal;
|
||||
#ifdef NUM_BONES
|
||||
Skinning_Compute(modelSpacePos,modelSpaceNormals);
|
||||
#endif
|
||||
normal = normalize(g_NormalMatrix * modelSpaceNormals);
|
||||
gl_Position = g_WorldViewProjectionMatrix * modelSpacePos;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user