diff --git a/jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.frag b/jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.frag index 08cd2a3bf..6dff8ac68 100644 --- a/jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.frag +++ b/jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.frag @@ -19,4 +19,12 @@ void main(){ #else gl_FragColor = color; #endif + + #ifdef PRE_SHADOW + if (gl_FragColor.r <= 0.1 && + gl_FragColor.g <= 0.1 && + gl_FragColor.b <= 0.1) { + discard; + } + #endif } \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.j3md b/jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.j3md index 80b45914b..c6116fa83 100644 --- a/jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.j3md +++ b/jme3-core/src/main/resources/Common/MatDefs/Misc/Particle.j3md @@ -63,6 +63,29 @@ MaterialDef Point Sprite { } } + Technique PreShadow { + + VertexShader GLSL100 : Common/MatDefs/Misc/Particle.vert + FragmentShader GLSL100 : Common/MatDefs/Misc/Particle.frag + + WorldParameters { + WorldViewProjectionMatrix + WorldViewMatrix + WorldMatrix + CameraPosition + } + + Defines { + USE_TEXTURE : Texture + PRE_SHADOW + } + + ForcedRenderState { + DepthWrite On + ColorWrite Off + } + } + Technique SoftParticles{ VertexShader GLSL100 : Common/MatDefs/Misc/SoftParticle.vert