Bloom partially working

Hi,



I have tried to implement blooming for a project I am working on (Physics based Solar System), to simulate rays from the sun and to illuminate the paths of the planets.



So far I have succeeded in getting selective blooming using seperate RenderPasses and having a glowlist containing Spatials which should have blooming, and a occludelist containing Spatials which should be able to occlude the glow.



My problem is as follows:

If I add the Line Spatials to the glowlist, they are not “blooming”.

If I add my entire scene to the glowlist (rootNode), only selective parts of the scene are “blooming”.  :?



To clarify, I have added these screenshots: (Click URL to enlarge)



(Case #1: Blooming on Sun and added Lines to glowlist)



http://www.lumenon.nl/P14/bloomsun.png



(Case #2: rootNode added to BloomRenderPass)





http://www.lumenon.nl/P14/bloomall.png



As a final I would like to have the following blooming:

  • Blue Grid
  • Sun
  • Colored Planet Paths



    Any help would be greatly appreciated because I have to present this tomorrow to a bunch of kids who are thinking about joining our study. :wink:



    PS.

    I will release the source for the navigation box you see on the bottom right and the Orbit Camera Handler when I clean up the code.

Sorry I can't help with your issue. But that AutoCAD style camera cube is awesome!


PS.
I will release the source for the navigation box you see on the bottom right and the Orbit Camera Handler when I clean up the code.

Can't wait to get my hands on that!

Can you render the parts you want to have bloom in one pass, then apply the bloom pass, then render the non bloom items?

If I understand correctly, I am not doing that at the moment.

I render the scene normal, then I have a extra renderpass that renders bloom / occluding items without bloom.



rootNode setup:

  • Ships
  • Planets

      L Planet Node

            L Planet Model

                L SwitchNode Mesh

                    L  QuadImage

                    L  Low Poly

                    L  High Poly Mesh

                L Billboard Quad text

            L Lines

                L Path Line (coloured line)

                L Zero-z Line (green line)

            L (selected) CameraNode
  • Lines

      L Blue outward running Z-zero lines

      L Blue circular Z-zero lines @ 0.5 AU



    PassManager setup:

    Renderpass background (skybox)  //Something I tried to get correct blending with the blooming, can be integrated in normal

    Renderpass normal (rootNode)    // Self explanatory, all parts of the scene are (indirect) children of the scene.

    Renderpass bloom (High Poly Sun Mesh, Line Path Node of planet, Lines Node of rootNode)  // see bottom line for more explanation.

    Renderpass controlpass (mouse, control box)  //clears Z-Buffer and renders the mouse/control box



    Construction of BloomPass:

    // This is very messy because I have been trying an x amount of setups to get occluding to work without having to duplicate my entire scene. ( I KNOW this is not the best way to do it. :wink: )

    This one just stuck because it correctly does not apply blooming to the occluding spatials, but still looks correct in blending.

    (Spatials are rendered as black by settings a total black MaterialState in the BloomRenderPass)



    BUT the problem still occured if I just make a normal BloomRenderPass and attach the rootNode/only the to be rendered spatials.





private void constructBloom() {

        bloompass = new BloomRenderPass(DisplaySystem.getDisplaySystem().getRenderer().getCamera(), 1) {

            @Override
            public void doRender(Renderer r) {
                Iterator<Spatial> oclist = super.spatials.iterator();
                while (oclist.hasNext()) {
                    Spatial next = oclist.next();
                    if (occludelist.contains(next)) {
                        next.setRenderState(swtch[2]);
                        next.updateRenderState();
                    }
                }
               
                super.doRender(r);
               
                Iterator<Spatial> ocblist = super.spatials.iterator();
                while (ocblist.hasNext()) {
                    Spatial next = ocblist.next();
                    if (occludelist.contains(next)) {
                        next.clearRenderState(RenderState.RS_MATERIAL);
                        next.updateRenderState();
                    }
                }

            }
        };
        bloompass.setBlurIntensityMultiplier(1.7f);
        bloompass.setBlurSize(0.008f);
        Iterator<Spatial> gllist = glowlist.iterator();
        while (gllist.hasNext()) {
            bloompass.add(gllist.next());
        }
        Iterator<Spatial> oclist = occludelist.iterator();
        while (oclist.hasNext()) {
            bloompass.add(oclist.next());
        }
    }



PS.

The Controlbox part looks really ugly at the moment and is made up out of Quads. (I ran into ugly visual problems if I introduced light with the controlbox using Boxes). It functions but still needs many basic things, like Spatialtransformer etc.

Sorry, I misunderstood.

This is what happens if renderpasses are: Background, Bloom, Normal, Control



Which looks cool except for the black lines there  8)

The only part I need solved, in essence, is:

  • Why are the Lines not bloomed when added to the BloomRenderPass, but are bloomed when I add the rootNode?



    It must be some setting within the nodes. But it also works if I add the Planet Node, which has no different settings.

    (but then I get the whole text bloom / all planets bloom etc etc)

I'm not sure, tbh.  hard to say without something to test.  Which method of bloom are you using, the redraw method or the use existing scene method?

Redraw method.


@Override
    public void render(float tpf) {
        DisplaySystem.getDisplaySystem().getRenderer().clearBuffers();
        pManager.renderPasses(DisplaySystem.getDisplaySystem().getRenderer());
    }



useCurrenScene == false;

It was the damn ColorRGBA of the line  :frowning: ://…



Seems Blooming is not visible with RGB beneath .8f (1f Alpha) with my current Bloom settings.

Now constructing a second Pass for the lines with higher blooming strength…



Damnit, I finally think I found something I could genuinely ask, and it's something this stupid  :x

Cool, at least you have something to show the kids tomorrow :slight_smile:

It looks awesome, I was interested to see bloom working with lines. You’ve probably got other things to look into, but the starfield class would look nice:



http://www.jmonkeyengine.com/jmeforum/index.php?topic=4732.0



Like, a smaller starfield for dust, and a larger one scaled large and repositioned around the camera location every update to be the real stars.

Everything works now. (occluding and different Bloom passes)



I decided to switch to a different view.

If you select a planet, the line glows.



Presentation went great btw. (was for Knowledge Engineering, Maastricht University, Netherlands)



http://www.lumenon.nl/P14/final.png



About the StarDust, I

I’ll try to clean up the Control Box creation/handling.

I haven’t really had time to do it thorough, at the moment it is very very rough and the code really doesn’t look pretty at all. :wink:

(Plus everythings is set instead of calculated. (didn’t had time to run through the math.))



Below is the current version.



[EDIT: Creation code was too long for the message. I’ll up it into TXT files.]



–==WARNING : Code below is NOT modified and not ready, but up here to keep my end of the bargain==–



Creation part of the Controlbox. You need to modify where the program takes the textures from (begin part).

http://www.lumenon.nl/P14/creation.txt



Update part of the RenderState. In essence, you can run the mouse over the box and it will change the materialstate, making it look like you have it selected, and you can select a part of the box which then can be recognized and do the things you want it to do.

http://www.lumenon.nl/P14/update.txt



OrbitHandler, small piece of code uses a CameraNode to translate the camera in such a way that you can easily use orbital controls (zoom/pan/tilt) and also translate that centerpoint. It also has a function that will let you translate the camera to a new point in a x number of frames.

It still needs to know what the “Up” vector is, (because this changes, and I had some problems using the Up from camera.)



http://www.lumenon.nl/P14/OrbitHandler.txt





I’m sorry I can’t provide a testcase at the moment. I’m also in the middle of an exam week, so that will have to wait until the end of this week.

Congrats on the successful demo.  It looks great btw.  If you could post it to a webstart, it would be cool to link to it from the jME site as an external demo.