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 {
|
Defines {
|
||||||
COLOR_MAP : ColorMap
|
COLOR_MAP : ColorMap
|
||||||
DISCARD_ALPHA : AlphaDiscardThreshold
|
DISCARD_ALPHA : AlphaDiscardThreshold
|
||||||
|
NUM_BONES : NumberOfBones
|
||||||
}
|
}
|
||||||
|
|
||||||
ForcedRenderState {
|
ForcedRenderState {
|
||||||
@ -224,6 +225,7 @@ MaterialDef Phong Lighting {
|
|||||||
FADE : FadeInfo
|
FADE : FadeInfo
|
||||||
PSSM : Splits
|
PSSM : Splits
|
||||||
POINTLIGHT : LightViewProjectionMatrix5
|
POINTLIGHT : LightViewProjectionMatrix5
|
||||||
|
NUM_BONES : NumberOfBones
|
||||||
}
|
}
|
||||||
|
|
||||||
ForcedRenderState {
|
ForcedRenderState {
|
||||||
@ -252,6 +254,7 @@ MaterialDef Phong Lighting {
|
|||||||
FADE : FadeInfo
|
FADE : FadeInfo
|
||||||
PSSM : Splits
|
PSSM : Splits
|
||||||
POINTLIGHT : LightViewProjectionMatrix5
|
POINTLIGHT : LightViewProjectionMatrix5
|
||||||
|
NUM_BONES : NumberOfBones
|
||||||
}
|
}
|
||||||
|
|
||||||
ForcedRenderState {
|
ForcedRenderState {
|
||||||
@ -274,10 +277,7 @@ MaterialDef Phong Lighting {
|
|||||||
|
|
||||||
Defines {
|
Defines {
|
||||||
DIFFUSEMAP_ALPHA : DiffuseMap
|
DIFFUSEMAP_ALPHA : DiffuseMap
|
||||||
}
|
NUM_BONES : NumberOfBones
|
||||||
|
|
||||||
RenderState {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,35 @@ MaterialDef Unshaded {
|
|||||||
// For hardware skinning
|
// For hardware skinning
|
||||||
Int NumberOfBones
|
Int NumberOfBones
|
||||||
Matrix4Array BoneMatrices
|
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 {
|
Technique {
|
||||||
@ -38,21 +67,106 @@ MaterialDef Unshaded {
|
|||||||
Technique {
|
Technique {
|
||||||
}
|
}
|
||||||
|
|
||||||
Technique PreNormalPass {
|
Technique PreNormalPass {
|
||||||
|
|
||||||
VertexShader GLSL100 : Common/MatDefs/SSAO/normal.vert
|
VertexShader GLSL100 : Common/MatDefs/SSAO/normal.vert
|
||||||
FragmentShader GLSL100 : Common/MatDefs/SSAO/normal.frag
|
FragmentShader GLSL100 : Common/MatDefs/SSAO/normal.frag
|
||||||
|
|
||||||
WorldParameters {
|
WorldParameters {
|
||||||
WorldViewProjectionMatrix
|
WorldViewProjectionMatrix
|
||||||
WorldViewMatrix
|
WorldViewMatrix
|
||||||
NormalMatrix
|
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 {
|
Technique Glow {
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/Skinning.glsllib"
|
||||||
uniform mat4 m_LightViewProjectionMatrix0;
|
uniform mat4 m_LightViewProjectionMatrix0;
|
||||||
uniform mat4 m_LightViewProjectionMatrix1;
|
uniform mat4 m_LightViewProjectionMatrix1;
|
||||||
uniform mat4 m_LightViewProjectionMatrix2;
|
uniform mat4 m_LightViewProjectionMatrix2;
|
||||||
@ -41,7 +42,12 @@ const mat4 biasMat = mat4(0.5, 0.0, 0.0, 0.0,
|
|||||||
|
|
||||||
|
|
||||||
void main(){
|
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
|
#ifndef POINTLIGHT
|
||||||
#ifdef PSSM
|
#ifdef PSSM
|
||||||
@ -50,7 +56,7 @@ void main(){
|
|||||||
vec4 worldPos=vec4(0.0);
|
vec4 worldPos=vec4(0.0);
|
||||||
#endif
|
#endif
|
||||||
// get the vertex in world space
|
// get the vertex in world space
|
||||||
worldPos = g_WorldMatrix * vec4(inPosition, 1.0);
|
worldPos = g_WorldMatrix * modelSpacePos;
|
||||||
|
|
||||||
#ifdef DISCARD_ALPHA
|
#ifdef DISCARD_ALPHA
|
||||||
texCoord = inTexCoord;
|
texCoord = inTexCoord;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
attribute vec4 inPosition;
|
#import "Common/ShaderLib/Skinning.glsllib"
|
||||||
|
attribute vec3 inPosition;
|
||||||
attribute vec2 inTexCoord;
|
attribute vec2 inTexCoord;
|
||||||
|
|
||||||
uniform mat4 g_WorldViewProjectionMatrix;
|
uniform mat4 g_WorldViewProjectionMatrix;
|
||||||
@ -7,6 +8,11 @@ uniform mat4 g_WorldViewMatrix;
|
|||||||
varying vec2 texCoord;
|
varying vec2 texCoord;
|
||||||
|
|
||||||
void main(){
|
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;
|
texCoord = inTexCoord;
|
||||||
}
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
#import "Common/ShaderLib/Skinning.glsllib"
|
||||||
uniform mat4 g_WorldViewProjectionMatrix;
|
uniform mat4 g_WorldViewProjectionMatrix;
|
||||||
uniform mat3 g_NormalMatrix;
|
uniform mat3 g_NormalMatrix;
|
||||||
|
|
||||||
@ -11,6 +12,11 @@ varying vec2 texCoord;
|
|||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
texCoord=inTexCoord.xy;
|
texCoord=inTexCoord.xy;
|
||||||
normal = normalize(g_NormalMatrix * inNormal);
|
vec4 modelSpacePos = vec4(inPosition, 1.0);
|
||||||
gl_Position = g_WorldViewProjectionMatrix * 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