Lines don't glow

Hey all, I’m having a problem using the bloom filter. When I try to make lines glow, only the closest line to the camera actually gets the effect. Here is a sample program to see the problem. Is there any way around this? I want to use the bloom filter in Objects mode, since I have other stuff that I don’t want the effect applied to.





[java]import com.jme3.app.SimpleApplication;

import com.jme3.material.Material;

import com.jme3.math.ColorRGBA;

import com.jme3.math.Vector3f;

import com.jme3.post.FilterPostProcessor;

import com.jme3.post.filters.BloomFilter;

import com.jme3.scene.Geometry;

import com.jme3.scene.Mesh;

import com.jme3.scene.VertexBuffer;

public class TestGlow extends SimpleApplication {

public static void main(String[] args) {

TestGlow app = new TestGlow();

app.start();

}



@Override

public void simpleInitApp() {

FilterPostProcessor fpp = new FilterPostProcessor(assetManager);

BloomFilter bloom = new BloomFilter();

bloom = new BloomFilter(BloomFilter.GlowMode.Objects);

//bloom.setBlurScale(1f);

bloom.setDownSamplingFactor(4f);

fpp.addFilter(bloom);

viewPort.addProcessor(fpp);



//Mesh glowBox = makeHex(10,10,5);

Mesh glowBox = new Mesh();

glowBox.setMode(Mesh.Mode.Lines);

glowBox.setBuffer(VertexBuffer.Type.Position, 3, new float[]{-10,0,0,10,1,1});

glowBox.updateBound();

glowBox.updateCounts();



Geometry glowGeometry = new Geometry(“box”, glowBox);

glowGeometry.move(0,3,-5);

Material m = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);

m.setColor(“Color”, ColorRGBA.Blue);

m.setColor(“GlowColor”, ColorRGBA.Red);

glowGeometry.setMaterial(m);

rootNode.attachChild(glowGeometry);



Geometry glowGeometry2 = new Geometry(“box”, glowBox);

glowGeometry2.move(0,-3,-5);

Material m2 = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);

m2.setColor(“Color”, ColorRGBA.Blue);

m2.setColor(“GlowColor”, ColorRGBA.Red);

glowGeometry2.setMaterial(m2);

rootNode.attachChild(glowGeometry2);







rootNode.attachChild(glowGeometry2);

cam.setLocation(new Vector3f(6,0,8));

//cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y);

}

}[/java]

Bloom filter is a post process filter… i.e. it is applied to the end result frame. (At least I think this is correct)



I think you probably want to write a specific shader to accomplish this.

Never mind, disregard. I didn’t give them different IDs. If you do it works fine.

@pjreddie said:
Never mind, disregard. I didn't give them different IDs. If you do it works fine.


What ID? That doesn't sound right.

Note: in your original code you also add glowGeometry2 twice.

Sorry, not IDs, names for the Geometries. If you give them the same name it doesn’t render properly but if you change them to be different it works fine.

Mmm… I’d call that a bug, personally. Those names should not be used for something like that, I think.

use downsamplingfactor 1, else you need a 4pixel width line to work reliable. (factor one uses 4 times more power on the gpu tho)