Bloom and Glow from scratch. Need a hand please. [fixed]

I’m having a real hard time implementing a glow that works with the underlying texture. Now the glow, as seen in the screen shot below (right side viewport), works and is colored with the star’s color (depending on its spectral class). But as below, the texture of the sun itself (as seen in the viewport in the top-middle of the screen) is nowhere to be seen. The glow map is set properly as we can see it glowing. I even made the GlowMap png with an alpha channel, but that didn’t cure the issue.



I read the Bloom and Glow wiki but this is confusing to me.

What is required to have a glow on a textured object while at the same time, having the object’s texture show?

Here’s the material definition for a Class M star:

[java]Material Star Material : Materials/Stars/GameLighting.j3md {

MaterialParameters {

Shininess : 5.0

ColorRamp : Textures/Stars/ClassM.png

NormalMap : Textures/Stars/ClassM_normal.png

HighQuality : true

Ambient : 1.0 0.2 0.2 1.0

Diffuse : 1.0 0.2 0.2 1.0

GlowMap : Textures/Stars/ClassM_glow.png

UseAlpha : true

UseMaterialColors : true

}

}[/java]

What i have tried:

GlowColor : [values]

GlowColor and no GlowMap.

Instead of ColorRamp I tried using DiffuseMap (using the same texture) but no change.

There has to be something I’m doing wrong. Please help. :frowning:

mhhh, this issue looks familiar :stuck_out_tongue:



ok first use DiffuseMap and not colorRamp (color ramp is used to define how shading is done, it’s usually used for toon shading).



Then you have 2 options :

1st : Don’t use diffuseMap, and use it as the glow map (the classM.png)



Material Star Material : Materials/Stars/GameLighting.j3md {

MaterialParameters {

Shininess : 5.0

GlowMap : Textures/Stars/ClassM.png

HighQuality : true

Ambient : 1.0 0.2 0.2 1.0

Diffuse : 1.0 0.2 0.2 1.0

UseAlpha : true

UseMaterialColors : true

}

}





2nd : use diffuseMap, but just use a glowColor



Material Star Material : Materials/Stars/GameLighting.j3md {

MaterialParameters {

Shininess : 5.0

ColorRamp : Textures/Stars/ClassM.png

NormalMap : Textures/Stars/ClassM_normal.png

HighQuality : true

Ambient : 1.0 0.2 0.2 1.0

Diffuse : 1.0 0.2 0.2 1.0

GlowColor : 1.0 0.0 0.0 0.0

UseAlpha : true

UseMaterialColors : true

}

}



Red color just for the example

If you only see a glowing red ball, you can reduce the glow intensity to reveal the underlying texture. setBloomIntensity(float) default is 2.0 try with 0.5f for example

Well, here’s the result. For now that’ll do. I like it, but it might change. :slight_smile:

This shows 6 of the 7 star class. The 7th, having about .00000003f chance to get one is absent. (I’ve only noticed one in all the galaxies I have ever generated).





Here’s how I do it. It’s pretty damn simple actually. :confused:



Each star’s material file contains only 2 lines specifying the textures relevant to the star:

[java]

Material Star Material : Materials/Stars/GameLighting.j3md {

MaterialParameters {

DiffuseMap : Textures/Stars/ClassO.png

GlowMap : Textures/Stars/ClassO.png

}

}

[/java]



The BloomFilter has those settings:

[java]

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

bf.setExposurePower(1.5f);

bf.setBloomIntensity(3f);

bf.setBlurScale(.75f);

bf.setExposureCutOff(.5f);

[/java]



Then in the scene I have a directional light the color that the star emits. That’s pretty much it.

Hey Nice!

Glad you went through this :wink:

Maybe you could try to add a light scattering filter over it with a low intensity value, It could add some nice effect

It is nice. :smiley:



Well, going through it is satisfying when you get to a good result. It’s all part of the learning experience. :slight_smile:



Light scattering, not sure… I’d love to have a corona effect though. But for now I’m happy. I wanted to add a bit of fluff because I’ll soon be looking for contributors and it’s always better to have a little eye-candy. Not too much, just enough to pique interest.



I might add that effect to a full-fledged sun in a solar system scene later just for kicks and see how it looks full size. But then again, I might wait to get a corona effect first. :wink:



@nehon

You might be the one to answer that question. I’m currently reading a GLSL shader book (OpenGL Shading Language 3rd Ed.) and I was thinking of trying to do that corona effect. Now, if I do a GLSL effect file, is it possible to inject that somehow directly?

Oh boy, don’t put “shader” and “inject” in the same sentence or @Momoko_Fan is gonna get mad!!!



You 'll have to create your own filter, and your own material with its associated shader.

For Filters i suggest you look into existing filters, but not the bloom, a simple one for a start, like the ColorOverlayFilter for example.

Then…if you want more info on how to integrate shaders in jME3 start by reading this

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:jme3_shaders

Shit. Just realized I posted in the wrong thread. sigh