• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Main repository of MikuMikuStudio


Commit MetaInfo

Revisãod0b9fcea331701575ffaf9ddb5a07c08b63e7407 (tree)
Hora2013-04-28 01:32:37
Autorremy.bouquet@gmail.com <remy.bouquet@gmai...>
Commiterremy.bouquet@gmail.com

Mensagem de Log

Shadows, SSAO and CartoonEdge now works with HardWareSkinning

git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@10580 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

Mudança Sumário

Diff

--- a/engine/src/core-data/Common/MatDefs/Light/Lighting.j3md
+++ b/engine/src/core-data/Common/MatDefs/Light/Lighting.j3md
@@ -192,6 +192,7 @@ MaterialDef Phong Lighting {
192192 Defines {
193193 COLOR_MAP : ColorMap
194194 DISCARD_ALPHA : AlphaDiscardThreshold
195+ NUM_BONES : NumberOfBones
195196 }
196197
197198 ForcedRenderState {
@@ -218,12 +219,13 @@ MaterialDef Phong Lighting {
218219 HARDWARE_SHADOWS : HardwareShadows
219220 FILTER_MODE : FilterMode
220221 PCFEDGE : PCFEdge
221- DISCARD_ALPHA : AlphaDiscardThreshold
222+ DISCARD_ALPHA : AlphaDiscardThreshold
222223 COLOR_MAP : ColorMap
223224 SHADOWMAP_SIZE : ShadowMapSize
224225 FADE : FadeInfo
225226 PSSM : Splits
226227 POINTLIGHT : LightViewProjectionMatrix5
228+ NUM_BONES : NumberOfBones
227229 }
228230
229231 ForcedRenderState {
@@ -246,12 +248,13 @@ MaterialDef Phong Lighting {
246248 HARDWARE_SHADOWS : HardwareShadows
247249 FILTER_MODE : FilterMode
248250 PCFEDGE : PCFEdge
249- DISCARD_ALPHA : AlphaDiscardThreshold
251+ DISCARD_ALPHA : AlphaDiscardThreshold
250252 COLOR_MAP : ColorMap
251253 SHADOWMAP_SIZE : ShadowMapSize
252254 FADE : FadeInfo
253255 PSSM : Splits
254256 POINTLIGHT : LightViewProjectionMatrix5
257+ NUM_BONES : NumberOfBones
255258 }
256259
257260 ForcedRenderState {
@@ -274,10 +277,7 @@ MaterialDef Phong Lighting {
274277
275278 Defines {
276279 DIFFUSEMAP_ALPHA : DiffuseMap
277- }
278-
279- RenderState {
280-
280+ NUM_BONES : NumberOfBones
281281 }
282282
283283 }
--- a/engine/src/core-data/Common/MatDefs/Misc/Unshaded.j3md
+++ b/engine/src/core-data/Common/MatDefs/Misc/Unshaded.j3md
@@ -15,6 +15,35 @@ MaterialDef Unshaded {
1515 // For hardware skinning
1616 Int NumberOfBones
1717 Matrix4Array BoneMatrices
18+
19+ //Shadows
20+ Int FilterMode
21+ Boolean HardwareShadows
22+
23+ Texture2D ShadowMap0
24+ Texture2D ShadowMap1
25+ Texture2D ShadowMap2
26+ Texture2D ShadowMap3
27+ //pointLights
28+ Texture2D ShadowMap4
29+ Texture2D ShadowMap5
30+
31+ Float ShadowIntensity
32+ Vector4 Splits
33+ Vector2 FadeInfo
34+
35+ Matrix4 LightViewProjectionMatrix0
36+ Matrix4 LightViewProjectionMatrix1
37+ Matrix4 LightViewProjectionMatrix2
38+ Matrix4 LightViewProjectionMatrix3
39+ //pointLight
40+ Matrix4 LightViewProjectionMatrix4
41+ Matrix4 LightViewProjectionMatrix5
42+ Vector3 LightPos
43+
44+ Float PCFEdge
45+
46+ Float ShadowMapSize
1847 }
1948
2049 Technique {
@@ -38,21 +67,106 @@ MaterialDef Unshaded {
3867 Technique {
3968 }
4069
41- Technique PreNormalPass {
70+ Technique PreNormalPass {
71+
72+ VertexShader GLSL100 : Common/MatDefs/SSAO/normal.vert
73+ FragmentShader GLSL100 : Common/MatDefs/SSAO/normal.frag
74+
75+ WorldParameters {
76+ WorldViewProjectionMatrix
77+ WorldViewMatrix
78+ NormalMatrix
79+ }
80+
81+ Defines {
82+ NUM_BONES : NumberOfBones
83+ }
84+ }
85+
86+ Technique PreShadow {
87+
88+ VertexShader GLSL100 : Common/MatDefs/Shadow/PreShadow.vert
89+ FragmentShader GLSL100 : Common/MatDefs/Shadow/PreShadow.frag
90+
91+ WorldParameters {
92+ WorldViewProjectionMatrix
93+ WorldViewMatrix
94+ }
95+
96+ Defines {
97+ COLOR_MAP : ColorMap
98+ DISCARD_ALPHA : AlphaDiscardThreshold
99+ NUM_BONES : NumberOfBones
100+ }
101+
102+ ForcedRenderState {
103+ FaceCull Off
104+ DepthTest On
105+ DepthWrite On
106+ PolyOffset 5 3
107+ ColorWrite Off
108+ }
109+
110+ }
111+
42112
43- VertexShader GLSL100 : Common/MatDefs/SSAO/normal.vert
44- FragmentShader GLSL100 : Common/MatDefs/SSAO/normal.frag
113+ Technique PostShadow15{
114+ VertexShader GLSL150: Common/MatDefs/Shadow/PostShadow.vert
115+ FragmentShader GLSL150: Common/MatDefs/Shadow/PostShadow15.frag
45116
46- WorldParameters {
47- WorldViewProjectionMatrix
48- WorldViewMatrix
49- NormalMatrix
50- }
117+ WorldParameters {
118+ WorldViewProjectionMatrix
119+ WorldMatrix
120+ }
121+
122+ Defines {
123+ HARDWARE_SHADOWS : HardwareShadows
124+ FILTER_MODE : FilterMode
125+ PCFEDGE : PCFEdge
126+ DISCARD_ALPHA : AlphaDiscardThreshold
127+ COLOR_MAP : ColorMap
128+ SHADOWMAP_SIZE : ShadowMapSize
129+ FADE : FadeInfo
130+ PSSM : Splits
131+ POINTLIGHT : LightViewProjectionMatrix5
132+ NUM_BONES : NumberOfBones
133+ }
51134
52- RenderState {
53- }
135+ ForcedRenderState {
136+ Blend Modulate
137+ DepthWrite Off
138+ PolyOffset -0.1 0
54139 }
140+ }
55141
142+ Technique PostShadow{
143+ VertexShader GLSL100: Common/MatDefs/Shadow/PostShadow.vert
144+ FragmentShader GLSL100: Common/MatDefs/Shadow/PostShadow.frag
145+
146+ WorldParameters {
147+ WorldViewProjectionMatrix
148+ WorldMatrix
149+ }
150+
151+ Defines {
152+ HARDWARE_SHADOWS : HardwareShadows
153+ FILTER_MODE : FilterMode
154+ PCFEDGE : PCFEdge
155+ DISCARD_ALPHA : AlphaDiscardThreshold
156+ COLOR_MAP : ColorMap
157+ SHADOWMAP_SIZE : ShadowMapSize
158+ FADE : FadeInfo
159+ PSSM : Splits
160+ POINTLIGHT : LightViewProjectionMatrix5
161+ NUM_BONES : NumberOfBones
162+ }
163+
164+ ForcedRenderState {
165+ Blend Modulate
166+ DepthWrite Off
167+ PolyOffset -0.1 0
168+ }
169+ }
56170
57171 Technique Glow {
58172
--- a/engine/src/core-data/Common/MatDefs/Shadow/PostShadow.vert
+++ b/engine/src/core-data/Common/MatDefs/Shadow/PostShadow.vert
@@ -1,3 +1,4 @@
1+#import "Common/ShaderLib/Skinning.glsllib"
12 uniform mat4 m_LightViewProjectionMatrix0;
23 uniform mat4 m_LightViewProjectionMatrix1;
34 uniform mat4 m_LightViewProjectionMatrix2;
@@ -41,7 +42,12 @@ const mat4 biasMat = mat4(0.5, 0.0, 0.0, 0.0,
4142
4243
4344 void main(){
44- gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition, 1.0);
45+ vec4 modelSpacePos = vec4(inPosition, 1.0);
46+
47+ #ifdef NUM_BONES
48+ Skinning_Compute(modelSpacePos);
49+ #endif
50+ gl_Position = g_WorldViewProjectionMatrix * modelSpacePos;
4551
4652 #ifndef POINTLIGHT
4753 #ifdef PSSM
@@ -50,7 +56,7 @@ void main(){
5056 vec4 worldPos=vec4(0.0);
5157 #endif
5258 // get the vertex in world space
53- worldPos = g_WorldMatrix * vec4(inPosition, 1.0);
59+ worldPos = g_WorldMatrix * modelSpacePos;
5460
5561 #ifdef DISCARD_ALPHA
5662 texCoord = inTexCoord;
--- a/engine/src/core-data/Common/MatDefs/Shadow/PreShadow.vert
+++ b/engine/src/core-data/Common/MatDefs/Shadow/PreShadow.vert
@@ -1,4 +1,5 @@
1-attribute vec4 inPosition;
1+#import "Common/ShaderLib/Skinning.glsllib"
2+attribute vec3 inPosition;
23 attribute vec2 inTexCoord;
34
45 uniform mat4 g_WorldViewProjectionMatrix;
@@ -7,6 +8,11 @@ uniform mat4 g_WorldViewMatrix;
78 varying vec2 texCoord;
89
910 void main(){
10- gl_Position = g_WorldViewProjectionMatrix * inPosition;
11+ vec4 modelSpacePos = vec4(inPosition, 1.0);
12+
13+ #ifdef NUM_BONES
14+ Skinning_Compute(modelSpacePos);
15+ #endif
16+ gl_Position = g_WorldViewProjectionMatrix * modelSpacePos;
1117 texCoord = inTexCoord;
1218 }
\ No newline at end of file
--- a/engine/src/core-effects/Common/MatDefs/SSAO/normal.vert
+++ b/engine/src/core-effects/Common/MatDefs/SSAO/normal.vert
@@ -1,3 +1,4 @@
1+#import "Common/ShaderLib/Skinning.glsllib"
12 uniform mat4 g_WorldViewProjectionMatrix;
23 uniform mat3 g_NormalMatrix;
34
@@ -11,6 +12,11 @@ varying vec2 texCoord;
1112 void main(void)
1213 {
1314 texCoord=inTexCoord.xy;
14- normal = normalize(g_NormalMatrix * inNormal);
15- gl_Position = g_WorldViewProjectionMatrix * vec4(inPosition,1.0);
15+ vec4 modelSpacePos = vec4(inPosition, 1.0);
16+ vec3 modelSpaceNormals = inNormal;
17+ #ifdef NUM_BONES
18+ Skinning_Compute(modelSpacePos,modelSpaceNormals);
19+ #endif
20+ normal = normalize(g_NormalMatrix * modelSpaceNormals);
21+ gl_Position = g_WorldViewProjectionMatrix * modelSpacePos;
1622 }
\ No newline at end of file