BloomEffect for Android

Hi jME team.
I was wondering if anyone on the forum ever found a way to have the bloom effect on android.
Maybe there is a shader I can play with to get it working.
I know the problem is that post processors aren’t really supported on android.
Please assist if possible.

The closest I’ve come to that is duplicating an object, and pushing vertices out in normal direction. Set it to transparent, smoothly wiggle the vertices around and modify the colour on distance from original location for a gradient effect, works quite nice on android for low poly models.

Awesome, do you by any change have the shader code for that along with the material def maybe?
This will really be a big boost for my game.

I can have a look for it, you’ll have to wait till I’m home. The gist of it is (all off top of my head):

[java]vert shader

uniform vec3 inNormal;
uniform vec3 inPosition;
uniform vec3 worldViewProjectionMatrix;

varying float distFromOriginalVert;

void main () {
distFromOriginalVert= 0.01; // Pick some magnitude, can be a product of sin wave over time
glPosition = worldViewProjectionMatrix * (inPosition + inNormal * distFromOriginalVert);

frag shader:
varying float distFromOriginalVert;

void main () {

vec4 glowColor = vec4(1.0, 0.0, 0.0, 1.0); // Opaque red

// Get some gradient, may be better to just adjust the alpha!! else this is from black (with no alpha) to glow colour
vec4 newColor = glowColor * distFromOriginalVert; // Assuming distFromOriginalVert from 0 -> 1;

if (newColor.a < 0.2) // Alpha discard

glFragColour = newColor;

So you have your original model, then you duplicate it, and apply something like this, don’t forget to put the duplication in the transparent bucket.

Hi @wezrule,

I finally came around to trying to implement this, but I really am struggling.

Could you please have a look and see if you still have the code to achieve this for unshaded materials.

I would really like this functionality for android.

Thanks in advance.

I can’t find that other code, but I have something similar

[java]MaterialDef Toon {

MaterialParameters {
    Float width
    Color outlineColor
    Float Time

Technique {
    VertexShader GLSL100:   Shaders/Toon.vert
    FragmentShader GLSL100: Shaders/Toon.frag

    WorldParameters {

    Defines {

    RenderState {


[java]Material My Material : MatDefs/Toon.j3md {
MaterialParameters {
width : 0.4
outlineColor : 0.8 0.2 0 0.6
Time : 1
AdditionalRenderState {

  DepthWrite Off
  Blend Alpha


[java]uniform mat4 g_WorldViewProjectionMatrix;
attribute vec3 inPosition;
attribute vec3 inNormal;

varying vec4 position;
uniform float m_width;
uniform float m_Time;

float rand (vec2 n) {
return (0.5 + 0.5 * fract (sin (dot(n.xy, vec2(12.9898, 78.233))) * 43758.5453));

void main() {
vec2 inPositionModified = inPosition.xz;
inPositionModified.x = inPositionModified.x * m_Time;
inPositionModified.y = inPositionModified.y * m_Time;

float randomNoise = rand (inPositionModified);

vec4 vertex = vec4(inPosition, 1) + vec4(inNormal * m_width * randomNoise, 0);
gl_Position = g_WorldViewProjectionMatrix * vertex;
position = gl_Position;


[java]varying vec4 position;
uniform vec4 m_outlineColor;

void main() {
vec4 outline = m_outlineColor;
outline.g = length ( / 1.5;
gl_FragColor = outline;

I use it like so:

[java] Spatial outerSpatial = spatial.clone();
((Node) spatial).attachChild(outerSpatial);

public void update(float tpf)
outerSpatial.getMaterial().setFloat(“Time”, myApp.getTimer().getTimeInSeconds());


Thank you very much, I will have a look and try it.
It might help.

Can someone post a screen shot of how this looks? Sounds like a really cool idea =)

EDIT: Ok… now I won’t assume I didn’t miss any posts since the last read and check first… nm!

Here is my result, it looks not so great: