Particles not blending with fog

Hi all,



My particles arent blending properly with the background fog, where the particles arent in the fog ( or when i turn the fog off )they are ok.

http://img2.freeimagehosting.net/image.php?266492d5c1.jpg



for the particles i use the standard snow from renParticleEditor



here is my setup


private void buildFog()
   {
      fs = display.getRenderer().createFogState();
      fs.setDensity(0.2f);
      fs.setColor(new ColorRGBA(0.5f, 0.5f, 0.7f, 0.4f));
      fs.setEnd(1000);
      fs.setStart(300);
      fs.setEnabled(true);
      fs.setDensityFunction(FogState.DF_LINEAR);
      fs.setApplyFunction(FogState.AF_PER_VERTEX);
      rootNode.setRenderState(fs);
      rootNode.updateRenderState();
   }



   private void buildSnow()
   {
      snowNode = new Node("snow node");
      try
      {

         Spatial snow = (Spatial) BinaryImporter.getInstance().load(
               Thread.currentThread().getContextClassLoader()
                     .getResourceAsStream("effects/snow.jme"));
         snowNode.attachChild(snow);

         ZBufferState zbuf = DisplaySystem.getDisplaySystem().getRenderer()
               .createZBufferState();
         zbuf.setWritable(false);
         snowNode.setRenderState(zbuf);
         snowNode.updateRenderState();
         
         rootNode.attachChild(snowNode);
      }
      catch (IOException ex)
      {
         ex.printStackTrace();
      }
   }



i also render the rootNode in the opaque que and im using baseGame.

what am i missing here ?

Maybe play with the alpha blend in the particles?

I allready tried to apply an alphastate but this has no positive effect ( i can brake it further by incorrect blending, but i cant fix it ).


private void buildSnow()
   {
      AlphaState as = display.getRenderer().createAlphaState();
      as = DisplaySystem.getDisplaySystem().getRenderer().createAlphaState();
      as.setBlendEnabled(true);
      as.setSrcFunction(AlphaState.SB_SRC_ALPHA);
      as.setDstFunction(AlphaState.DB_ONE);
      as.setTestEnabled(true);
      as.setTestFunction(AlphaState.TF_GREATER);
      as.setEnabled(true);

      snowNode = new Node("snow node");
      try
      {

         Spatial snow = (Spatial) BinaryImporter.getInstance().load(
               Thread.currentThread().getContextClassLoader()
                     .getResourceAsStream("effects/snow.jme"));
         snowNode.attachChild(snow);

         ZBufferState zbuf = DisplaySystem.getDisplaySystem().getRenderer()
               .createZBufferState();
         zbuf.setWritable(false);
         zbuf.setEnabled(true);
         snow.setRenderState(as);
         snow.setRenderState(zbuf);
         snow.updateRenderState();
         rootNode.attachChild(snowNode);
      }
      catch (IOException ex)
      {
         ex.printStackTrace();
      }

      snowNode.setRenderQueueMode(Renderer.QUEUE_TRANSPARENT);
   }



I dont think the blending of the particles itself is wrong as it working correct without the fog, my guess is i'm missing something else

Did you play with different values for the AlphaStates DstFunction ?




yes i tried several values and all i got was a complete black particle or no visible particle at all

For now i just fixed it by moving the snow to a higher level node than the fog, but i would still like to understand why it diddent work/ what i was doing wrong