Hi
I have some problem with the ShadowedRenderPass when using it together with my snow particle effect.
If I use setLightingMethod(ShadowedRenderPass.LightingMethod.Additive) the particles looses its tranparency. Why?
I don't think that the SRP does anything to anything that it's not touching–have you tried putting your particle effects into a different render pass to see if that fixes the problem?
Well, it obviously does something.
I try to upload some images. Hope this works.
First image: sPass.setLightingMethod(ShadowedRenderPass.LightingMethod.Modulative) works fine.
Second image: sPass.setLightingMethod(ShadowedRenderPass.LightingMethod.Additive) doesn't work.
Its not a big deal to me. I stick with the Modulative version. But I find it a little bit odd.
Can you post the code pertaining to setting up the SRP and snow?
Most certain I screw things up. here's the code.
sPass.setRenderShadows(shadow);
sPass.setShadowColor(new ColorRGBA(.2f,.2f,.2f,1));
sPass.setLightingMethod(ShadowedRenderPass.LightingMethod.Modulative);//Additive);//
pManager.add(sPass);
private void buildSnow() {
particleGeom= ParticleFactory.buildParticles("Rain effect",1000);
particleGeom.clearInfluences();
BlendState as = DisplaySystem.getDisplaySystem().getRenderer().createBlendState();
as.setBlendEnabled( true );
as.setSourceFunction( BlendState.SourceFunction.SourceAlpha );
as.setDestinationFunction( BlendState.DestinationFunction.One );
as.setTestEnabled( true );
as.setTestFunction( BlendState.TestFunction.GreaterThan );
as.setEnabled( true );
particleGeom.setRenderState(as);
TextureState ts = display.getRenderer().createTextureState();
ts.setEnabled(true);
Texture t2 = TextureManager.loadTexture(getResource("data/texture/flaresmall.jpg"),Texture.MinificationFilter.BilinearNearestMipMap, Texture.MagnificationFilter.Bilinear);
ts.setTexture(t2);
particleGeom.setRenderState(ts);
ZBufferState zbuf = renderer.createZBufferState();
zbuf.setWritable(false);
zbuf.setEnabled(true);
zbuf.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo);
particleGeom.setRenderState(zbuf);
particleGeom.addInfluence(SimpleParticleInfluenceFactory.createBasicGravity(new Vector3f(0, -3f, 0), true));
particleGeom.setEmissionDirection(new Vector3f(0.0f, -1.0f, 0.0f));
particleGeom.setMaximumAngle(1.5707964f);
particleGeom.setMinimumAngle(0);
particleGeom.getParticleController().setSpeed(0.2f);
particleGeom.setMinimumLifeTime(1057.0f);
particleGeom.setMaximumLifeTime(1500.0f);
particleGeom.setStartSize(10.0f);
particleGeom.setEndSize(10.0f);
particleGeom.setStartColor(new ColorRGBA(0.3764706f, 0.3764706f,0.3764706f, 1.0f));
particleGeom.setEndColor(new ColorRGBA(0.3764706f, 0.3764706f,0.3764706f, 0.1882353f));
particleGeom.getParticleController().setControlFlow(false);
particleGeom.setReleaseRate(300);
particleGeom.setReleaseVariance(0.0f);
particleGeom.setInitialVelocity(0.59999996f);
particleGeom.getParticleController().setRepeatType(Controller.RT_WRAP);
particleGeom.warmUp(120);
Ring disk = new Ring(new Vector3f(0,1500,0), Vector3f.UNIT_Y, 1, 1500);
particleGeom.setGeometry(disk);
particleGeom.updateGeometricState(0, true);
particleGeom.updateRenderState();
particleGeom.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);
rootNode.attachChild(particleGeom);
}
Put the snow in it's own render pass. Make sure it's after the shadow pass.
Ok, Thanks!
Did it work?
Yes. Thanks again.
No problem!